X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fsequential-iterator.cc;h=cdbba8e5ac0a7d7a5fca050115311acb3a4fde39;hb=5bbfc22fce036b9b69df5e420de93e11da23c05e;hp=8679bcbbe158843dbdaeffa00b84cf1d6699429b;hpb=a276a19dc6bd57832db3107f2f2cbb04cb4677b6;p=lilypond.git diff --git a/lily/sequential-iterator.cc b/lily/sequential-iterator.cc index 8679bcbbe1..cdbba8e5ac 100644 --- a/lily/sequential-iterator.cc +++ b/lily/sequential-iterator.cc @@ -1,9 +1,20 @@ /* - sequential-iterator.cc -- implement Sequential_iterator + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 1997--2014 Han-Wen Nienhuys - (c) 1997--2007 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "sequential-iterator.hh" @@ -44,7 +55,7 @@ Sequential_iterator::get_music_list () const { Music *m = get_music (); SCM proc = m->get_property ("elements-callback"); - if (scm_procedure_p (proc)) + if (ly_is_procedure (proc)) return scm_call_1 (proc, m->self_scm ()); else return SCM_EOL; @@ -90,26 +101,26 @@ create_grace_fixup_list (SCM cursor) Moment l = mus->get_length () - s; if (s.grace_part_) - { - if (last != Moment (-1)) - { - Grace_fixup *p = new Grace_fixup; - p->start_ = last; - p->length_ = here - last; - p->grace_start_ = s.grace_part_; - p->next_ = 0; - *tail = p; - tail = &(*tail)->next_; - } - - here.grace_part_ = s.grace_part_; - } + { + if (last != Moment (-1)) + { + Grace_fixup *p = new Grace_fixup; + p->start_ = last; + p->length_ = here - last; + p->grace_start_ = s.grace_part_; + p->next_ = 0; + *tail = p; + tail = &(*tail)->next_; + } + + here.grace_part_ = s.grace_part_; + } if (l.to_bool ()) - { - last = here; - here += l; - } + { + last = here; + here += l; + } } return head; @@ -124,7 +135,7 @@ Sequential_iterator::construct_children () if (scm_is_pair (cursor_)) { Music *m = unsmob_music (scm_car (cursor_)); - iter_ = unsmob_iterator (get_iterator (m)); + iter_ = Music_iterator::unsmob (get_iterator (m)); } while (iter_ && !iter_->ok ()) @@ -170,10 +181,10 @@ Sequential_iterator::next_element (bool) else { /* - !len.grace_part_ || len.main_part_ + !len.grace_part_ || len.main_part_ - We skip over a big chunk (mainpart != 0). Any starting graces - in that chunk should be in len.grace_part_ + We skip over a big chunk (mainpart != 0). Any starting graces + in that chunk should be in len.grace_part_ */ last_mom_ = here_mom_; @@ -184,7 +195,7 @@ Sequential_iterator::next_element (bool) iter_->quit (); if (scm_is_pair (cursor_)) - iter_ = unsmob_iterator (get_iterator (unsmob_music (scm_car (cursor_)))); + iter_ = Music_iterator::unsmob (get_iterator (unsmob_music (scm_car (cursor_)))); else iter_ = 0; } @@ -196,28 +207,28 @@ Sequential_iterator::process (Moment until) { Grace_fixup *gf = get_grace_fixup (); if (gf - && gf->start_ + gf->length_ - + Moment (Rational (0), gf->grace_start_) == until) - { - /* - do the stuff/note/rest preceding a grace. - */ - iter_->process (iter_->music_get_length ()); - } + && gf->start_ + gf->length_ + + Moment (Rational (0), gf->grace_start_) == until) + { + /* + do the stuff/note/rest preceding a grace. + */ + iter_->process (iter_->music_get_length ()); + } else - { - Moment w = until - here_mom_ + iter_->music_start_mom (); - iter_->process (w); - } + { + Moment w = until - here_mom_ + iter_->music_start_mom (); + iter_->process (w); + } /* - if the iter is still OK, there must be events left that have + if the iter is still OK, there must be events left that have - TIME > LEFT + TIME > LEFT */ if (iter_->ok ()) - return; + return; descend_to_child (iter_->get_outlet ()); next_element (true);