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 ();
62 Music_iterator
* iter
= Music_iterator::static_get_iterator_p (music_p_
);
63 iter
->init_translator(music_p_
, trans_p
);
65 iter
->construct_children();
70 warning (_("need music in a score"));
76 trans_p
->run_iterator_on_me (iter
);
82 // should we? hampers debugging.
83 warning (_ ("errors found, /*not processing score*/"));
86 Music_output
* output
= trans_p
->get_output_p();
88 *mlog
<< endl
<< _f ("time: %.2f seconds", timer
.read ()) << flush
;
90 output
->header_l_
= header_p_
;
91 output
->origin_str_
= location_str();
105 for (int i
=0; i
< def_p_arr_
.size (); i
++)
107 if (no_paper_global_b
108 && dynamic_cast<Paper_def
*>(def_p_arr_
[i
]))
110 run_translator (def_p_arr_
[i
]);
121 music_p_
-> print ();
122 for (int i
=0; i
< def_p_arr_
.size (); i
++)
123 def_p_arr_
[i
]->print();
129 Score::add_output (Music_output_def
*pap_p
)
131 def_p_arr_
.push(pap_p
);