63 long int debug_level = MYDEBUG_ANY;
64 long int DEFAULT_DEBUG_LEVEL = MYDEBUG_ANY;
66 void _Assert(
const char*
file,
const int line,
const char*
msg)
70 std::cerr << std::endl <<
"ASSERT fault in file " << file
71 <<
" at line " << line;
73 std::cerr <<
':' << std::endl <<
msg;
75 std::cerr << std::endl;
84 std::ostream& _Out(std::ostream& out,
const char*
file,
const int line)
89 out <<
"[" << file <<
"," << line <<
"]: ";
93 int get_debug_options(
const char *
const s,
const debug_array da[])
95 if (s == NULL || s[0] ==
'\0') {
96 ::debug_level = DEFAULT_DEBUG_LEVEL;
102 const char* sep = std::strchr(p,
':');
109 debug_array* w = (debug_array*)da;
110 while (w->s != NULL) {
111 if (l == strlen(w->s) && strncmp(w->s, p, l) == 0) {
117 if (l == 4 && strncmp(
"none", p, 4) == 0) {
118 ::debug_level = MYDEBUG_NONE;
119 }
else if (l == 3 && strncmp(
"any", p, 3) == 0) {
120 ::debug_level = MYDEBUG_ANY;
122 silent_cerr(
"Unknown debug level \"");
123 for (
unsigned int i = 0; i < l; i++) {
126 silent_cerr(
"\"" << std::endl);
129 ::debug_level |= w->l;
130 silent_cerr(
"debug level: " << w->s << std::endl);
143 #if defined(__GNUC__) && (defined(_M_IX86) || defined(__x86_64)) && !defined(NDEBUG) && (defined(__CYGWIN__) || defined(_WIN32))
144 extern "C" void __assert_func (
const char* file,
int line,
const char*
func,
const char* expr)
146 std::cerr <<
"assertion " << expr <<
" failed: file " << file <<
":" << line <<
":" << func << std::endl;
149 __asm__
volatile (
"int $3");
#define MBDYN_EXCEPT_ARGS
void func(const T &u, const T &v, const T &w, doublereal e, T &f)