]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/text-stream.cc
release: 1.0.1
[lilypond.git] / flower / text-stream.cc
index a2d3e4b1199acae862debead233556f62ff9f3db..9c87211c252e02ff06cf9f9c60733936cff49731 100644 (file)
@@ -1,31 +1,41 @@
 #include "text-stream.hh"
 
-Text_stream::Text_stream(String fn)
+Text_stream::Text_stream (String fn)
 {
-    ios::sync_with_stdio();
-    if (fn == "") 
-           {
-           name = "<STDIN>";       
-           f = stdin;
-           }
-       
-       else 
-           {
-           name = fn;      
-           f = fopen(fn, "r");
-           }
-       
-       if (!f) {
-           cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
-           exit(1);
-       }
+  ios::sync_with_stdio();
+  if (fn == "")
+    {
+      name = _ ("<stdin>");
+      f = stdin;
+    }
+
+  else
+    {
+      name = fn;
+      f = fopen (fn.ch_C (), "r");
+    }
 
-       line_no = 1;
+  if (!f)
+    {
+      cerr << __FUNCTION__ 
+          << ": " << _f ("can't open file: `%s'", fn) << '\n';
+      exit (1);
     }
 
+  line_no = 1;
+}
+
 void
-Text_stream::message(String s)
+Text_stream::message (String s)
 {
-    cerr << "\n"<<get_name() << ": " << line()<<": "<<s<<endl;
+  cerr << '\n'<<get_name() << ": " << line ()<<": "<<s<<endl;
 }
 
+bool
+Text_stream::eof_b ()
+{
+  /* UGH UGH ugh*/
+    return
+      // !pushback.size () && 
+      feof (f);
+}