aboutsummaryrefslogtreecommitdiff
path: root/src/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug.h')
-rw-r--r--src/debug.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/debug.h b/src/debug.h
index 06ca5cb..b3ec17b 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -10,16 +10,36 @@ void gemma_gsl_error_handler (const char * reason,
const char * file,
int line, int gsl_errno);
+void debug_set_debug_mode(bool setting);
+void debug_set_no_check_mode(bool setting);
+void debug_set_strict_mode(bool setting);
+void debug_set_quiet_mode(bool setting);
+void debug_set_issue(uint issue);
+void debug_set_legacy_mode(bool setting);
+
+bool is_debug_mode();
+bool is_no_check_mode();
+bool is_check_mode();
+bool is_strict_mode();
+bool is_quiet_mode();
+bool is_issue(uint issue);
+bool is_legacy_mode();
+
+gsl_matrix *gsl_matrix_safe_alloc(size_t rows,size_t cols);
+gsl_vector *gsl_vector_safe_alloc(size_t n);
+
+char *do_strtok_safe(char *tokenize, const char *delimiters, const char *__pretty_function, const char *__file, int __line);
+#define strtok_safe(string,delimiters) do_strtok_safe(string,delimiters,__PRETTY_FUNCTION__,__FILE__,__LINE__)
// Validation routines
-void do_validate_K(const gsl_matrix *K, bool do_check, bool strict, const char *__file, int __line);
+void do_validate_K(const gsl_matrix *K, const char *__file, int __line);
#define ROUND(f) round(f * 10000.)/10000
-#define validate_K(K,check,strict) do_validate_K(K,check,strict,__FILE__,__LINE__)
+#define validate_K(K) do_validate_K(K,__FILE__,__LINE__)
#define warning_at_msg(__file,__line,msg) cerr << "**** WARNING: " << msg << " in " << __file << " at line " << __line << endl;
-inline void fail_at_msg(bool strict, const char *__file, int __line, const char *msg) {
+inline void warnfail_at_msg(bool strict, const char *__file, int __line, const char *msg) {
if (strict)
std::cerr << "**** STRICT FAIL: ";
else
@@ -29,10 +49,25 @@ inline void fail_at_msg(bool strict, const char *__file, int __line, const char
exit(1);
}
+inline void fail_at_msg(const char *__file, int __line, std::string msg) {
+ std::cerr << msg << " in " << __file << " at line " << __line << std::endl;
+ exit(1);
+}
+
# ifndef __ASSERT_VOID_CAST
# define __ASSERT_VOID_CAST (void)
# endif
+inline void fail_msg(const char *msg) {
+ std::cerr << "**** FAILED: " << msg << std::endl;
+ exit(5);
+}
+
+inline void fail_msg(std::string msg) {
+ std::cerr << "**** FAILED: " << msg << std::endl;
+ exit(5);
+}
+
#if defined NDEBUG
#define warning_msg(msg) cerr << "**** WARNING: " << msg << endl;