]> git.donarmstrong.com Git - lilypond.git/blobdiff - lib/source.cc
release: 1.0.1
[lilypond.git] / lib / source.cc
index 8901c8f7934f123245d0084ac882affcfa1ec574..81423bb1cb95b01a5a4b063628dbcd4f128f1bc1 100644 (file)
@@ -1,9 +1,9 @@
 /*
-  source.cc -- implement Source
+  source.cc -- implement Sources
 
   source file of the LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
 #include "plist.hh"
 #include "source-file.hh"
 #include "source.hh"
+#include "file-path.hh"
+
+Sources::Sources ()
+{
+  path_C_= 0;
+  binary_b_ = false;
+}
 
 void
-Sources::set_path(File_path *f_C)
+Sources::set_binary (bool bo)
 {
-    path_C_ = f_C;
+  binary_b_ = bo;
+}
+
+void
+Sources::set_path (File_path *f_C)
+{
+  path_C_ = f_C;
 }
 
 /**
@@ -31,30 +44,25 @@ Sources::set_path(File_path *f_C)
   @return 0 if no file found
   */
 Source_file*
-Sources::get_file_l(String &file_str ) //UGH
+Sources::get_file_l (String &file_str) //UGH
 {
-    if (path_C_){
-       String file_str_o = path_C_->find(file_str); 
-       if ( ( file_str_o == "" ) && ( file_str != "" ) )
-           return 0;
-       file_str = file_str_o;
+  if ((file_str != "-") && path_C_)
+    {
+      String file_str_o = path_C_->find (file_str); 
+      if ((file_str_o == "") && (file_str != ""))
+       return 0;
+      file_str = file_str_o;
     }
-    Source_file * f_p= (!binary_b_) ?
-       new Source_file(file_str) : new Binary_source_file(file_str);
-    add(f_p);
-    return f_p;
-}
-
-Sources::Sources()
-{
-    path_C_= 0;
-    binary_b_ = false;
+  Source_file * f_p = (!binary_b_) ?
+    new Source_file (file_str) : new Binary_source_file (file_str);
+  add (f_p);
+  return f_p;
 }
 
 void
-Sources::add( Source_file* sourcefile_p )
+Sources::add (Source_file* sourcefile_p)
 {
-    sourcefile_p_iplist_.bottom().add( sourcefile_p );
+  sourcefile_p_list_.bottom ().add (sourcefile_p);
 }
 
 /**
@@ -63,11 +71,12 @@ Sources::add( Source_file* sourcefile_p )
   @return 0 if not found.
   */
 Source_file*
-Sources::sourcefile_l( char const* ch_C )
+Sources::sourcefile_l (char const* ch_C)
 {
-    PCursor<Source_file*> sourcefile_l_pcur( sourcefile_p_iplist_.top() );
-    for ( ; sourcefile_l_pcur.ok(); sourcefile_l_pcur++ )
-       if ( sourcefile_l_pcur->in_b( ch_C ) )  
-           return *sourcefile_l_pcur;
-    return 0;
+  PCursor<Source_file*> sourcefile_l_pcur (sourcefile_p_list_.top ());
+  for (; sourcefile_l_pcur.ok (); sourcefile_l_pcur++)
+    if (sourcefile_l_pcur->in_b (ch_C))        
+      return *sourcefile_l_pcur;
+  return 0;
 }
+