X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Fwarn.cc;h=0bf8983c7a83f4dbd27a369404faf686c0c33cfe;hb=cd211b6d1600b961f9bb9dc28b2d9c78d81cdb40;hp=4fa9dcd2052173a2a6c4d2a3c8ded8fa169dd261;hpb=3a7b6b3cbd35499a0993d46c302f37853f1b9c51;p=lilypond.git diff --git a/flower/warn.cc b/flower/warn.cc index 4fa9dcd205..0bf8983c7a 100644 --- a/flower/warn.cc +++ b/flower/warn.cc @@ -1,38 +1,82 @@ -#include -#include +/* + This file is part of LilyPond, the GNU music typesetter. + + Copyright (C) 1997--2010 Han-Wen Nienhuys + + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . +*/ + #include "warn.hh" +#include +#include + +#include "international.hh" + +using namespace std; +/* Is progress indication at NEWLINE? */ +static bool progress_newline = true; + +/* Display user information that is not a full message. */ void -error (String s) +progress_indication (string s) { - cerr << _ ("error: ") << s << '\n'; + /* Test if all silly progress_indication ("\n") can be dropped now. */ + if (s == "\n") + return; - exit (1); + fputs (s.c_str (), stderr); + fflush (stderr); + if (s.length ()) + progress_newline = s[s.length () - 1] == '\n'; } +/* Display a single user message. Always starts on a new line. */ void -non_fatal_error (String s) +message (string s) { - cerr << _ ("error: ") << s << '\n'; + if (!progress_newline) + fputc ('\n', stderr); + progress_indication (s); } +/* Display a warning message. Always starts on a new line. */ void -warning (String m) +warning (string s) { - cerr << _ ("warning: ") <