2 scores.cc -- implement some globals
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 #include "paper-def.hh"
16 #include "file-path.hh"
17 #include "file-results.hh"
18 #include "my-lily-parser.hh"
20 #include "lily-version.hh"
21 #include "scm-hash.hh"
23 Sources* source_global_l = 0;
24 Array<String> inclusion_global_array;
25 Array<String> target_str_global_array;
26 Link_array<Score> score_global_array;
27 Scheme_hash_table * global_header_p;
30 void write_dependency_file (String fn, Array<String> targets,
33 const int WRAPWIDTH = 65;
35 progress_indication (_f ("dependencies output to %s...", fn.ch_C ()));
36 progress_indication ("\n");
37 ofstream f (fn.ch_C ());
39 warning (_f ("can't open file: `%s'", fn));
41 f << "# Generated automatically by: " << gnu_lilypond_version_str () << '\n';
43 for (int i=0; i < targets.size (); i ++)
44 out += targets[i] + " ";
46 for (int i=0; i < deps.size (); i ++)
48 if (out.length_i() > WRAPWIDTH)
61 if (dependency_global_b)
63 Path p = split_path (outname_global);
65 write_dependency_file (p.path (),
66 target_str_global_array,
67 inclusion_global_array);
76 global_header_p = new Scheme_hash_table;
77 for (int i=0; i < score_global_array.size(); i++)
79 Score* is_p = score_global_array[i];
81 if (is_p->errorlevel_i_)
83 is_p->warning (_("Score contains errors; will not process it"));
97 for (int i=0; i < score_global_array.size (); i++)
98 scm_unprotect_object (score_global_array[i]->self_scm ());
99 score_global_array.clear();
101 inclusion_global_array.clear ();
103 scm_unprotect_object (global_header_p ->self_scm ());
109 do_one_file (String init_str, String file_str)
111 if (init_str.length_i () && global_path.find (init_str).empty_b ())
113 warning (_f ("can't find file: `%s'", init_str));
114 warning (_f ("(search path: `%s')", global_path.str ().ch_C()));
117 if ((file_str != "-") && global_path.find (file_str).empty_b ())
119 warning (_f ("can't find file: `%s'", file_str));
124 source_global_l = &sources;
125 source_global_l->set_path (&global_path);
127 My_lily_parser parser (source_global_l);
128 parser.set_version_check (false);
129 progress_indication (_f ("Now processing: `%s'", file_str.ch_C ()));
130 progress_indication ("\n");
131 parser.parse_file (init_str, file_str);
133 if (parser.error_level_i_)