Remove last vestiges of SeparationItem.
[lilypond/mpolesky.git] / flower / warn.cc
blob0bf8983c7a83f4dbd27a369404faf686c0c33cfe
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 warning message. Always starts on a new line. */
56 void
57 warning (string s)
59 message (_f ("warning: %s", s.c_str ()) + "\n");
62 void
63 non_fatal_error (string s)
65 message (_f ("error: %s", s.c_str ()) + "\n");
68 /* Display an error message. Always starts on a new line. */
69 void
70 error (string s)
72 non_fatal_error (s);
73 exit (1);
76 void
77 programming_error (string s)
79 message (_f ("programming error: %s", s) + "\n");
80 message (_ ("continuing, cross fingers") + "\n");