X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Finclude%2Fwarn.hh;h=8203c2d4e8b5a179043d5ad2f274ba862370c7f5;hb=9e781b7dc83b60a543ce218aa1a5f139f74c760f;hp=170fbca827810ffeb8e99cfe16691961f760b8e4;hpb=e18531db1f79fb685fbd16d6a2a67bf4b6c09915;p=lilypond.git diff --git a/flower/include/warn.hh b/flower/include/warn.hh index 170fbca827..8203c2d4e8 100644 --- a/flower/include/warn.hh +++ b/flower/include/warn.hh @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1997--2010 Han-Wen Nienhuys + Copyright (C) 1997--2014 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 @@ -22,11 +22,47 @@ #include "std-string.hh" -void error (string s); -void message (string s); -void non_fatal_error (string); -void programming_error (string s); -void progress_indication (string s); -void warning (string s); +/* Log-level bitmasks */ +#define LOG_NONE 0 +#define LOG_ERROR 1<<0 +#define LOG_WARN 1<<1 +#define LOG_BASIC 1<<2 // undocumented basic_progress, i.e. input file name and success +#define LOG_PROGRESS 1<<3 +#define LOG_INFO 1<<4 +#define LOG_DEBUG 1<<8 + +/* Log-level definitions (or'ed bitmasks) */ +#define LOGLEVEL_NONE (LOG_NONE) +#define LOGLEVEL_ERROR (LOG_ERROR) +#define LOGLEVEL_WARN (LOGLEVEL_ERROR | LOG_WARN) +#define LOGLEVEL_BASIC (LOGLEVEL_WARN | LOG_BASIC) +#define LOGLEVEL_PROGRESS (LOGLEVEL_BASIC | LOG_PROGRESS) +#define LOGLEVEL_INFO (LOGLEVEL_PROGRESS | LOG_INFO) +#define LOGLEVEL_DEBUG (LOGLEVEL_INFO | LOG_DEBUG) + +extern int loglevel; +extern bool warning_as_error; + +/* output messages, in decreasing order of importance */ +void error (string s, const string &location = ""); // Fatal error, exits lilypond! +void programming_error (const string &s, const string &location = ""); +void non_fatal_error (const string&, const string &location = ""); +void warning (const string &s, const string &location = ""); +void basic_progress (const string &s, const string &location = ""); +/* progress_indication does by default *NOT* start on a new line */ +void progress_indication (const string &s, bool newline = false, const string &location = ""); +void message (const string &s, bool newline = true, const string &location = ""); +void debug_output (const string &s, bool newline = true, const string &location = ""); + +/* Helper functions that always print out the message. Callers should ensure + that the loglevel is obeyed */ +void print_message (int level, const string &location, string s, bool newline = true); + +bool is_loglevel (int level); +void set_loglevel (int level); +void set_loglevel (string level); + +void expect_warning (const string &msg); +void check_expected_warnings (); #endif /* WARN_HH */