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
* m
=unsmob_music (s
.music_
);
42 music_
= m
?m
->clone()->self_scm () : SCM_EOL
;
43 for (int i
=0; i
< s
.def_p_arr_
.size (); i
++)
44 def_p_arr_
.push(s
.def_p_arr_
[i
]->clone());
45 errorlevel_i_
= s
.errorlevel_i_
;
46 header_p_
= (s
.header_p_
) ? new Scope (*s
.header_p_
): 0;
52 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 programming_error ("no toplevel translator");
67 progress_indication ("\n" + _("Interpreting music..."));
68 Music
* music
= unsmob_music (music_
);
70 trans_p
->final_mom_
= music
->length_mom ();
73 Music_iterator
* iter
= Music_iterator::static_get_iterator_p (music
);
74 iter
->init_translator(music
, trans_p
);
76 iter
->construct_children();
81 warning (_("Need music in a score"));
87 trans_p
->run_iterator_on_me (iter
);
93 // should we? hampers debugging.
94 warning (_ ("Errors found/*, not processing score*/"));
97 Music_output
* output
= trans_p
->get_output_p();
100 progress_indication (_f ("elapsed time: %.2f seconds", timer
.read ()));
102 output
->header_l_
= header_p_
;
103 output
->origin_str_
= location_str();
105 progress_indication ("\n");
110 force GC. At this point, GUILE may give back mallocated area to
120 if (!unsmob_music (music_
))
124 for (int i
=0; i
< def_p_arr_
.size (); i
++)
126 if (no_paper_global_b
127 && dynamic_cast<Paper_def
*>(def_p_arr_
[i
]))
129 run_translator (def_p_arr_
[i
]);
139 DEBUG_OUT
<< "score {\n";
140 // music_p_ -> print ();
141 for (int i
=0; i
< def_p_arr_
.size (); i
++)
142 def_p_arr_
[i
]->print();
148 Score::add_output (Music_output_def
*pap_p
)
150 def_p_arr_
.push(pap_p
);