- alt_count_ = scm_ilength (alts);
- rep_count_ = gh_scm2int (get_music ()->get_mus_property ("repeat-count"));
- done_count_ = 0;
-}
-
-
-/*
- TODO: add source information for debugging
- */
-void
-Volta_repeat_iterator::add_repeat_command (SCM what)
-{
- SCM reps = ly_symbol2scm ("repeatCommands");
- SCM current_reps = get_outlet ()->internal_get_property (reps);
-
- Context * where = get_outlet ()->where_defined (reps);
- if (where
- && current_reps == SCM_EOL || gh_pair_p (current_reps))
- {
- current_reps = gh_cons (what, current_reps);
- where->internal_set_property (reps, current_reps);
- }
-}
-
-
-void
-Volta_repeat_iterator::next_element (bool side_effect)
-{
- done_count_ ++;
-
- Sequential_iterator::next_element (side_effect);
-
- if (side_effect)
- {
- if (alt_count_)
- {
- String repstr = to_string (rep_count_ - alt_count_ + done_count_) + ".";
- if (done_count_ > 1)
- {
- add_repeat_command (scm_list_n (ly_symbol2scm ("volta"), SCM_BOOL_F, SCM_UNDEFINED));
-
- if (done_count_ - 1 < alt_count_)
- add_repeat_command (ly_symbol2scm ("end-repeat"));
- }
-
-
-
- if (done_count_ == 1 && alt_count_ < rep_count_)
- {
- repstr = "1.--" + to_string (rep_count_ - alt_count_ + done_count_) + ".";
- }
-
- if (done_count_ <= alt_count_)
- add_repeat_command (scm_list_n (ly_symbol2scm ("volta"),
- scm_makfrom0str (repstr.to_str0 ()), SCM_UNDEFINED));
- }
- else
- {
- add_repeat_command (ly_symbol2scm ("end-repeat"));