lilypond-1.3.115
[lilypond.git] / flower / text-stream.cc
blob446c44a01917bccf55f1ec6889791f6ec92d64b3
1 #include <stdlib.h>
2 #include <iostream.h>
3 #include "text-stream.hh"
5 Text_stream::Text_stream (String fn)
7 ios::sync_with_stdio();
8 if (fn == "")
10 name = _ ("<stdin>");
11 f = stdin;
14 else
16 name = fn;
17 f = fopen (fn.ch_C (), "r");
20 if (!f)
22 cerr << __FUNCTION__
23 << ": " << _f ("can't open file: `%s'", fn) << '\n';
24 exit (1);
27 line_no = 1;
30 void
31 Text_stream::message (String s)
33 cerr << '\n'<<get_name() << ": " << line ()<<": "<<s<<endl;
36 bool
37 Text_stream::eof_b ()
39 /* UGH UGH ugh*/
40 return
41 // !pushback.size () &&
42 feof (f);
45 Text_stream::~Text_stream()
47 if (!eof_b())
48 cerr <<__FUNCTION__<< ": closing unended file";
50 fclose (f);