2 input.cc -- implement Input
4 source file of the LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "flower-proto.hh"
15 #include "source-file.hh"
17 Input::Input (Source_file*s, char const *cl)
36 Input::set_spot (Input const &i)
42 Produce GNU-compliant error message. Correcting lilypond source is
43 such a breeze if you ('re edidor) know (s) the error column too
47 [file:line:column:][warning:]message
51 Input::message (String message_str) const
56 marked "Work in prgress" in GNU iostream
60 why not just return always -1 (unknown),
61 iso breaking the interface?
63 int col = cerr.rdbuf ()->column ();
67 // well, we don't want to loose first warning...
73 str += location_str () + String (": ");
79 str += source_file_l_->error_str (defined_ch_C_);
81 fprintf (stderr, "%s\n", str.ch_C());
85 Input::warning (String message_str) const
87 message (_ ("warning: ") + message_str);
90 Input::error (String s) const
92 message (_ ("error: ")+ s);
96 Input::non_fatal_error (String s) const
98 message (_ ("non fatal error: ") + s);
101 Input::location_str () const
104 return source_file_l_->file_line_column_str (defined_ch_C_);
106 return " (" + _ ("position unknown") + ")";
110 Input::line_number_str () const
113 return to_str (source_file_l_->line_i (defined_ch_C_));
119 Input::file_str () const
122 return source_file_l_->name_str ();
129 Input::line_number () const
132 return source_file_l_->line_i (defined_ch_C_);
139 Input::column_number () const
142 return source_file_l_->column_i (defined_ch_C_);