ReactOS  0.4.15-dev-2993-g14fbe80
trace.c
Go to the documentation of this file.
1 // 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
15 static char THIS_FILE[] = __FILE__;
16 
17 void _DebugBreak(void)
18 {
19  DebugBreak();
20 }
21 
22 void Trace(TCHAR* lpszFormat, ...)
23 {
24  va_list args;
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 
36 void 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 
49 void Trace(TCHAR* lpszFormat, ...) { };
50 void Assert(void* assert, TCHAR* file, int line, void* msg) { };
51 
52 #endif //_DEBUG
53 
#define args
Definition: format.c:66
#define assert(x)
Definition: debug.h:53
#define OutputDebugString
Definition: winbase.h:3746
Definition: match.c:390
#define va_end(ap)
Definition: acmsvcex.h:90
void WINAPI DebugBreak(void)
Definition: parser.c:48
char * va_list
Definition: acmsvcex.h:78
char TCHAR
Definition: xmlstorage.h:189
void Assert(void *assert, TCHAR *file, int line, void *msg)
Definition: trace.c:50
va_start(ap, x)
#define _vsntprintf
Definition: xmlstorage.h:203
#define NULL
Definition: types.h:112
#define msg(x)
Definition: auth_time.c:54
void Trace(const int level, const char *const fmt,...)
Definition: trace.c:30
#define printf
Definition: config.h:203
Definition: fci.c:126