2 input.cc -- implement Input
4 source file of the LilyPond music typesetter
6 (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
14 #include "source-file.hh"
16 Input::Input (Source_file*s, char const *cl)
35 Input::set_spot (Input const &i)
41 Produce GNU-compliant error message. Correcting lilypond source is
42 such a breeze if you ('re edidor) know (s) the error column too
46 [file:line:column:][warning:]message
50 Input::message (String message_string) const
55 marked "Work in prgress" in GNU iostream
59 why not just return always -1 (unknown),
60 iso breaking the interface?
62 int col = cerr.rdbuf ()->column ();
66 // well, we don't want to loose first warning...
72 str += location_string () + String (": ");
74 str += message_string;
78 str += source_file_->error_string (defined_str0_);
80 fprintf (stderr, "%s\n", str.to_str0 ());
85 Input::warning (String message_string) const
87 message (_ ("warning: ") + message_string);
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_string () const
104 return source_file_->file_line_column_string (defined_str0_);
106 return " (" + _ ("position unknown") + ")";
110 Input::line_number_string () const
113 return to_string (source_file_->get_line (defined_str0_));
119 Input::file_string () const
122 return source_file_->name_string ();
129 Input::line_number () const
132 return source_file_->get_line (defined_str0_);
139 Input::column_number () const
142 return source_file_->get_column (defined_str0_);