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
|
#ifndef HAVE_ESPIK_DEBUG_H
#define HAVE_ESPIK_DEBUG_H
#include "espik_global.h"
#define DEBUG_PRINT_FILENO stdout
#define DEBUG_ENTLEV_FILENO stderr
#if defined (_ESPIK_DEBUG_) && defined (__GNUC__)
#define espik_debug_print(fmt, ...) \
{ \
fprintf (DEBUG_PRINT_FILENO, "%s +%i @%s: '", __FILE__, __LINE__, \
__func__); \
fprintf (DEBUG_PRINT_FILENO, fmt, ##__VA_ARGS__); \
fprintf (DEBUG_PRINT_FILENO, "'\n"); \
}
#else
#define espik_debug_print(fmt, ...) \
{ \
}
#endif /* _ESPIK_DEBUG_ && __GNUC__ */
#ifdef _ESPIK_DEBUG_
int __indent_level;
#define espik_enter() \
{ \
__indent_level++; \
fprintf (DEBUG_ENTLEV_FILENO, ">%*c%s +%i @%s\n", __indent_level, ' ', \
__FILE__, __LINE__, __func__); \
}
#define espik_leave() \
{ \
fprintf (DEBUG_ENTLEV_FILENO, "<%*c%s +%i @%s\n", __indent_level, ' ', \
__FILE__, __LINE__, __func__); \
__indent_level--; \
}
#else
#define espik_enter() \
{ \
}
#define espik_leave() \
{ \
}
#endif /* _ESPIK_DEBUG_ */
inline void espik_bt (void);
void espik_debug_init();
void kill_me (short num);
#endif /* HAVE_ESPIK_DEBUG_H */
|