lilypond-1.5.9
[lilypond.git] / lily / debug.cc
blob57380d6e7fb0c10863e13cad07088518bd2d87cd
1 /*
2 debug.cc -- implement debugging routines
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include <fstream.h>
11 #include <signal.h>
12 #include <stdlib.h>
14 #include "debug.hh"
15 #include "dstream.hh"
16 #include "flower-debug.hh"
17 #include "moment.hh"
18 #include "misc.hh"
19 #include "main.hh"
21 Dstream *my_monitor=0;
23 void
24 float_handler (int)
26 cerr << _ ("floating point exception") << endl;
27 assert (false);
30 void
31 debug_init ()
33 my_monitor = new Dstream (&cout, ".dstreamrc");
34 signal (SIGFPE, float_handler);
37 bool check_malloc_b = false;
39 void
40 set_debug (bool b)
42 if (b)
43 flower_dstream = my_monitor;
44 else
45 flower_dstream = 0;
47 #ifdef MEMORY_PARANOID
48 if (check_malloc_b)
49 if (mcheck (0))
50 warning (_ ("can't set mem-checking!"));
51 #endif