]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/scores.cc
release: 1.3.93
[lilypond.git] / lily / scores.cc
index 4a25a85a0fc78201c2013868b05a20a770d8acd6..7d611e494aa3489f1e7d20a5e925cfeab8ac66d6 100644 (file)
@@ -3,25 +3,27 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 #include <fstream.h>
 #include "main.hh"
 #include "score.hh"
 #include "string.hh"
 #include "paper-def.hh"
-#include "header.hh"
+#include "scope.hh"
 #include "debug.hh"
 #include "parray.hh"
 #include "file-path.hh"
 #include "file-results.hh"
 #include "my-lily-parser.hh"
 #include "source.hh"
+#include "lily-version.hh"
 
 Sources* source_global_l = 0;
 Array<String> inclusion_global_array;
 Array<String> target_str_global_array;
 Link_array<Score> score_global_array;
+Scope * header_global_p;
 
 
 void write_dependency_file (String fn, Array<String> targets,
@@ -29,13 +31,13 @@ void write_dependency_file (String fn, Array<String> targets,
 {
   const int WRAPWIDTH = 65;
 
-
-  cout << "Writing dependency file " << fn << " ...\n";
+  progress_indication (_f ("Writing dependency file: `%s'...", fn.ch_C ()));
+  progress_indication ("\n");
   ofstream f (fn.ch_C ());
   if (!f)
-    warning ( _("Can't open dependency file `" + fn + "\'"));
+    warning (_f ("can't open file: `%s'", fn));
 
-  f << "# Automatically generated by " << get_version_str ()  << "\n";
+  f << "# Automatically generated by " << gnu_lilypond_version_str ()  << '\n';
   String out;
   for (int i=0; i < targets.size (); i ++)
      out += targets[i] + " ";
@@ -66,18 +68,15 @@ do_deps()
 void
 do_scores()
 {
+  if (!header_global_p)
+    header_global_p = new Scope;
   for (int i=0; i < score_global_array.size(); i++)
     {
       Score* is_p = score_global_array[i];
-      if (!is_p->header_p_)
-       is_p->header_p_ = new Header;
-      
-                
-      is_p->header_p_->lily_id_str_ = "Lily was here, " +
-       get_version_number_str();
+
       if (is_p->errorlevel_i_)
        {
-         is_p->warning (_("Score contains errors. Will not process it. "));
+         is_p->warning (_("Score contains errors; will not process it"));
          exit_status_i_ |= 1;
        }
       else
@@ -91,48 +90,39 @@ do_scores()
 void
 clear_scores ()
 {
-  for (int i=0; i < score_global_array.size(); i++)
-    {
-      delete score_global_array[i];
-    }
-  score_global_array.clear();
+  junk_pointer_array (score_global_array);
+
   inclusion_global_array.clear ();
+  delete  header_global_p ;
+  header_global_p =0; 
 }
 
-extern File_path path;
 
 void
 do_one_file (String init_str, String file_str)
 {
-  if (init_str.length_i () && path.find (init_str).empty_b ())
+  if (init_str.length_i () && global_path.find (init_str).empty_b ())
     {
-      error (_("Can not find `") + init_str +"\'");
-      return ;
+      warning (_f ("can't find file: `%s'", init_str));
+      warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
+      return;
     }
-  if (file_str.length_i () && path.find (file_str).empty_b ())
+  if ((file_str != "-") && global_path.find (file_str).empty_b ())
     {
-      error (_("Can not find `") + file_str + "'");
-      return ;
+      warning (_f ("can't find file: `%s'", file_str));
+      return;
     }
 
   Sources sources;
   source_global_l = &sources;
-  source_global_l->set_path (&path);
+  source_global_l->set_path (&global_path);
   {
     My_lily_parser parser (source_global_l);
-    parser.set_version_check (version_ignore_global_b);
+    parser.set_version_check (false);
+    progress_indication (_f ("Now processing: `%s'", file_str.ch_C ()));
+    progress_indication ("\n");
     parser.parse_file (init_str, file_str);
 
-    
-    if (file_str.length_i () && file_str[0] != '-')
-      {
-       String a,b,c,d;
-       split_path (file_str, a, b, c, d);
-       default_outname_base_global = c;
-      }
-    else
-      default_outname_base_global = "lelie";
-  
     if (parser.error_level_i_)
       {
        exit_status_i_  = 1;
@@ -143,3 +133,4 @@ do_one_file (String init_str, String file_str)
   }
   source_global_l = 0;
 }
+