2 input.cc -- implement Input
4 source file of the LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "flower-proto.hh"
13 #include "source-file.hh"
15 Input::Input (Source_file
*s
, char const *cl
)
34 Input::set_spot (Input
const &i
)
40 Produce GNU-compliant error message. Correcting lilypond source is
41 such a breeze if you ('re edidor) know (s) the error column too
45 [file:line:column:][warning:]message
49 Input::message (String message_str
) const
54 marked "Work in prgress" in GNU iostream
58 why not just return always -1 (unknown),
59 iso breaking the interface?
61 int col = cerr.rdbuf ()->column ();
65 // well, we don't want to loose first warning...
71 str
+= location_str () + String (": ");
77 str
+= source_file_l_
->error_str (defined_ch_C_
);
83 Input::warning (String message_str
) const
85 message (_ ("warning: ") + message_str
);
88 Input::error (String s
) const
90 message (_ ("error: ")+ s
);
94 Input::non_fatal_error (String s
) const
96 message (_ ("non fatal error: ") + s
);
99 Input::location_str () const
102 return source_file_l_
->file_line_column_str (defined_ch_C_
);
104 return " (" + _ ("position unknown") + ")";
108 Input::line_number_str () const
111 return to_str (source_file_l_
->line_i (defined_ch_C_
));
117 Input::file_str () const
120 return source_file_l_
->name_str ();
127 Input::line_number () const
130 return source_file_l_
->line_i (defined_ch_C_
);
137 Input::column_number () const
140 return source_file_l_
->column_i (defined_ch_C_
);