source file of the GNU LilyPond music typesetter
- (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
& Han-Wen Nienhuys <hanwen@stack.nl>
*/
if (!name_str_.length_i())
return &cin;
*/
-
- if (!istream_p_)
+
+ if (!istream_p_)
{
if (length_i()) // can-t this be done without such a hack?
istream_p_ = new istrstream(ch_C(), length_i());
- else
+ else
{
istream_p_ = new istrstream("", 0);
istream_p_->set(ios::eofbit);
Source_file::file_line_no_str(char const *context_ch_C) const
{
if (!ch_C())
- return "(unknown)";
+ return _("(unknown)");
else
return name_str() + ": "
+ String(line_i(context_ch_C));
char const* data_ch_C = ch_C();
char const * eof_C_ = data_ch_C + length_i();
if (!in_b(pos_ch_C))
- return "(position unknown)";
+ return _("(position unknown)");
+
-
if (pos_ch_C == eof_C_)
pos_ch_C --;
char const* begin_ch_C = pos_ch_C;
while (begin_ch_C > data_ch_C)
- if (*--begin_ch_C == '\n')
+ if (*--begin_ch_C == '\n')
{
begin_ch_C++;
break;
char const* end_ch_C = pos_ch_C;
while (end_ch_C < eof_C_)
- if (*end_ch_C++ == '\n')
+ if (*end_ch_C++ == '\n')
{
end_ch_C--;
break;
}
-
+
// String(char const* p, int length) is missing!?
String line_str((Byte const*)begin_ch_C, end_ch_C - begin_ch_C);
else
error_col_i++;
- String str = line_str.left_str(pos_ch_C - begin_ch_C)
+ String str = line_str.left_str(pos_ch_C - begin_ch_C)
+ String('\n')
- + String(' ', error_col_i)
+ + String(' ', error_col_i)
+ line_str.mid_str(pos_ch_C - begin_ch_C, INT_MAX); // String::mid should take 0 arg..
return str;
}
char const* scan_ch_C = ch_C();
if (!scan_ch_C)
return 0;
-
+
while (scan_ch_C < pos_ch_C)
if (*scan_ch_C++ == '\n')
i++;