2 score.cc -- implement Score
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
13 #include "music-output-def.hh"
14 #include "music-output.hh"
16 #include "source-file.hh"
17 #include "music-iterator.hh"
19 #include "global-translator.hh"
21 #include "cpu-timer.hh"
23 #include "paper-def.hh"
38 Score::Score (Score const &s)
41 music_p_ = (s.music_p_) ? s.music_p_->clone() : 0;
42 for (int i=0; i < s.def_p_arr_.size (); i++)
43 def_p_arr_.push(s.def_p_arr_[i]->clone());
44 errorlevel_i_ = s.errorlevel_i_;
45 header_p_ = (s.header_p_) ? new Scope (*s.header_p_): 0;
51 junk_pointer_array (def_p_arr_);
56 Score::run_translator (Music_output_def *odef_l)
61 Global_translator * trans_p = odef_l->get_global_translator_p();
64 non_fatal_error (_("no toplevel translator"));
67 progress_indication ("\n" + _("Interpreting music..."));
68 trans_p->final_mom_ = music_p_->length_mom ();
71 Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_);
72 iter->init_translator(music_p_, trans_p);
74 iter->construct_children();
79 warning (_("Need music in a score"));
85 trans_p->run_iterator_on_me (iter);
91 // should we? hampers debugging.
92 warning (_ ("Errors found/*, not processing score*/"));
95 Music_output * output = trans_p->get_output_p();
97 progress_indication (_f ("elapsed time: %.2f seconds", timer.read ()));
99 output->header_l_ = header_p_;
100 output->origin_str_ = location_str();
102 progress_indication ("\n");
107 force GC. At this point, GUILE may give back mallocated area to
121 for (int i=0; i < def_p_arr_.size (); i++)
123 if (no_paper_global_b
124 && dynamic_cast<Paper_def*>(def_p_arr_[i]))
126 run_translator (def_p_arr_[i]);
136 DEBUG_OUT << "score {\n";
137 music_p_ -> print ();
138 for (int i=0; i < def_p_arr_.size (); i++)
139 def_p_arr_[i]->print();
145 Score::add_output (Music_output_def *pap_p)
147 def_p_arr_.push(pap_p);