source file of the GNU LilyPond music typesetter
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "score.hh"
#include "music-iterator.hh"
#include "music.hh"
#include "global-translator.hh"
-#include "header.hh"
+#include "scope.hh"
#include "cpu-timer.hh"
+#include "main.hh"
+#include "paper-def.hh"
-extern String default_out_fn;
Score::Score()
+ : Input()
{
header_p_ = 0;
music_p_ = 0;
}
Score::Score (Score const &s)
+ : Input (s)
{
- music_p_ = s.music_p_->clone();
+ music_p_ = (s.music_p_) ? s.music_p_->clone() : 0;
for (int i=0; i < s.def_p_arr_.size (); i++)
def_p_arr_.push(s.def_p_arr_[i]->clone());
- header_p_ = new Header (*s.header_p_);
+
+ header_p_ = (s.header_p_) ? new Header (*s.header_p_): 0;
}
Score::~Score()
Cpu_timer timer;
Global_translator * trans_p = odef_l->get_global_translator_p();
if (!trans_p)
- return ;
+ {
+ non_fatal_error (_("no toplevel translator"));
+ return ;
+ }
+ *mlog << '\n' << _("Interpreting music...") << flush;
+ trans_p->last_mom_ = music_p_->duration ();
+
+ Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_, trans_p);
- *mlog << "\nInterpreting music ...";
- trans_p->last_mom_ = music_p_->time_int().max ();
- Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_,
- trans_p);
iter->construct_children();
- if (! iter->ok())
+ if (! iter->ok())
{
delete iter;
- warning ("Need music in a score");
+ warning (_("need music in a score"));
errorlevel_i_ =1;
return ;
}
-
+
trans_p->start();
-
- while (iter->ok() || trans_p->moments_left_i ())
+
+ while (iter->ok() || trans_p->moments_left_i ())
{
- Moment w = infinity_mom;
- if (iter->ok())
+ Moment w;
+ w.set_infinite (1);
+ if (iter->ok())
{
w = iter->next_moment();
- DOUT << "proccing: " << w <<"\n";
- iter->print();
+ DOUT << "proccing: " << w << '\n';
+ if (!monitor->silent_b ("walking"))
+ iter->print();
}
+
trans_p->modify_next (w);
trans_p->prepare (w);
- trans_p->print();
+
+ if (!monitor->silent_b ("walking"))
+ trans_p->print();
iter->process_and_next (w);
trans_p->process();
}
+
delete iter;
trans_p->finish();
-
- if (errorlevel_i_)
+
+ if (errorlevel_i_)
{
- // should we? hampers debugging.
- warning ("Errors found, /*not processing score*/");
+ // should we? hampers debugging.
+ warning (_ ("errors found, /*not processing score*/"));
}
-
+
Music_output * output = trans_p->get_output_p();
delete trans_p;
- *mlog << " (time: " << String(timer.read (), "%.2f") << " seconds)";
+ *mlog << endl << _f ("time: %.2f seconds", timer.read ()) << flush;
-
output->header_l_ = header_p_;
- output->default_out_str_ = default_out_fn;
output->origin_str_ = location_str();
-
+
*mlog << endl;
output->process();
delete output ;
print();
for (int i=0; i < def_p_arr_.size (); i++)
- run_translator (def_p_arr_[i]);
+ {
+ if (no_paper_global_b
+ && def_p_arr_[i]->is_type_b (Paper_def::static_name ()))
+ continue;
+ run_translator (def_p_arr_[i]);
+ }
}
-
void
Score::print() const
{
#ifndef NPRINT
- DOUT << "score {\n";
+ DOUT << "score {\n";
music_p_ -> print ();
for (int i=0; i < def_p_arr_.size (); i++)
def_p_arr_[i]->print();
}
void
-Score::add (Music_output_def *pap_p)
+Score::add_output (Music_output_def *pap_p)
{
def_p_arr_.push(pap_p);
}
-
-
-