2 score.cc -- implement Score
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "music-output-def.hh"
12 #include "music-output.hh"
14 #include "source-file.hh"
15 #include "music-iterator.hh"
17 #include "global-translator.hh"
19 #include "cpu-timer.hh"
21 #include "paper-def.hh"
32 Score::Score (Score const &s)
35 music_p_ = (s.music_p_) ? s.music_p_->clone() : 0;
36 for (int i=0; i < s.def_p_arr_.size (); i++)
37 def_p_arr_.push(s.def_p_arr_[i]->clone());
38 errorlevel_i_ = s.errorlevel_i_;
39 header_p_ = (s.header_p_) ? new Header (*s.header_p_): 0;
45 junk_pointer_array (def_p_arr_);
50 Score::run_translator (Music_output_def *odef_l)
53 Global_translator * trans_p = odef_l->get_global_translator_p();
56 non_fatal_error (_("no toplevel translator"));
59 *mlog << '\n' << _("Interpreting music...") << flush;
60 trans_p->last_mom_ = music_p_->length_mom ();
63 bool playing = odef_l->scope_p_->elem_b ("unfold_all");
64 Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_, playing);
65 iter->init_translator(music_p_, trans_p);
67 iter->construct_children();
72 warning (_("Need music in a score"));
78 trans_p->run_iterator_on_me (iter);
84 // should we? hampers debugging.
85 warning (_ ("Errors found/*, not processing score*/"));
88 Music_output * output = trans_p->get_output_p();
90 *mlog << endl << _f ("elapsed time: %.2f seconds", timer.read ()) << flush;
92 output->header_l_ = header_p_;
93 output->origin_str_ = location_str();
107 for (int i=0; i < def_p_arr_.size (); i++)
109 if (no_paper_global_b
110 && dynamic_cast<Paper_def*>(def_p_arr_[i]))
112 run_translator (def_p_arr_[i]);
122 DEBUG_OUT << "score {\n";
123 music_p_ -> print ();
124 for (int i=0; i < def_p_arr_.size (); i++)
125 def_p_arr_[i]->print();
131 Score::add_output (Music_output_def *pap_p)
133 def_p_arr_.push(pap_p);