SynthLab SDK
trace.h
1 #pragma once
2 // TRACE macro for win32
3 #ifndef __TRACE_H__850CE873
4 #define __TRACE_H__850CE873
5 
6 #include <crtdbg.h>
7 #include <stdarg.h>
8 #include <stdio.h>
9 #include <string.h>
10 
11 #ifdef _DEBUG
12 #define TRACEMAXSTRING 1024
13 
14 static char szBuffer[TRACEMAXSTRING];
15 inline void TRACE(const char* format,...)
16 {
17  va_list args;
18  va_start(args,format);
19  int nBuf;
20  nBuf = _vsnprintf(szBuffer,
21  TRACEMAXSTRING,
22  format,
23  args);
24  va_end(args);
25 
26  _RPT0(_CRT_WARN,szBuffer);
27 }
28 #define TRACEF _snprintf(szBuffer,TRACEMAXSTRING,"%s(%d): ", \
29  &strrchr(__FILE__,'\\')[1],__LINE__); \
30  _RPT0(_CRT_WARN,szBuffer); \
31  TRACE
32 #else
33 // Remove for release mode
34 #define TRACE ((void)0)
35 #define TRACEF ((void)0)
36 #endif
37 
38 #endif // __TRACE_H__850CE873