-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.h
More file actions
47 lines (37 loc) · 1.02 KB
/
debug.h
File metadata and controls
47 lines (37 loc) · 1.02 KB
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
/*
* =====================================================================================
*
* Filename: debug.h
*
* Description: Debug MACROS
*
* Version: 1.0
* Created: 06/09/2011 08:19:52 AM
* Revision: none
* Compiler: gcc
*
* Author: Pratik Sinha (freethinker), pratik@humbug.in
* Company: http://www.humbug.in/
*
* =====================================================================================
*/
#ifndef _DEBUG_H
#define _DEBUG_H
#include <stdio.h>
#include <stdarg.h>
#ifdef ODEBUG
int humbug_odebug = 1;
#else
int humbug_odebug = 0;
#endif
#ifdef EDEBUG
int humbug_edebug = 1;
#else
int humbug_edebug = 0;
#endif
#define debug_print(fmt, ...) \
do { if (humbug_odebug) fprintf(stdout, fmt, __VA_ARGS__); } while (0)
#define error_print(fmt, ...) \
do { if (humbug_edebug) fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
__LINE__, __func__, __VA_ARGS__); } while (0)
#endif /* _DEBUG_H */