]> git.donarmstrong.com Git - lilypond.git/blob - lily/debug.cc
patch::: 1.3.144.jcn6
[lilypond.git] / lily / debug.cc
1 /*   
2   debug.cc --  implement debugging routines
3
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1996--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include <fstream.h>
11 #include <signal.h>
12 #include <stdlib.h>
13
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"
20
21 Dstream *my_monitor=0;
22
23 void
24 float_handler (int)
25 {
26   cerr << _ ("floating point exception") << endl;
27   assert (false);
28 }
29
30 void
31 debug_init ()
32 {
33   my_monitor = new Dstream (&cout, ".dstreamrc");
34   signal (SIGFPE, float_handler);
35 }
36
37 bool check_malloc_b = false;
38
39 void
40 set_debug (bool b)
41 {
42   if (b)
43     flower_dstream = my_monitor;
44   else
45     flower_dstream = 0;
46   
47 #ifdef MEMORY_PARANOID
48   if (check_malloc_b)
49     if (mcheck (0))
50       warning (_ ("can't set mem-checking!"));
51 #endif
52 }
53