lilypond-1.3.12
[lilypond.git] / lily / global-translator.cc
blob9728a4c0f265553823b6f94b7b73f0775c070ce0
1 /*
2 global-translator.cc -- implement Global_translator
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "global-translator.hh"
10 #include "music-iterator.hh"
11 #include "debug.hh"
13 Global_translator::Global_translator()
17 void
18 Global_translator::add_moment_to_process (Moment m)
20 if (m > final_mom_)
21 return;
23 for (int i=0; i < extra_mom_pq_.size(); i++)
24 if (extra_mom_pq_[i] == m)
25 return;
26 extra_mom_pq_.insert (m);
29 void
30 Global_translator::modify_next (Moment &w)
32 while (extra_mom_pq_.size() &&
33 extra_mom_pq_.front() <= w)
35 w =extra_mom_pq_.get();
38 int
39 Global_translator::moments_left_i() const
41 return extra_mom_pq_.size();
44 void
45 Global_translator::prepare (Moment m)
47 prev_mom_ = now_mom_;
48 now_mom_ = m;
51 Moment
52 Global_translator::now_mom () const
54 return now_mom_;
59 Music_output*
60 Global_translator::get_output_p()
62 return 0;
65 void
66 Global_translator::process ()
69 void
70 Global_translator::start ()
73 void
74 Global_translator::finish ()
78 void
79 Global_translator::run_iterator_on_me (Music_iterator * iter)
81 while (iter->ok() || moments_left_i ())
83 Moment w;
84 w.set_infinite (1);
85 if (iter->ok())
87 w = iter->next_moment();
88 DEBUG_OUT << "proccing: " << w << '\n';
89 if (flower_dstream && !flower_dstream->silent_b ("walking"))
90 iter->print();
93 modify_next (w);
94 prepare (w);
96 if (flower_dstream && !flower_dstream->silent_b ("walking"))
97 print();
99 iter->process_and_next (w);
100 process();