From 2b10ac44d67ed6540f1ed76ebd98d95a6150da80 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 10 Feb 1999 18:06:45 +0100 Subject: [PATCH] patch::: 1.1.29.jcn4: repeat-iter: snapnie pl 29.jcn4 - unsuccessful try at fixing repeat-iter::ok () constness --- Generated by janneke@gnu.org using package-diff 0.62, >From = lilypond-1.1.29.jcn3, To = lilypond-1.1.29.jcn4 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.1.29.jcn4.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure and possibly make outdirs. --state 1.1.29.jcn3 1.1.29.jcn4 ++state --- NEWS | 10 +++++- TODO | 1 - VERSION | 2 +- lily/include/repeated-music-iterator.hh | 1 + lily/repeated-music-iterator.cc | 44 ++++++++++++------------- 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/NEWS b/NEWS index 607407ff6e..c0d39a6dcf 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,12 @@ ---- ../lilypond-1.1.29.jcn2/NEWS Tue Feb 9 22:46:07 1999 +--- ../lilypond-1.1.29.jcn3/NEWS Wed Feb 10 15:21:05 1999 +++ b/NEWS Wed Feb 10 17:56:14 1999 +@@ -1,3 +1,6 @@ +pl 29.jcn4 + - unsuccessful try at fixing repeat-iter::ok () constness + + pl 29.jcn3 + - fix: slur-case3.ly + - init.sly: .fly with linewidt=-1--- ../lilypond-1.1.29.jcn2/NEWS Tue Feb 9 22:46:07 1999 ++ b/NEWS Wed Feb 10 15:21:05 1999 @@ -1,3 +1,7 @@ pl 29.jcn3 diff --git a/TODO b/TODO index a5b256713d..596c8df7a2 100644 --- a/TODO +++ b/TODO @@ -78,7 +78,6 @@ Fix: set bar-number to 0 if first bar is an anacrouse? . * make ly2dvi test page. . * Try to use Killing_cons iso. Pointer_list . * make dependencies () a virtual function. -. * fix Repeated_music_iterator::ok() (constness.) . * one big ly2dvi input that includes *all* tests. . * Don't use boolean properties (0,1), instead check existence of property. diff --git a/VERSION b/VERSION index 537aaa1c96..f34be36d3f 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=29 -MY_PATCH_LEVEL=jcn3 +MY_PATCH_LEVEL=jcn4 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/lily/include/repeated-music-iterator.hh b/lily/include/repeated-music-iterator.hh index 4b42751c0b..79f3f3ae15 100644 --- a/lily/include/repeated-music-iterator.hh +++ b/lily/include/repeated-music-iterator.hh @@ -28,6 +28,7 @@ protected: private: void start_next_element (); + bool done_b_; int unfold_i_; Moment here_mom_; Music_iterator* repeat_iter_p_; diff --git a/lily/repeated-music-iterator.cc b/lily/repeated-music-iterator.cc index 80007e5b13..15f3caf334 100644 --- a/lily/repeated-music-iterator.cc +++ b/lily/repeated-music-iterator.cc @@ -19,6 +19,7 @@ Repeated_music_iterator::Repeated_music_iterator () alternative_iter_p_ = 0; here_mom_ = 0; unfold_i_ = -1; + done_b_ = false; } Repeated_music_iterator::~Repeated_music_iterator () @@ -37,6 +38,7 @@ Repeated_music_iterator::do_print () const void Repeated_music_iterator::construct_children () { + done_b_ = false; repeat_iter_p_ = get_iterator_p (dynamic_cast (music_l_)->repeat_p_); } @@ -49,10 +51,20 @@ Repeated_music_iterator::do_process_and_next (Moment m) if (!success) music_l_->warning ( _("No one to print a volta bracket")); } + + if (!ok ()) + start_next_element (); + + // if (!ok()) + // return; + if (repeat_iter_p_ && repeat_iter_p_->ok ()) repeat_iter_p_->process_and_next (m - here_mom_); - else + else if (alternative_iter_p_ && alternative_iter_p_->ok ()) alternative_iter_p_->process_and_next (m - here_mom_); + else + return; + Music_iterator::do_process_and_next (m); } @@ -69,34 +81,18 @@ Repeated_music_iterator::next_moment () const return r->alternative_p_->length_mom () + here_mom_; } -/* - FIXME - */ bool Repeated_music_iterator::ok () const { - if (!repeat_iter_p_ && !alternative_iter_p_) - return false; - - if ((repeat_iter_p_ && repeat_iter_p_->ok ()) - || (alternative_iter_p_ && alternative_iter_p_->ok ())) - return true; - - Repeated_music_iterator *urg = (Repeated_music_iterator*)this; - // urg, we're const - urg->start_next_element (); - - return ok (); + return !done_b_; } - void Repeated_music_iterator::start_next_element () { Repeated_music const*rep =dynamic_cast (music_l_); - - if (repeat_iter_p_) + if (repeat_iter_p_) { assert (!repeat_iter_p_->ok ()); assert (!alternative_iter_p_); @@ -120,17 +116,21 @@ Repeated_music_iterator::start_next_element () unfold_i_--; repeat_iter_p_ = get_iterator_p (rep->repeat_p_); // urg, assume same length alternatives for now... -// here_mom_ += rep->alternative_p_->music_p_list_p_->top ()->length_mom (); + // here_mom_ += rep->alternative_p_->music_p_list_p_->top ()->length_mom (); /* URG this is *wrong* but at least it doesn't dump core when unfolding, the alternative (sequential) music shouldn't automatically move to the next alternative - + how to intercept this... - */ + */ here_mom_ += rep->alternative_p_->length_mom (); } } + + if ((!repeat_iter_p_ || !repeat_iter_p_->ok ()) + && (!alternative_iter_p_ || !alternative_iter_p_->ok ())) + done_b_ = true; } -- 2.39.5