+/*
+ debug.cc -- implement debugging routines
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1996,98 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
#include <fstream.h>
#include <signal.h>
-#include <std/new.h>
#include <stdlib.h>
+
#include "debug.hh"
#include "dstream.hh"
-#include "vector.hh"
-
-Dstream *monitor=0;
-ostream * nulldev =0;
-
-struct _Dinit {
- _Dinit() {
- nulldev = new ofstream("/dev/null");
- monitor = new Dstream(&cout,".dstreamrc");
- }
- ~_Dinit() {
- delete nulldev;
- delete monitor;
- }
-} dinit;
+#include "flower-debug.hh"
+#include "moment.hh"
+#include "misc.hh"
+#include "main.hh"
+Dstream *my_monitor=0;
-
-/*
- want to do a stacktrace .
- */
void
-mynewhandler()
+float_handler (int)
{
- assert(false);
-}
-
-void
-float_handler(int)
-{
- cerr << "Floating point exception .. \n"<< flush;
- assert(false);
+ cerr << _ ("floating point exception") << endl;
+ assert (false);
}
void
debug_init()
{
-#ifndef NDEBUG
- set_new_handler(&mynewhandler);
-#endif
- set_matrix_debug(*monitor);
- signal(SIGFPE, float_handler);
-}
+ my_monitor = new Dstream (&cout, ".dstreamrc");
+ signal (SIGFPE, float_handler);
+}
-bool check_debug=false;
+bool check_malloc_b = false;
void
-set_debug(bool b)
+set_debug (bool b)
{
- check_debug =b;
+ if (b)
+ flower_dstream = my_monitor;
+ else
+ flower_dstream = 0;
+
+#ifdef MEMORY_PARANOID
+ if (check_malloc_b)
+ if (mcheck (0))
+ warning (_ ("Can't set mem-checking!"));
+#endif
}
-