OLD | NEW |
1 /* | 1 /* |
2 input.cc -- implement Input | 2 input.cc -- implement Input |
3 | 3 |
4 source file of the LilyPond music typesetter | 4 source file of the LilyPond music typesetter |
5 | 5 |
6 (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl> | 6 (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl> |
7 */ | 7 */ |
8 | 8 |
9 #include "input.hh" | 9 #include "input.hh" |
10 | 10 |
11 #include <cstdio> | 11 #include <cstdio> |
12 using namespace std; | 12 using namespace std; |
13 | 13 |
14 #include "international.hh" | 14 #include "international.hh" |
| 15 #include "program-option.hh" |
15 #include "source-file.hh" | 16 #include "source-file.hh" |
16 #include "sources.hh" | 17 #include "sources.hh" |
17 #include "warn.hh" | 18 #include "warn.hh" |
18 | 19 |
19 Input::Input (Input const &i) | 20 Input::Input (Input const &i) |
20 { | 21 { |
21 source_file_ = i.source_file_; | 22 source_file_ = i.source_file_; |
22 start_ = i.start_; | 23 start_ = i.start_; |
23 end_ = i.end_; | 24 end_ = i.end_; |
24 } | 25 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (source_file_) | 73 if (source_file_) |
73 s = location_string () + ": " + s + "\n" | 74 s = location_string () + ": " + s + "\n" |
74 + source_file_->quote_input (start_) + "\n"; | 75 + source_file_->quote_input (start_) + "\n"; |
75 ::message (s); | 76 ::message (s); |
76 } | 77 } |
77 | 78 |
78 | 79 |
79 void | 80 void |
80 Input::programming_error (string s) const | 81 Input::programming_error (string s) const |
81 { | 82 { |
82 message (_f ("programming error: %s", s.c_str ())); | 83 if (get_program_option ("warning-as-error")) |
83 message (_ ("continuing, cross fingers") + "\n"); | 84 ::error (s); |
| 85 else { |
| 86 message (_f ("programming error: %s", s.c_str ())); |
| 87 message (_ ("continuing, cross fingers") + "\n"); |
| 88 } |
84 } | 89 } |
85 | 90 |
86 | 91 |
87 void | 92 void |
88 Input::warning (string s) const | 93 Input::warning (string s) const |
89 { | 94 { |
90 message (_f ("warning: %s", s)); | 95 if (get_program_option ("warning-as-error")) |
| 96 ::error (s); |
| 97 else |
| 98 message (_f ("warning: %s", s)); |
91 } | 99 } |
92 | 100 |
93 void | 101 void |
94 Input::error (string s) const | 102 Input::error (string s) const |
95 { | 103 { |
96 message (_f ("error: %s", s)); | 104 message (_f ("error: %s", s)); |
97 // UGH, fix naming or usage | 105 // UGH, fix naming or usage |
98 // exit (1); | 106 // exit (1); |
99 } | 107 } |
100 | 108 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 Input::start () const | 194 Input::start () const |
187 { | 195 { |
188 return start_; | 196 return start_; |
189 } | 197 } |
190 | 198 |
191 char const * | 199 char const * |
192 Input::end () const | 200 Input::end () const |
193 { | 201 { |
194 return end_; | 202 return end_; |
195 } | 203 } |
OLD | NEW |