From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Wed, 13 Sep 2000 17:38:47 +0000 (+0200)
Subject: patch::: 1.3.86.jcn1
X-Git-Tag: release/1.3.87~3
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=08c8760ee53ee597eaf6ac24dd783af6938d632d;p=lilypond.git

patch::: 1.3.86.jcn1

1.3.86.jcn1
===========

* Fixed chord iteration.

1.3.85.jcn5
===========

* Modified part-combiner to use new get_music ()/next () music iterator
  functionality.

1.3.85.jcn4
===========

* Added clone () to music iterators, so that we can do next () on a copy.

1.3.85.jcn3
===========

* Added get_music () and next () to music iterators.
---

diff --git a/CHANGES b/CHANGES
index 974339d20f..aa2080ce36 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,24 @@
+1.3.86.jcn1
+===========
+
+* Fixed chord iteration.
+
+1.3.85.jcn5
+===========
+
+* Modified part-combiner to use new get_music ()/next () music iterator
+  functionality.
+
+1.3.85.jcn4
+===========
+
+* Added clone () to music iterators, so that we can do next () on a copy.
+
+1.3.85.jcn3
+===========
+
+* Added get_music () and next () to music iterators.
+
 1.3.85.hwn2
 ===========
 
diff --git a/VERSION b/VERSION
index 42a4121ff5..f8465bf1cd 100644
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=86
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=jcn1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff --git a/lily/include/auto-change-iterator.hh b/lily/include/auto-change-iterator.hh
index ff55700bc1..aa03806c27 100644
--- a/lily/include/auto-change-iterator.hh
+++ b/lily/include/auto-change-iterator.hh
@@ -13,15 +13,18 @@
 #include "music-wrapper-iterator.hh"
 #include "direction.hh"
 
-class Auto_change_iterator  : public Music_wrapper_iterator
+class Auto_change_iterator : public Music_wrapper_iterator
 {
-  Direction where_dir_;
+public:
+  VIRTUAL_COPY_CONS (Music_iterator);
+  Auto_change_iterator ();
 
-  void change_to (Music_iterator* , String, String);
 protected:
   virtual void do_process_and_next (Moment);  
-public:
-  Auto_change_iterator ();
+
+private:
+  Direction where_dir_;
+  void change_to (Music_iterator* , String, String);
 };
 
 #endif /* AUTO_CHANGE_ITERATOR_HH */
diff --git a/lily/include/change-iterator.hh b/lily/include/change-iterator.hh
index 4ab9d99e4a..a43c4da5f2 100644
--- a/lily/include/change-iterator.hh
+++ b/lily/include/change-iterator.hh
@@ -15,15 +15,17 @@
 
 class Change_iterator : public Music_iterator
 {
-  void  error (String);
-
-protected:
-  virtual void do_process_and_next (Moment);
-
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   /*
     CTOR is public
    */
+
+protected:
+  virtual void do_process_and_next (Moment);
+
+private:
+  void  error (String);
 };
 
 #endif
diff --git a/lily/include/chord-tremolo-iterator.hh b/lily/include/chord-tremolo-iterator.hh
index 9cd632985d..6d25034d6d 100644
--- a/lily/include/chord-tremolo-iterator.hh
+++ b/lily/include/chord-tremolo-iterator.hh
@@ -14,10 +14,8 @@
 
 class Chord_tremolo_iterator : public Music_iterator
 {
-  Moment factor_;
-  Music_iterator * child_iter_p_;
-
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   Chord_tremolo_iterator ();
 
 protected:
@@ -28,6 +26,10 @@ protected:
   virtual void do_print () const;
   virtual void do_process_and_next (Moment) ;
   virtual Music_iterator *try_music_in_children (Music *) const;
+
+private:
+  Moment factor_;
+  Music_iterator * child_iter_p_;
 };
 
 
diff --git a/lily/include/folded-repeat-iterator.hh b/lily/include/folded-repeat-iterator.hh
index e26bac173e..1b36df304a 100644
--- a/lily/include/folded-repeat-iterator.hh
+++ b/lily/include/folded-repeat-iterator.hh
@@ -18,11 +18,8 @@
  */
 class Folded_repeat_iterator : public Music_iterator
 {
-  Music_iterator * main_iter_p_;
-  Music_iterator * alternative_iter_p_;
-  int count_;
-  Moment main_length_mom_;
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   Folded_repeat_iterator ();
   ~Folded_repeat_iterator ();
   
@@ -36,6 +33,12 @@ protected:
   
   virtual void do_process_and_next (Moment);
   virtual Music_iterator *try_music_in_children (Music *) const;
+
+private:
+  Music_iterator * main_iter_p_;
+  Music_iterator * alternative_iter_p_;
+  int count_;
+  Moment main_length_mom_;
 };
 #endif /* FOLDED_REPEAT_ITERATOR_HH */
 
diff --git a/lily/include/grace-iterator.hh b/lily/include/grace-iterator.hh
index 9743d7ab90..c253d078e8 100644
--- a/lily/include/grace-iterator.hh
+++ b/lily/include/grace-iterator.hh
@@ -15,6 +15,7 @@
 class Grace_iterator : public Music_wrapper_iterator
 {
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   ~Grace_iterator ();
   virtual void construct_children () ;
   virtual void do_process_and_next (Moment);
diff --git a/lily/include/interpretation-context-handle.hh b/lily/include/interpretation-context-handle.hh
index a8adf33cb4..cb788f124a 100644
--- a/lily/include/interpretation-context-handle.hh
+++ b/lily/include/interpretation-context-handle.hh
@@ -13,17 +13,20 @@
 
 class Interpretation_context_handle
 {
-  Translator_group * report_to_l_;
-  void down ();
-  void up (Translator_group*);
 public:
   ~Interpretation_context_handle ();
   Interpretation_context_handle ();
+  Interpretation_context_handle* clone () const;
   void set_translator (Translator_group*);
   bool try_music (Music *);
   void operator =(Interpretation_context_handle const&);
   Interpretation_context_handle (Interpretation_context_handle const&);
   Translator_group * report_to_l () const;
+
+private:
+  Translator_group * report_to_l_;
+  void down ();
+  void up (Translator_group*);
 };
 
 #endif /* INTERPRETATION_CONTEXT_HANDLE_HH */
diff --git a/lily/include/lyric-combine-music-iterator.hh b/lily/include/lyric-combine-music-iterator.hh
index 2264996110..31a47b4896 100644
--- a/lily/include/lyric-combine-music-iterator.hh
+++ b/lily/include/lyric-combine-music-iterator.hh
@@ -15,9 +15,10 @@
 
 class Lyric_combine_music_iterator : public Music_iterator
 {
-  Music_iterator * music_iter_p_;
-  Music_iterator * lyric_iter_p_;
-  
+public:
+  VIRTUAL_COPY_CONS (Music_iterator);
+  Lyric_combine_music_iterator ();
+
 protected:
   virtual void construct_children ();
   virtual Moment next_moment () const;
@@ -27,8 +28,10 @@ protected:
   virtual bool ok () const;
   virtual void do_print () const;
   virtual ~Lyric_combine_music_iterator ();
-public:
-  Lyric_combine_music_iterator ();
+
+private:
+  Music_iterator * music_iter_p_;
+  Music_iterator * lyric_iter_p_;
 };
 #endif /* LYRIC_COMBINE_MUSIC_ITERATOR_HH */
 
diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh
index 561e9c11eb..87644b494f 100644
--- a/lily/include/music-iterator.hh
+++ b/lily/include/music-iterator.hh
@@ -24,40 +24,14 @@
   The state of an iterator would be the intersection of the particular music 
   construct with one point in musical time.
  */
-class Music_iterator {
-  Interpretation_context_handle handle_;
-
-protected:
-  Music  * music_l_;
-
-  /// ugh. JUNKME
-  bool first_b_;
-
-  /**
-    Do the actual printing.  This should be overriden in derived classes.  It 
-    is called by #print#, in the public interface
-   */
-  virtual void do_print() const;
-    
-  /**
-    Find a bottom notation context to deliver requests to.
-   */
-  virtual Translator_group* get_req_translator_l();
-
-  /**
-    Get an iterator for MUS, inheriting the translation unit from THIS.
-   */
-  Music_iterator* get_iterator_p (Music *mus) const;
-
-  /** Do the actual move.  This should be overriden in derived
-    classes.  It is called by #process_and_next#, the public interface 
-    */
-  virtual void do_process_and_next (Moment until);
-
-
-  virtual Music_iterator* try_music_in_children (Music  *) const;
-  
+class Music_iterator
+{
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
+
+  Music_iterator ();
+  Music_iterator (Music_iterator const&);
+  virtual ~Music_iterator ();
 
   /**
      Do the reporting.  Will try MUSIC_L_ in its own translator first,
@@ -68,7 +42,7 @@ public:
   /**
     The translation unit that we this iterator is reporting  to now.
    */
-  Translator_group*report_to_l() const;
+  Translator_group*report_to_l () const;
 
   void set_translator (Translator_group*);
   
@@ -78,17 +52,15 @@ public:
   static Music_iterator* static_get_iterator_p (Music * mus);
   void init_translator (Music  *, Translator_group *); 
 
-  Music_iterator();
-    
   ///  Find the next interesting point in time.
-  virtual Moment next_moment() const;
+  virtual Moment next_moment () const;
 
 
   ///Are we finished with this piece of music?
-  virtual bool ok() const;
-
-  virtual ~Music_iterator();
+  virtual bool ok () const;
 
+  virtual Music* get_music ();
+  virtual bool next ();
 
   ///Report all musical information that occurs between now and UNTIL
   void process_and_next (Moment until);
@@ -97,8 +69,40 @@ public:
     Construct sub-iterators, and set the translator to 
     report to.
    */
-  virtual void construct_children();
-  void print() const;
+  virtual void construct_children ();
+  void print () const;
+
+protected:
+  Music  * music_l_;
+
+  /// ugh. JUNKME
+  bool first_b_;
+
+  /**
+    Do the actual printing.  This should be overriden in derived classes.  It 
+    is called by #print#, in the public interface
+   */
+  virtual void do_print () const;
+    
+  /**
+    Find a bottom notation context to deliver requests to.
+   */
+  virtual Translator_group* get_req_translator_l ();
+
+  /**
+    Get an iterator for MUS, inheriting the translation unit from THIS.
+   */
+  Music_iterator* get_iterator_p (Music *) const;
+
+  /** Do the actual move.  This should be overriden in derived
+    classes.  It is called by #process_and_next#, the public interface 
+    */
+  virtual void do_process_and_next (Moment until);
+
+  virtual Music_iterator* try_music_in_children (Music *) const;
+  
+private:
+  Interpretation_context_handle handle_;
 };
 
 #endif // MUSIC_ITERATOR_HH
diff --git a/lily/include/music-wrapper-iterator.hh b/lily/include/music-wrapper-iterator.hh
index 8200709e52..1d97eb9067 100644
--- a/lily/include/music-wrapper-iterator.hh
+++ b/lily/include/music-wrapper-iterator.hh
@@ -21,12 +21,16 @@
 class Music_wrapper_iterator : public Music_iterator
 {
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   Music_wrapper_iterator ();
+  Music_wrapper_iterator (Music_wrapper_iterator const&);
   ~Music_wrapper_iterator ();
 
   virtual void construct_children  () ;
   virtual Moment next_moment () const;
   virtual bool ok () const;
+  virtual Music* get_music ();
+  virtual bool next ();
 
 protected:
   virtual void do_print () const;
diff --git a/lily/include/part-combine-music-iterator.hh b/lily/include/part-combine-music-iterator.hh
index 7b38e0f033..d43a00a72d 100644
--- a/lily/include/part-combine-music-iterator.hh
+++ b/lily/include/part-combine-music-iterator.hh
@@ -15,6 +15,7 @@
 class Part_combine_music_iterator : public Music_iterator
 {
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   Part_combine_music_iterator ();
 
 protected:
@@ -32,11 +33,8 @@ private:
 
   Music_iterator * first_iter_p_;
   Music_iterator * second_iter_p_;
-  Moment now_;
   Moment first_until_;
   Moment second_until_;
-
-  bool combined_b_;
 };
 
 #endif /* PART_COMBINE_MUSIC_ITERATOR_HH */
diff --git a/lily/include/property-iterator.hh b/lily/include/property-iterator.hh
index 7591fce277..66c7143656 100644
--- a/lily/include/property-iterator.hh
+++ b/lily/include/property-iterator.hh
@@ -21,6 +21,7 @@
 class Property_iterator : public Music_iterator
 {
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   // construction  
 protected:
   virtual void do_process_and_next (Moment);
@@ -28,12 +29,16 @@ protected:
 
 class Push_property_iterator : public Music_iterator
 {
+public:
+  VIRTUAL_COPY_CONS (Music_iterator);
 protected:
   virtual void do_process_and_next (Moment);
 };
 
 class Pop_property_iterator : public Music_iterator
 {
+public:
+  VIRTUAL_COPY_CONS (Music_iterator);
 protected:
   virtual void do_process_and_next (Moment);
 };
diff --git a/lily/include/request-chord-iterator.hh b/lily/include/request-chord-iterator.hh
index bc09247992..a4794f100b 100644
--- a/lily/include/request-chord-iterator.hh
+++ b/lily/include/request-chord-iterator.hh
@@ -15,7 +15,8 @@
 /**
    Walk through a Request_chord
  */
-class Request_chord_iterator : public Music_iterator {
+class Request_chord_iterator : public Music_iterator
+{
   Request_chord * elt_l () const;
   /**
      cache elt_l ()->length_mom ().
@@ -24,14 +25,17 @@ class Request_chord_iterator : public Music_iterator {
   bool last_b_;
 
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   Request_chord_iterator ();
+  Request_chord_iterator (Request_chord_iterator const&);
   
+  virtual bool next ();
+  virtual bool ok () const;
 
 protected:
   virtual void do_process_and_next (Moment);
   virtual Moment next_moment() const;
   virtual void construct_children();
-  virtual bool ok() const;
   virtual void do_print() const;
 };
 
diff --git a/lily/include/request-iterator.hh b/lily/include/request-iterator.hh
index ea2b07b026..e69de29bb2 100644
--- a/lily/include/request-iterator.hh
+++ b/lily/include/request-iterator.hh
@@ -1,23 +0,0 @@
-/*   
-  request-iterator.hh -- declare Request_iterator
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#ifndef REQUEST_ITERATOR_HH
-#define REQUEST_ITERATOR_HH
-
-#include "music-iterator.hh"
-
-class Simple_music_iterator : public Music_iterator
-{
-public:
-protected:
-  virtual void do_process_and_next (Moment );
-};
-
-#endif /* REQUEST_ITERATOR_HH */
-
diff --git a/lily/include/sequential-music-iterator.hh b/lily/include/sequential-music-iterator.hh
index 79f493fa87..1a2dc730e7 100644
--- a/lily/include/sequential-music-iterator.hh
+++ b/lily/include/sequential-music-iterator.hh
@@ -18,12 +18,16 @@
 class Sequential_music_iterator :  public Music_iterator
 {
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   Sequential_music_iterator ();
+  Sequential_music_iterator (Sequential_music_iterator const&);
   virtual ~Sequential_music_iterator ();
 
   virtual void construct_children ();
   virtual Moment next_moment () const;
   virtual bool ok () const;
+  virtual Music* get_music ();
+  virtual bool next ();
 
 protected:
   virtual void do_print() const;
diff --git a/lily/include/simple-music-iterator.hh b/lily/include/simple-music-iterator.hh
new file mode 100644
index 0000000000..324c9b952a
--- /dev/null
+++ b/lily/include/simple-music-iterator.hh
@@ -0,0 +1,26 @@
+/*   
+  simple-music-iterator.hh -- declare Simple_music_iterator
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ */
+
+#ifndef SIMPLE_MUSIC_ITERATOR_HH
+#define SIMPLE_MUSIC_ITERATOR_HH
+
+#include "music-iterator.hh"
+
+class Simple_music_iterator : public Music_iterator
+{
+public:
+  VIRTUAL_COPY_CONS (Music_iterator);
+  Simple_music_iterator ();
+  Simple_music_iterator (Simple_music_iterator const &);
+
+protected:
+  virtual void do_process_and_next (Moment );
+};
+
+#endif /* SIMPLE_MUSIC_ITERATOR_HH */
+
diff --git a/lily/include/simultaneous-music-iterator.hh b/lily/include/simultaneous-music-iterator.hh
index 6c4008a95b..26666c339c 100644
--- a/lily/include/simultaneous-music-iterator.hh
+++ b/lily/include/simultaneous-music-iterator.hh
@@ -9,22 +9,27 @@
 
 #ifndef SIMULTANEOUS_MUSIC_ITERATOR_HH
 #define SIMULTANEOUS_MUSIC_ITERATOR_HH
+
 #include "music-iterator.hh"
 #include "cons.hh"
 
 class Simultaneous_music_iterator : public Music_iterator
 {
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
+  Simultaneous_music_iterator ();
+  Simultaneous_music_iterator (Simultaneous_music_iterator const&);
+  virtual ~Simultaneous_music_iterator ();
 
   /// make a new context for every child.
   bool separate_contexts_b_;
-  
-  Simultaneous_music_iterator ();
-  virtual ~Simultaneous_music_iterator ();
+  int cursor_i_;
 
   virtual void construct_children ();
   virtual Moment next_moment () const;
   virtual bool ok () const;
+  virtual bool next ();
+  virtual Music* get_music ();
 
 protected:
   virtual void do_print () const;
diff --git a/lily/include/time-scaled-music-iterator.hh b/lily/include/time-scaled-music-iterator.hh
index 28ab473db0..abdd2ac6a6 100644
--- a/lily/include/time-scaled-music-iterator.hh
+++ b/lily/include/time-scaled-music-iterator.hh
@@ -15,6 +15,7 @@
 class Time_scaled_music_iterator : public Music_wrapper_iterator
 {
 public:  
+  VIRTUAL_COPY_CONS (Music_iterator);
   // construction
 protected:
   virtual void do_process_and_next (Moment);
diff --git a/lily/include/unfolded-repeat-iterator.hh b/lily/include/unfolded-repeat-iterator.hh
index 97a649a10a..e52361b473 100644
--- a/lily/include/unfolded-repeat-iterator.hh
+++ b/lily/include/unfolded-repeat-iterator.hh
@@ -19,6 +19,7 @@
 class Unfolded_repeat_iterator : public Music_iterator
 {
 public:
+  VIRTUAL_COPY_CONS (Music_iterator);
   /**
      How often have we done the body (assuming bodies are interspersed.)?
    */
diff --git a/lily/interpretation-context-handle.cc b/lily/interpretation-context-handle.cc
index b6a403ea2d..e5b056e601 100644
--- a/lily/interpretation-context-handle.cc
+++ b/lily/interpretation-context-handle.cc
@@ -11,6 +11,32 @@
 #include "interpretation-context-handle.hh"
 #include "translator-group.hh"
 
+Interpretation_context_handle::Interpretation_context_handle()
+{
+  report_to_l_ =0;
+}
+
+Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s)
+{
+  report_to_l_ =0;
+  if (s.report_to_l_)
+    up (s.report_to_l_ );
+}
+
+Interpretation_context_handle*
+Interpretation_context_handle::clone () const
+{
+  Interpretation_context_handle* handle = new Interpretation_context_handle;
+  handle->report_to_l_ = this->report_to_l_;
+  return handle;
+}
+
+Interpretation_context_handle::~Interpretation_context_handle ()
+{
+  if (report_to_l_)
+    down ();
+}
+
 void
 Interpretation_context_handle::up (Translator_group*t)
 {
@@ -31,13 +57,6 @@ Interpretation_context_handle::try_music (Music *m)
   return  report_to_l_->try_music (m);
 }
 
-Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s)
-{
-  report_to_l_ =0;
-  if (s.report_to_l_)
-    up (s.report_to_l_ );
-}
-
 void
 Interpretation_context_handle::operator = (Interpretation_context_handle const &s)
 {
@@ -61,14 +80,4 @@ Interpretation_context_handle::report_to_l ()const
   return report_to_l_;
 }
 
-Interpretation_context_handle::Interpretation_context_handle()
-{
-  report_to_l_ =0;
-}
-
-Interpretation_context_handle::~Interpretation_context_handle ()
-{
-  if (report_to_l_)
-    down ();
-}
 
diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc
index b1697e199e..bae22a94af 100644
--- a/lily/music-iterator.cc
+++ b/lily/music-iterator.cc
@@ -37,10 +37,26 @@
 #include "part-combine-music.hh"
 #include "part-combine-music-iterator.hh"
 #include "request.hh"
-#include "request-iterator.hh"
+#include "simple-music-iterator.hh"
 #include "output-property.hh"
 #include "chord-tremolo-iterator.hh"
 
+Music_iterator::Music_iterator ()
+{
+  first_b_ = true;
+}
+
+Music_iterator::Music_iterator (Music_iterator const& src)
+{
+  first_b_ = src.first_b_;
+  handle_ = *src.handle_.clone ();
+  music_l_ = src.music_l_;
+}
+
+Music_iterator::~Music_iterator()
+{
+}
+
 void
 Music_iterator::do_print() const
 {
@@ -94,10 +110,6 @@ Music_iterator::construct_children()
 {
 }
 
-Music_iterator::~Music_iterator()
-{
-}
-
 Moment
 Music_iterator::next_moment() const
 {
@@ -118,11 +130,26 @@ Music_iterator::do_process_and_next (Moment)
 }
 
 bool
-Music_iterator::ok() const
+Music_iterator::ok () const
 {
   return first_b_;
 }
 
+Music*
+Music_iterator::get_music ()
+{
+  if (ok ())
+    return music_l_;
+  return 0;
+}
+
+bool
+Music_iterator::next ()
+{
+  first_b_ = false;
+  return ok ();
+}
+
 Music_iterator*
 Music_iterator::static_get_iterator_p (Music  *m)
 {
@@ -202,11 +229,6 @@ Music_iterator::get_iterator_p (Music *m) const
   return p;
 }
 
-Music_iterator::Music_iterator()
-{
-  first_b_ = true;
-}
-
 Music_iterator*
 Music_iterator::try_music (Music  *m) const
 {
diff --git a/lily/music-wrapper-iterator.cc b/lily/music-wrapper-iterator.cc
index af658cf72a..396e9c4657 100644
--- a/lily/music-wrapper-iterator.cc
+++ b/lily/music-wrapper-iterator.cc
@@ -16,7 +16,16 @@ Music_wrapper_iterator::Music_wrapper_iterator ()
   child_iter_p_ =0;
 }
 
+Music_wrapper_iterator::Music_wrapper_iterator (Music_wrapper_iterator const &src)
+  : Music_iterator (src)
+{
+  child_iter_p_ = src.child_iter_p_->clone ();
+}
 
+Music_wrapper_iterator::~Music_wrapper_iterator ()
+{
+  delete child_iter_p_;
+}
 
 void
 Music_wrapper_iterator::do_print () const
@@ -31,12 +40,6 @@ Music_wrapper_iterator::construct_children ()
     get_iterator_p (dynamic_cast<Music_wrapper const*> (music_l_)->element ());
 }
 
-Music_wrapper_iterator::~Music_wrapper_iterator ()
-{
-  delete child_iter_p_;
-}
-
-
 bool
 Music_wrapper_iterator::ok () const
 {
@@ -50,6 +53,17 @@ Music_wrapper_iterator::do_process_and_next (Moment m)
   Music_iterator::do_process_and_next (m);
 }
 
+Music*
+Music_wrapper_iterator::get_music ()
+{
+  return child_iter_p_->get_music ();
+}
+
+bool
+Music_wrapper_iterator::next ()
+{
+  return child_iter_p_->next ();
+}
 
 Moment
 Music_wrapper_iterator::next_moment () const
diff --git a/lily/part-combine-music-iterator.cc b/lily/part-combine-music-iterator.cc
index 3a72a587a9..b5c3780961 100644
--- a/lily/part-combine-music-iterator.cc
+++ b/lily/part-combine-music-iterator.cc
@@ -10,13 +10,11 @@
 #include "part-combine-music-iterator.hh"
 #include "translator-group.hh"
 #include "musical-request.hh"
+#include "music-sequence.hh"
 #include "warn.hh"
 
 Part_combine_music_iterator::Part_combine_music_iterator ()
 {
-  combined_b_ = true;
-
-  now_ = 0;
   first_iter_p_ = 0;
   second_iter_p_ = 0;
   first_until_ = 0;
@@ -117,110 +115,118 @@ Part_combine_music_iterator::change_to (Music_iterator *it, String to_type,
     error (_f ("none of these in my family: `%s'", to_id.ch_C ()));
 }
 
-Pitch_interrogate_req* first_spanish_inquisition; // nobody expects it
-Pitch_interrogate_req* second_spanish_inquisition; // won't strike twice
-
-Rhythm_interrogate_req* first_rhythmic_inquisition;
-Rhythm_interrogate_req* second_rhythmic_inquisition;
-
 void
 Part_combine_music_iterator::do_process_and_next (Moment m)
 {
   Part_combine_music const * p = dynamic_cast<Part_combine_music const* > (music_l_);
 
-  now_ = next_moment ();
+  Moment now = next_moment ();
 
-  /*
-    Hmm, shouldn't we check per iterator if next_moment < m?
-   */
+  Array<Musical_pitch> first_pitches;
+  Array<Duration> first_durations;
   if (first_iter_p_->ok ())
-    first_iter_p_->process_and_next (m);
-  
-  if (second_iter_p_->ok ())
-    second_iter_p_->process_and_next (m);
-
-  Music_iterator::do_process_and_next (m);
-
-  /*
-    TODO:
-
-    * Maybe we need a Skip_engraver?
-
-    (check): can this all be handled now?
-    
-    Maybe different modes exist?
-
-    * Wind instruments (Flute I/II)
-    * Hymnals:  
-
-
-      Rules for Hymnals/SATB (John Henckel <henckel@iname.com>):
-
-      1. if S and A differ by less than a third, the stems should be up/down.
-      2. else if S and A have different values, the stems should be up/down.
-      3. else if A sings "la" or higher, both S and A stems should be down.
-      4. else both stems should be up
-
-    * This may get really tricky: combining voices/staffs: string instruments
+    {
+      Music_iterator* i = first_iter_p_->clone ();
+      Moment until = i->next_moment ();
+
+      /* Urg, silly first_b_ stuff */
+      if (now && i->next ())
+	until = i->next_moment ();
+
+      /* How about a 'now_moment ()' for iterators? */
+      for (; i->ok () && i->next_moment () == until; i->next ())
+	{
+	  if (Music_sequence* m = dynamic_cast<Music_sequence *> (i->get_music ()))
+	    {
+	      for (SCM s = m->music_list (); gh_pair_p (s);  s = gh_cdr (s))
+		{
+		  Music *u = unsmob_music (gh_car (s));
+		  if (Melodic_req *r = dynamic_cast<Melodic_req *> (u))
+		    first_pitches.push (r->pitch_);
+		  if (Rhythmic_req *r = dynamic_cast<Rhythmic_req *> (u))
+		    first_durations.push (r->duration_);
+		}
+	    }
+	}
+    }
 
-   */
-  
-  if (!first_spanish_inquisition)
-    first_spanish_inquisition = new Pitch_interrogate_req;
-  first_iter_p_->try_music (first_spanish_inquisition);
+  Array<Musical_pitch> second_pitches;
+  Array<Duration> second_durations;
+  if (second_iter_p_->ok ())
+    {
+      Music_iterator* i = second_iter_p_->clone ();
+      Moment until = i->next_moment ();
+
+      /* Urg, silly second_b_ stuff */
+      if (now && i->next ())
+	until = i->next_moment ();
+
+      /* How about a 'now_moment ()' for iterators? */
+      for (; i->ok () && i->next_moment () == until; i->next ())
+	{
+	  if (Music_sequence* m = dynamic_cast<Music_sequence *> (i->get_music ()))
+	    {
+	      for (SCM s = m->music_list (); gh_pair_p (s);  s = gh_cdr (s))
+		{
+		  Music *u = unsmob_music (gh_car (s));
+		  if (Melodic_req *r = dynamic_cast<Melodic_req *> (u))
+		    second_pitches.push (r->pitch_);
+		  if (Rhythmic_req *r = dynamic_cast<Rhythmic_req *> (u))
+		    second_durations.push (r->duration_);
+		}
+	    }
+	}
+    }
   
-  if (!second_spanish_inquisition)
-    second_spanish_inquisition = new Pitch_interrogate_req;
-  second_iter_p_->try_music (second_spanish_inquisition);
-
-  Array<Musical_pitch>* first_pitches = &first_spanish_inquisition->pitch_arr_;
-  Array<Musical_pitch>* second_pitches = &second_spanish_inquisition->pitch_arr_;
-
-  if (!first_rhythmic_inquisition)
-    first_rhythmic_inquisition = new Rhythm_interrogate_req;
-  first_iter_p_->try_music (first_rhythmic_inquisition);
-
-  if (!second_rhythmic_inquisition)
-    second_rhythmic_inquisition = new Rhythm_interrogate_req;
-  second_iter_p_->try_music (second_rhythmic_inquisition);
-
-  Array<Duration>* first_durations = &first_rhythmic_inquisition->duration_arr_;
-  Array<Duration>* second_durations = &second_rhythmic_inquisition->duration_arr_;
-
   SCM interval = SCM_BOOL_F;
-  if (first_pitches->size () && second_pitches->size ())
+  if (first_pitches.size () && second_pitches.size ())
     {
-      first_pitches->sort (Musical_pitch::compare);
-      second_pitches->sort (Musical_pitch::compare);
-      interval = gh_int2scm (first_pitches->top ().steps ()
-			     - (*second_pitches)[0].steps ());
+      first_pitches.sort (Musical_pitch::compare);
+      second_pitches.sort (Musical_pitch::compare);
+      interval = gh_int2scm (first_pitches.top ().steps ()
+			     - second_pitches[0].steps ());
     }
-  if (first_durations->size ())
+  if (first_durations.size ())
     {
-      first_durations->sort (Duration::compare);
-      Moment new_until = now_ + first_durations->top ().length_mom ();
+      first_durations.sort (Duration::compare);
+      Moment new_until = now + first_durations.top ().length_mom ();
       if (new_until > first_until_)
 	first_until_ = new_until;
     }
 
-    if (second_durations->size ())
+    if (second_durations.size ())
     {
-      second_durations->sort (Duration::compare);
-      Moment new_until = now_ + second_durations->top ().length_mom ();
+      second_durations.sort (Duration::compare);
+      Moment new_until = now + second_durations.top ().length_mom ();
       if (new_until > second_until_)
 	second_until_ = new_until;
     }
 
+#if 0 /* DEBUG */
+  printf ("now: %s\n", now.str ().ch_C ());
+  printf ("first: ");
+  for (int i = 0; i < first_pitches.size (); i++)
+    {
+      printf ("%s, ", first_pitches[i].str ().ch_C ());
+    }
+  printf ("\nsecond: ");
+  for (int i = 0; i < second_pitches.size (); i++)
+    {
+      printf ("%s, ", second_pitches[i].str ().ch_C ());
+    }
+  printf ("\n");
+#endif
+
   Translator_group * fir = first_iter_p_->report_to_l ();
   Translator_group * sir = second_iter_p_->report_to_l ();
 
-  bool solo_b = (first_pitches->empty () != second_pitches->empty ())
-    && !(first_until_ > now_ && second_until_ > now_);
+  bool solo_b = (first_pitches.empty () != second_pitches.empty ())
+    && !(first_until_ > now && second_until_ > now);
 
-  bool unirhythm_b = !solo_b && !compare (first_durations, second_durations);
-  bool unison_b = unirhythm_b && !first_pitches->empty ()
-    &&!compare (first_pitches, second_pitches);
-  bool unisilence_b = unirhythm_b && first_pitches->empty ();
+  bool unirhythm_b = !solo_b && !compare (&first_durations, &second_durations);
+  bool unison_b = unirhythm_b && !first_pitches.empty ()
+    &&!compare (&first_pitches, &second_pitches);
+  bool unisilence_b = unirhythm_b && first_pitches.empty ();
 
   Translator_group * fd = fir->find_create_translator_l (p->what_str_, "one");
   Translator_group * sd = sir->find_create_translator_l (p->what_str_, "two");
@@ -238,28 +244,23 @@ Part_combine_music_iterator::do_process_and_next (Moment m)
 	split_interval_b = true;
     }
 
-  /*
-    Hmm, maybe we should set/check combined_b_ against
+  bool combined_b = first_iter_p_->report_to_l ()->daddy_trans_l_
+    == second_iter_p_->report_to_l ()->daddy_trans_l_;
 
-       first_iter_p_->report_to_l () == second_iter_p_->report_to_l ()
-
-   ? 
-   */
-
-  String to_id =  combined_b_ ? "one" : "two";
-  if ((!unirhythm_b && combined_b_)
-      || (split_interval_b && combined_b_)
-      || (solo_b && combined_b_)
-      /*|| (unisilence_b && combined_b_) */
+  String to_id =  combined_b ? "one" : "two";
+  if ((!unirhythm_b && combined_b)
+      || (split_interval_b && combined_b)
+      || (solo_b && combined_b)
+      /*|| (unisilence_b && combined_b) */
       || ((unirhythm_b || unison_b || unisilence_b)
-	  && !combined_b_ && !split_interval_b && !solo_b))
+	  && !combined_b && !split_interval_b && !solo_b))
     {
-      combined_b_ = !combined_b_;
-      to_id =  combined_b_ ? "one" : "two";
+      combined_b = !combined_b;
+      to_id =  combined_b ? "one" : "two";
       change_to (second_iter_p_, p->what_str_, to_id);
     }
 
-  if (!combined_b_)
+  if (!combined_b)
     sir = second_iter_p_->report_to_l ();
 
   SCM b = unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F;
@@ -279,22 +280,28 @@ Part_combine_music_iterator::do_process_and_next (Moment m)
   sd->set_property ("unison", b);
 
   b = solo_b  ? SCM_BOOL_T : SCM_BOOL_F;
-  if (first_pitches->size ())
+  if (first_pitches.size ())
     {
       fd->set_property ("solo", b);
       sd->set_property ("solo", SCM_BOOL_F);
     }
 
-  if (second_pitches->size ())
+  if (second_pitches.size ())
     {
       fd->set_property ("solo", SCM_BOOL_F);
       sd->set_property ("solo", b);
     }
 
-  first_pitches->clear ();
-  second_pitches->clear ();
-  first_durations->clear ();
-  second_durations->clear ();
+  /*
+    Hmm, shouldn't we check per iterator if next_moment < m?
+  */
+  if (first_iter_p_->ok ())
+    first_iter_p_->process_and_next (m);
+  
+  if (second_iter_p_->ok ())
+    second_iter_p_->process_and_next (m);
+
+  Music_iterator::do_process_and_next (m);
 }
 
 Music_iterator*
diff --git a/lily/request-chord-iterator.cc b/lily/request-chord-iterator.cc
index 7f0b00827f..7ac4c2e2c7 100644
--- a/lily/request-chord-iterator.cc
+++ b/lily/request-chord-iterator.cc
@@ -12,7 +12,17 @@
 #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,12 +37,6 @@ Request_chord_iterator::elt_l () const
   return (Request_chord*) music_l_;
 }
 
-Request_chord_iterator::Request_chord_iterator ()
-{
-  last_b_ = false;
-}
-
-
 bool
 Request_chord_iterator::ok() const
 {
@@ -57,12 +61,23 @@ Request_chord_iterator::do_print() const
 #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_and_next (Moment)
 {
+  // URG
   if (first_b_)
     {
-      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 *> (get_music ())->music_list (); gh_pair_p (s);  s = gh_cdr (s))
 	{
 	  Music *mus = unsmob_music (gh_car (s));
 	  if (Request * req_l = dynamic_cast<Request*> (mus))
@@ -75,9 +90,7 @@ Request_chord_iterator::do_process_and_next (Moment mom)
 	    mus->origin ()->warning (_f ("Huh?  Not a Request: `%s'",
 						 classname (mus)));
 		    }
-      first_b_ = false;
     }
 
-  if (mom >= elt_length_mom_)
-    last_b_ = true;
+  next ();
 }
diff --git a/lily/request-iterator.cc b/lily/request-iterator.cc
index 51c7604281..e69de29bb2 100644
--- a/lily/request-iterator.cc
+++ b/lily/request-iterator.cc
@@ -1,25 +0,0 @@
-/*   
-  request-iterator.cc --  implement Simple_music_iterator
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-#include "request-iterator.hh"
-#include "music.hh"
-#include "input.hh"
-
-void
-Simple_music_iterator::do_process_and_next (Moment m)
-{
-  if (first_b_)
-    {
-      bool g= try_music (music_l_);
-      if (!g)
-	music_l_->origin ()->warning (_f ("Junking music: `%s'", classname(music_l_)));
-
-      first_b_ = false;
-    }
-  Music_iterator::do_process_and_next (m);
-}
diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc
index d99381cf54..8ba2fa20db 100644
--- a/lily/sequential-music-iterator.cc
+++ b/lily/sequential-music-iterator.cc
@@ -12,19 +12,37 @@
 #include "music-list.hh"
 #include "request-chord-iterator.hh"
 
+Sequential_music_iterator::Sequential_music_iterator ()
+{
+  cursor_ = 0;
+  here_mom_ = 0;
+  iter_p_ =0;
+}
 
-void
-Sequential_music_iterator::do_print() const
+Sequential_music_iterator::Sequential_music_iterator (Sequential_music_iterator const &src)
+  : Music_iterator (src)
+{
+  cursor_ = src.cursor_;
+  here_mom_ = src.here_mom_;
+  iter_p_ = src.iter_p_->clone ();
+}
+
+Sequential_music_iterator::~Sequential_music_iterator()
 {
   if (iter_p_)
-    iter_p_->print();
+    {
+      if (iter_p_->ok ())
+	music_l_->origin ()->warning (_ ("Must stop before this music ends"));
+      delete iter_p_;
+      iter_p_ = 0;
+    }
 }
 
-Sequential_music_iterator::Sequential_music_iterator ()
+void
+Sequential_music_iterator::do_print() const
 {
-  cursor_ = 0;
-  here_mom_ = 0;
-  iter_p_ =0;
+  if (iter_p_)
+    iter_p_->print();
 }
 
 void
@@ -75,50 +93,68 @@ Sequential_music_iterator::set_sequential_music_translator()
     set_translator (child_report);
 }
 
-Sequential_music_iterator::~Sequential_music_iterator()
+Music*
+Sequential_music_iterator::get_music ()
 {
-  if (iter_p_)
+  if (ok ())
+    return unsmob_music (gh_car (cursor_));
+      
+  return 0;
+}
+  
+bool
+Sequential_music_iterator::next ()
+{
+  if (ok ())
     {
+      bool b = false;
       if (iter_p_->ok ())
-	music_l_->origin ()->warning (_ ("Must stop before this music ends"));
-      delete iter_p_;
-      iter_p_ = 0;
+	b = iter_p_->next ();
+      if (!b)
+	{
+	  set_sequential_music_translator ();
+	  leave_element ();
+	  if (gh_pair_p (cursor_))
+	    start_next_element ();
+	  b = ok ();
+	}
+      return b;
     }
+  return false;
 }
 
+/*
+  This should use get_music () and next ()
+ */
 void
 Sequential_music_iterator::do_process_and_next (Moment until)
 {
-  if (!iter_p_)
-    return;
-
-  while (1) 
+  if (ok ())
     {
-      Moment local_until = until - here_mom_;
-      while (iter_p_->ok()) 
-	{
-	  Moment here = iter_p_->next_moment();
-	  if (here != local_until)
-	    goto loopexit;
-	    
-	  iter_p_->process_and_next (local_until);
-	}
-      
-      if (!iter_p_->ok()) 
+      while (1) 
 	{
-	  set_sequential_music_translator();
-	  leave_element();
+	  Moment local_until = until - here_mom_;
+	  while (iter_p_->ok ()) 
+	    {
+	      Moment here = iter_p_->next_moment ();
+	      if (here != local_until)
+		return Music_iterator::do_process_and_next (until);
+	      
+	      iter_p_->process_and_next (local_until);
+	    }
 	  
-	  if (gh_pair_p (cursor_))
-	    start_next_element();
-	  else 
-	    goto loopexit;
+	  if (!iter_p_->ok ()) 
+	    {
+	      set_sequential_music_translator ();
+	      leave_element ();
+	      
+	      if (gh_pair_p (cursor_))
+		start_next_element ();
+	      else 
+		return Music_iterator::do_process_and_next (until);
+	    }
 	}
     }
-
-loopexit:
-
-  Music_iterator::do_process_and_next (until);
 }
 
 Moment
diff --git a/lily/simple-music-iterator.cc b/lily/simple-music-iterator.cc
new file mode 100644
index 0000000000..d19d615a22
--- /dev/null
+++ b/lily/simple-music-iterator.cc
@@ -0,0 +1,36 @@
+/*   
+  simple-music-iterator.cc --  implement Simple_music_iterator
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "simple-music-iterator.hh"
+#include "music.hh"
+#include "input.hh"
+
+Simple_music_iterator::Simple_music_iterator ()
+  : Music_iterator ()
+{
+}
+
+Simple_music_iterator::Simple_music_iterator (Simple_music_iterator const &src)
+  : Music_iterator (src)
+{
+}
+
+void
+Simple_music_iterator::do_process_and_next (Moment m)
+{
+  if (ok ())
+    {
+      bool b = try_music (get_music ());
+      if (!b)
+	music_l_->origin ()->warning (_f ("Junking music: `%s'",
+					  classname (music_l_)));
+
+    }
+  Music_iterator::do_process_and_next (m);
+}
diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc
index 5ea7f71218..3e4d821ede 100644
--- a/lily/simultaneous-music-iterator.cc
+++ b/lily/simultaneous-music-iterator.cc
@@ -15,6 +15,19 @@
 Simultaneous_music_iterator::Simultaneous_music_iterator ()
 {
   separate_contexts_b_ = false;
+  cursor_i_ = 0;
+}
+
+Simultaneous_music_iterator::Simultaneous_music_iterator (Simultaneous_music_iterator const& src)
+  : Music_iterator (src)
+{
+  cursor_i_ = src.cursor_i_;
+  separate_contexts_b_ = src.separate_contexts_b_;
+  for (Cons<Music_iterator> *p = children_p_list_.head_; p; p = p->next_)
+    {
+      Music_iterator *i = p->car_;
+      children_p_list_.append (new Killing_cons<Music_iterator> (i->clone (), 0));
+    }
 }
 
 Simultaneous_music_iterator::~Simultaneous_music_iterator ()
@@ -22,6 +35,28 @@ Simultaneous_music_iterator::~Simultaneous_music_iterator ()
   children_p_list_.junk ();
 }
 
+bool
+Simultaneous_music_iterator::next ()
+{
+  if (cursor_i_ < children_p_list_.size_i ())
+    cursor_i_++;
+  return cursor_i_ < children_p_list_.size_i ();
+}
+
+Music*
+Simultaneous_music_iterator::get_music ()
+{
+  if (cursor_i_ < children_p_list_.size_i ())
+    {
+      Cons<Music_iterator> *p = children_p_list_.head_;
+      for (int i = 0; i <= cursor_i_ && p; i++)
+	p = p->next_;
+      if (p)
+	return p->car_->get_music ();
+    }
+  return 0;
+}
+
 void
 Simultaneous_music_iterator::construct_children()
 {
diff --git a/lily/translator-group.cc b/lily/translator-group.cc
index 19b54bb2aa..0477d3e645 100644
--- a/lily/translator-group.cc
+++ b/lily/translator-group.cc
@@ -33,7 +33,8 @@ Translator_group::properties_dict () const
 
 Translator_group::~Translator_group ()
 {
-  assert (removable_b());
+  
+  //assert (removable_b());
 }