]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/request-chord-iterator.cc
patch::: 1.3.86.jcn2
[lilypond.git] / lily / request-chord-iterator.cc
index 47d28ce770484c69e928723bb0ba3b9ebb2b1148..c13de02132a05674c81df4612ed0db8efafd0cfc 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "translator-group.hh"
 #include "music-list.hh"
 #include "request.hh"
 
+Request_chord_iterator::Request_chord_iterator ()
+{
+  last_b_ = false;
+}
 
+Request_chord_iterator::Request_chord_iterator (Request_chord_iterator const &src)
+  : Music_iterator (src)
+{
+  last_b_ = src.last_b_;
+  elt_length_mom_ = src.elt_length_mom_;
+}
 
 void
 Request_chord_iterator::construct_children()
@@ -27,14 +37,6 @@ Request_chord_iterator::elt_l () const
   return (Request_chord*) music_l_;
 }
 
-Request_chord_iterator::Request_chord_iterator ()
-{
-  last_b_ = false;
-  //  cursor_ = elt_l ()->music_p_list_p_->head_;
-  cursor_ = 0;
-}
-
-
 bool
 Request_chord_iterator::ok() const
 {
@@ -50,53 +52,47 @@ Request_chord_iterator::next_moment() const
   return m;
 }
 
-Music*
-Request_chord_iterator::next_music_l ()
-{
-  if (first_b_)
-    {
-      cursor_ = elt_l ()->music_p_list_p_->head_;
-      first_b_ = false;
-    }
-  else
-    {
-      if (cursor_)
-       cursor_ = cursor_->next_;
-    }
-  if (cursor_)
-    return cursor_->car_;
-  else
-    return 0;
-}
 
 void
 Request_chord_iterator::do_print() const
 {
 #ifndef NPRINT
-  DOUT << "duration: " << elt_length_mom_;
+  DEBUG_OUT << "duration: " << elt_length_mom_;
 #endif
 }
 
+bool
+Request_chord_iterator::next ()
+{
+  if (first_b_)
+    first_b_ = false;
+  else
+    last_b_ = true;
+  return ok ();
+}
+
 void
-Request_chord_iterator::do_process_and_next (Moment mom)
+Request_chord_iterator::do_process (Moment)
 {
+#if 0
+  // URG
   if (first_b_)
     {
-      for (Cons<Music> *i = elt_l ()->music_p_list_p_->head_; i; i = i->next_)
+      for (SCM s = dynamic_cast<Music_sequence *> (get_music ())->music_list (); gh_pair_p (s);  s = gh_cdr (s))
        {
-         if (Request * req_l = dynamic_cast<Request*> (i->car_))
+         Music *mus = unsmob_music (gh_car (s));
+         if (Request * req_l = dynamic_cast<Request*> (mus))
            {
-             bool gotcha = report_to_l()->try_music (req_l);
+             bool gotcha = try_music (req_l);
              if (!gotcha)
-               req_l->warning (_f ("junking request: `%s\'", classname( req_l)));
+               req_l->origin ()->warning (_f ("Junking request: `%s'", classname( req_l)));
            }
          else
-           i->car_->warning (_f ("Huh? Not a Request: `%s\'",
-                                  classname (i->car_)));
-       }
-      first_b_ = false;
+           mus->origin ()->warning (_f ("Huh?  Not a Request: `%s'",
+                                                classname (mus)));
+                   }
     }
 
-  if (mom >= elt_length_mom_)
-    last_b_ = true;
+  next ();
+#endif
 }