From e58fce49b3113408254011774685370b8233df17 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 4 Feb 2004 16:47:56 +0000 Subject: [PATCH] * lily/include/music-iterator.hh (class Music_iterator): remove Music_iterator::skip and Music_iterator::get_pending_events from interface. Rename report_to -> get_outlet * lily/auto-change-iterator.cc: move contents from new-auto-change-iterator.cc from * lily/new-auto-change-iterator.cc (process): new file. * lily/new-part-combine-iterator.cc (kill_mmrest): new function. --- ChangeLog | 4 + Documentation/topdocs/NEWS.texi | 10 ++- input/test/ac-extra-voice.ly | 4 +- input/test/slur-ugly.ly | 4 +- lily/apply-context-iterator.cc | 2 +- lily/auto-change-iterator.cc | 6 +- lily/bar-check-iterator.cc | 2 +- lily/change-iterator.cc | 8 +- lily/chord-tremolo-iterator.cc | 2 +- lily/context-specced-music-iterator.cc | 2 +- lily/event-chord-iterator.cc | 28 ++----- lily/folded-repeat-iterator.cc | 7 +- lily/include/event-chord-iterator.hh | 1 - lily/include/interpretation-context-handle.hh | 5 +- lily/include/music-iterator.hh | 11 +-- lily/include/music-wrapper-iterator.hh | 1 - lily/include/sequential-iterator.hh | 2 - lily/include/simple-music-iterator.hh | 2 - lily/include/simultaneous-music-iterator.hh | 2 - lily/interpretation-context-handle.cc | 40 +++++----- lily/lyric-combine-music-iterator.cc | 4 +- lily/music-iterator.cc | 25 ++---- lily/music-wrapper-iterator.cc | 11 +-- lily/new-lyric-combine-music-iterator.cc | 4 +- lily/new-part-combine-iterator.cc | 71 +++++++--------- lily/output-property-music-iterator.cc | 2 - lily/percent-repeat-iterator.cc | 2 +- lily/property-iterator.cc | 18 ++--- lily/sequential-iterator.cc | 80 +------------------ lily/simple-music-iterator.cc | 16 +--- lily/simultaneous-music-iterator.cc | 42 +--------- lily/time-scaled-music-iterator.cc | 2 +- lily/unfolded-repeat-iterator.cc | 4 +- 33 files changed, 121 insertions(+), 303 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5073100ec5..90100f1bee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2004-02-04 Han-Wen Nienhuys + * lily/include/music-iterator.hh (class Music_iterator): remove + Music_iterator::skip and Music_iterator::get_pending_events from + interface. Rename report_to -> get_outlet + * lily/auto-change-iterator.cc: move contents from new-auto-change-iterator.cc from diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index 0ca5c7bb2e..6a96969133 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -17,6 +17,14 @@ Version 2.1.13 @end ignore @itemize @bullet + +@item The automatic staff changer was internally rewritten. The new +syntax for this is + +@example + \autochange @var{the music} +@end example + @item The ergonomic syntax of @code{\markup} now has an equivalent in Scheme. The @code{markup*} macro creates such objects; the following two markup commands are equivalent: @@ -52,7 +60,7 @@ sizes. @item A more cleanly constructed part combiner has been installed. It is more robust and less buggy. The part-combiner can be used with @example - \newpartcombine @var{mus1} @var{mus2} + \partcombine @var{mus1} @var{mus2} @end example @noindent diff --git a/input/test/ac-extra-voice.ly b/input/test/ac-extra-voice.ly index cba5559984..aade68342c 100644 --- a/input/test/ac-extra-voice.ly +++ b/input/test/ac-extra-voice.ly @@ -1,4 +1,4 @@ -\version "2.1.7" +\version "2.1.18" %% I don't know what this example is supposed to do. delete it? %% It shows how to use the autochange feature together with an extra @@ -40,7 +40,7 @@ accompany = \repeat unfold 4 \basloopje \context Staff=down<< \global \clef bass - \autochange Staff \context Voice \accompany + \autochange \context Voice \accompany >> >> diff --git a/input/test/slur-ugly.ly b/input/test/slur-ugly.ly index ae3b58535b..a16cddebb2 100644 --- a/input/test/slur-ugly.ly +++ b/input/test/slur-ugly.ly @@ -1,5 +1,5 @@ -\version "2.1.7" +\version "2.1.18" \header { texidoc="@cindex Slur Ugly You can get ugly slurs, if you want. " @@ -15,7 +15,7 @@ baseWalk = \notes \relative c { \context Staff=up { s1 * 6/4 } \context Staff=down << \clef bass - \autochange Staff \context Voice \baseWalk + \autochange \context Voice \baseWalk >> >> \paper { diff --git a/lily/apply-context-iterator.cc b/lily/apply-context-iterator.cc index 3b42c54fcb..feb3a83460 100644 --- a/lily/apply-context-iterator.cc +++ b/lily/apply-context-iterator.cc @@ -20,7 +20,7 @@ Apply_context_iterator::process (Moment m) { SCM proc = get_music ()->get_mus_property ("procedure"); - scm_call_1 (proc, report_to()->self_scm()); + scm_call_1 (proc, get_outlet ()->self_scm()); Simple_music_iterator::process(m); } diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index f7da5c2780..f5bb1bbe39 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -37,7 +37,7 @@ void Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym, String to_id) { - Translator_group * current = it->report_to (); + Translator_group * current = it->get_outlet (); Translator_group * last = 0; /* @@ -66,7 +66,7 @@ Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym, if (last) { Translator_group * dest = - it->report_to ()->find_create_translator (to_type_sym, to_id, SCM_EOL); + it->get_outlet ()->find_create_translator (to_type_sym, to_id, SCM_EOL); current->remove_translator (last); dest->add_used_group_translator (last); } @@ -89,7 +89,7 @@ Auto_change_iterator::process (Moment m) Music_wrapper_iterator::process (m); - Moment now = report_to ()->now_mom (); + Moment now = get_outlet ()->now_mom (); Moment *splitm = 0; for (; gh_pair_p (split_list_); split_list_ = gh_cdr (split_list_)) diff --git a/lily/bar-check-iterator.cc b/lily/bar-check-iterator.cc index 16b03abf2c..380edbf448 100644 --- a/lily/bar-check-iterator.cc +++ b/lily/bar-check-iterator.cc @@ -37,7 +37,7 @@ Bar_check_iterator::process (Moment m) Simple_music_iterator::process(m); if (!m.to_bool ()) { - Translator_group *tr = report_to (); + Translator_group *tr = get_outlet (); SCM mp = tr->get_property ("measurePosition"); SCM sync= tr->get_property ("barCheckSynchronize"); diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc index 16e3f783a1..cda98a09d1 100644 --- a/lily/change-iterator.cc +++ b/lily/change-iterator.cc @@ -26,8 +26,8 @@ Change_iterator::error (String reason) GUHG! */ String warn2= "Change_iterator::process (): " - + report_to ()->context_name () + " = `" - + report_to ()->id_string_ + "': "; + + get_outlet ()->context_name () + " = `" + + get_outlet ()->id_string_ + "': "; warning (warn2); get_music ()->origin ()->warning (warn1); } @@ -38,7 +38,7 @@ Change_iterator::error (String reason) void Change_iterator::process (Moment m) { - Translator_group * current = report_to (); + Translator_group * current = get_outlet (); Translator_group * last = 0; SCM to_type = get_music ()->get_mus_property ("change-to-type"); @@ -65,7 +65,7 @@ Change_iterator::process (Moment m) if (last) { Translator_group * dest = - report_to ()->find_create_translator (to_type, to_id, SCM_EOL); + get_outlet ()->find_create_translator (to_type, to_id, SCM_EOL); current->remove_translator (last); dest->add_used_group_translator (last); } diff --git a/lily/chord-tremolo-iterator.cc b/lily/chord-tremolo-iterator.cc index ae9a17eb46..3de2ba5ba3 100644 --- a/lily/chord-tremolo-iterator.cc +++ b/lily/chord-tremolo-iterator.cc @@ -71,7 +71,7 @@ Chord_tremolo_iterator::process (Moment m) { Music_iterator *yeah = try_music (get_music ()); if (yeah) - set_translator (yeah->report_to ()); + set_translator (yeah->get_outlet ()); else get_music ()->origin ()->warning (_ ("no one to print a tremolos")); } diff --git a/lily/context-specced-music-iterator.cc b/lily/context-specced-music-iterator.cc index c6751227bb..801f1b20dd 100644 --- a/lily/context-specced-music-iterator.cc +++ b/lily/context-specced-music-iterator.cc @@ -31,7 +31,7 @@ Context_specced_music_iterator::construct_children () SCM ops = get_music ()->get_mus_property ("property-operations"); Translator_group* a - = report_to ()->find_create_translator (ct, c_id, ops); + = get_outlet ()->find_create_translator (ct, c_id, ops); if (a) set_translator (a); diff --git a/lily/event-chord-iterator.cc b/lily/event-chord-iterator.cc index ffb423bc66..d45168d573 100644 --- a/lily/event-chord-iterator.cc +++ b/lily/event-chord-iterator.cc @@ -24,12 +24,12 @@ Event_chord_iterator::Event_chord_iterator (Event_chord_iterator const &src) Translator_group* Event_chord_iterator::get_req_translator () { - assert (report_to ()); - if (report_to ()->is_bottom_context ()) - return report_to (); + assert (get_outlet ()); + if (get_outlet ()->is_bottom_context ()) + return get_outlet (); - set_translator (report_to ()->get_default_interpreter ()); - return report_to (); + set_translator (get_outlet ()->get_default_interpreter ()); + return get_outlet (); } void @@ -45,24 +45,9 @@ Event_chord_iterator::get_elt () const return (Event_chord*) get_music (); } -SCM -Event_chord_iterator::get_pending_events (Moment) const -{ - SCM s = SCM_EOL; - if (last_processed_mom_ < Moment (0)) - { - Music_sequence * ms = dynamic_cast (get_music ()); - - for (SCM m = ms->music_list (); gh_pair_p (m); m = ly_cdr (m)) - { - s = gh_cons (ly_car (m) , s); - } - } - return s; -} void -Event_chord_iterator::process (Moment m) +Event_chord_iterator::process (Moment ) { if (last_processed_mom_ < Moment (0)) { @@ -76,7 +61,6 @@ Event_chord_iterator::process (Moment m) mus->origin ()->warning (_f ("Junking event: `%s'", mus->name())); } } - skip (m); } IMPLEMENT_CTOR_CALLBACK (Event_chord_iterator); diff --git a/lily/folded-repeat-iterator.cc b/lily/folded-repeat-iterator.cc index 40f4680326..9465184b6b 100644 --- a/lily/folded-repeat-iterator.cc +++ b/lily/folded-repeat-iterator.cc @@ -8,11 +8,6 @@ */ -/* - Folded repeats are a stupid idea at this point, so we refrain from - implementing get_pending_events () and skip (). -*/ - #include "folded-repeat-iterator.hh" #include "repeated-music.hh" #include "music-list.hh" @@ -132,7 +127,7 @@ Folded_repeat_iterator::enter_alternative () */ Simultaneous_music_iterator * s = new Simultaneous_music_iterator; s->separate_contexts_b_ = true; - s->init_translator (mus, report_to ()); + s->init_translator (mus, get_outlet ()); alternative_iter_ = s; alternative_iter_->construct_children (); diff --git a/lily/include/event-chord-iterator.hh b/lily/include/event-chord-iterator.hh index ec436d88e1..e3c5fa0d09 100644 --- a/lily/include/event-chord-iterator.hh +++ b/lily/include/event-chord-iterator.hh @@ -35,7 +35,6 @@ public: Event_chord_iterator (); Event_chord_iterator (Event_chord_iterator const&); - virtual SCM get_pending_events (Moment) const; protected: virtual void process (Moment); virtual void construct_children (); diff --git a/lily/include/interpretation-context-handle.hh b/lily/include/interpretation-context-handle.hh index 6ab87d4064..d13e302b77 100644 --- a/lily/include/interpretation-context-handle.hh +++ b/lily/include/interpretation-context-handle.hh @@ -21,11 +21,12 @@ public: bool try_music (Music *); void operator = (Interpretation_context_handle const&); Interpretation_context_handle (Interpretation_context_handle const&); - Translator_group * report_to () const; + Translator_group * get_outlet () const; + int get_count () const; void quit (); private: - Translator_group * report_to_; + Translator_group * outlet_; void down (); void up (Translator_group*); }; diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 0831317f38..db99254956 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -45,12 +45,6 @@ * Typically this reports the music to an interpretation context, thus changing the state of the interpretation context. - get_pending_events (M) -- return all events starting at M (pre: no events - before M). No side-effects - - skip (M) -- remove all events starting before M (leave the ones that - start M). no side-effects on interpretation context - TODO: @@ -81,7 +75,7 @@ public: /** The translation unit that we this iterator is reporting to now. */ - Translator_group* report_to () const; + Translator_group* get_outlet () const; void set_translator (Translator_group*); @@ -97,10 +91,7 @@ public: virtual bool ok () const; virtual bool run_always () const; - virtual SCM get_pending_events (Moment until)const; virtual void process (Moment until); - virtual void skip (Moment until); - virtual void derived_mark ()const; virtual void construct_children (); diff --git a/lily/include/music-wrapper-iterator.hh b/lily/include/music-wrapper-iterator.hh index 4bd32a93d1..a9baaf4de8 100644 --- a/lily/include/music-wrapper-iterator.hh +++ b/lily/include/music-wrapper-iterator.hh @@ -34,7 +34,6 @@ public: virtual void do_quit(); virtual bool ok () const; virtual SCM get_pending_events (Moment)const; - virtual void skip (Moment); virtual bool run_always () const; protected: virtual void process (Moment); diff --git a/lily/include/sequential-iterator.hh b/lily/include/sequential-iterator.hh index 1ab1d00c5d..2cef81e96e 100644 --- a/lily/include/sequential-iterator.hh +++ b/lily/include/sequential-iterator.hh @@ -65,8 +65,6 @@ public: virtual Moment pending_moment () const; virtual void do_quit(); virtual bool ok () const; - virtual void skip (Moment); - virtual SCM get_pending_events (Moment)const; protected: virtual void process (Moment); diff --git a/lily/include/simple-music-iterator.hh b/lily/include/simple-music-iterator.hh index fa0e09c614..88a1fa1b79 100644 --- a/lily/include/simple-music-iterator.hh +++ b/lily/include/simple-music-iterator.hh @@ -29,8 +29,6 @@ public: virtual void process (Moment); virtual bool ok ()const; virtual Moment pending_moment ()const; - - virtual void skip (Moment); }; #endif /* SIMPLE_MUSIC_ITERATOR_HH */ diff --git a/lily/include/simultaneous-music-iterator.hh b/lily/include/simultaneous-music-iterator.hh index 446e3ae1e5..f602a823a3 100644 --- a/lily/include/simultaneous-music-iterator.hh +++ b/lily/include/simultaneous-music-iterator.hh @@ -29,8 +29,6 @@ public: virtual Moment pending_moment () const; virtual void do_quit(); virtual bool ok () const; - virtual SCM get_pending_events (Moment)const; - virtual void skip (Moment); virtual bool run_always () const; protected: diff --git a/lily/interpretation-context-handle.cc b/lily/interpretation-context-handle.cc index dee2951851..b617aa7544 100644 --- a/lily/interpretation-context-handle.cc +++ b/lily/interpretation-context-handle.cc @@ -11,21 +11,21 @@ Interpretation_context_handle::Interpretation_context_handle () { - report_to_ =0; + outlet_ =0; } Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s) { - report_to_ =0; - if (s.report_to_) - up (s.report_to_); + outlet_ =0; + if (s.outlet_) + up (s.outlet_); } Interpretation_context_handle* Interpretation_context_handle::clone () const { Interpretation_context_handle* handle = new Interpretation_context_handle; - handle->report_to_ = this->report_to_; + handle->outlet_ = this->outlet_; return handle; } @@ -34,7 +34,7 @@ Interpretation_context_handle::~Interpretation_context_handle () /* Don't do - if (report_to_) + if (outlet_) down (); with GC, this is asynchronous. @@ -44,59 +44,59 @@ Interpretation_context_handle::~Interpretation_context_handle () void Interpretation_context_handle::up (Translator_group*t) { - report_to_ = t; + outlet_ = t; t->iterator_count_ ++; } void Interpretation_context_handle::down () { - report_to_->iterator_count_ --; - report_to_ = 0; + outlet_->iterator_count_ --; + outlet_ = 0; } void Interpretation_context_handle::quit () { - if (report_to_) + if (outlet_) { - report_to_->iterator_count_ --; - report_to_ = 0; + outlet_->iterator_count_ --; + outlet_ = 0; } } bool Interpretation_context_handle::try_music (Music *m) { - return report_to_->try_music (m); + return outlet_->try_music (m); } void Interpretation_context_handle::operator = (Interpretation_context_handle const &s) { - set_translator (s.report_to_); + set_translator (s.outlet_); } void Interpretation_context_handle::set_translator (Translator_group*trans) { - if (report_to_ ==trans) + if (outlet_ ==trans) return; - if (report_to_) + if (outlet_) down (); if (trans) up (trans); } Translator_group* -Interpretation_context_handle::report_to ()const +Interpretation_context_handle::get_outlet () const { - return report_to_; + return outlet_; } int -Interpretation_context_handle::get_count ()const +Interpretation_context_handle::get_count () const { - return report_to_->iterator_count_ ; + return outlet_->iterator_count_ ; } diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc index 3b3e19ec78..4124cfedb3 100644 --- a/lily/lyric-combine-music-iterator.cc +++ b/lily/lyric-combine-music-iterator.cc @@ -125,7 +125,7 @@ Lyric_combine_music_iterator::get_busy_status () const if (try_music (busy_req)) return true; - Translator_group * tr = music_iter_->report_to (); + Translator_group * tr = music_iter_->get_outlet (); SCM grobs = tr->get_property ("busyGrobs"); Moment now = tr->now_mom(); @@ -151,7 +151,7 @@ bool Lyric_combine_music_iterator::melisma_busy () { /* - We can not read the property, since music_iter_->report_to() might + We can not read the property, since music_iter_->get_outlet () might not be the context that sets the melisma properties, but rather a parent context. */ diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index 7d53a9c702..45d2f374dc 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -40,9 +40,9 @@ Music_iterator::~Music_iterator () } Translator_group* -Music_iterator::report_to () const +Music_iterator::get_outlet () const { - return handle_.report_to (); + return handle_.get_outlet (); } void @@ -73,16 +73,7 @@ Music_iterator::ok () const return false; } -void -Music_iterator::skip (Moment) -{ -} -SCM -Music_iterator::get_pending_events (Moment)const -{ - return SCM_EOL; -} SCM Music_iterator::get_static_get_iterator (Music *m) @@ -132,14 +123,14 @@ Music_iterator::init_translator (Music *m, Translator_group *report) { music_ = m; assert (m); - if (! report_to ()) + if (! get_outlet ()) set_translator (report); } void Music_iterator::substitute_outlet (Translator_group*f, Translator_group *t) { - if (report_to () == f) + if (get_outlet () == f) set_translator (t); derived_substitute (f,t); } @@ -155,7 +146,7 @@ Music_iterator::get_iterator (Music *m) const SCM ip = get_static_get_iterator (m); Music_iterator*p = unsmob_iterator (ip); - p->init_translator (m, report_to ()); + p->init_translator (m, get_outlet ()); p->construct_children (); return ip; @@ -169,7 +160,7 @@ Music_iterator::get_iterator (Music *m) const Music_iterator* Music_iterator::try_music (Music *m) const { - bool b = report_to ()->try_music ((Music*)m); // ugh + bool b = get_outlet ()->try_music ((Music*)m); // ugh Music_iterator * it = b ? (Music_iterator*) this : 0; // ugh if (!it) it = try_music_in_children (m); @@ -206,8 +197,8 @@ Music_iterator::mark_smob (SCM smob) Careful with GC, although we intend the following as pointers only, we _must_ mark them. */ - if (mus->report_to()) - scm_gc_mark (mus->report_to()->self_scm()); + if (mus->get_outlet ()) + scm_gc_mark (mus->get_outlet ()->self_scm()); if (mus->music_) scm_gc_mark (mus->music_->self_scm()); diff --git a/lily/music-wrapper-iterator.cc b/lily/music-wrapper-iterator.cc index be56471ad8..4d794033d8 100644 --- a/lily/music-wrapper-iterator.cc +++ b/lily/music-wrapper-iterator.cc @@ -59,11 +59,7 @@ Music_wrapper_iterator::ok () const { return child_iter_ && child_iter_->ok (); } -void -Music_wrapper_iterator::skip (Moment m) -{ - child_iter_->skip (m); -} + void Music_wrapper_iterator::process (Moment m) @@ -71,11 +67,6 @@ Music_wrapper_iterator::process (Moment m) child_iter_->process (m); } -SCM -Music_wrapper_iterator::get_pending_events (Moment m)const -{ - return child_iter_->get_pending_events (m); -} Moment Music_wrapper_iterator::pending_moment () const diff --git a/lily/new-lyric-combine-music-iterator.cc b/lily/new-lyric-combine-music-iterator.cc index e7c2e84696..3442efb74b 100644 --- a/lily/new-lyric-combine-music-iterator.cc +++ b/lily/new-lyric-combine-music-iterator.cc @@ -164,7 +164,7 @@ New_lyric_combine_music_iterator::construct_children () find_thread (); if (lyric_iter_) - lyrics_context_ = find_context_below (lyric_iter_->report_to (), + lyrics_context_ = find_context_below (lyric_iter_->get_outlet (), "LyricsVoice", ""); /* @@ -183,7 +183,7 @@ New_lyric_combine_music_iterator::find_thread () if (gh_string_p (voice_name)) { - Translator_group *t = report_to (); + Translator_group *t = get_outlet (); while (t && t->daddy_trans_) t = t->daddy_trans_; diff --git a/lily/new-part-combine-iterator.cc b/lily/new-part-combine-iterator.cc index 872941f444..05b837d1c2 100644 --- a/lily/new-part-combine-iterator.cc +++ b/lily/new-part-combine-iterator.cc @@ -31,7 +31,6 @@ protected: virtual void do_quit(); virtual void process (Moment); - virtual SCM get_pending_events (Moment)const; virtual Music_iterator *try_music_in_children (Music *) const; virtual bool ok () const; @@ -152,10 +151,10 @@ New_pc_iterator::chords_together () { playing_state_ = TOGETHER; state_ = TOGETHER; - first_iter_->substitute_outlet (one_.report_to (), shared_.report_to ()); - first_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); - second_iter_->substitute_outlet (two_.report_to (), shared_.report_to ()); - second_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); + first_iter_->substitute_outlet (one_.get_outlet (), shared_.get_outlet ()); + first_iter_->substitute_outlet (null_.get_outlet (), shared_.get_outlet ()); + second_iter_->substitute_outlet (two_.get_outlet (), shared_.get_outlet ()); + second_iter_->substitute_outlet (null_.get_outlet (), shared_.get_outlet ()); } } @@ -181,13 +180,13 @@ New_pc_iterator::solo1 () else { state_ = SOLO1; - first_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); - first_iter_->substitute_outlet (one_.report_to (), shared_.report_to ()); + first_iter_->substitute_outlet (null_.get_outlet (), shared_.get_outlet ()); + first_iter_->substitute_outlet (one_.get_outlet (), shared_.get_outlet ()); - second_iter_->substitute_outlet (two_.report_to (), null_.report_to ()); - second_iter_->substitute_outlet (shared_.report_to (), null_.report_to ()); - kill_mmrest (two_.report_to ()); - kill_mmrest (shared_.report_to ()); + second_iter_->substitute_outlet (two_.get_outlet (), null_.get_outlet ()); + second_iter_->substitute_outlet (shared_.get_outlet (), null_.get_outlet ()); + kill_mmrest (two_.get_outlet ()); + kill_mmrest (shared_.get_outlet ()); if (playing_state_ != SOLO1) { @@ -210,13 +209,13 @@ New_pc_iterator::unisono (bool silent) else { - first_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); - first_iter_->substitute_outlet (one_.report_to (), shared_.report_to ()); + first_iter_->substitute_outlet (null_.get_outlet (), shared_.get_outlet ()); + first_iter_->substitute_outlet (one_.get_outlet (), shared_.get_outlet ()); - second_iter_->substitute_outlet (two_.report_to (), null_.report_to ()); - second_iter_->substitute_outlet (shared_.report_to (), null_.report_to ()); - kill_mmrest (two_.report_to ()); - kill_mmrest (shared_.report_to ()); + second_iter_->substitute_outlet (two_.get_outlet (), null_.get_outlet ()); + second_iter_->substitute_outlet (shared_.get_outlet (), null_.get_outlet ()); + kill_mmrest (two_.get_outlet ()); + kill_mmrest (shared_.get_outlet ()); if (playing_state_ != UNISONO && newstate == UNISONO) @@ -241,13 +240,13 @@ New_pc_iterator::solo2 () { state_ = SOLO2; - second_iter_->substitute_outlet (null_.report_to (), shared_.report_to ()); - second_iter_->substitute_outlet (two_.report_to (), shared_.report_to ()); + second_iter_->substitute_outlet (null_.get_outlet (), shared_.get_outlet ()); + second_iter_->substitute_outlet (two_.get_outlet (), shared_.get_outlet ()); - first_iter_->substitute_outlet (one_.report_to (), null_.report_to ()); - first_iter_->substitute_outlet (shared_.report_to (), null_.report_to ()); - kill_mmrest (one_.report_to ()); - kill_mmrest (shared_.report_to ()); + first_iter_->substitute_outlet (one_.get_outlet (), null_.get_outlet ()); + first_iter_->substitute_outlet (shared_.get_outlet (), null_.get_outlet ()); + kill_mmrest (one_.get_outlet ()); + kill_mmrest (shared_.get_outlet ()); if (playing_state_ != SOLO2) { @@ -273,11 +272,11 @@ New_pc_iterator::apart (bool silent) { state_ = APART; - first_iter_->substitute_outlet (null_.report_to (), one_.report_to ()); - first_iter_->substitute_outlet (shared_.report_to (), one_.report_to ()); + first_iter_->substitute_outlet (null_.get_outlet (), one_.get_outlet ()); + first_iter_->substitute_outlet (shared_.get_outlet (), one_.get_outlet ()); - second_iter_->substitute_outlet (null_.report_to (), two_.report_to ()); - second_iter_->substitute_outlet (shared_.report_to (), two_.report_to ()); } + second_iter_->substitute_outlet (null_.get_outlet (), two_.get_outlet ()); + second_iter_->substitute_outlet (shared_.get_outlet (), two_.get_outlet ()); } } void @@ -292,13 +291,13 @@ New_pc_iterator::construct_children () SCM_UNDEFINED); Translator_group *tr - = report_to ()->find_create_translator (ly_symbol2scm ("Voice"), + = get_outlet ()->find_create_translator (ly_symbol2scm ("Voice"), "shared",props); shared_ .set_translator (tr); set_translator (tr); Translator_group *null - = report_to ()->find_create_translator (ly_symbol2scm ("Devnull"), + = get_outlet ()->find_create_translator (ly_symbol2scm ("Devnull"), "", SCM_EOL); if (!null) @@ -351,7 +350,7 @@ New_pc_iterator::construct_children () void New_pc_iterator::process (Moment m) { - Moment now = report_to ()->now_mom (); + Moment now = get_outlet ()->now_mom (); Moment *splitm = 0; for (; gh_pair_p (split_list_); split_list_ = gh_cdr (split_list_)) @@ -401,16 +400,4 @@ New_pc_iterator::try_music_in_children (Music *m) const return second_iter_->try_music (m); } - -SCM -New_pc_iterator::get_pending_events (Moment m)const -{ - SCM s = SCM_EOL; - if (first_iter_) - s = gh_append2 (s,first_iter_->get_pending_events (m)); - if (second_iter_) - s = gh_append2 (second_iter_->get_pending_events (m),s); - return s; -} - IMPLEMENT_CTOR_CALLBACK (New_pc_iterator); diff --git a/lily/output-property-music-iterator.cc b/lily/output-property-music-iterator.cc index e1cd1618a6..e8744e16b8 100644 --- a/lily/output-property-music-iterator.cc +++ b/lily/output-property-music-iterator.cc @@ -27,8 +27,6 @@ Output_property_music_iterator::process (Moment m) get_music ()->origin ()->warning (_f ("Junking event: `%s'", classname (get_music ()))); } - - skip (m); } IMPLEMENT_CTOR_CALLBACK (Output_property_music_iterator); diff --git a/lily/percent-repeat-iterator.cc b/lily/percent-repeat-iterator.cc index 2329daff5a..5f25bcf6c5 100644 --- a/lily/percent-repeat-iterator.cc +++ b/lily/percent-repeat-iterator.cc @@ -60,7 +60,7 @@ Percent_repeat_iterator::process (Moment m) { Music_iterator *yeah = try_music (get_music ()); if (yeah) - set_translator (yeah->report_to ()); + set_translator (yeah->get_outlet ()); else get_music ()->origin ()->warning ( _ ("no one to print a percent")); } diff --git a/lily/property-iterator.cc b/lily/property-iterator.cc index c054aa28ba..11d0f3212e 100644 --- a/lily/property-iterator.cc +++ b/lily/property-iterator.cc @@ -30,7 +30,7 @@ Property_iterator::process (Moment m) if (val != SCM_EOL) ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?")); if (ok) - report_to ()->internal_set_property (sym, val); + get_outlet ()->internal_set_property (sym, val); } Simple_music_iterator::process (m); } @@ -40,7 +40,7 @@ Property_unset_iterator::process (Moment m) { SCM sym = get_music ()->get_mus_property ("symbol"); type_check_assignment (sym, SCM_EOL, ly_symbol2scm ("translation-type?")); - report_to ()->unset_property (sym); + get_outlet ()->unset_property (sym); Simple_music_iterator::process (m); } @@ -63,10 +63,10 @@ Property_iterator::do_quit () { if (to_boolean (get_music ()->get_mus_property ("once"))) { - SCM trans = report_to()->self_scm(); + SCM trans = get_outlet ()->self_scm(); SCM music = get_music()->self_scm(); - Global_translator * tg= report_to()->top_translator (); + Global_translator * tg= get_outlet ()->top_translator (); tg->add_finalization (scm_list_n (once_finalization_proc, trans, music, SCM_UNDEFINED)); @@ -111,9 +111,9 @@ Push_property_iterator::process (Moment m) if (to_boolean (get_music ()->get_mus_property ("pop-first")) && !to_boolean (get_music ()->get_mus_property ("once")) ) - report_to()->execute_pushpop_property (sym, eprop, SCM_UNDEFINED); + get_outlet ()->execute_pushpop_property (sym, eprop, SCM_UNDEFINED); - report_to()->execute_pushpop_property (sym, eprop, val); + get_outlet ()->execute_pushpop_property (sym, eprop, val); } Simple_music_iterator::process (m); } @@ -140,10 +140,10 @@ Push_property_iterator::do_quit () { if (to_boolean (get_music ()->get_mus_property ("once"))) { - SCM trans = report_to()->self_scm(); + SCM trans = get_outlet ()->self_scm(); SCM music = get_music ()->self_scm(); - Global_translator * tg= report_to()->top_translator (); + Global_translator * tg= get_outlet ()->top_translator (); tg->add_finalization (scm_list_n (once_finalization_proc, trans, music, SCM_UNDEFINED)); } @@ -157,7 +157,7 @@ Pop_property_iterator::process (Moment m) if (check_grob (get_music (), sym)) { SCM eprop = get_music ()->get_mus_property ("grob-property"); - report_to()->execute_pushpop_property (sym, eprop, SCM_UNDEFINED); + get_outlet ()->execute_pushpop_property (sym, eprop, SCM_UNDEFINED); } Simple_music_iterator::process (m); } diff --git a/lily/sequential-iterator.cc b/lily/sequential-iterator.cc index d60ca429f8..2b41b1e016 100644 --- a/lily/sequential-iterator.cc +++ b/lily/sequential-iterator.cc @@ -229,8 +229,8 @@ Sequential_iterator::next_element (bool) void Sequential_iterator::descend_to_child () { - Translator_group * child_report = child_report = iter_->report_to (); - Translator_group * me_report = report_to (); + Translator_group * child_report = child_report = iter_->get_outlet (); + Translator_group * me_report = get_outlet (); Translator_group * c = child_report; while (c && c != me_report) @@ -243,82 +243,6 @@ Sequential_iterator::descend_to_child () } -/* - Retrieve all music (starting at HERE), until a music with length L > - 0 is found. From the precondition, we know that UNTIL is later than - the earliest event. Hence we know - - L >= (UNTIL - HERE) - - so something that comes after this thing with L > 0 happens after - - HERE + L >= HERE + (UNTIL - HERE) = UNTIL - - Hence all events after the one with L>0 are uninteresting, so we - ignore them. - -*/ - -SCM -Sequential_iterator::get_pending_events (Moment until) const -{ - SCM s = SCM_EOL; - if (until < pending_moment ()) - return s; - - Sequential_iterator * me = - dynamic_cast (clone ()); - while (me->ok ()) - { - SCM nm = me->iter_->get_pending_events (until - me->here_mom_); - s = gh_append2 (nm, s); - - Moment m = 0; - for (SCM i = nm; gh_pair_p (i); i = ly_cdr (i)) - { - Music *mus=unsmob_music (ly_car (i)); - m = m >? (mus->get_length () - mus->start_mom ()); - } - if (m > Moment (0)) - break ; - else - me->next_element (false); - } - - scm_gc_unprotect_object (me->self_scm()); - return s; -} - - -/* - Skip events till UNTIL. We don't do any other side effects such as - descending to child iterator contexts, because they might depend on - \context specs and \translator changes being executed - */ -void -Sequential_iterator::skip (Moment until) -{ - while (ok ()) - { - if (grace_fixups_ && - grace_fixups_->start_ == here_mom_ - && (grace_fixups_->start_ + grace_fixups_->length_ - + Moment (Rational (0), grace_fixups_->grace_start_) == until)) - { - /* - do the stuff/note/rest preceding a grace. - */ - iter_->skip (iter_->music_get_length ()); - } - else if (iter_->music_get_length () >= until - here_mom_) - iter_->skip (until - here_mom_ + iter_->music_start_mom ()); - - if (iter_->ok ()) - return ; - - next_element (false); - } -} void Sequential_iterator::process (Moment until) diff --git a/lily/simple-music-iterator.cc b/lily/simple-music-iterator.cc index 7593937490..5ea6270a5a 100644 --- a/lily/simple-music-iterator.cc +++ b/lily/simple-music-iterator.cc @@ -46,28 +46,14 @@ Simple_music_iterator::pending_moment ()const return music_get_length (); } -void -Simple_music_iterator::skip (Moment m) -{ - /* - docme??!! - - uncommented because setting MUSIC_L_ = 0 causes core dumps with - grace notes. */ - - // music_ = 0; - - last_processed_mom_ = m; -} void -Simple_music_iterator::process (Moment m) +Simple_music_iterator::process (Moment ) { /* don't do try_music (), since it would make the function useless for base classes */ - skip (m); } IMPLEMENT_CTOR_CALLBACK (Simple_music_iterator); diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc index ad0796250a..347837275b 100644 --- a/lily/simultaneous-music-iterator.cc +++ b/lily/simultaneous-music-iterator.cc @@ -54,17 +54,6 @@ Simultaneous_music_iterator::derived_substitute(Translator_group*f,Translator_gr unsmob_iterator (gh_car (s))-> substitute_outlet (f,t); } -SCM -Simultaneous_music_iterator::get_pending_events (Moment m)const -{ - SCM l = SCM_EOL; - for (SCM s = children_list_; gh_pair_p (s); s = gh_cdr(s)) - { - l = gh_append2 (unsmob_iterator (gh_car (s))->get_pending_events (m), l); - } - return l; -} - void Simultaneous_music_iterator::construct_children () { @@ -84,13 +73,13 @@ Simultaneous_music_iterator::construct_children () /* if separate_contexts_b_ is set, create a new context with the number number as name */ - SCM name = unsmob_context_def (report_to ()->definition_)->get_context_name (); + SCM name = unsmob_context_def (get_outlet ()->definition_)->get_context_name (); Translator_group * t = (j && separate_contexts_b_) - ? report_to ()->find_create_translator (name, to_string (j), SCM_EOL) - : report_to (); + ? get_outlet ()->find_create_translator (name, to_string (j), SCM_EOL) + : get_outlet (); if (!t) - t = report_to (); + t = get_outlet (); mi->init_translator (mus, t); mi->construct_children (); @@ -129,29 +118,6 @@ Simultaneous_music_iterator::process (Moment until) } } -void -Simultaneous_music_iterator::skip (Moment until) -{ - SCM *proc = &children_list_; - while(gh_pair_p (*proc)) - { - Music_iterator * i = unsmob_iterator (gh_car (*proc)); - if (i->pending_moment () <= until) - { - i->skip (until); - } - if (!i->ok ()) - { - i->quit (); - *proc = gh_cdr (*proc); - } - else - { - proc = SCM_CDRLOC(*proc); - } - } -} - Moment Simultaneous_music_iterator::pending_moment () const { diff --git a/lily/time-scaled-music-iterator.cc b/lily/time-scaled-music-iterator.cc index ede99b4931..89cdd483b9 100644 --- a/lily/time-scaled-music-iterator.cc +++ b/lily/time-scaled-music-iterator.cc @@ -20,7 +20,7 @@ Time_scaled_music_iterator::process (Moment m) { Music_iterator *yeah = try_music (get_music ()); if (yeah) - set_translator (yeah->report_to ()); + set_translator (yeah->get_outlet ()); else get_music ()->origin ()->warning (_ ("no one to print a tuplet start bracket")); } diff --git a/lily/unfolded-repeat-iterator.cc b/lily/unfolded-repeat-iterator.cc index 27141d0e27..fac94cece6 100644 --- a/lily/unfolded-repeat-iterator.cc +++ b/lily/unfolded-repeat-iterator.cc @@ -107,9 +107,9 @@ void Volta_repeat_iterator::add_repeat_command (SCM what) { SCM reps = ly_symbol2scm ("repeatCommands"); - SCM current_reps = report_to ()->internal_get_property (reps); + SCM current_reps = get_outlet ()->internal_get_property (reps); - Translator_group * where = report_to ()->where_defined (reps); + Translator_group * where = get_outlet ()->where_defined (reps); if (where && current_reps == SCM_EOL || gh_pair_p (current_reps)) { -- 2.39.5