]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/warn.hh
Run grand-replace (issue 3765)
[lilypond.git] / flower / include / warn.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef WARN_HH
21 #define WARN_HH
22
23 #include "std-string.hh"
24
25 /* Log-level bitmasks */
26 #define LOG_NONE 0
27 #define LOG_ERROR 1<<0
28 #define LOG_WARN 1<<1
29 #define LOG_BASIC 1<<2  // undocumented basic_progress, i.e. input file name and success
30 #define LOG_PROGRESS 1<<3
31 #define LOG_INFO 1<<4
32 #define LOG_DEBUG 1<<8
33
34 /* Log-level definitions (or'ed bitmasks) */
35 #define LOGLEVEL_NONE (LOG_NONE)
36 #define LOGLEVEL_ERROR (LOG_ERROR)
37 #define LOGLEVEL_WARN (LOGLEVEL_ERROR | LOG_WARN)
38 #define LOGLEVEL_BASIC (LOGLEVEL_WARN | LOG_BASIC)
39 #define LOGLEVEL_PROGRESS (LOGLEVEL_BASIC | LOG_PROGRESS)
40 #define LOGLEVEL_INFO (LOGLEVEL_PROGRESS | LOG_INFO)
41 #define LOGLEVEL_DEBUG (LOGLEVEL_INFO | LOG_DEBUG)
42
43 extern int loglevel;
44 extern bool warning_as_error;
45
46 /* output messages, in decreasing order of importance */
47 void error (string s, const string &location = ""); // Fatal error, exits lilypond!
48 void programming_error (const string &s, const string &location = "");
49 void non_fatal_error (const string&, const string &location = "");
50 void warning (const string &s, const string &location = "");
51 void basic_progress (const string &s, const string &location = "");
52 /* progress_indication does by default *NOT* start on a new line */
53 void progress_indication (const string &s, bool newline = false, const string &location = "");
54 void message (const string &s, bool newline = true, const string &location = "");
55 void debug_output (const string &s, bool newline = true, const string &location = "");
56
57 /* Helper functions that always print out the message. Callers should ensure
58    that the loglevel is obeyed */
59 void print_message (int level, const string &location, string s, bool newline = true);
60
61 bool is_loglevel (int level);
62 void set_loglevel (int level);
63 void set_loglevel (string level);
64
65 void expect_warning (const string &msg);
66 void check_expected_warnings ();
67
68 #endif /* WARN_HH */