From 0c925d60d17a5d84e9372a6a666dc24c4d09c53f Mon Sep 17 00:00:00 2001
From: hanwen <hanwen>
Date: Sun, 16 Jan 2005 17:54:19 +0000
Subject: [PATCH] * lily/include/transposed-music.hh (class Transposed_music):
 remove.

* lily/transposed-music.cc: remove

* lily/include/relative-music.hh: remove.

* lily/include/music-sequence.hh (struct Music_sequence): change
into "namespace" class.

* lily/untransposable-music.cc (Module): remove

* lily/include/un-relativable-music.hh (Module): remove

* lily/include/untransposable-music.hh (Module): remove

* lily/include/music-list.hh (Module): remove file

* lily/un-relativable-music.cc: remove file.
---
 ChangeLog                              | 21 +++++++++++
 lily/chord-tremolo-engraver.cc         |  1 -
 lily/event-chord-iterator.cc           |  3 +-
 lily/event.cc                          | 30 ----------------
 lily/folded-repeat-iterator.cc         |  1 -
 lily/global-context.cc                 |  1 -
 lily/include/event.hh                  |  1 -
 lily/include/music-list.hh             | 37 -------------------
 lily/include/music-sequence.hh         |  7 ++--
 lily/include/music.hh                  |  1 +
 lily/include/relative-music.hh         | 26 --------------
 lily/include/relative-octave-check.hh  | 26 --------------
 lily/include/repeated-music.hh         |  2 ++
 lily/include/transposed-music.hh       | 25 -------------
 lily/include/un-relativable-music.hh   | 25 -------------
 lily/include/untransposable-music.hh   | 26 --------------
 lily/music-sequence.cc                 | 50 ++++++++++++++++++--------
 lily/music.cc                          | 42 ++++++++++++++++++----
 lily/output-property-music-iterator.cc |  2 +-
 lily/parser.yy                         |  2 --
 lily/relative-octave-check.cc          | 33 ++++++++---------
 lily/relative-octave-music.cc          | 43 +++++++++++++---------
 lily/repeated-music.cc                 |  3 +-
 lily/sequential-iterator.cc            |  3 +-
 lily/sequential-music-iterator.cc      |  5 ++-
 lily/simultaneous-music-iterator.cc    |  3 +-
 lily/simultaneous-music.cc             | 49 -------------------------
 lily/transposed-music.cc               | 26 --------------
 lily/tuplet-engraver.cc                |  1 -
 lily/un-relativable-music.cc           | 24 -------------
 lily/untransposable-music.cc           | 24 -------------
 scm/define-music-properties.scm        |  1 -
 scm/define-music-types.scm             | 23 +++++++-----
 33 files changed, 163 insertions(+), 404 deletions(-)
 delete mode 100644 lily/include/music-list.hh
 delete mode 100644 lily/include/relative-music.hh
 delete mode 100644 lily/include/relative-octave-check.hh
 delete mode 100644 lily/include/transposed-music.hh
 delete mode 100644 lily/include/un-relativable-music.hh
 delete mode 100644 lily/include/untransposable-music.hh
 delete mode 100644 lily/transposed-music.cc
 delete mode 100644 lily/un-relativable-music.cc
 delete mode 100644 lily/untransposable-music.cc

diff --git a/ChangeLog b/ChangeLog
index 57db6df651..fa7b5bbd83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2005-01-16  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+	* lily/include/transposed-music.hh (class Transposed_music): remove.
+
+	* lily/transposed-music.cc: remove
+
+	* lily/include/relative-music.hh: remove.
+
+	* lily/include/music-sequence.hh (struct Music_sequence): change
+	into "namespace" class.
+
+	* lily/untransposable-music.cc (Module): remove
+
+	* lily/include/un-relativable-music.hh (Module): remove
+
+	* lily/include/untransposable-music.hh (Module): remove
+
+	* lily/include/music-list.hh (Module): remove file
+
+	* lily/un-relativable-music.cc: remove file.
+
 2005-01-14  Jan Nieuwenhuizen  <janneke@gnu.org>
 
 	* lily/parser.yy: Compile fix.
diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc
index a9bb0f0b2c..e2f5d9516f 100644
--- a/lily/chord-tremolo-engraver.cc
+++ b/lily/chord-tremolo-engraver.cc
@@ -19,7 +19,6 @@
 #include "item.hh"
 #include "chord-tremolo-iterator.hh"
 #include "stem-tremolo.hh"
-#include "music-list.hh"
 #include "math.h"           // ceil
 
 /**
diff --git a/lily/event-chord-iterator.cc b/lily/event-chord-iterator.cc
index 56fe24f6cb..20be73257b 100644
--- a/lily/event-chord-iterator.cc
+++ b/lily/event-chord-iterator.cc
@@ -10,7 +10,6 @@
 
 #include "context.hh"
 #include "warn.hh"
-#include "music-list.hh"
 #include "event.hh"
 
 Event_chord_iterator::Event_chord_iterator ()
@@ -47,7 +46,7 @@ Event_chord_iterator::process (Moment m)
 {
   if (last_processed_mom_ < Moment (0))
     {
-      for (SCM s = dynamic_cast<Music_sequence *> (get_music ())->music_list ();
+      for (SCM s = get_music ()->get_property ("elements");
 	   scm_is_pair (s);  s = scm_cdr (s))
 	{
 	  Music *mus = unsmob_music (scm_car (s));
diff --git a/lily/event.cc b/lily/event.cc
index d4beba4c13..c11c2b0ac7 100644
--- a/lily/event.cc
+++ b/lily/event.cc
@@ -23,36 +23,6 @@ Event::length_callback (SCM m)
     }
   return mom.smobbed_copy();
 }
-
-
-Pitch
-Event::to_relative_octave (Pitch last)
-{
-  Pitch *old_pit = unsmob_pitch (get_property ("pitch"));
-  if (old_pit)
-    {
-      Pitch new_pit = *old_pit;
-      new_pit = new_pit.to_relative_octave (last);
-
-      SCM check = get_property ("absolute-octave");
-      if (scm_is_number (check) &&
-	  new_pit.get_octave () != scm_to_int (check))
-	{
-	  Pitch expected_pit (scm_to_int (check),
-			      new_pit.get_notename (),
-			      new_pit.get_alteration ());
-	  origin ()->warning (_f ("octave check failed; expected %s, found: %s",
-				  expected_pit.to_string (),
-				  new_pit.to_string ()));
-	  new_pit = expected_pit;
-	}
-      
-      set_property ("pitch", new_pit.smobbed_copy ());
-  
-      return new_pit;
-    }
-  return last;
-}
   
 Event::Event (SCM i)
   : Music (i)
diff --git a/lily/folded-repeat-iterator.cc b/lily/folded-repeat-iterator.cc
index 16456ed41f..eaa110c5a8 100644
--- a/lily/folded-repeat-iterator.cc
+++ b/lily/folded-repeat-iterator.cc
@@ -11,7 +11,6 @@
 
 #include "input.hh"
 #include "repeated-music.hh"
-#include "music-list.hh"
 #include "simultaneous-music-iterator.hh"
 #include "context.hh"
 
diff --git a/lily/global-context.cc b/lily/global-context.cc
index 3096610966..a72aa89b04 100644
--- a/lily/global-context.cc
+++ b/lily/global-context.cc
@@ -12,7 +12,6 @@
 
 #include "warn.hh"
 #include "event.hh"
-#include "music-list.hh"
 #include "music-iterator.hh"
 #include "score-context.hh"
 #include "context-def.hh"
diff --git a/lily/include/event.hh b/lily/include/event.hh
index 7800913444..2c3272552d 100644
--- a/lily/include/event.hh
+++ b/lily/include/event.hh
@@ -23,7 +23,6 @@ public:
   Event (SCM);
   VIRTUAL_COPY_CONSTRUCTOR (Music, Event);
   DECLARE_SCHEME_CALLBACK(length_callback,(SCM));
-  virtual Pitch to_relative_octave (Pitch);
 };
 
 
diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh
deleted file mode 100644
index b635f02ccf..0000000000
--- a/lily/include/music-list.hh
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-  music-list.hh -- declare Simultaneous_music, Sequential_music, Event_chord
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef MUSIC_LIST_HH
-#define MUSIC_LIST_HH
-
-#include "music-sequence.hh"
-
-/**
-  Simultaneous_music is a list of music-elements which happen simultaneously
- */
-class Simultaneous_music : public Music_sequence
-{
-public:
-  Simultaneous_music (SCM);
-  VIRTUAL_COPY_CONSTRUCTOR (Music, Simultaneous_music);
-  virtual Pitch to_relative_octave (Pitch);
-};
-
-/*
-  A chord.
- */
-class Event_chord : public Simultaneous_music
-{
-public:
-  VIRTUAL_COPY_CONSTRUCTOR (Music, Event_chord);
-  virtual Pitch to_relative_octave (Pitch);
-  Event_chord (SCM);
-};
-
-#endif /* MUSIC_LIST_HH */
diff --git a/lily/include/music-sequence.hh b/lily/include/music-sequence.hh
index 46ee4507ee..398c20297d 100644
--- a/lily/include/music-sequence.hh
+++ b/lily/include/music-sequence.hh
@@ -12,16 +12,15 @@
 
 #include "music.hh"
 
-class Music_sequence : public Music
+struct Music_sequence
 {
 public:
-  Music_sequence (SCM h);
-  VIRTUAL_COPY_CONSTRUCTOR (Music, Music_sequence);
   DECLARE_SCHEME_CALLBACK(cumulative_length_callback, (SCM));
   DECLARE_SCHEME_CALLBACK(maximum_length_callback, (SCM));
   DECLARE_SCHEME_CALLBACK(minimum_start_callback, (SCM));
   DECLARE_SCHEME_CALLBACK(first_start_callback, (SCM));
-  SCM music_list () const;
+  DECLARE_SCHEME_CALLBACK(simultaneous_relative_callback, (SCM, SCM));
+  DECLARE_SCHEME_CALLBACK(event_chord_relative_callback, (SCM, SCM));
   
   Pitch do_relative_octave (Pitch p, bool b);
   
diff --git a/lily/include/music.hh b/lily/include/music.hh
index edca9632e8..c8fec91cd5 100644
--- a/lily/include/music.hh
+++ b/lily/include/music.hh
@@ -32,6 +32,7 @@ public:
   bool internal_is_music_type (SCM) const;
   int duration_log () const;
   
+  DECLARE_SCHEME_CALLBACK(relative_callback,(SCM,SCM));
   virtual Pitch to_relative_octave (Pitch);
   String name () const;
   Moment get_length () const;
diff --git a/lily/include/relative-music.hh b/lily/include/relative-music.hh
deleted file mode 100644
index 17f0f5721b..0000000000
--- a/lily/include/relative-music.hh
+++ /dev/null
@@ -1,26 +0,0 @@
-/*   
-  relative-music.hh -- declare Relative_octave_music
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#ifndef RELATIVE_MUSIC_HH
-#define RELATIVE_MUSIC_HH
-
-#include "music-wrapper.hh"
-
-class Relative_octave_music : public Music_wrapper
-{
-public:
-  Relative_octave_music (SCM);
-  VIRTUAL_COPY_CONSTRUCTOR (Music, Relative_octave_music);
-
-  virtual Pitch to_relative_octave (Pitch);
-};
-
-#endif /* RELATIVE_MUSIC_HH */
-
-
diff --git a/lily/include/relative-octave-check.hh b/lily/include/relative-octave-check.hh
deleted file mode 100644
index ae3b9adb06..0000000000
--- a/lily/include/relative-octave-check.hh
+++ /dev/null
@@ -1,26 +0,0 @@
-/*   
-  relative-octave-check.hh -- declare Relative_octave_octave-check
-  
-  source file of  GNU LilyPond
-  
-  (c) 2003--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#ifndef RELATIVE_OCTAVE_CHECK_HH
-#define RELATIVE_OCTAVE_CHECK_HH
-
-#include "music.hh"
-
-class Relative_octave_check : public Music
-{
-public:
-  Relative_octave_check (SCM);
-  VIRTUAL_COPY_CONSTRUCTOR (Music, Relative_octave_check);
-
-  virtual Pitch to_relative_octave (Pitch);
-};
-
-#endif /* RELATIVE_OCTAVE_CHECK_HH */
-
-
diff --git a/lily/include/repeated-music.hh b/lily/include/repeated-music.hh
index a61dd75fd2..7d8141dc4f 100644
--- a/lily/include/repeated-music.hh
+++ b/lily/include/repeated-music.hh
@@ -57,6 +57,8 @@ public:
 
   /* How often do we repeat? */
   int repeat_count () const;
+  DECLARE_SCHEME_CALLBACK(relative_callback,(SCM,SCM));
+
   virtual Pitch to_relative_octave (Pitch);
 
   Moment body_get_length () const;
diff --git a/lily/include/transposed-music.hh b/lily/include/transposed-music.hh
deleted file mode 100644
index 2642531475..0000000000
--- a/lily/include/transposed-music.hh
+++ /dev/null
@@ -1,25 +0,0 @@
-/*   
-  transposed-music.hh -- declare Transposed_music
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#ifndef TRANSPOSED_MUSIC_HH
-#define TRANSPOSED_MUSIC_HH
-
-#include "music-wrapper.hh"
-
-class Transposed_music : public Music_wrapper
-{
-public:
-  Transposed_music (SCM);
-  VIRTUAL_COPY_CONSTRUCTOR (Music, Transposed_music);
-
-  virtual Pitch to_relative_octave (Pitch);
-};
-
-#endif /* TRANSPOSED_MUSIC_HH */
-
diff --git a/lily/include/un-relativable-music.hh b/lily/include/un-relativable-music.hh
deleted file mode 100644
index 09460a9ab3..0000000000
--- a/lily/include/un-relativable-music.hh
+++ /dev/null
@@ -1,25 +0,0 @@
-/*   
-  un-relativable-music.hh -- declare Un_relativable_music
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 2001--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#ifndef UN_RELATIVABLE_MUSIC_HH
-#define UN_RELATIVABLE_MUSIC_HH
-
-#include "music-wrapper.hh"
-
-class Un_relativable_music: public Music_wrapper
-{
-public:
-  Un_relativable_music (SCM);
-  VIRTUAL_COPY_CONSTRUCTOR (Music, Un_relativable_music);
-
-  Pitch to_relative_octave (Pitch);
-};
-
-#endif /* UN_RELATIVABLE_MUSIC_HH */
-
diff --git a/lily/include/untransposable-music.hh b/lily/include/untransposable-music.hh
deleted file mode 100644
index e240f96572..0000000000
--- a/lily/include/untransposable-music.hh
+++ /dev/null
@@ -1,26 +0,0 @@
-/*   
-  untransposable-music.hh -- declare Untransposable_music
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 2001--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#ifndef UNTRANSPOSABLE_MUSIC_HH
-#define UNTRANSPOSABLE_MUSIC_HH
-
-#include "music-wrapper.hh"
-
-class Untransposable_music : public Music_wrapper
-{
-public:
-  Untransposable_music (SCM);
-  VIRTUAL_COPY_CONSTRUCTOR (Music, Untransposable_music);
-
-  virtual Pitch to_relative_octave (Pitch);
-};
-
-
-#endif /* UNTRANSPOSABLE_MUSIC_HH */
-
diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc
index 150cc9cba4..c56558a4ad 100644
--- a/lily/music-sequence.cc
+++ b/lily/music-sequence.cc
@@ -6,21 +6,11 @@
   (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "music-list.hh"
 #include "warn.hh"
+#include "scm-option.hh"
 #include "pitch.hh"
 #include "input.hh"
-
-Music_sequence::Music_sequence (SCM x)
-  : Music (x)
-{
-}
-
-SCM
-Music_sequence::music_list () const
-{
-  return get_property ("elements");
-}
+#include "music-sequence.hh"
 
 void
 transpose_music_list (SCM lst, Pitch rq)
@@ -116,7 +106,7 @@ music_list_to_relative (SCM l,Pitch p, bool ret_first)
 	}
     }
 
-  return  (ret_first)?  first : last;
+  return (ret_first) ? first : last;
 }
 
 
@@ -127,8 +117,6 @@ compress_music_list (SCM l, Moment m)
     unsmob_music (scm_car (s))->compress (m);
 }
 
-ADD_MUSIC (Music_sequence);
-
 Moment
 Music_sequence::minimum_start (SCM l)
 {
@@ -157,4 +145,36 @@ Music_sequence::first_start (SCM l)
   return m;
 }
 
+MAKE_SCHEME_CALLBACK(Music_sequence, simultaneous_relative_callback, 2);
+SCM
+Music_sequence::simultaneous_relative_callback (SCM music, SCM pitch)
+{
+  Music *me = unsmob_music (music);
+  Pitch p = *unsmob_pitch (pitch);
+
+  SCM elts = me->get_property ("elements"); 
+
+  Pitch retval = music_list_to_relative (elts, p, false);
+  if (lily_1_8_relative)
+    {
+      Pitch retval_1_8 = music_list_to_relative (elts, p, true);
+      if (retval_1_8 != retval)
+	lily_1_8_compatibility_used = true;
+
+      retval = retval_1_8;
+    }
+
+  return retval.smobbed_copy ();
+}
+
 
+MAKE_SCHEME_CALLBACK(Music_sequence,event_chord_relative_callback,2);
+SCM
+Music_sequence::event_chord_relative_callback (SCM music, SCM pitch)
+{
+  Music *me = unsmob_music (music);
+  Pitch p = *unsmob_pitch (pitch);
+  return music_list_to_relative (me->get_property ("elements"),
+				 p, true).smobbed_copy ();
+}
+  
diff --git a/lily/music.cc b/lily/music.cc
index 645b5d1846..04ab151b25 100644
--- a/lily/music.cc
+++ b/lily/music.cc
@@ -7,12 +7,11 @@
 */
 
 #include "music.hh"
-
+#include "music-sequence.hh"
 #include "duration.hh"
 #include "input-smob.hh"
 #include "ly-smobs.icc"
 #include "main.hh"
-#include "music-list.hh"
 #include "pitch.hh"
 #include "score.hh"
 #include "warn.hh"
@@ -158,15 +157,46 @@ Music::print_smob (SCM s, SCM p, scm_print_state*)
 }
 
 Pitch
-Music::to_relative_octave (Pitch p)
+Music::to_relative_octave (Pitch last)
 {
+  SCM callback = get_property ("to-relative-callback");
+  if (ly_c_procedure_p (callback))
+    {
+      Pitch * p = unsmob_pitch (scm_call_2 (callback, self_scm(), last.smobbed_copy ()));
+      return *p;
+    }
+
   SCM elt = get_property ("element");
+  Pitch *old_pit = unsmob_pitch (get_property ("pitch"));
+  if (old_pit)
+    {
+      Pitch new_pit = *old_pit;
+      new_pit = new_pit.to_relative_octave (last);
 
+      SCM check = get_property ("absolute-octave");
+      if (scm_is_number (check) &&
+	  new_pit.get_octave () != scm_to_int (check))
+	{
+	  Pitch expected_pit (scm_to_int (check),
+			      new_pit.get_notename (),
+			      new_pit.get_alteration ());
+	  origin ()->warning (_f ("octave check failed; expected %s, found: %s",
+				  expected_pit.to_string (),
+				  new_pit.to_string ()));
+	  new_pit = expected_pit;
+	}
+      
+      set_property ("pitch", new_pit.smobbed_copy ());
+  
+      last = new_pit;
+    }
+
+  
   if (Music *m = unsmob_music (elt))
-    p = m->to_relative_octave (p);
+    last = m->to_relative_octave (last);
 
-  p = music_list_to_relative (get_property ("elements"), p, false);
-  return p;
+  last = music_list_to_relative (get_property ("elements"), last, false);
+  return last;
 }
 
 void
diff --git a/lily/output-property-music-iterator.cc b/lily/output-property-music-iterator.cc
index af85ee2d00..4ba83ca523 100644
--- a/lily/output-property-music-iterator.cc
+++ b/lily/output-property-music-iterator.cc
@@ -7,8 +7,8 @@
  */
 
 #include "input.hh"
-#include "music-list.hh"
 #include "simple-music-iterator.hh"
+#include "music.hh"
 
 class Output_property_music_iterator : public Simple_music_iterator
 {
diff --git a/lily/parser.yy b/lily/parser.yy
index 58cafdf098..9248c534a9 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -36,8 +36,6 @@ TODO:
 #include "lilypond-input-version.hh"
 #include "main.hh"
 #include "misc.hh"
-#include "music-list.hh"
-#include "music-sequence.hh"
 #include "lily-lexer.hh"
 #include "lily-parser.hh"
 #include "paper-book.hh"
diff --git a/lily/relative-octave-check.cc b/lily/relative-octave-check.cc
index f751dc1e24..9ce7c5d88d 100644
--- a/lily/relative-octave-check.cc
+++ b/lily/relative-octave-check.cc
@@ -7,16 +7,25 @@
 
 */
 
-#include "relative-octave-check.hh"
-
+#include "music.hh"
 #include "input.hh"
 #include "pitch.hh"
 
-Pitch
-Relative_octave_check::to_relative_octave (Pitch p)
+class Relative_octave_check
 {
-  Pitch * check_p = unsmob_pitch (get_property ("pitch"));
+public:
+  DECLARE_SCHEME_CALLBACK(relative_callback,(SCM,SCM));
+};
+
 
+MAKE_SCHEME_CALLBACK(Relative_octave_check, relative_callback, 2)
+SCM
+Relative_octave_check::relative_callback (SCM music, SCM last_pitch)
+{
+  Pitch p = *unsmob_pitch (last_pitch);
+  Music *m = unsmob_music (music); 
+  Pitch *check_p = unsmob_pitch (m->get_property ("pitch"));
+  
   int delta_oct = 0;
   if (check_p)
     {
@@ -31,20 +40,12 @@ Relative_octave_check::to_relative_octave (Pitch p)
 	  String s = _("Failed octave check, got: ");
 	  s += result.to_string ();
 	  
-	  origin ()->warning (s);
+	  m->origin ()->warning (s);
 	  
 	  delta_oct = check_p->get_octave () - result.get_octave ();
 	}
     }
   
-  return  Pitch (p.get_octave () + delta_oct,
-		 p.get_notename (), p.get_alteration ());
+  return Pitch (p.get_octave () + delta_oct,
+		p.get_notename (), p.get_alteration ()).smobbed_copy ();
 }
-
-
-Relative_octave_check::Relative_octave_check (SCM x)
-  : Music (x)
-{
-}
-
-ADD_MUSIC (Relative_octave_check);
diff --git a/lily/relative-octave-music.cc b/lily/relative-octave-music.cc
index 0d3cdf5552..3732808d09 100644
--- a/lily/relative-octave-music.cc
+++ b/lily/relative-octave-music.cc
@@ -7,36 +7,47 @@
   
  */
 
-#include "relative-music.hh"
+#include "music.hh"
+#include "pitch.hh"
 #include "warn.hh"
 #include "scm-option.hh"
 
-Pitch
-Relative_octave_music::to_relative_octave (Pitch p)
+
+class Relative_octave_music
+{
+public:
+  DECLARE_SCHEME_CALLBACK(relative_callback,(SCM,SCM));
+  DECLARE_SCHEME_CALLBACK(no_relative_callback,(SCM,SCM));
+};
+
+MAKE_SCHEME_CALLBACK(Relative_octave_music,no_relative_callback,2)
+SCM
+Relative_octave_music::no_relative_callback (SCM music, SCM pitch)
+{
+  (void)music;
+  return pitch;
+}
+
+MAKE_SCHEME_CALLBACK(Relative_octave_music,relative_callback,2)
+SCM
+Relative_octave_music::relative_callback (SCM music, SCM pitch)
 {
+  Music *me = unsmob_music (music);
   if (lily_1_8_relative)
     {
       lily_1_8_compatibility_used = true;
       /*  last-pitch should be junked some time, when
 	  we ditch 1.8 compat too.
-
+cvs-
 	 When you do, B should start where A left off.
 
 	\relative { A \relative { ...} B }  */
-      Pitch *ptr = unsmob_pitch (get_property ("last-pitch"));
-      return (ptr) ?  *ptr : p;
+      SCM last_pitch = me->get_property ("last-pitch");
+      Pitch *ptr = unsmob_pitch (last_pitch);
+      return (ptr) ?  last_pitch : pitch;
     }
   else
-    return p;
+    return pitch;
 }
 
 
-Relative_octave_music::Relative_octave_music (SCM x)
-  : Music_wrapper (x)
-{
-  
-}
-
-ADD_MUSIC (Relative_octave_music);
-
-
diff --git a/lily/repeated-music.cc b/lily/repeated-music.cc
index 90764d987e..3773567913 100644
--- a/lily/repeated-music.cc
+++ b/lily/repeated-music.cc
@@ -8,8 +8,7 @@
  */
 
 #include "repeated-music.hh"
-
-#include "music-list.hh"
+#include "music-sequence.hh"
 #include "pitch.hh"
 #include "warn.hh"
 #include "scm-option.hh"
diff --git a/lily/sequential-iterator.cc b/lily/sequential-iterator.cc
index d822c61b86..e5640980ea 100644
--- a/lily/sequential-iterator.cc
+++ b/lily/sequential-iterator.cc
@@ -7,10 +7,9 @@
 */
 
 #include "sequential-iterator.hh"
-
+#include "music.hh"
 #include "translator-group.hh"
 #include "context.hh"
-#include "music-list.hh"
 #include "grace-fixup.hh"
 
 /*
diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc
index acb21ddba0..3fe1319b9f 100644
--- a/lily/sequential-music-iterator.cc
+++ b/lily/sequential-music-iterator.cc
@@ -6,11 +6,10 @@
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "sequential-music-iterator.hh"
-
 #include "context.hh"
+#include "sequential-music-iterator.hh"
+#include "music.hh"
 #include "warn.hh"
-#include "music-list.hh"
 
 IMPLEMENT_CTOR_CALLBACK (Sequential_music_iterator);
 
diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc
index c3294832b8..672c08bf73 100644
--- a/lily/simultaneous-music-iterator.cc
+++ b/lily/simultaneous-music-iterator.cc
@@ -7,10 +7,9 @@
 */
 
 #include "simultaneous-music-iterator.hh"
-
+#include "music.hh"
 #include "context.hh"
 #include "warn.hh"
-#include "music-list.hh"
 #include "context-def.hh"
 
 Simultaneous_music_iterator::Simultaneous_music_iterator ()
diff --git a/lily/simultaneous-music.cc b/lily/simultaneous-music.cc
index 3441103c89..e69de29bb2 100644
--- a/lily/simultaneous-music.cc
+++ b/lily/simultaneous-music.cc
@@ -1,49 +0,0 @@
-/*   
-  simultaneous-music.cc --  implement Simultaneous_music
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 1998--2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
-*/
-
-#include "input.hh"
-#include "pitch.hh"
-#include "music-list.hh"
-#include "scm-option.hh"
-
-Simultaneous_music::Simultaneous_music (SCM x)
-  : Music_sequence (x)
-{
-
-}
-
-Pitch
-Simultaneous_music::to_relative_octave (Pitch p)
-{
-  Pitch retval = music_list_to_relative (music_list (), p, false);
-  if (lily_1_8_relative)
-    {
-      Pitch retval_1_8 = music_list_to_relative (music_list (), p, true);
-      if (retval_1_8 != retval)
-	lily_1_8_compatibility_used = true;
-
-      retval = retval_1_8;
-    }
-
-  return retval;
-}
-ADD_MUSIC (Simultaneous_music);
-
-Pitch
-Event_chord::to_relative_octave (Pitch p)
-{
-  return music_list_to_relative (music_list (), p, true);
-}
-
-Event_chord::Event_chord (SCM x)
-  : Simultaneous_music (x)
-{
-}
-
-ADD_MUSIC (Event_chord);
diff --git a/lily/transposed-music.cc b/lily/transposed-music.cc
deleted file mode 100644
index b394b7c096..0000000000
--- a/lily/transposed-music.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-/*   
-  transposed-music.cc --  implement Transposed_music
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#include "transposed-music.hh"
-
-#include "warn.hh"
-
-Pitch
-Transposed_music::to_relative_octave (Pitch p)
-{
-  return p;
-}
-
-ADD_MUSIC (Transposed_music);
-
-Transposed_music::Transposed_music (SCM x)
-  : Music_wrapper (x)
-{
-
-}
diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc
index 9d8e6acd3f..e2983fbabf 100644
--- a/lily/tuplet-engraver.cc
+++ b/lily/tuplet-engraver.cc
@@ -10,7 +10,6 @@
 #include "tuplet-bracket.hh"
 #include "note-column.hh"
 #include "beam.hh"
-#include "music-list.hh"
 #include "engraver.hh"
 #include "spanner.hh"
 
diff --git a/lily/un-relativable-music.cc b/lily/un-relativable-music.cc
deleted file mode 100644
index af6a4dc2b8..0000000000
--- a/lily/un-relativable-music.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-/*   
-  un-relativable-music.cc --  implement Un_relativable_music
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 2001--2004  Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#include "un-relativable-music.hh"
-
-Un_relativable_music::Un_relativable_music (SCM x)
-  : Music_wrapper (x)
-{
-}
-
-Pitch
-Un_relativable_music::to_relative_octave (Pitch p)
-{
-  return p;
-}
-
-ADD_MUSIC (Un_relativable_music);
-
diff --git a/lily/untransposable-music.cc b/lily/untransposable-music.cc
deleted file mode 100644
index e791bde068..0000000000
--- a/lily/untransposable-music.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-/*   
-untransposable-music.cc --  implement Untransposable_music
-
-source file of the GNU LilyPond music typesetter
-
-(c) 2001--2004  Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#include "untransposable-music.hh"
-
-Pitch
-Untransposable_music::to_relative_octave (Pitch p)
-{
-  return p;
-}
-
-ADD_MUSIC (Untransposable_music);
-
-Untransposable_music::Untransposable_music (SCM init)
-  : Music_wrapper (init)
-{
-
-}
diff --git a/scm/define-music-properties.scm b/scm/define-music-properties.scm
index 0dc5913765..e5329cf1a2 100644
--- a/scm/define-music-properties.scm
+++ b/scm/define-music-properties.scm
@@ -87,7 +87,6 @@ For chord inversions, this is negative.")
      (quoted-voice-direction ,ly:dir? "Should the quoted voice be up-stem or down-stem?")
      (quoted-context-type ,symbol? "The name of the context to direct quotes to, eg., @code{Voice}.")
      (quoted-context-id ,string? "The id of the context to direct quotes to, eg., @code{cue}.")
-
      (to-relative-callback ,procedure? "How to transform a piece of music to relative pitches")
      (repeat-count  ,integer? "do a @code{\repeat} how ofen?")
      (span-direction ,ly:dir? "Does this start or stop a spanner?")
diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm
index 96a4b37076..af47663473 100644
--- a/scm/define-music-types.scm
+++ b/scm/define-music-types.scm
@@ -352,7 +352,7 @@ SYNTAX
      . (
 	(description .	"Combine two parts on a staff, either merged or
 as separate voices.")
-	(internal-class-name . "Simultaneous_music")
+	(internal-class-name . "Music")
 	(length-callback . ,Music_sequence::maximum_length_callback)
 	(start-callback . ,Music_sequence::minimum_start_callback)
 	(types . (general-music part-combine-music))
@@ -406,7 +406,8 @@ goes down).")
     
     (RelativeOctaveCheck
      . ((description . "Check if a pitch is in the correct octave.")
-	(internal-class-name . "Relative_octave_check")
+	(internal-class-name . "Music")
+	(to-relative-callback . ,Relative_octave_check::relative_callback)
 	(types . (general-music relative-octave-check))
 	))
     
@@ -499,10 +500,11 @@ SYNTAX
 
 @code{ \\simultaneous @{ .. @}} or < .. >.")
 
-	(internal-class-name . "Simultaneous_music")
+	(internal-class-name . "Music")
 	(iterator-ctor . ,Simultaneous_music_iterator::constructor)
 	(start-callback . ,Music_sequence::minimum_start_callback)
 	(length-callback . ,Music_sequence::maximum_length_callback)
+	(to-relative-callback . ,Music_sequence::simultaneous_relative_callback)
 	
 	(types . (general-music simultaneous-music))
 	))
@@ -567,14 +569,16 @@ Syntax @code{\\times @var{fraction} @var{music}}, e.g.
      . (
 	(description .	"Music that has been transposed.")
 	(internal-class-name . "Transposed_music")
+	(to-relative-callback . ,Relative_octave_music::no_relative_callback)
 	(types . (music-wrapper-music general-music transposed-music))
 	))
 
     (UntransposableMusic
      . (
 	(description .	"Music that can not be transposed.")
+	(to-relative-callback . ,Relative_octave_music::no_relative_callback)
 	(untransposable . #t)
-	(internal-class-name . "Untransposable_music")
+	(internal-class-name . "Music_wrapper")
 	(types . (music-wrapper-music general-music untransposable-music)) 
 	))
 
@@ -582,6 +586,7 @@ Syntax @code{\\times @var{fraction} @var{music}}, e.g.
      . (
 	(description .	"Music that can not be converted from relative to absolute notation.
 For example, transposed music.")
+	(to-relative-callback . ,Relative_octave_music::no_relative_callback)
 	(internal-class-name . "Un_relativable_music")
 	(types . (music-wrapper-music general-music unrelativable-music))
 	))
@@ -589,20 +594,20 @@ For example, transposed music.")
     (RelativeOctaveMusic
      . (
 	(description .	"Music that was entered in relative octave notation.")
-
-	(internal-class-name . "Relative_octave_music")
+	(to-relative-callback . ,Relative_octave_music::relative_callback)
+	(internal-class-name . "Music_wrapper")
 	(types . (music-wrapper-music general-music relative-octave-music))
 	))
     
     (EventChord
      . (
 	(description .	"Internally used to group a set of events.")
-	(internal-class-name . "Event_chord")
+	(internal-class-name . "Music")
 	(iterator-ctor . ,Event_chord_iterator::constructor)
 	(length-callback . ,Music_sequence::maximum_length_callback)
+	(to-relative-callback . ,Music_sequence::event_chord_relative_callback)
 	(types . (general-music event-chord simultaneous-music))
-	)
-     )
+	))
     
     (ScriptEvent
      . (
-- 
2.39.5