ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/svsconfig.h
Revision: 1.4
Committed: Wed Sep 5 11:23:13 2007 UTC (16 years, 9 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.3: +2 -2 lines
Log Message:
removed GPLed code and put license back to BSD

File Contents

# User Rev Content
1 pippijn 1.2 /*
2     * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
3 pippijn 1.4 * Rights to this code are documented in doc/pod/license.pod.
4 pippijn 1.2 *
5     * Compile-time configuration and some sysconf #defines.
6     * dbg, the ermyth debug output, also lives in this file.
7     *
8 pippijn 1.4 * $Id: svsconfig.h,v 1.3 2007-08-29 21:01:18 pippijn Exp $
9 pippijn 1.2 */
10    
11 pippijn 1.1 #ifndef CONFIG_H
12     #define CONFIG_H
13    
14 pippijn 1.2 #include <sysconf.h>
15    
16 pippijn 1.1 /* Compile-time configuration */
17    
18     #define PURE_ISO 1
19     #define DEBUG 1
20 pippijn 1.3 #define CALLBACK_DEBUG 0
21 pippijn 1.1
22     /* End configuration */
23    
24     #define E extern
25    
26 pippijn 1.3 /* GNU extensions */
27 pippijn 1.1 #if __GNUC__ >= 3
28 pippijn 1.3 # define expect(expr, value) __builtin_expect ((expr), (value))
29 pippijn 1.1 # define is_const(expr) __builtin_constant_p ((expr))
30     #else
31 pippijn 1.3 # define expect(expr, value) (expr)
32 pippijn 1.1 # define is_const(expr) 0
33     #endif
34    
35     #define expect_false(expr) expect ((expr) != 0, 0)
36     #define expect_true(expr) expect ((expr) != 0, 1)
37    
38 pippijn 1.3 /* Get current function if available */
39     #ifdef __GNUC__
40     # define CURFUNC __PRETTY_FUNCTION__
41     #elif defined(__BORLANDC__)
42     # define CURFUNC __FUNC__
43     #elif defined(_MSC_VER)
44     # if _MSC_VER >= 1300
45     # define CURFUNC __FUNCDNAME__
46     # else
47     # define CURFUNC __FUNCTION__
48     # endif
49     #else
50     # ifdef __FUNCTION__
51     # define CURFUNC __FUNCTION__
52     # else
53     # define CURFUNC "<unknown function>"
54     # endif
55     #endif
56    
57     /* printf formats */
58 pippijn 1.1 #if SIZEOF_TIME_T == SIZEOF_LONG
59 pippijn 1.3 #define PRItime "ld"
60 pippijn 1.1 #elif SIZEOF_TIME_T == SIZEOF_INT
61 pippijn 1.3 #define PRItime "d"
62 pippijn 1.1 #else
63     #error Size of time_t not known
64     #endif
65    
66 pippijn 1.3 #if SIZEOF_SIZE_T == SIZEOF_LONG
67     #define PRIsize "lu"
68     #elif SIZEOF_SIZE_T == SIZEOF_INT
69     #define PRIsize "u"
70 pippijn 1.1 #else
71     #error Size of size_t not known
72     #endif
73    
74     /**
75     * Debug stuff...
76     */
77    
78     #include <iostream> // even needed when DEBUG is 0
79    
80     #if DEBUG
81 pippijn 1.3 # define dbg std::cerr << CURFUNC << ": " << std::dec << "#" << __LINE__ << ": "
82 pippijn 1.1 #else
83     # define dbg if (0) std::cerr
84     #endif
85    
86     #if CALLBACK_DEBUG
87 pippijn 1.3 # define dout std::cerr << CURFUNC << ": " << std::dec << "#" << __LINE__ << ": "
88 pippijn 1.1 #else
89     # define dout if (0) std::cerr
90     #endif
91    
92     #endif // CONFIG_H