]> git.donarmstrong.com Git - lilypond.git/blob - flower/text-stream.cc
release: 1.0.1
[lilypond.git] / flower / text-stream.cc
1 #include "text-stream.hh"
2
3 Text_stream::Text_stream (String fn)
4 {
5   ios::sync_with_stdio();
6   if (fn == "")
7     {
8       name = _ ("<stdin>");
9       f = stdin;
10     }
11
12   else
13     {
14       name = fn;
15       f = fopen (fn.ch_C (), "r");
16     }
17
18   if (!f)
19     {
20       cerr << __FUNCTION__ 
21            << ": " << _f ("can't open file: `%s'", fn) << '\n';
22       exit (1);
23     }
24
25   line_no = 1;
26 }
27
28 void
29 Text_stream::message (String s)
30 {
31   cerr << '\n'<<get_name() << ": " << line ()<<": "<<s<<endl;
32 }
33
34 bool
35 Text_stream::eof_b ()
36 {
37   /* UGH UGH ugh*/
38     return
39       // !pushback.size () && 
40       feof (f);
41 }