2 source.cc -- implement Source
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
12 #include "binary-source-file.hh"
16 #include "source-file.hh"
20 Sources::set_path(File_path *f_C)
28 @param file_str the file to be opened, name might be changed if it
29 is found in a search path. UGH!
31 @return 0 if no file found
34 Sources::get_file_l(String &file_str ) //UGH
37 String file_str_o = path_C_->find(file_str);
38 if ( ( file_str_o == "" ) && ( file_str != "" ) )
40 file_str = file_str_o;
42 Source_file * f_p= (!binary_b_) ?
43 new Source_file(file_str) : new Binary_source_file(file_str);
55 Sources::add( Source_file* sourcefile_p )
57 sourcefile_p_iplist_.bottom().add( sourcefile_p );
61 search the list for file whose map contains pointer #ch_C#
63 @return 0 if not found.
66 Sources::sourcefile_l( char const* ch_C )
68 PCursor<Source_file*> sourcefile_l_pcur( sourcefile_p_iplist_.top() );
69 for ( ; sourcefile_l_pcur.ok(); sourcefile_l_pcur++ )
70 if ( sourcefile_l_pcur->in_b( ch_C ) )
71 return *sourcefile_l_pcur;