34cf4058 |
1 | #ifndef __COMMON_H__ |
2 | #define __COMMON_H__ |
3 | |
4 | //#define PROFILE_GBI |
5 | |
6 | #define LOG_NONE 0 |
7 | #define LOG_ERROR 1 |
8 | #define LOG_MINIMAL 2 |
9 | #define LOG_WARNING 3 |
10 | #define LOG_VERBOSE 4 |
11 | |
12 | #define LOG_LEVEL LOG_NONE |
13 | |
14 | # ifndef min |
15 | # define min(a,b) ((a) < (b) ? (a) : (b)) |
16 | # endif |
17 | # ifndef max |
18 | # define max(a,b) ((a) > (b) ? (a) : (b)) |
19 | # endif |
20 | |
21 | |
22 | #if LOG_LEVEL>0 |
23 | |
34cf4058 |
24 | #define LOG(A, ...) \ |
25 | if (A <= LOG_LEVEL) \ |
26 | { \ |
a4bc0a6f |
27 | if (A == LOG_WARNING) printf("(WW) "); \ |
28 | if (A == LOG_ERROR) printf("(EE) "); \ |
29 | printf(__VA_ARGS__); \ |
30 | fflush(stdout); \ |
34cf4058 |
31 | } |
32 | |
33 | #else |
34 | |
35 | #define LOG(A, ...) |
36 | |
37 | #endif |
38 | |
39 | #endif |