1 |
#ifndef CONFIG_H |
2 |
#define CONFIG_H |
3 |
|
4 |
/* Compile-time configuration */ |
5 |
|
6 |
#define PURE_ISO 1 |
7 |
#define DEBUG 1 |
8 |
|
9 |
/* End configuration */ |
10 |
|
11 |
#define E extern |
12 |
|
13 |
#if __GNUC__ >= 3 |
14 |
# define expect(expr,value) __builtin_expect ((expr),(value)) |
15 |
# define is_const(expr) __builtin_constant_p ((expr)) |
16 |
#else |
17 |
# define expect(expr,value) (expr) |
18 |
# define is_const(expr) 0 |
19 |
#endif |
20 |
|
21 |
#define expect_false(expr) expect ((expr) != 0, 0) |
22 |
#define expect_true(expr) expect ((expr) != 0, 1) |
23 |
|
24 |
#if SIZEOF_TIME_T == SIZEOF_LONG |
25 |
#define TTP "%ld" |
26 |
#elif SIZEOF_TIME_T == SIZEOF_INT |
27 |
#define TTP "%d" |
28 |
#else |
29 |
#error Size of time_t not known |
30 |
#endif |
31 |
|
32 |
#if SIZEOF_SIZE_T == SIZEOF_INT |
33 |
#define STP "%u" |
34 |
#elif SIZEOF_SIZE_T == SIZEOF_LONG |
35 |
#define STP "%lu" |
36 |
#else |
37 |
#error Size of size_t not known |
38 |
#endif |
39 |
|
40 |
/** |
41 |
* Debug stuff... |
42 |
*/ |
43 |
#ifndef DEBUG |
44 |
# define DEBUG 0 |
45 |
#else |
46 |
# define DEBUG 1 |
47 |
#endif |
48 |
#ifndef CALLBACK_DEBUG |
49 |
# define CALLBACK_DEBUG 0 |
50 |
#else |
51 |
# define CALLBACK_DEBUG 1 |
52 |
#endif |
53 |
|
54 |
#include <iostream> // even needed when DEBUG is 0 |
55 |
|
56 |
#if DEBUG |
57 |
#ifdef __GNUC__ |
58 |
# define dbg std::cerr << __PRETTY_FUNCTION__ << ": " << std::dec << "#" << __LINE__ << ": " |
59 |
#else |
60 |
# define dbg std::cerr << __FILE__ << ": " << std::dec << "#" << __LINE__ << ": " |
61 |
#endif |
62 |
#else |
63 |
# define dbg if (0) std::cerr |
64 |
#endif |
65 |
|
66 |
#if CALLBACK_DEBUG |
67 |
# ifdef __GNUC__ |
68 |
# define dout std::cerr << __PRETTY_FUNCTION__ << ": " << std::dec << "#" << __LINE__ << ": " |
69 |
# else |
70 |
# define dout std::cerr << __LINE__ << ": " << std::dec << "#" << __LINE__ << ": " |
71 |
# endif |
72 |
#else |
73 |
# define dout if (0) std::cerr |
74 |
#endif |
75 |
|
76 |
#endif // CONFIG_H |