2 scores.cc -- implement some globals
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
12 #include "paper-def.hh"
16 #include "file-path.hh"
17 #include "file-results.hh"
18 #include "my-lily-parser.hh"
21 Sources* source_global_l = 0;
22 Array<String> inclusion_global_array;
23 Array<String> target_str_global_array;
24 Link_array<Score> score_global_array;
27 void write_dependency_file (String fn, Array<String> targets,
30 const int WRAPWIDTH = 65;
33 cout << "Writing dependency file " << fn << " ...\n";
34 ofstream f (fn.ch_C ());
36 warning ( _("Can't open dependency file `" + fn + "\'"));
38 f << "# Automatically generated by " << get_version_str () << "\n";
40 for (int i=0; i < targets.size (); i ++)
41 out += targets[i] + " ";
43 for (int i=0; i < deps.size (); i ++)
45 if (out.length_i() > WRAPWIDTH)
58 if (dependency_global_b)
60 write_dependency_file (default_outname_base_global + ".dep", target_str_global_array,
61 inclusion_global_array);
69 for (int i=0; i < score_global_array.size(); i++)
71 Score* is_p = score_global_array[i];
73 is_p->header_p_ = new Header;
76 is_p->header_p_->lily_id_str_ = "Lily was here, " +
77 get_version_number_str();
78 if (is_p->errorlevel_i_)
80 is_p->warning (_("Score contains errors. Will not process it. "));
94 for (int i=0; i < score_global_array.size(); i++)
96 delete score_global_array[i];
98 score_global_array.clear();
99 inclusion_global_array.clear ();
102 extern File_path path;
105 do_one_file (String init_str, String file_str)
107 if (init_str.length_i () && path.find (init_str).empty_b ())
109 warning (_("Can not find `") + init_str +"\'");
112 if (file_str.length_i () && path.find (file_str).empty_b ())
114 warning (_("Can not find `") + file_str + "'");
119 source_global_l = &sources;
120 source_global_l->set_path (&path);
122 My_lily_parser parser (source_global_l);
123 parser.set_version_check (version_ignore_global_b);
124 parser.parse_file (init_str, file_str);
127 if (file_str.length_i () && file_str[0] != '-')
130 split_path (file_str, a, b, c, d);
131 default_outname_base_global = c;
134 default_outname_base_global = "lelie";
136 if (parser.error_level_i_)