lilypond-0.0.38
[lilypond.git] / src / inputfile.cc
blob9e1a49683456786d793dbddb807d0655edd01715
1 /*
2 inputfile.cc -- implement Input_file
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> Jan Nieuwenhuizen <jan@digicash.com>
7 */
9 #include <iostream.h>
10 #include <strstream.h>
11 #include "proto.hh"
12 #include "plist.hh"
13 #include "inputfile.hh"
14 #include "debug.hh"
15 #include "sourcefile.hh"
16 #include "binary-source-file.hh"
17 #include "source.hh"
19 Input_file::Input_file(String s)
21 name = s;
22 line = 1;
23 String pf(s);
24 if ( pf == "" ) {
25 is = &cin;
26 defined_ch_c_l_ = 0;
27 sourcefile_l_ = 0;
29 else {
30 Source_file* sourcefile_p = 0;
31 // ugh, very dirty, need to go away
32 if ( ( pf.right_str( 3 ).lower_str() == "mid" ) || ( pf.right_str( 4 ).lower_str() == "midi" ) )
33 sourcefile_p = new Binary_source_file( pf );
34 else
35 sourcefile_p = new Source_file( pf );
36 source_l_g->add( sourcefile_p );
37 sourcefile_l_ = sourcefile_p;
38 is = sourcefile_l_->istream_l();
39 defined_ch_c_l_ = sourcefile_l_->ch_c_l();
41 cout << "[" << pf << flush;
44 Input_file::~Input_file()
46 cout << "]" << flush;