DCL 3.7.4
Loading...
Searching...
No Matches
_trace.h
Go to the documentation of this file.
1#ifndef __DEBUG_H__
2#define __DEBUG_H__ 20061110
3
4#include <stdio.h>
5#include <stdarg.h>
6
7#ifdef __WINNT__
8#define __DEBUG_TRACE__ "D:/temp/dcl_hsc_ap2.txt"
9#else
10#define __DEBUG_TRACE__ "/dev/pts/0"
11#endif
12
13#ifndef __THIS_FILE__
14#define __THIS_FILE__ L"" __FILE__
15#endif
16
17static void trace(const char* fmt, ...)
18{
19 va_list args;
20 FILE* fp = fopen(__DEBUG_TRACE__, "a");
21 if (fp) {
22#ifdef __DCL_DEBUG
23 fprintf(fp, "D ");
24#else
25 fprintf(fp, "R ");
26#endif
27 va_start(args, fmt);
28 vfprintf(fp, fmt, args);
29 va_end(args);
30 fclose(fp);
31 }
32}
33
34#define _TRACE0(str) \
35 trace("%ls(%d) %s: %s", __THIS_FILE__, __LINE__, __PRETTY_FUNCTION__, str)
36#define _TRACE1(fmt, arg1) \
37 trace("%ls(%d) %s: " fmt, __THIS_FILE__, __LINE__, __PRETTY_FUNCTION__, arg1)
38#define _TRACE2(fmt, arg1, arg2) \
39 trace("%ls(%d) %s: " fmt, __THIS_FILE__, __LINE__, __PRETTY_FUNCTION__, arg1, arg2)
40#define _TRACE3(fmt, arg1, arg2, arg3) \
41 trace("%ls(%d) %s: " fmt, __THIS_FILE__, __LINE__, __PRETTY_FUNCTION__, arg1, arg2, arg3)
42#define _TRACE4(fmt, arg1, arg2, arg3, arg4) \
43 trace("%ls(%d) %s: " fmt, __THIS_FILE__, __LINE__, __PRETTY_FUNCTION__, arg1, arg2, arg3, arg4)
44
45#endif
#define __DEBUG_TRACE__
Definition _trace.h:10