74 #define NO_OP do {} while(0)
78 const long int MYDEBUG_NONE = 0x00000000;
79 const long int MYDEBUG_ANY = 0xFFFFFFFF;
80 const long int MYDEBUG_FNAMES = 0x00000001;
82 const long int MYDEBUG_PRETTYFN = 0x00000002;
86 extern long int debug_level ;
87 extern long int DEFAULT_DEBUG_LEVEL;
94 extern int get_debug_options(
const char *
const s,
const debug_array da[]);
107 extern void _Assert(
const char*
file,
const int line,
const char*
msg = NULL);
108 extern std::ostream& _Out(std::ostream& out,
const char*
file,
const int line);
110 #define ASSERT(expr) \
113 _Assert(__FILE__, __LINE__); \
118 #define ASSERTBREAK(expr) \
121 _Assert(__FILE__, __LINE__); \
122 throw MyAssert::ErrGeneric(MBDYN_EXCEPT_ARGS); \
126 #define ASSERTMSG(expr, msg) \
129 _Assert(__FILE__, __LINE__, (msg)); \
133 #define ASSERTMSGBREAK(expr, msg) \
136 _Assert(__FILE__, __LINE__, (msg)); \
137 throw MyAssert::ErrGeneric(MBDYN_EXCEPT_ARGS); \
145 _Out(std::cout, __FILE__, __LINE__)
148 _Out(std::cerr, __FILE__, __LINE__)
152 #define DEBUGCOUT(msg) \
154 _Out(std::cout, __FILE__, __LINE__) << msg; std::cout.flush(); \
157 #define DEBUGCERR(msg) \
159 _Out(std::cerr, __FILE__, __LINE__) << msg; std::cerr.flush(); \
162 #define DEBUG_LEVEL(level) \
163 ((level) & ::debug_level)
165 #define DEBUG_LEVEL_MATCH(level) \
166 (((level) & ::debug_level) == (level))
168 #define DEBUGLCOUT(level, msg) \
170 if (::debug_level & (level)) { \
175 #define DEBUGLCERR(level, msg) \
177 if (::debug_level & (level)) { \
182 #define DEBUGLMCOUT(level, msg) \
184 if ((::debug_level & (level)) == (level)) { \
189 #define DEBUGLMCERR(level, msg) \
191 if ((::debug_level & (level)) == (level)) { \
196 #if defined(__GNUC__)
197 #define DEBUGCOUTFNAME(fname) \
199 if (::debug_level & MYDEBUG_FNAMES) { \
200 if (::debug_level & MYDEBUG_PRETTYFN) { \
201 DEBUGCOUT("Entering `" << __PRETTY_FUNCTION__ << "'" << std::endl); \
203 DEBUGCOUT("Entering `" << __FUNCTION__ << "'" << std::endl); \
208 #define DEBUGCOUTFNAME(fname) \
209 DEBUGLCOUT(MYDEBUG_FNAMES, "Entering `" << fname << "'" << std::endl)
213 #define ASSERT(expr) \
216 #define ASSERTBREAK(expr) \
219 #define ASSERTMSG(expr, msg) \
222 #define ASSERTMSGBREAK(expr, msg) \
232 #define DEBUGCOUT(msg) \
235 #define DEBUGCERR(msg) \
238 #define DEBUG_LEVEL(level) \
241 #define DEBUG_LEVEL_MATCH(level) \
244 #define DEBUGLCOUT(level, msg) \
247 #define DEBUGLCERR(level, msg) \
250 #define DEBUGLMCOUT(level, msg) \
253 #define DEBUGLMCERR(level, msg) \
256 #define DEBUGCOUTFNAME(fname) \
#define MBDYN_EXCEPT_ARGS_PASSTHRU
#define MBDYN_EXCEPT_ARGS_DECL