X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Fwarn.cc;h=c911526c97c5e012c770617796ca6995056413c5;hb=8a719f6eec1bd84269a55d1ec99adb3f17c04e64;hp=548782c9b6b8a150d3e837ec79e24432563b5304;hpb=c659cb200486c2f908703696a1b2873e78c8160a;p=lilypond.git diff --git a/flower/warn.cc b/flower/warn.cc index 548782c9b6..c911526c97 100644 --- a/flower/warn.cc +++ b/flower/warn.cc @@ -3,33 +3,55 @@ source file of the Flower Library - (c) 1997--2004 Han-Wen Nienhuys + (c) 1997--2006 Han-Wen Nienhuys */ #include "warn.hh" #include #include +using namespace std; +/* 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) { - fputs (s.to_str0 (), stderr); + /* Test if all silly progress_indication ("\n") can be dropped now. */ + if (s == "\n") + return; + + 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 +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", s.to_str0 ()) + "\n"); + message (_f ("warning: %s", s.c_str ()) + "\n"); } void non_fatal_error (String s) { - message (_f ("error: %s", s.to_str0 ()) + "\n"); + message (_f ("error: %s", s.c_str ()) + "\n"); } +/* Display an error message. Always starts on a new line. */ void error (String s) { @@ -41,6 +63,6 @@ void programming_error (String s) { message (_f ("programming error: %s", s) + "\n"); - message (_ ("Continuing; crossing fingers") + "\n"); + message (_ ("continuing, cross fingers") + "\n"); }