lilypond-1.5.8
[lilypond.git] / src / debug.cc
blob01a35bd140feeebda41d767aed18027df111149b
1 #include <fstream.h>
2 #include <signal.h>
3 #include <std/new.h>
4 #include <stdlib.h>
5 #include "debug.hh"
6 #include "dstream.hh"
7 #include "vector.hh"
9 Dstream *monitor=0;
10 ostream * nulldev =0;
12 struct _Dinit {
13 _Dinit() {
14 nulldev = new ofstream("/dev/null");
15 monitor = new Dstream(&cout,".dstreamrc");
17 ~_Dinit() {
18 delete nulldev;
19 delete monitor;
21 } dinit;
26 want to do a stacktrace .
28 void
29 mynewhandler()
31 assert(false);
34 void
35 float_handler(int)
37 cerr << "Floating point exception .. \n"<< flush;
38 assert(false);
41 void
42 debug_init()
44 #ifndef NDEBUG
45 set_new_handler(&mynewhandler);
46 #endif
47 set_matrix_debug(*monitor);
48 signal(SIGFPE, float_handler);
51 bool check_debug=false;
53 void
54 set_debug(bool b)
56 check_debug =b;