]> git.donarmstrong.com Git - lilypond.git/blob - src/warn.cc
release: 0.0.24
[lilypond.git] / src / warn.cc
1 #include "debug.hh"
2 #include "lexer.hh"
3 #include "moment.hh"
4 #include "timedescription.hh"
5
6 ostream &warnout (cerr);
7 ostream *mlog(&cerr);
8
9 void
10 warning(String s)
11 {
12     WARN << s;
13 }
14
15
16 void
17 error(String s)
18 {
19     if (busy_parsing())
20         yyerror(s);
21     else
22         cerr <<  "\nerror: " << s << "\n";
23         
24     exit(1);
25 }
26
27 void
28 error_t(const String& s, const Moment& r)
29 {
30     String t_mom = String(trunc(r)) + String(r - Moment(trunc(r)));
31     String e=s+ " (t = " +  t_mom + ")";
32     error(e);
33 }
34
35
36 void
37 error_t(const String& s, Time_description const &t_tdes)
38 {
39     String e=s+ " (at t=" + t_tdes.bars + ": " + t_tdes.whole_in_measure + ")\n";
40     error(e);
41 }