2 unfolded-repeat-iterator.cc -- implement Unfolded_repeat_iterator
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "sequential-iterator.hh"
13 class Unfolded_repeat_iterator
: public Sequential_iterator
16 DECLARE_SCHEME_CALLBACK (constructor
, ());
18 virtual SCM
get_music_list () const;
22 Unfolded_repeat_iterator::get_music_list () const
27 SCM body
= get_music ()->get_property ("element");
28 SCM alts
= get_music ()->get_property ("elements");
29 int alt_count
= scm_ilength (alts
);
30 int rep_count
= scm_to_int (get_music ()->get_property ("repeat-count"));
32 for (int i
= 0; i
< rep_count
; i
++)
34 if (unsmob_music (body
))
35 *tail
= scm_cons (body
, SCM_EOL
);
37 tail
= SCM_CDRLOC (*tail
);
41 *tail
= scm_cons (scm_car (alts
), SCM_EOL
);
42 tail
= SCM_CDRLOC (*tail
);
43 if (i
>= rep_count
- alt_count
)
45 alts
= scm_cdr (alts
);
52 IMPLEMENT_CTOR_CALLBACK (Unfolded_repeat_iterator
);