X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Fwarn.cc;h=52631a866592661850c77c0c19053d1e35fd1c3e;hb=0bfdeecf944c00aa57bbca3f406e9305d93dd21f;hp=24e52939470b588ed4dc75ea4250fe544ef05795;hpb=91e7cbaa6e54e004365d28e0f10c9362a7f13320;p=lilypond.git diff --git a/flower/warn.cc b/flower/warn.cc index 24e5293947..52631a8665 100644 --- a/flower/warn.cc +++ b/flower/warn.cc @@ -3,7 +3,7 @@ source file of the Flower Library - (c) 1997--2005 Han-Wen Nienhuys + (c) 1997--2007 Han-Wen Nienhuys */ #include "warn.hh" @@ -11,36 +11,61 @@ #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 -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) +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) +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) +error (string s) { non_fatal_error (s); exit (1); } void -programming_error (String s) +programming_error (string s) { message (_f ("programming error: %s", s) + "\n"); - message (_ ("Continuing; crossing fingers") + "\n"); + message (_ ("continuing, cross fingers") + "\n"); }