Remove redundant acknowledger in Bar_number_engraver.
[lilypond/mpolesky.git] / flower / warn.cc
blob37751f7bde731ec02965e46b2381eb695d622124
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1997--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "warn.hh"
22 #include <cstdlib>
23 #include <cstdio>
25 #include "international.hh"
27 using namespace std;
29 /* Is progress indication at NEWLINE? */
30 static bool progress_newline = true;
32 /* Display user information that is not a full message. */
33 void
34 progress_indication (string s)
36 /* Test if all silly progress_indication ("\n") can be dropped now. */
37 if (s == "\n")
38 return;
40 fputs (s.c_str (), stderr);
41 fflush (stderr);
42 if (s.length ())
43 progress_newline = s[s.length () - 1] == '\n';
46 /* Display a single user message. Always starts on a new line. */
47 void
48 message (string s)
50 if (!progress_newline)
51 fputc ('\n', stderr);
52 progress_indication (s);
55 /* Display a success message. Always starts on a new line. */
56 void
57 successful (string s)
59 message (_f ("success: %s", s.c_str ()) + "\n");
62 /* Display a warning message. Always starts on a new line. */
63 void
64 warning (string s)
66 message (_f ("warning: %s", s.c_str ()) + "\n");
69 void
70 non_fatal_error (string s)
72 message (_f ("error: %s", s.c_str ()) + "\n");
75 /* Display an error message. Always starts on a new line. */
76 void
77 error (string s)
79 non_fatal_error (s);
80 exit (1);
83 void
84 programming_error (string s)
86 message (_f ("programming error: %s", s) + "\n");
87 message (_ ("continuing, cross fingers") + "\n");