Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / flower / warn.cc
blob8529477cde86f7f1c2efecd1f2b2dc14c5184ceb
1 /*
2 warn.cc -- implement warnings
4 source file of the Flower Library
6 (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "warn.hh"
11 #include <cstdlib>
12 #include <cstdio>
14 #include "international.hh"
16 using namespace std;
18 /* Is progress indication at NEWLINE? */
19 static bool progress_newline = true;
21 /* Display user information that is not a full message. */
22 void
23 progress_indication (string s)
25 /* Test if all silly progress_indication ("\n") can be dropped now. */
26 if (s == "\n")
27 return;
29 fputs (s.c_str (), stderr);
30 fflush (stderr);
31 if (s.length ())
32 progress_newline = s[s.length () - 1] == '\n';
35 /* Display a single user message. Always starts on a new line. */
36 void
37 message (string s)
39 if (!progress_newline)
40 fputc ('\n', stderr);
41 progress_indication (s);
44 /* Display a warning message. Always starts on a new line. */
45 void
46 warning (string s)
48 message (_f ("warning: %s", s.c_str ()) + "\n");
51 void
52 non_fatal_error (string s)
54 message (_f ("error: %s", s.c_str ()) + "\n");
57 /* Display an error message. Always starts on a new line. */
58 void
59 error (string s)
61 non_fatal_error (s);
62 exit (1);
65 void
66 programming_error (string s)
68 message (_f ("programming error: %s", s) + "\n");
69 message (_ ("continuing, cross fingers") + "\n");