X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=flower%2Fwarn.cc;h=8ac73541b6cf0cc30f2559f32b24c1896ae7424a;hb=b1e87575d7dbce73e74c7e6eb1b64dbfc82e65a4;hp=a0a36a8aa83f2748a40c2d8cff8eaa26c7a28d91;hpb=a6ee9dcd388111e842064a8d46ab06c4897a00d2;p=lilypond.git diff --git a/flower/warn.cc b/flower/warn.cc index a0a36a8aa8..8ac73541b6 100644 --- a/flower/warn.cc +++ b/flower/warn.cc @@ -3,33 +3,54 @@ source file of the Flower Library - (c) 1997--2000 Han-Wen Nienhuys + (c) 1997--2005 Han-Wen Nienhuys */ -#include -#include - #include "warn.hh" +#include +#include + +/* Is progress indication at NEWLINE? */ +static bool progress_newline = true; +/* Display user information that is not a full message. */ void -message (String s) +progress_indication (String s) { + /* Test if all silly progress_indication ("\n") can be dropped now. */ + if (s == "\n") + return; + fputs (s.to_str0 (), 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 +message (String s) +{ + if (!progress_newline) + fputc ('\n', stderr); + progress_indication (s); } +/* Display a warning message. Always starts on a new line. */ void warning (String s) { - message (_f ("warning: %s\n", s.to_str0 ())); + message (_f ("warning: %s", s.to_str0 ()) + "\n"); } void non_fatal_error (String s) { - message (_f ("error: %s\n", s.to_str0 ())); + message (_f ("error: %s", s.to_str0 ()) + "\n"); } +/* Display an error message. Always starts on a new line. */ void error (String s) { @@ -40,7 +61,7 @@ error (String s) void programming_error (String s) { - message (_f ("programming error: %s (Continuing; cross thumbs)\n", - s.to_str0 ())); + message (_f ("programming error: %s", s) + "\n"); + message (_ ("continuing, cross fingers") + "\n"); }