| 1 | #ifndef __DEBUG_H__ |
| 2 | #define __DEBUG_H__ |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | #include "fprintf.h" |
| 6 | |
| 7 | /* constants */ |
| 8 | |
| 9 | #define COMPRESS 1 |
| 10 | #define DECOMPRESS 2 |
| 11 | |
| 12 | #define NB_CHARS 256 |
| 13 | #define BUFFER_SIZE 4096 |
| 14 | |
| 15 | #define DEBUG 4 |
| 16 | #define INFO 3 |
| 17 | #define WARNING 2 |
| 18 | #define ERROR 1 |
| 19 | |
| 20 | /* macros */ |
| 21 | |
| 22 | #define CEIL(x, y) (((x) + (y) - 1) / (y)) |
| 23 | #define MIN(x, y) (((x) < (y)) ? (x) : (y)) |
| 24 | #define MAX(x, y) (((x) > (y)) ? (x) : (y)) |
| 25 | #define VERBOSE(level, statement...) do { if (level <= verbose) { statement; } } while(0) |
| 26 | #define PRINTF(args...) do { myfprintf (stdout, args); fflush (stdout); } while (0) |
| 27 | |
| 28 | /* gobal variables */ |
| 29 | |
| 30 | extern int verbose; |
| 31 | |
| 32 | #endif /* __DEBUG_H__ */ |
| 33 | |
| 34 | /* vim: set ts=4 sw=4 et */ |