+/* Descend to a bottom context; implicitly create a new one if necessary */
+void
+Music_iterator::descend_to_bottom_context ()
+{
+ assert (get_outlet ());
+ if (!get_outlet ()->is_bottom_context ())
+ set_context (get_outlet ()->get_default_interpreter ());
+}
+
+void
+Music_iterator::report_event (Music *m)
+{
+ descend_to_bottom_context ();
+
+ /*
+ FIXME: then don't do it.
+ */
+ if (!m->is_mus_type ("event"))
+ m->origin ()->programming_error (_ ("Sending non-event to context"));
+
+ m->send_to_context (get_outlet ());
+}
+
+IMPLEMENT_CTOR_CALLBACK (Music_iterator);
+
+Music *
+Music_iterator::get_music () const
+{
+ return music_;
+}
+
+/****************************************************************/
+
+IMPLEMENT_TYPE_P (Music_iterator, "ly:iterator?");
+IMPLEMENT_SMOBS (Music_iterator);
+IMPLEMENT_DEFAULT_EQUAL_P (Music_iterator);
+
+SCM
+Music_iterator::mark_smob (SCM smob)
+{
+ Music_iterator *mus = (Music_iterator *)SCM_CELL_WORD_1 (smob);
+
+ mus->derived_mark ();
+ /*
+ Careful with GC, although we intend the following as pointers
+ only, we _must_ mark them.
+ */
+ if (mus->get_outlet ())
+ scm_gc_mark (mus->get_outlet ()->self_scm ());
+ if (mus->music_)
+ scm_gc_mark (mus->music_->self_scm ());
+
+ return SCM_EOL;
+}
+
+int
+Music_iterator::print_smob (SCM sm, SCM port, scm_print_state*)
+{
+ char s[1000];