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 Scope (*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
->final_mom_
= music_p_
->length_mom ();
63 Music_iterator
* iter
= Music_iterator::static_get_iterator_p (music_p_
);
64 iter
->init_translator(music_p_
, trans_p
);
66 iter
->construct_children();
71 warning (_("Need music in a score"));
77 trans_p
->run_iterator_on_me (iter
);
83 // should we? hampers debugging.
84 warning (_ ("Errors found/*, not processing score*/"));
87 Music_output
* output
= trans_p
->get_output_p();
89 *mlog
<< endl
<< _f ("elapsed time: %.2f seconds", timer
.read ()) << flush
;
91 output
->header_l_
= header_p_
;
92 output
->origin_str_
= location_str();
106 for (int i
=0; i
< def_p_arr_
.size (); i
++)
108 if (no_paper_global_b
109 && dynamic_cast<Paper_def
*>(def_p_arr_
[i
]))
111 run_translator (def_p_arr_
[i
]);
121 DEBUG_OUT
<< "score {\n";
122 music_p_
-> print ();
123 for (int i
=0; i
< def_p_arr_
.size (); i
++)
124 def_p_arr_
[i
]->print();
130 Score::add_output (Music_output_def
*pap_p
)
132 def_p_arr_
.push(pap_p
);