Debian Codegraph @

src/macros.h

raw symbols SCIP
1 /***************************************************************************
2 macros.h - description
3 -------------------
4 begin : september 21th, 2003
5 copyright : (C) 2003-2007 by Duong Khang NGUYEN
6 email : neoneurone @ gmail com
7
8 $Id: macros.h 375 2008-10-28 14:47:15Z neoneurone $
9 ***************************************************************************/
10
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * any later version. *
17 * *
18 ***************************************************************************/
19
20 #ifndef _OPENCITY_MACROS_H_
21 #define _OPENCITY_MACROS_H_ 1
22
23 #include <iostream>
24 #include <cassert> // for assert() => ifdef NDEBUG: do nothing
25 using std::cout;
26 using std::endl;
27 using std::cerr;
28
29 // Debug message macro
30 #ifndef NDEBUG
31 #define OPENCITY_DEBUG( msg ) { \
32 cout << "<DEBUG> " << __FILE__ << " " << __LINE__ << " : " << msg << endl; \
33 }
34 #else
35 #define OPENCITY_DEBUG(msg)
36 #endif
37
38 // Information message macro
39 #define OPENCITY_INFO( msg ) { \
40 cout << "<INFO> " << msg << endl; \
41 }
42
43 // Option message macro
44 #define OPENCITY_OPTION( msg ) { \
45 cout << "<OPTION> " << msg << endl; \
46 }
47
48 // Error message macro
49 #define OPENCITY_ERROR( msg ) { \
50 cerr << "<ERROR> " << msg << endl; \
51 }
52
53 // Fatal message macro
54 #define OPENCITY_FATAL( msg ) { \
55 cerr << "<FATAL> " << __FILE__ << " " << __LINE__ << " : " << msg << endl; \
56 }
57
58 // Swap two variables so that a <= b
59 #define OPENCITY_SWAP( a, b, type ) \
60 {\
61 if (a > b) { \
62 type c;\
63 c = a; a = b; b = c;\
64 }\
65 }
66
67 // We use "uint" for "unsigned int"
68 #ifndef uint
69 typedef unsigned int uint;
70 #endif
71
72 // Define some missing magical macros for Visual Studio 2005
73 #ifdef __WIN32__
74 #if !defined(__PRETTY_FUNCTION__)
75 #define __PRETTY_FUNCTION__ __FUNCTION__
76 #endif
77
78 // and operator workaround for MSVC2005
79 #if !defined(__MINGW32_VERSION)
80 #if !defined(and)
81 #include <ciso646>
82 #endif
83 #endif
84
85 // strcasecmp workaround
86 #if !defined(strcasecmp)
87 #define strcasecmp _stricmp
88 #endif
89
90 /* C99 standard has this
91 // log2 workaround
92 #if !defined(log2)
93 #define log2(value) log((double)value)/log(2.0)
94 #endif
95 */
96 #endif // #if defined(__WIN32__)
97 #endif
98