2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2015 Daniel Eble <dan@faithful.be>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "change-sequence-iterator.hh"
26 Change_sequence_iterator::Change_sequence_iterator () :
32 Change_sequence_iterator::construct_children ()
34 Music_wrapper_iterator::construct_children ();
36 change_list_ = get_music ()->get_property ("context-change-list");
40 Change_sequence_iterator::process (Moment m)
42 // Find the ID of the output context to use now. The loop is a bit of
43 // paranoia; we shouldn't expect multiple changes between moments in this
45 SCM context_id = SCM_EOL;
46 for (; scm_is_pair (change_list_); change_list_ = scm_cdr (change_list_))
48 SCM mom_scm = scm_caar (change_list_);
49 Moment *mom = unsmob<Moment> (mom_scm);
55 context_id = scm_cdar (change_list_);
59 string s = "expected moment in change list: ";
60 s += ly_scm2string (mom_scm);
61 programming_error (s);
65 if (!scm_is_null (context_id))
66 change_to (ly_symbol2string (context_id));
68 Music_wrapper_iterator::process (m);