]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/request-iterator.cc
release: 1.1.54
[lilypond.git] / lily / request-iterator.cc
index b2f8a712a4b6182d8ecae57fe04d0568f2c8b38d..9cbf798a4b3fa71b6995ddd86c216c75cb6d4966 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "translator-group.hh"
@@ -30,6 +30,8 @@ Request_chord_iterator::elt_l () const
 Request_chord_iterator::Request_chord_iterator ()
 {
   last_b_ = false;
+  //  cursor_ = elt_l ()->music_p_list_p_->head_;
+  cursor_ = 0;
 }
 
 
@@ -39,8 +41,6 @@ Request_chord_iterator::ok() const
   return (elt_length_mom_ && !last_b_) || first_b_;
 }
 
-
-
 Moment
 Request_chord_iterator::next_moment() const
 {
@@ -50,6 +50,25 @@ 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
 {
@@ -63,17 +82,17 @@ Request_chord_iterator::do_process_and_next (Moment mom)
 {
   if (first_b_)
     {
-      for (PCursor<Music*> i (elt_l ()->music_p_list_p_->top ()); i.ok(); i++)
+      for (Cons<Music> *i = elt_l ()->music_p_list_p_->head_; i; i = i->next_)
        {
-         if (Request * req_l = dynamic_cast<Request*> (i.ptr()))
+         if (Request * req_l = dynamic_cast<Request*> (i->car_))
            {
              bool gotcha = report_to_l()->try_music (req_l);
              if (!gotcha)
                req_l->warning (_f ("junking request: `%s\'", classname( req_l)));
            }
          else
-           i.ptr ()->warning (_f ("Huh? Not a Request: `%s\'",
-                                  classname (i.ptr())));
+           i->car_->warning (_f ("Huh? Not a Request: `%s\'",
+                                  classname (i->car_)));
        }
       first_b_ = false;
     }