]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/request-chord-iterator.cc
patch::: 1.5.22.jcn4
[lilypond.git] / lily / request-chord-iterator.cc
index f463190a342dc3223c4939a5cdf54c902aba8516..e9a103808950a3951d14ed0c17ad54115c71e99d 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "translator-group.hh"
@@ -33,30 +33,29 @@ Request_chord_iterator::get_req_translator_l ()
 }
 
 void
-Request_chord_iterator::construct_children()
+Request_chord_iterator::construct_children ()
 {
   Simple_music_iterator::construct_children ();
-  get_req_translator_l();
+  get_req_translator_l ();
 }
 
 Request_chord*
 Request_chord_iterator::elt_l () const
 {
-  return (Request_chord*) music_l_;
+  return (Request_chord*) music_l ();
 }
 
-
 SCM
-Request_chord_iterator::get_music (Moment)const
+Request_chord_iterator::get_music (Moment) const
 {
   SCM s = SCM_EOL;
-  if (music_l_)
+  if (last_processed_mom_ < Moment (0))
     {
-      Music_sequence * ms = dynamic_cast<Music_sequence*> (music_l_);
+      Music_sequence * ms = dynamic_cast<Music_sequence*> (music_l ());
      
-      for (SCM m = ms->music_list (); gh_pair_p (m); m = gh_cdr (m))
+      for (SCM m = ms->music_list (); gh_pair_p (m); m = ly_cdr (m))
        {
-         s = gh_cons (gh_car (m) , s);
+         s = gh_cons (ly_car (m) , s);
        }
     }
   return s;
@@ -65,25 +64,19 @@ Request_chord_iterator::get_music (Moment)const
 void
 Request_chord_iterator::process (Moment m)
 {
-  last_processed_mom_ = m;
-  if (music_l_)
+  if (last_processed_mom_ < Moment (0))
     {
-      for (SCM s = dynamic_cast<Music_sequence *> (music_l_)->music_list ();
-          gh_pair_p (s);  s = gh_cdr (s))
+      for (SCM s = dynamic_cast<Music_sequence *> (music_l ())->music_list ();
+          gh_pair_p (s);  s = ly_cdr (s))
        {
-         Music *mus = unsmob_music (gh_car (s));
+         Music *mus = unsmob_music (ly_car (s));
 
-         if (Request * req_l = dynamic_cast<Request*> (mus))
-           {
-             bool gotcha = try_music (req_l);
-             if (!gotcha)
-               req_l->origin ()->warning (_f ("Junking request: `%s'", classname( req_l)));
-           }
-         else
-           mus->origin ()->warning (_f ("Huh?  Not a Request: `%s'",
-                                        classname (mus)));
+         bool gotcha = try_music (mus);
+         if (!gotcha)
+           mus->origin ()->warning (_f ("Junking request: `%s'", classname (mus)));
        }
-
-     music_l_ =0;
     }
+  skip (m);
 }
+
+IMPLEMENT_CTOR_CALLBACK (Request_chord_iterator);