Generated by hanwen@cs.uu.nl,
From = lilypond-1.5.57, To = lilypond-1.5.58

usage 

    cd lilypond-source-dir; patch -E -p1 < lilypond-1.5.57-1.5.58.diff

Patches do not contain automatically generated files 
or (urg) empty directories, 
i.e., you should rerun autoconf, configure

diff -purN ../lilypond-1.5.57/ChangeLog ./ChangeLog
--- ../lilypond-1.5.57/ChangeLog	Sun May 19 02:16:28 2002
+++ ./ChangeLog	Wed May 22 11:33:37 2002
@@ -1,3 +1,75 @@
+2002-05-22  Han-Wen  <hanwen@cs.uu.nl>
+
+	* mf/feta-beugel.mf (code): use autometric macros for braces.
+	This fixes input/bugs/braces.
+
+	* lily/afm.cc (count): return numOfChars, not size of array
+	(always equals 256.)
+
+	* lily/script.cc (before_line_breaking): postpone setting the
+	X-parent of vertical scripts. This fixes the case of scripts on
+	chords with seconds 
+
+2002-05-21  Han-Wen  <hanwen@cs.uu.nl>
+
+	* scm/grob-description.scm:  fix alignment of barnumber: make sure
+	it doesn't hit the G-clef. 
+
+	* input/mozart-hrn3-defs.ly (startGraceMusic): typo (it's
+	startGraceMusic not startGraceContext).
+
+2002-05-20  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* stepmake/autogen.sh: Check for autoconf2.13, and abort if not
+	found.
+
+2002-05-20  Han-Wen  <hanwen@cs.uu.nl>
+
+	* lily/accidental-engraver.cc: remove old accidental engraver,
+	move new one to accidental-engraver.cc.
+
+	* lily/local-key-item.cc: remove file
+
+	* lily/include/local-key-item.hh: remove file
+
+	* scripts/ly2dvi.py (make_preview): add --preview-resolution
+	option.
+
+	* lily/accidental.cc (brew_molecule): support for cautionary
+	accidentals. 
+
+	* lily/note-head.cc (internal_brew_molecule): warn if note head
+	not found.
+
+	* lily/time-signature.cc (special_time_signature): remove warning
+	about time signature. 
+
+	* lily/spacing-spanner.cc (musical_column_spacing): Prevent
+	reverse springs by limiting fixed-note space.
+
+2002-05-19  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* stepmake/aclocal.m4: Bugfix: complain if program not found.
+
+	* scripts/update-lily.py (next_version, prev_version, diff_name):
+	New function.  Patches now named name-prev-latest.diff.gz.
+	Bugfix: import shutil.
+
+2002-05-19  Han-Wen  <hanwen@cs.uu.nl>
+
+	* input/tutorial/sammartini.ly: fix and document autochange
+	weirdness.
+
+	* scm/pdftex.scm: resurrect PDFTeX output. Still doesn't work, but
+	does produce .pdftex files.
+
+	* lily/note-collision.cc (check_meshing_chords): move file from
+	collision.cc, implement merged note heads (there you go, Drarn :-)
+
+	* input/regression/collision-heads.ly: new file
+
+	* VERSION: 1.5.57 released.
+
 2002-05-18  Juergen Reuter  <reuter@ipd.uka.de>
 
 	* mf/parmesan-heads.mf, scm/grob-description.scm,
diff -purN ../lilypond-1.5.57/Documentation/regression-test.tely ./Documentation/regression-test.tely
--- ../lilypond-1.5.57/Documentation/regression-test.tely	Sat May  4 14:57:28 2002
+++ ./Documentation/regression-test.tely	Tue May 21 00:05:01 2002
@@ -55,6 +55,8 @@ documenting bugfixes.
 
 @lilypondfile[printfilename]{accidental.ly}
 
+@lilypondfile[printfilename]{accidental-cautionary.ly}
+
 @lilypondfile[printfilename]{accidental-placement.ly}
 
 @lilypondfile[printfilename]{accidental-single-double.ly}
@@ -248,6 +250,8 @@ Grace note do weird things with timing. 
 
 @lilypondfile[printfilename]{collision-dots.ly}
 
+@lilypondfile[printfilename]{collision-heads.ly}
+
 @lilypondfile[printfilename]{collision-mesh.ly}
 
 @lilypondfile[printfilename]{number-staff-lines.ly}
diff -purN ../lilypond-1.5.57/Documentation/user/refman.itely ./Documentation/user/refman.itely
--- ../lilypond-1.5.57/Documentation/user/refman.itely	Sun May 19 02:11:55 2002
+++ ./Documentation/user/refman.itely	Wed May 22 11:49:26 2002
@@ -1,6 +1,4 @@
-
-
-@c Note:
+@c Note: -*-texinfo-*-
 @c
 @c A menu is needed before every deeper *section nesting of @node's; run
 @c     M-x texinfo-all-menus-update
@@ -1458,7 +1456,7 @@ Unbeamed eighth notes and shorter by def
 stem.
 
 @lilypond[fragment,verbatim]
-\relative c'' {
+\relative c'' \context Voice {
   \grace c8 c4 \grace { [c16 c16] } c4
   \grace { 
     \property Voice.Stem \override #'flag-style = #'() 
@@ -1638,6 +1636,7 @@ Make beat or measure repeats. These look
 
 @menu
 * Repeat syntax::               
+* Repeats and MIDI::            
 * Manual repeat commands::      
 * Tremolo repeats::             
 * Tremolo subdivisions::        
@@ -1700,11 +1699,13 @@ the specified number of repeats.
 }
 @end lilypond
 
-@subsection Unfolding repeats for MIDI output.
+@node Repeats and MIDI
+@subsection Repeats and MIDI
 
 @cindex expanding repeats
 
-See @file{input/test/unfold-all-repeats.ly}. 
+For instructions on how to unfoldi repeats for MIDI output, see
+the example file @file{input/test/unfold-all-repeats.ly}.
 
 
 @refbugs
@@ -1883,13 +1884,16 @@ other pianistic peculiarities.
 Voices can switch automatically between the top and the bottom
 staff. The syntax for this is
 @example
-        \autochange @var{contexttype} @var{musicexp}
+        \autochange @var{contexttype} \context @var{childcontexttype}
+     		@var{musicexp} 
 @end example
-This will switch the interpretation context of @var{musicexp} between a
-@var{contexttype} named @code{up} and @code{down}. Typically, you use
-@internalsref{Staff} for @var{contexttype}.  The autochanger switches on basis
-of pitch (central C is the turning point), and it looks ahead skipping
-over rests to switch rests in advance.
+@c
+This will switch the interpretation context of @var{musicexp} between
+a @var{contexttype} named @code{up} and @code{down}. Typically, you
+use @internalsref{Staff} for @var{contexttype}, and
+@internalsref{Voice} for @var{childcontexttype}. The autochanger
+switches on basis of pitch (central C is the turning point), and it
+looks ahead skipping over rests to switch rests in advance.
         
 @lilypond[verbatim,singleline]
 \score { \notes \context PianoStaff <
diff -purN ../lilypond-1.5.57/Documentation/user/tutorial.itely ./Documentation/user/tutorial.itely
--- ../lilypond-1.5.57/Documentation/user/tutorial.itely	Sun Apr 28 01:02:00 2002
+++ ./Documentation/user/tutorial.itely	Tue May 21 00:05:02 2002
@@ -1019,6 +1019,10 @@ The following piece of music is played t
 indicates the type of repeat.  In this case, @code{"volta"} means that
 prima volta/secunda volta brackets are used for the alternative
 endings---if there were any.
+
+A special notation for repeats allows you to get correct repeats in
+MIDI output. However, some extra trickery is needed to get this
+working, See @ref{Repeats and MIDI}.  
 @separate
 @example 
 
@@ -1822,10 +1826,10 @@ will be at the left.
 @node A piano excerpt
 @section A piano excerpt
 
-Our fourth subject is a piece of piano music.  The fragment in the input
-file is a piano reduction of the G major Sinfonia by Giovanni Battista
-Sammartini.  It was composed around 1740.  It's in the source package
-under  the name @file{sammartini.ly}.
+Our fourth subject is a piece of piano music.  The fragment in the
+input file is a piano reduction of the G major Sinfonia by Giovanni
+Battista Sammartini.  It was composed around 1740.  It's in the source
+package under the name @file{sammartini.ly}.
 
 @lilypond[verbatim]
 \include "paper16.ly"
@@ -1864,11 +1868,11 @@ oboes = \notes \relative c'' \context Vo
 }
 
 hoomPah = \repeat unfold 8 \notes
-    \transpose c' { \stemUp c8 \stemBoth \stemDown c'8 \stemBoth }
+    \transpose c' { \stemUp c8 \stemBoth \stemDown g'8 \stemBoth }
 
 bassvoices = \notes \relative c' {
     c4 g8. b,16
-    \autochange Staff \hoomPah
+    \autochange Staff \context Voice \hoomPah
     \translator Staff = down
     \stemDown [c8 c'8] r4
     <g d'> r4
@@ -2135,7 +2139,7 @@ having to worry about getting the motive
 @example 
 bassvoices = \notes \relative c' @{
 c4 g8. b,16
-\autochange Staff \hoomPah 
+\autochange Staff \hoomPah \context Voice
 @end example
 @cindex staff switch, automatic
 @cindex cross staff voice, automatic
diff -purN ../lilypond-1.5.57/Documentation/windows/installing.texi ./Documentation/windows/installing.texi
--- ../lilypond-1.5.57/Documentation/windows/installing.texi	Fri Apr 12 09:57:05 2002
+++ ./Documentation/windows/installing.texi	Tue May 21 14:55:18 2002
@@ -76,9 +76,8 @@ Enter the following into the file
 
 @end example
 @end quotation
-Close the file and save it. Run the following command a few times (at
-least three times) until it says @code{PS output to `foo.ps', DVI output
-to `foo.dvi'}.
+Close the file and save it. Run the following command. It should say
+@code{PS output to `foo.ps', DVI output to `foo.dvi'}.
 @quotation
 @example
 
diff -purN ../lilypond-1.5.57/NEWS ./NEWS
--- ../lilypond-1.5.57/NEWS	Sun Apr 21 01:02:55 2002
+++ ./NEWS	Tue May 21 00:05:01 2002
@@ -3,16 +3,23 @@ New features in 1.5
 
 * Many speedups, many slowdowns.
 
+* More extensibility
+
 * Figured bass support
 
 * Improved beam formatting.
 
 * Improved grace notes.
 
-* Better spacing.
+* Improved accidental handling and formatting
+
+* Better spacing. Includes subtle details like optical stem spacing.
+
+* More ancient notation support: mensural ligatures, porrectuses, more
+shapes.
 
-* More ancient notation support.
+* Bracket piano pedals.
 
 * Some entry optimizations.
 
-* Font updated and improved.
+* Font completely revised and improved.
diff -purN ../lilypond-1.5.57/VERSION ./VERSION
--- ../lilypond-1.5.57/VERSION	Sun May 19 02:23:13 2002
+++ ./VERSION	Tue May 21 12:36:49 2002
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
-PATCH_LEVEL=57
+PATCH_LEVEL=58
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
diff -purN ../lilypond-1.5.57/aclocal.m4 ./aclocal.m4
--- ../lilypond-1.5.57/aclocal.m4	Sun May 19 02:23:17 2002
+++ ./aclocal.m4	Tue May 21 00:05:15 2002
@@ -58,11 +58,11 @@ AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
 # Return if tested proram ($1) was found (true) or not (false).
 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
     r="`eval echo '$'"$1"`"
-    if test -n "$r" -a "$r" != "error" -a "$r" != "no" && ! expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
+    if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
+	true
+    else
 	##STEPMAKE_WARN(cannot find $2. $3)
 	false
-    else
-	true
     fi
 ])
 
@@ -599,8 +599,9 @@ AC_DEFUN(STEPMAKE_INIT, [
     AC_SUBST(INSTALL)
     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
-    AC_SUBST(PATHSEP)
     AC_SUBST(DIRSEP)
+    AC_SUBST(PATHSEP)
+    AC_SUBST(ROOTSEP)
   
     STEPMAKE_DATADIR
 ])
diff -purN ../lilypond-1.5.57/autogen.sh ./autogen.sh
--- ../lilypond-1.5.57/autogen.sh	Fri May 17 14:09:11 2002
+++ ./autogen.sh	Tue May 21 00:05:15 2002
@@ -7,19 +7,14 @@
 srcdir=`dirname $0`
 DIE=0
 
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
-  echo
-  echo "ERROR: You must have \`autoconf' installed to."
-  echo "Download the appropriate package for your distribution,"
-  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-  DIE=1
-}
-
-if test "$DIE" -eq 1; then
+# autoconf > 2.50 is not very common yet,
+# and disappointingly incompatible with the widely available 2.13
+version=`autoconf --version 2>/dev/null | awk '{print $3}'`
+if test "$version" != "2.13"; then
+  echo "ERROR: Please install autoconf 2.13"
   exit 1
 fi
 
-
 if test -z "$*"; then
   echo "WARNING: I am going to run \`configure' with no arguments."
   echo "If you wish to pass any to it, please specify them on the"
diff -purN ../lilypond-1.5.57/config.make.in ./config.make.in
--- ../lilypond-1.5.57/config.make.in	Sun May 19 02:11:53 2002
+++ ./config.make.in	Tue May 21 00:05:01 2002
@@ -56,6 +56,7 @@ BIBTEX2HTML_FLAGS=@BIBTEX2HTML_FLAGS@
 BISON = @BISON@
 FIND = @FIND@
 FLEX = @FLEX@
+GROFF = @GROFF@
 GUILE = @GUILE@
 GUILE_CONFIG = @GUILE_CONFIG@
 GUILE_CFLAGS = @GUILE_CFLAGS@
@@ -72,7 +73,7 @@ PERL = @PERL@
 PKTRACE = @PKTRACE@
 PYTHON = @PYTHON@
 SHELL = @SHELL@
-TAR= @TAR@
+TAR = @TAR@
 TBL = @TBL@
 TROFF = @TROFF@
 ZIP = @ZIP@
diff -purN ../lilypond-1.5.57/input/bugs/accid.ly ./input/bugs/accid.ly
--- ../lilypond-1.5.57/input/bugs/accid.ly	Mon Aug 13 16:21:14 2001
+++ ./input/bugs/accid.ly	Thu Jan  1 01:00:00 1970
@@ -1,11 +0,0 @@
-\header {
-texidoc="The sharp is printed too far to the left."
-}
-
-\version "1.4.0"
-\score {
-\notes \context Staff <
-  \context Voice = up {\stemUp gis''4}
-  \context Voice = dwn {\stemDown <ces' d'>}
->
-}
diff -purN ../lilypond-1.5.57/input/bugs/accidental-collision.ly ./input/bugs/accidental-collision.ly
--- ../lilypond-1.5.57/input/bugs/accidental-collision.ly	Mon Aug 13 16:33:27 2001
+++ ./input/bugs/accidental-collision.ly	Thu Jan  1 01:00:00 1970
@@ -1,16 +0,0 @@
-\header {
-texidoc="The two sharps overstrike, the flat and sharp overstrike"
-}
-\version "1.3.148"
-
-\include "paper16.ly"
-\score {
-  \notes {
-    \relative c'' \context Voice \sequential {
-     <dis1 ais e> <bes dis>
-   }
-  }
-  \paper{
-      linewidth = 5.0\cm
-  }
-}
diff -purN ../lilypond-1.5.57/input/bugs/bizarre-beam.ly ./input/bugs/bizarre-beam.ly
--- ../lilypond-1.5.57/input/bugs/bizarre-beam.ly	Thu Jan  1 01:00:00 1970
+++ ./input/bugs/bizarre-beam.ly	Wed May 22 11:32:05 2002
@@ -0,0 +1,10 @@
+
+
+\score{ \notes {g''4 [<e'''8 g> g'']
+\notes\relative c'{
+   \times 2/3{[d16 fis' d,]} \times 2/3{[cis g'' cis,,]}
+  a'16 cis a, g''' % Used to give a nice beam directed upwards.
+  <{\stemUp a,,4:32} \context Voice=lower{\stemDown d,:32}>
+
+}
+	    }}
diff -purN ../lilypond-1.5.57/input/bugs/braces.ly ./input/bugs/braces.ly
--- ../lilypond-1.5.57/input/bugs/braces.ly	Mon Aug 13 17:15:14 2001
+++ ./input/bugs/braces.ly	Thu Jan  1 01:00:00 1970
@@ -1,83 +0,0 @@
-\version "1.3.148"
-
-
-\header {
-texidoc = "Braces at different sizes don't attach exactly to the staffs.
-Previously, some braces were too small, while others were too big; this was
-apparently caused by dvips + mf rounding.  Now, braces are just a bit
-too big."
-}
-
-\include "paper11.ly"
-\paper { linewidth = -1.0 }
-
-\score {
-  \context GrandStaff <
-    \context Staff = a \notes c''1
-    \context Staff = b \notes c''1
-  >
-}
-
-
-\include "paper13.ly"
-\paper { linewidth = -1.0 }
-
-\score {
-  \context GrandStaff <
-    \context Staff = a \notes c''1
-    \context Staff = b \notes c''1
-  >
-  \paper {
-    \translator {
-      \GrandStaffContext
-      SystemStartDelimiter \override #'weird = #-5
-    }
-  }
-}
-
-
-\include "paper16.ly"
-\paper { linewidth = -1.0 }
-
-\score {
-  \context GrandStaff <
-    \context Staff = a \notes c''1
-    \context Staff = b \notes c''1
-  >
-  \paper {
-    \translator {
-      \GrandStaffContext
-      SystemStartDelimiter \override #'weird = #5
-    }
-  }
-}
-
-
-\include "paper20.ly"
-\paper { linewidth = -1.0 }
-
-\score {
-  \context GrandStaff <
-    \context Staff = a \notes c''1
-    \context Staff = b \notes c''1
-  >
-  \paper {
-    \translator {
-      \GrandStaffContext
-      SystemStartDelimiter \override #'weird = #-7
-    }
-  }
-}
-
-
-\include "paper26.ly"
-\paper { linewidth = -1.0 }
-
-\score {
-  \context GrandStaff <
-    \context Staff = a \notes c''1
-    \context Staff = b \notes c''1
-    \context Staff = c \notes c''1
-    \context Staff = d \notes c''1
-  >
-}
diff -purN ../lilypond-1.5.57/input/bugs/time.ly ./input/bugs/time.ly
--- ../lilypond-1.5.57/input/bugs/time.ly	Mon Aug 13 18:15:54 2001
+++ ./input/bugs/time.ly	Thu Jan  1 01:00:00 1970
@@ -1,11 +0,0 @@
-\version "1.3.148"
-\header {
-texidoc="Should use old style."
-}
-
-\score {
-  \notes { 
-    \property Staff.TimeSignature \override #'style = #'oldC4/4
-    s1 
-  }
-}
diff -purN ../lilypond-1.5.57/input/mozart-hrn-3.ly ./input/mozart-hrn-3.ly
--- ../lilypond-1.5.57/input/mozart-hrn-3.ly	Sat May  4 14:57:28 2002
+++ ./input/mozart-hrn-3.ly	Wed May 22 11:32:05 2002
@@ -15,8 +15,9 @@
   maintainer = "hanwen@cs.uu.nl"
   maintainerEmail = "hanwen@cs.uu.nl"
   maintainerWeb = "http://www.cs.uu.nl/~hanwen/"	
-  lastupdated = "2002/March/26"
+  lastupdated = "2002/May/21"
   source = "Edition Breitkopf 2563"
+  footer = "Mutopia-2002/05/21-25"
 
   tagline =  "\\parbox{\hsize}{\\thefooter\\quad\\small This music is part of the Mutopia project, \\texttt{http://sca.uwaterloo.ca/Mutopia/}. It has been typeset and placed in the public domain by " + \maintainer + ". Unrestricted modification and redistribution is permitted and encouraged---copy this music and share it!}"
 
@@ -29,6 +30,8 @@ virtuoso that taught in Geneva. 
 
 %}
 
+\version "1.5.57"
+
 \include "mozart-hrn3-defs.ly"
 \include "mozart-hrn3-allegro.ly"
 \include "mozart-hrn3-romanze.ly"
diff -purN ../lilypond-1.5.57/input/mozart-hrn3-allegro.ly ./input/mozart-hrn3-allegro.ly
--- ../lilypond-1.5.57/input/mozart-hrn3-allegro.ly	Wed May 15 13:36:29 2002
+++ ./input/mozart-hrn3-allegro.ly	Wed May 22 11:32:05 2002
@@ -1,5 +1,5 @@
 \version "1.5.49"
-%\include  "mozart-hrn3-defs.ly"
+\include  "mozart-hrn3-defs.ly"
 
 allegro =
 	\notes
@@ -17,7 +17,7 @@ allegro =
 	r8 [g' g g] [g g e c]
 	g'4 g, r2
 	R1*18
-	r2 r4 g'4^"Solo" |
+	r2 r4^"Solo" g'4 |
 	\mark "A"
 	e'4. () c8 [f (d c )b ]
 	[b()c] g4 r8 [g c e]
diff -purN ../lilypond-1.5.57/input/mozart-hrn3-defs.ly ./input/mozart-hrn3-defs.ly
--- ../lilypond-1.5.57/input/mozart-hrn3-defs.ly	Wed May 15 13:36:29 2002
+++ ./input/mozart-hrn3-defs.ly	Wed May 22 11:32:05 2002
@@ -27,52 +27,23 @@ cresc = \notes {
     \property Voice.crescendoSpanner = #'dashed-line
 }
 
-startGraceContextOrig = \startGraceContext
+%%
+%% TODO: a better mechanism for tweaking Grace settings.
+%%
 
-startGraceContext = {
-    %% Huh?
-    %% \startGraceContextOrig
-
-    
-    %%URG copy from original
-    \property Voice.Stem \override  #'direction = #1
-    \property Voice.Stem \override #'length = #6
-    \property Voice.Stem \override #'lengths = 
-        #(map (lambda (x) (* 0.8 x)) '(3.5 3.5 3.5 4.5 5.0))
-    \property Voice.Stem \override #'beamed-lengths =
-        #(map (lambda (x) (* 0.8 x)) '(0.0 2.5 2.0 1.5))
-    \property Voice.Stem \override #'beamed-minimum-lengths =
-        #(map (lambda (x) (* 0.8 x)) '(0.0 1.5 1.25 1.0))
-    \property Voice.Stem \override #'no-stem-extend = ##t
-    \property Voice.Stem \override #'flag-style  = #"grace"
-    \property Voice.Beam \override #'thickness = #0.384
-
-    %% Instead of calling Beam::space_function, we should invoke
-    %% the previously active beam function...
-    \property Voice.Beam \override #'space-function =
-      #(lambda (beam mult) (* 0.8 (Beam::space_function beam mult)))
-
-    \property Voice.Beam \override #'position-callbacks =
-      #`(,Beam::least_squares
-	 ,Beam::check_concave
-	 ,Beam::slope_damping)
-    
-    % Can't use Staff.fontSize, since time sigs, keys sigs, etc. will
-    % be smaller as well.
-
-    \property Voice.fontSize = #-2
-    \property Staff.Accidentals \override #'font-relative-size = #-2
-    \property Voice.Slur \override #'direction = #-1
-    %% end copy
-    
-    
-    \property Voice.Beam \revert #'space-function
+startGraceMusic = \sequential { 
+    \startGraceMusic 
     \property Voice.Beam \override #'space-function
        = #(lambda (beam mult) (* 0.8 0.8))
-    \property Voice.Beam \revert #'thickness
     \property Voice.Beam \override #'thickness = #(* 0.384 (/ 0.6 0.48))
 }
 
+stopGraceMusic= \sequential {
+    \property Voice.Beam \revert #'thickness
+    \property Voice.Beam \revert #'space-function
+    \stopGraceMusic
+}
+
 \paper{
     \stylesheet #my-sheet
     \translator {
@@ -95,6 +66,4 @@ startGraceContext = {
     indent = 10. \mm
     linewidth = 189. \mm
 
-    % The piece should fit on 4 pages. 
-    textheight = 275.\mm
 }
diff -purN ../lilypond-1.5.57/input/mozart-hrn3-romanze.ly ./input/mozart-hrn3-romanze.ly
--- ../lilypond-1.5.57/input/mozart-hrn3-romanze.ly	Wed May 15 13:36:29 2002
+++ ./input/mozart-hrn3-romanze.ly	Wed May 22 11:32:05 2002
@@ -1,6 +1,6 @@
 
 \version "1.5.49"
-%\include  "mozart-hrn3-defs.ly"
+\include  "mozart-hrn3-defs.ly"
 
 romanze = \notes \relative c' {
 	\key f \major
@@ -43,13 +43,17 @@ romanze = \notes \relative c' {
 	[d8( e f )d] b4 r8 g
 	[c ()e g g] [g( f e )d]
 	c4(
-	\grace { \longgrace e16 }
+	\grace { \longgrace e16 \endlonggrace }
 	[d8. )c16 \< ] [c8 c-.( c-. \! )c-.]
 	\mark "C"
-	des1\sfp
-	g,1\sfp 
-	c\sfp   
-	c,\sfp  
+
+	%% this is a trick to get the sfp-s to align. 
+	\property Voice.Hairpin \override #'transparent = ##t
+	des1\sfp \> \!
+	g,1\sfp  \> \!
+	c\sfp    \> \!
+	c,\sfp
+	\property Voice.Hairpin \revert #'transparent 
 	R1*3
 	r8 [c-\p c c] c2~
 	[c8 c' c c] c2~
diff -purN ../lilypond-1.5.57/input/regression/accidental-cautionary.ly ./input/regression/accidental-cautionary.ly
--- ../lilypond-1.5.57/input/regression/accidental-cautionary.ly	Thu Jan  1 01:00:00 1970
+++ ./input/regression/accidental-cautionary.ly	Mon May 20 23:36:01 2002
@@ -0,0 +1,13 @@
+\header {
+
+texidoc = "Cautionary accidentals are indicated using either
+smaller accidentals (default) or parentheses."
+
+}
+
+\score { \notes {
+    c''4
+    cis''?4
+    \property Staff.Accidental \override #'cautionary-style = #'parentheses
+    cis''?4
+    }}
diff -purN ../lilypond-1.5.57/input/regression/bar-number.ly ./input/regression/bar-number.ly
--- ../lilypond-1.5.57/input/regression/bar-number.ly	Sat May  4 14:57:28 2002
+++ ./input/regression/bar-number.ly	Wed May 22 11:32:05 2002
@@ -11,7 +11,7 @@ start counting after the anacrusis."
   \notes \relative c'' {
       \partial 4 c4 
       c1 c c
-      \property Score.currentBarNumber = #25
+      \property Score.currentBarNumber = #99999
       \property Score.BarNumber \override #'padding = #3
       c1 c
   }
diff -purN ../lilypond-1.5.57/input/regression/collision-heads.ly ./input/regression/collision-heads.ly
--- ../lilypond-1.5.57/input/regression/collision-heads.ly	Thu Jan  1 01:00:00 1970
+++ ./input/regression/collision-heads.ly	Sun May 19 15:43:09 2002
@@ -0,0 +1,29 @@
+\header {
+    texidoc =
+
+    "If @code{merge-differently-headed}, then
+open note heads may be merged with black noteheads, but only
+if the black note heads are from 8th or shorter notes.
+"
+    
+}
+\score { \notes \context Staff\relative c''<
+\context Voice = VA {
+    \voiceOne
+    c2 c8 c4.
+    
+    \property Staff.NoteCollision \override #'merge-differently-headed = ##t
+    c2
+    c8 c4.
+    c2
+}
+\context Voice = VB {
+    \voiceTwo
+    c8 c4.
+    c2
+    c8 c4.
+    c2
+    c4
+}
+    >
+	 }
diff -purN ../lilypond-1.5.57/input/regression/mensural.ly ./input/regression/mensural.ly
--- ../lilypond-1.5.57/input/regression/mensural.ly	Thu Apr  5 00:02:37 2001
+++ ./input/regression/mensural.ly	Tue May 21 00:05:04 2002
@@ -1,10 +1,16 @@
 \version "1.3.146"
 \header {
-texidoc = "There is limited support for mensural notation: note head shapes are available. Mensural stems are centered on the note heads, both for up and down stems."
+    
+texidoc = "There is limited support for mensural notation: note head
+shapes are available. Mensural stems are centered on the note heads,
+both for up and down stems."
+
 }
 
+
 \score {\notes { \context Voice { 
-\property Voice.NoteHead \override #'style = #'mensural
+    \property Voice.NoteHead \set #'font-family = #'ancient
+    \property Voice.NoteHead \override #'style = #'mensural
 \transpose d''' {  c4 c2 c8  c16 c16  c1 c\breve c\longa }
 \transpose c'' { c4 c2 c8  c16 c16  c1 c\breve c\longa }
 }}}
diff -purN ../lilypond-1.5.57/input/regression/script-collision.ly ./input/regression/script-collision.ly
--- ../lilypond-1.5.57/input/regression/script-collision.ly	Thu Jan  1 01:00:00 1970
+++ ./input/regression/script-collision.ly	Tue May 21 23:58:47 2002
@@ -0,0 +1,16 @@
+
+\header {
+
+    texidoc = "Scripts are put on the utmost head, so they are
+      positioned correctly when there are collisions."
+}
+
+\score  {
+\notes \relative c'' {
+  c4
+  <c d c'-\marcato>
+  < \context Voice = VA { \voiceOne c4^^ }
+    \context Voice = VB { \voiceTwo d4_^} >
+    }
+\paper { linewidth = -1. }
+    }
diff -purN ../lilypond-1.5.57/input/test/ancient-time.ly ./input/test/ancient-time.ly
--- ../lilypond-1.5.57/input/test/ancient-time.ly	Thu Jan  1 01:00:00 1970
+++ ./input/test/ancient-time.ly	Wed May 22 00:39:24 2002
@@ -0,0 +1,12 @@
+\version "1.3.148"
+\header {
+texidoc="Should use old style."
+}
+
+\score {
+  \notes { 
+    \property Staff.TimeSignature \override #'style = #'oldC4/4
+    \property Staff.TimeSignature \override #'font-family = #'ancient
+    s1 
+  }
+}
diff -purN ../lilypond-1.5.57/input/tutorial/sammartini.ly ./input/tutorial/sammartini.ly
--- ../lilypond-1.5.57/input/tutorial/sammartini.ly	Tue Aug 14 18:45:37 2001
+++ ./input/tutorial/sammartini.ly	Tue May 21 00:05:04 2002
@@ -33,11 +33,11 @@ oboes = \notes \relative c'' \context Vo
 }
 
 hoomPah = \repeat unfold 8 \notes
-    \transpose c' { c8 \stemDown c'8 \stemUp }
+    \transpose c' { c8 \stemDown g'8 \stemUp }
 
 bassvoices = \notes \relative c' {
     c4 g8. b,16
-    \autochange Staff \hoomPah
+    \autochange Staff \context Voice \hoomPah
     \translator Staff = down
     \stemDown [c8 c'8] r4
     <g d'> r4
diff -purN ../lilypond-1.5.57/lily/accidental-engraver.cc ./lily/accidental-engraver.cc
--- ../lilypond-1.5.57/lily/accidental-engraver.cc	Sun May  5 21:39:41 2002
+++ ./lily/accidental-engraver.cc	Tue May 21 00:05:05 2002
@@ -7,13 +7,11 @@
 
 #include "musical-request.hh"
 #include "command-request.hh"
-#include "local-key-item.hh"
 #include "item.hh"
 #include "tie.hh"
 #include "rhythmic-head.hh"
 #include "engraver-group-engraver.hh"
-
-#include "staff-symbol-referencer.hh"
+#include "accidental-placement.hh"
 #include "side-position-interface.hh"
 #include "engraver.hh"
 #include "arpeggio.hh"
@@ -32,9 +30,25 @@ tweakable.
 
 */
 
+struct Accidental_entry {
+  bool done_;
+  Note_req * melodic_;
+  Grob * accidental_;
+  Translator_group *origin_;
+  Grob*  head_;
+  Accidental_entry();
+};
+
+Accidental_entry::Accidental_entry()
+{
+  done_ = false;
+  melodic_ =0;
+  accidental_ = 0;
+  origin_ = 0;
+  head_ = 0;
+}
 
 struct Accidental_engraver : Engraver {
-  Item *key_item_p_;
 protected:
   TRANSLATOR_DECLARATIONS (Accidental_engraver);
   virtual void process_music ();
@@ -60,19 +74,24 @@ public:
     store all information before we can really create the accidentals.
   */
   Link_array<Grob> arpeggios_;
+
+  Grob * accidental_placement_;
   
-  Link_array<Note_req> mel_l_arr_;
-  Link_array<Grob> head_l_arr_;
-  Link_array<Item> forced_l_arr_;
-  Link_array<Grob> tie_l_arr_;
-  Link_array<Translator_group> origin_l_arr_;
+
+  /*
+    The next 
+   */
+  Array<Accidental_entry> accidental_arr_;
+  
+  Link_array<Grob> tie_arr_;
+
 
 };
 
 
 Accidental_engraver::Accidental_engraver ()
 {
-  key_item_p_ = 0;
+  accidental_placement_ = 0;
   last_keysig_ = SCM_EOL;
 }
 
@@ -99,10 +118,9 @@ calculates the number of accidentals on 
 
 */
 static int
-number_accidentals (SCM sig, Note_req * note_l, SCM curbarnum, SCM lazyness, 
+number_accidentals (SCM sig, Note_req * note_l, Pitch *pitch, SCM curbarnum, SCM lazyness, 
 		    bool ignore_octave_b)
 {
-  Pitch *pitch = unsmob_pitch (note_l->get_mus_property ("pitch"));
   int n = pitch->notename_i_;
   int o = pitch->octave_i_;
   int a = pitch->alteration_i_;
@@ -146,7 +164,7 @@ number_accidentals (SCM sig, Note_req * 
 }
 
 static int
-number_accidentals (Note_req * note_l, Translator_group * origin_l, 
+number_accidentals (Note_req * note_l, Pitch *pitch, Translator_group * origin_l, 
 		    SCM accidentals, SCM curbarnum)
 {
   int number = 0;
@@ -173,7 +191,7 @@ number_accidentals (Note_req * note_l, T
 	  if (same_octave_b || any_octave_b)
 	    {
 	      int n = number_accidentals
-		(localsig, note_l, curbarnum, lazyness, any_octave_b);
+		(localsig, note_l, pitch, curbarnum, lazyness, any_octave_b);
 	      diff = diff || (n < 0);
 	      number = max (number, abs (n));     
 	    }
@@ -208,7 +226,7 @@ number_accidentals (Note_req * note_l, T
 void
 Accidental_engraver::create_grobs ()
 {
-  if (!key_item_p_ && mel_l_arr_.size ()) 
+  if (accidental_arr_.size () && !accidental_arr_.top().done_)
     {
       //SCM localsig = get_property ("localKeySignature");
       SCM accidentals =  get_property ("autoAccidentals");
@@ -216,17 +234,21 @@ Accidental_engraver::create_grobs ()
       SCM barnum = get_property ("currentBarNumber");
 
       bool extra_natural_b = get_property ("extraNatural") == SCM_BOOL_T;
-      for (int i = 0; i  < mel_l_arr_.size (); i++) 
+      for (int i = 0; i  < accidental_arr_.size (); i++) 
 	{
-	  Grob * support_l = head_l_arr_[i];
-	  Note_req * note_l = mel_l_arr_[i];
-	  Translator_group * origin_l = origin_l_arr_[i];
-
-	  int num = number_accidentals (note_l, origin_l, accidentals, barnum);
-	  int num_caut = number_accidentals (note_l, origin_l, cautionaries, barnum);
+	  if (accidental_arr_[i].done_ )
+	    continue;
+	  accidental_arr_[i].done_  = true;
+	  Grob * support_l = accidental_arr_[i].head_;
+	  Note_req * note_l = accidental_arr_[i].melodic_;
+	  Translator_group * origin_l = accidental_arr_[i].origin_;
+
+	  Pitch * pitch = unsmob_pitch (note_l->get_mus_property ("pitch"));
+	  int num = number_accidentals (note_l, pitch, origin_l, accidentals, barnum);
+	  int num_caut = number_accidentals (note_l, pitch, origin_l, cautionaries, barnum);
 	  bool cautionary = to_boolean (note_l->get_mus_property ("cautionary"));
 	  
-	  if (abs (num_caut)>abs (num))
+	  if (abs (num_caut) > abs (num))
 	    {
 	      num = num_caut;
 	      cautionary = true;
@@ -241,8 +263,8 @@ Accidental_engraver::create_grobs ()
 
 	  Grob *tie_break_reminder = 0;
 	  bool tie_changes = false;
-	  for (int j = 0; j < tie_l_arr_.size (); j++)
-	    if (support_l == Tie::head (tie_l_arr_[j], RIGHT))
+	  for (int j = 0; j < tie_arr_.size (); j++)
+	    if (support_l == Tie::head (tie_arr_[j], RIGHT))
 	      {
 		tie_changes = different;
 
@@ -253,31 +275,57 @@ Accidental_engraver::create_grobs ()
 		   
 		Maybe check property noTieBreakForceAccidental? */
 		if (different)
-		  tie_break_reminder = tie_l_arr_[j];
+		  tie_break_reminder = tie_arr_[j];
 		break;
 	      }
 
 	  if (num)
 	    {
-	      if (!key_item_p_) 
+	      Grob * a = new Item (get_property ("Accidental"));
+	      a->set_parent (support_l, Y_AXIS);
+
+	      if (!accidental_placement_)
 		{
-		  key_item_p_ = new Item (get_property ("Accidentals"));
+		  accidental_placement_ = new Item (get_property ("AccidentalPlacement"));
+		  announce_grob (accidental_placement_, a->self_scm());
+		}
+	      
+	      Accidental_placement::add_accidental (accidental_placement_, a);
+	      announce_grob (a, SCM_EOL);
 
-		  SCM c0 = get_property ("centralCPosition");
-		  if (gh_number_p (c0))
-		    Staff_symbol_referencer::set_position (key_item_p_, gh_scm2int (c0));
+	      
+	      SCM accs = gh_cons (gh_int2scm (pitch->alteration_i_), SCM_EOL);
+	      if (num == 2 && extra_natural_b)
+		accs = gh_cons (gh_int2scm (0), accs);
 
-		  announce_grob (key_item_p_, SCM_EOL);
-		}
+	      /* TODO:
 
+	      add cautionary option in accidental.
+	       */
+
+	      if (cautionary)
+		{
+		  a->set_grob_property ("cautionary", SCM_BOOL_T);
+		}
+	      
+	      if (tie_break_reminder)
+		{
+		  // TODO.
+		  a->set_grob_property ("tie", tie_break_reminder->self_scm());
+		}
 	      
-	      Local_key_item::add_pitch (key_item_p_, *unsmob_pitch (note_l->get_mus_property ("pitch")), 
-					 cautionary, 
-					 num == 2 && extra_natural_b, 
-					 tie_break_reminder);
-	      Side_position_interface::add_support (key_item_p_, support_l);
 	      
-	      support_l->set_grob_property ("accidental-grob", key_item_p_->self_scm ());
+	      support_l->set_grob_property ("accidental-grob", a->self_scm ());
+
+	      a->set_grob_property ("accidentals", accs);
+	      accidental_arr_[i].accidental_ = a;
+ /*
+	We add the accidentals to the support of the arpeggio, so it is put left of the
+	accidentals. 
+	
+      */
+	      for (int i = 0;  i < arpeggios_.size ();  i++)
+		Side_position_interface::add_support (arpeggios_[i], a);
 	    }
 	  
 
@@ -289,7 +337,7 @@ Accidental_engraver::create_grobs ()
 	    always do the correct thing?
 	  */
 	  
-	  Pitch *pitch = unsmob_pitch (note_l->get_mus_property ("pitch"));
+
 	  int n = pitch->notename_i_;
 	  int o = pitch->octave_i_;
 	  int a = pitch->alteration_i_;
@@ -312,10 +360,10 @@ Accidental_engraver::create_grobs ()
 	    
 	    
 	  */
-	  Translator_group * trans_ = origin_l_arr_[i];
-	  while (trans_)
+
+	  while (origin_l)
 	    {
-	      SCM localsig = trans_->get_property ("localKeySignature");
+	      SCM localsig = origin_l->get_property ("localKeySignature");
 	      if (tie_changes)
 		{
 		  /*
@@ -334,25 +382,11 @@ Accidental_engraver::create_grobs ()
 		  localsig = ly_assoc_front_x
 		    (localsig, on_s, gh_cons (gh_int2scm (a), barnum)); 
 		}
-	      trans_->set_property ("localKeySignature",  localsig);
-	      trans_ = trans_->daddy_trans_l_;
+	      origin_l->set_property ("localKeySignature",  localsig);
+	      origin_l = origin_l->daddy_trans_l_;
 	    }
 	}
     }
-
-  
-  if (key_item_p_)
-    {
-      /*
-	We add the accidentals to the support of the arpeggio, so it
-	is put left of the accidentals.
-	
-      */
-      for (int i = 0;  i < arpeggios_.size ();  i++)
-	Side_position_interface::add_support (arpeggios_[i], key_item_p_);
-
-      arpeggios_.clear ();
-    }
 }
 
 void
@@ -364,22 +398,22 @@ Accidental_engraver::finalize ()
 void
 Accidental_engraver::stop_translation_timestep ()
 {
-  if (key_item_p_)
+  for (int i = 0; i < accidental_arr_.size(); i++)
     {
-      for (int i = 0; i < head_l_arr_.size (); i++)
-	Side_position_interface::add_support (key_item_p_, head_l_arr_[i]);
-
-      typeset_grob (key_item_p_);
-      key_item_p_ = 0;
+      Grob *a = accidental_arr_[i].accidental_;
+      if (a)
+	{
+	  typeset_grob (a);
+	}
     }
 
-
-  mel_l_arr_.clear ();
+  if (accidental_placement_)
+    typeset_grob(accidental_placement_);
+  accidental_placement_ = 00;
+  
+  accidental_arr_.clear();
   arpeggios_.clear ();
-  tie_l_arr_.clear ();
-  head_l_arr_.clear ();
-  forced_l_arr_.clear ();
-  origin_l_arr_.clear ();
+  tie_arr_.clear ();
 }
 
 void
@@ -389,18 +423,22 @@ Accidental_engraver::acknowledge_grob (G
 
   if (note_l && Rhythmic_head::has_interface (info.grob_l_))
     {
-      mel_l_arr_.push (note_l);
-      head_l_arr_.push (info.grob_l_);
-      origin_l_arr_.push (info.origin_trans_l_->daddy_trans_l_);
+      Accidental_entry entry ;
+      entry.head_ = info.grob_l_;
+      entry.origin_ = info.origin_trans_l_->daddy_trans_l_;
+      entry.melodic_ = note_l;
+
+      accidental_arr_.push (entry);
     }
   else if (Tie::has_interface (info.grob_l_))
     {
-      tie_l_arr_.push (info.grob_l_);
+      tie_arr_.push (info.grob_l_);
     }
   else if (Arpeggio::has_interface (info.grob_l_))
     {
       arpeggios_.push (info.grob_l_); 
     }
+  
 }
 
 void
@@ -434,7 +472,7 @@ ENTER_DESCRIPTION (Accidental_engraver,
 events.  Due to interaction with ties (which don't come together
 with note heads), this needs to be in a context higher than Tie_engraver.",
 		   
-	       "Accidentals",
+	       "Accidental",
 	       "rhythmic-head-interface tie-interface arpeggio-interface",
 	       "localKeySignature extraNatural autoAccidentals autoCautionaries",
 		   "localKeySignature");
diff -purN ../lilypond-1.5.57/lily/accidental-placement.cc ./lily/accidental-placement.cc
--- ../lilypond-1.5.57/lily/accidental-placement.cc	Sat May  4 14:57:28 2002
+++ ./lily/accidental-placement.cc	Tue May 21 00:05:05 2002
@@ -17,7 +17,7 @@ source file of the GNU LilyPond music ty
 #include "accidental-placement.hh"
 #include "note-column.hh"
 #include "group-interface.hh"
-#include "collision.hh"
+#include "note-collision.hh"
 
 MAKE_SCHEME_CALLBACK(Accidental_placement,extent_callback, 2);
 SCM
@@ -206,7 +206,7 @@ Accidental_placement::position_accidenta
   for (int i = note_cols.size() ; i--;)
     {
       Grob *c = note_cols[i]->get_parent (X_AXIS);
-      if (Collision::has_interface (c))
+      if (Note_collision_interface::has_interface (c))
 	{
 	  Link_array<Grob> gs =
 	    Pointer_group_interface__extract_grobs (c, (Grob*)0, "elements");
diff -purN ../lilypond-1.5.57/lily/accidental.cc ./lily/accidental.cc
--- ../lilypond-1.5.57/lily/accidental.cc	Sun May  5 21:34:22 2002
+++ ./lily/accidental.cc	Wed May 22 11:49:54 2002
@@ -49,9 +49,18 @@ SCM
 Accidental_interface::brew_molecule (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-
+  bool smaller = false;
+  bool parens = false;
+  
+  bool caut  = to_boolean (me->get_grob_property ("cautionary"));
+  if (caut)
+    {
+      SCM cstyle = me->get_grob_property ("cautionary-style");
+      parens = gh_equal_p (cstyle, ly_symbol2scm ("parentheses"));
+      smaller = gh_equal_p (cstyle, ly_symbol2scm ("smaller"));
+    }
+  
   SCM scm_style = me->get_grob_property ("style");
- 
   String style;
   if (gh_symbol_p (scm_style))
     {
@@ -65,7 +74,20 @@ Accidental_interface::brew_molecule (SCM
       style = "";
     }
 
-  
+
+  Font_metric *fm = 0;
+  if (smaller)
+    {
+      SCM ac = Font_interface::font_alist_chain (me);
+      ac = gh_cons (gh_cons (gh_cons
+			     (ly_symbol2scm ("font-relative-size"),
+			      gh_int2scm (-1)), SCM_EOL),
+		    ac);
+      fm = Font_interface::get_font (me, ac);
+    }
+  else
+    fm = Font_interface::get_default_font (me);
+
   Molecule mol;
   for (SCM s = me->get_grob_property ("accidentals");
        gh_pair_p (s);  s= gh_cdr (s))
@@ -73,19 +95,16 @@ Accidental_interface::brew_molecule (SCM
       SCM entry  = gh_car (s);
       
       
-      Molecule acc (Font_interface::get_default_font (me)->
-		    find_by_name (String ("accidentals-") +
-				  style +
-				  to_str (gh_scm2int(entry))));
+      Molecule acc (fm->find_by_name (String ("accidentals-") +
+				      style +
+				      to_str (gh_scm2int(entry))));
       
       mol.add_at_edge (X_AXIS,  RIGHT, acc, 0.1);
     }
 
-#if 0
-  // TODO.
-  if (to_boolean (me->get_grob_property ("parenthesize")))
+  if (parens)
     mol = parenthesize (me, mol); 
-#endif
+
   return mol.smobbed_copy();
 }
 
@@ -93,4 +112,4 @@ Accidental_interface::brew_molecule (SCM
 
 ADD_INTERFACE(Accidental_interface, "accidental-interface",
 	      "a single accidental",
-	      "style tie accidentals");
+	      "cautionary-style style tie accidentals");
diff -purN ../lilypond-1.5.57/lily/afm.cc ./lily/afm.cc
--- ../lilypond-1.5.57/lily/afm.cc	Mon Mar 18 01:11:27 2002
+++ ./lily/afm.cc	Wed May 22 11:32:06 2002
@@ -83,7 +83,8 @@ Adobe_font_metric::find_char_metric (Str
 int
 Adobe_font_metric::count () const
 {
-  return ascii_to_metric_idx_.size ();
+  return font_inf_->numOfChars ;
+  //  return ascii_to_metric_idx_.size ();
 }
 
 Box
diff -purN ../lilypond-1.5.57/lily/collision-engraver.cc ./lily/collision-engraver.cc
--- ../lilypond-1.5.57/lily/collision-engraver.cc	Sun Mar 24 21:46:53 2002
+++ ./lily/collision-engraver.cc	Tue May 21 00:05:05 2002
@@ -7,7 +7,7 @@
 */
 
 #include "note-column.hh"
-#include "collision.hh"
+#include "note-collision.hh"
 
 #include "engraver.hh"
 #include "axis-group-interface.hh"
@@ -40,7 +40,7 @@ Collision_engraver::create_grobs ()
     }
   
   for (int i=0; i< note_column_l_arr_.size (); i++)
-    Collision::add_column (col_p_,note_column_l_arr_[i]);
+    Note_collision_interface::add_column (col_p_,note_column_l_arr_[i]);
 }
 
 void
diff -purN ../lilypond-1.5.57/lily/collision.cc ./lily/collision.cc
--- ../lilypond-1.5.57/lily/collision.cc	Sun Mar 24 21:46:53 2002
+++ ./lily/collision.cc	Thu Jan  1 01:00:00 1970
@@ -1,383 +0,0 @@
-/*
-  collision.cc -- implement Collision
-
-  source file of the GNU LilyPond music typesetter
-
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "debug.hh"
-#include "collision.hh"
-#include "note-column.hh"
-#include "rhythmic-head.hh"
-#include "paper-def.hh"
-#include "axis-group-interface.hh"
-#include "item.hh"
-#include "stem.hh"
-
-MAKE_SCHEME_CALLBACK (Collision,force_shift_callback,2);
-
-SCM
-Collision::force_shift_callback (SCM element_smob, SCM axis)
-{
-  Grob *me = unsmob_grob (element_smob);
-  Axis a = (Axis) gh_scm2int (axis);
-  assert (a == X_AXIS);
-  
-   me = me->get_parent (a);
-
-   if (! to_boolean (me->get_grob_property ("collision-done")))
-    {
-      me->set_grob_property ("collision-done", SCM_BOOL_T);
-      do_shifts (me);
-    }
-  
-  return gh_double2scm (0.0);
-}
-
-
-void
-check_meshing_chords (Grob*me,
-		      Drul_array< Array < Real > > *offsets,
-		      Drul_array< Array < Slice > > const &extents,
-		      Drul_array<Link_array<Grob> > const &clash_groups)
-	
-{
-  if (!extents[UP].size () || ! extents[DOWN].size ())
-    return ;
-  
-  
-  Grob *cu =clash_groups[UP][0];
-  Grob *cd =clash_groups[DOWN][0];
-
-  Grob * nu_l= Note_column::first_head (cu);
-  Grob * nd_l = Note_column::first_head (cd);
-      
-     
-
-  /*
-    this case (distant half collide), 
-    
-        |
-      x |
-     | x
-     |
-
-   the noteheads may be closer than this case (close half collide)
-
-       |
-       |
-      x 
-     x
-    |
-    |
-    
-   */
-  
-  bool close_half_collide = false;
-  bool distant_half_collide = false;  
-  bool full_collide = false;  
-
-  /*
-    TODO:
-
-    filter out the 'o's in this configuration, since they're no part
-    in the collision.
-
-     |
-    x|o
-    x|o
-    x
-
-    
-   */
-  Array<int> ups = Stem::note_head_positions (Note_column::stem_l (cu));
-  Array<int> dps = Stem::note_head_positions (Note_column::stem_l (cd));
-
-  /*
-    they're too far apart to collide. 
-    
-   */
-
-  if (ups[0] > dps.top () + 1)
-    return ; 
-
-  bool touch = (ups[0] - dps.top () >= 0);
-  
-  bool merge_possible = (ups[0] >= dps[0]) && (ups.top () >= dps.top ());
-
-  merge_possible = merge_possible &&
-    Rhythmic_head::balltype_i (nu_l) == Rhythmic_head::balltype_i (nd_l);
-
-
-  /*
-    don't merge whole notes (or longer, like breve, longa, maxima) 
-   */
-  merge_possible = merge_possible && (Rhythmic_head::balltype_i (nu_l) > 0);
-
-  if (!to_boolean (me->get_grob_property ("merge-differently-dotted")))
-    merge_possible = merge_possible && Rhythmic_head::dot_count (nu_l) == Rhythmic_head::dot_count (nd_l);
-  
-  int i = 0, j=0;
-  while (i < ups.size () && j < dps.size ())
-  {
-    if (abs (ups[i] - dps[j]) == 1)
-      {
-	merge_possible = false;
-	if (ups[i] > dps[j])
-	  close_half_collide = true;
-	else
-	  distant_half_collide = true;
-      }
-    else if (ups[i]==dps[j])
-      full_collide = true;
-    else if (ups[i] >dps[0] && ups[i] < dps.top ())
-      merge_possible = false;
-    else if (dps[j] >ups[0] && dps[j] < ups.top ())
-      merge_possible = false;
-    
-    if (ups[i] < dps[j])
-      i++;
-    else if (ups[i] > dps[j])
-      j++;
-    else
-      {
-	i++;
-	j++;
-      }
-  }
-
-  Drul_array<Real> center_note_shifts;
-  center_note_shifts[LEFT] = 0.0;
-  center_note_shifts[RIGHT] = 0.0;
-
-  
-  Real shift_amount = 1;
-
-  if (touch)
-    shift_amount *= -1;
-
-  /*
-    for full collisions, the right hand head may obscure dots, so
-    make sure the dotted heads go to the right.
-   */
-  if ((Rhythmic_head::dot_count (nu_l) > Rhythmic_head::dot_count (nd_l)
-       && full_collide))
-    shift_amount = 1;
-
-  /*
-    TODO: these numbers are magic; should devise a set of grob props
-    to tune this behavior.  */
-  
-  if (merge_possible)
-    shift_amount *= 0.0;
-  else if (close_half_collide && !touch)
-    shift_amount *= 0.52;
-  else if (distant_half_collide && !touch)
-    shift_amount *= 0.4;
-  else if (distant_half_collide || close_half_collide || full_collide)
-    shift_amount *= 0.5;
-  
-  /*
-    we're meshing.
-  */
-  else if (Rhythmic_head::dot_count (nu_l) || Rhythmic_head::dot_count (nd_l))
-    shift_amount *= 0.1;
-  else
-    shift_amount *= 0.25;
-
-  Direction d = UP;
-  do
-    {
-      for (int i=0; i < clash_groups[d].size (); i++)
-	(*offsets)[d][i] += d * shift_amount;
-    }
-  while ((flip (&d))!= UP);
-}
-
-
-/*
-  TODO: make callback of this.
-
-  TODO:
-
-  note-width is hardcoded, making it difficult to handle all note
-  heads sanely. We should really look at the widths of the colliding
-  columns, and have a separate setting for "align stems".
-
-  
- */
-void
-Collision::do_shifts (Grob* me)
-{
-  SCM autos (automatic_shift (me));
-  SCM hand (forced_shift (me));
-  
-  Link_array<Grob> done;
-
-
-  Real wid
-    = gh_scm2double (me->get_grob_property ("note-width"));
-  
-  for (; gh_pair_p (hand); hand =ly_cdr (hand))
-    {
-      Grob * s = unsmob_grob (ly_caar (hand));
-      Real amount = gh_scm2double (ly_cdar (hand));
-      
-      s->translate_axis (amount *wid, X_AXIS);
-      done.push (s);
-    }
-  for (; gh_pair_p (autos); autos =ly_cdr (autos))
-    {
-      Grob * s = unsmob_grob (ly_caar (autos));
-      Real amount = gh_scm2double (ly_cdar (autos));
-      
-      if (!done.find_l (s))
-	s->translate_axis (amount * wid, X_AXIS);
-    }
-}
-
-/** This complicated routine moves note columns around horizontally to
-  ensure that notes don't clash.
-
-  This should be put into Scheme.  
-  */
-SCM
-Collision::automatic_shift (Grob *me)
-{
-  Drul_array<Link_array<Grob> > clash_groups;
-  Drul_array<Array<int> > shifts;
-  SCM  tups = SCM_EOL;
-
-  SCM s = me->get_grob_property ("elements");
-  for (; gh_pair_p (s); s = ly_cdr (s))
-    {
-      SCM car = ly_car (s);
-
-      Grob * se = unsmob_grob (car);
-      if (Note_column::has_interface (se))
-	clash_groups[Note_column::dir (se)].push (se);
-    }
-
-  
-  Direction d = UP;
-  do
-    {
-      Array<int> & shift (shifts[d]);
-      Link_array<Grob> & clashes (clash_groups[d]);
-
-      clashes.sort (Note_column::shift_compare);
-
-      for (int i=0; i < clashes.size (); i++)
-	{
-	  SCM sh
-	    = clashes[i]->get_grob_property ("horizontal-shift");
-
-	  if (gh_number_p (sh))
-	    shift.push (gh_scm2int (sh));
-	  else
-	    shift.push (0);
-	}
-      
-      for (int i=1; i < shift.size (); i++)
-	{
-	  if (shift[i-1] == shift[i])
-	    {
-	      me->warning (_ ("Too many clashing notecolumns.  Ignoring them."));
-	      return tups;
-	    }
-	}
-    }
-  while ((flip (&d))!= UP);
-
-  Drul_array< Array < Slice > > extents;
-  Drul_array< Array < Real > > offsets;
-  d = UP;
-  do
-    {
-      for (int i=0; i < clash_groups[d].size (); i++)
-	{
-	  Slice s (Note_column::head_positions_interval (clash_groups[d][i]));
-	  s[LEFT] --;
-	  s[RIGHT]++;
-	  extents[d].push (s);
-	  offsets[d].push (d * 0.5 * i);
-	}
-    }
-  while ((flip (&d))!= UP);
-
-  /*
-    do horizontal shifts of each direction 
-
-       | 
-      x||
-       x||
-        x|
-   */
-  
-  do
-    {
-      for (int i=1; i < clash_groups[d].size (); i++)
-	{
-	  Slice prev =extents[d][i-1];
-	  prev.intersect (extents[d][i]);
-	  if (prev.length ()> 0 ||
- (extents[-d].size () && d * (extents[d][i][-d] - extents[-d][0][d]) < 0))
-	    for (int j = i; j <  clash_groups[d].size (); j++)
-	      offsets[d][j] += d * 0.5;
-	}
-    }	
-  while ((flip (&d))!= UP);
-
-
-  /*
-    Check if chords are meshing
-   */
-
-  check_meshing_chords (me, &offsets, extents, clash_groups);
-  
-  do
-    {
-      for (int i=0; i < clash_groups[d].size (); i++)
-	tups = gh_cons (gh_cons (clash_groups[d][i]->self_scm (), gh_double2scm (offsets[d][i])),
-				 tups);
-    }
-  while (flip (&d) != UP);
-  return tups;
-}
-
-
-SCM
-Collision::forced_shift (Grob *me)
-{
-  SCM tups = SCM_EOL;
-  
-  SCM s = me->get_grob_property ("elements");
-  for (; gh_pair_p (s); s = ly_cdr (s))
-    {
-      Grob * se = unsmob_grob (ly_car (s));
-
-      SCM force =  se->remove_grob_property ("force-hshift");
-      if (gh_number_p (force))
-	{
-	  tups = gh_cons (gh_cons (se->self_scm (), force),
-			  tups);
-	}
-    }
-  return tups;
-}
-
-void
-Collision::add_column (Grob*me,Grob* ncol_l)
-{
-  ncol_l->add_offset_callback (Collision::force_shift_callback_proc, X_AXIS);
-  Axis_group_interface::add_element (me, ncol_l);
-  me->add_dependency (ncol_l);
-}
-
-
-ADD_INTERFACE (Collision, "note-collision-interface",
-  "An object that handles collisions between notes with different
-stem directions and horizontal shifts. Most of the interesting
-properties are to be set in @ref{note-column-interface}",
-  "merge-differently-dotted note-width collision-done");
diff -purN ../lilypond-1.5.57/lily/include/collision.hh ./lily/include/collision.hh
--- ../lilypond-1.5.57/lily/include/collision.hh	Wed Apr 10 19:25:36 2002
+++ ./lily/include/collision.hh	Thu Jan  1 01:00:00 1970
@@ -1,38 +0,0 @@
-/*
-  collision.hh -- declare Collision
-
-  source file of the GNU LilyPond music typesetter
-
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef COLLISION_HH
-#define COLLISION_HH
-
-#include "lily-proto.hh"
-#include "lily-guile.hh"
-
-
-/**
-  Resolve conflicts between various Note_columns (chords).
-  
-  TODO 
-
-  * multistaff support (see Chlapik: equal noteheads should be on the
-  same hpos.)  
-
-  * Make interface of this, similar to align-interface.
-  
-*/
-class Collision			// interface
-{
-public:
-  static SCM automatic_shift (Grob*);
-  static SCM forced_shift (Grob*);
-  DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element, SCM axis));
-  static void do_shifts (Grob*);
-  static void add_column (Grob*me,Grob*ncol_l);
-  static bool has_interface(Grob*);
-};
-#endif // COLLISION_HH
diff -purN ../lilypond-1.5.57/lily/include/local-key-item.hh ./lily/include/local-key-item.hh
--- ../lilypond-1.5.57/lily/include/local-key-item.hh	Sun Apr 21 01:02:56 2002
+++ ./lily/include/local-key-item.hh	Thu Jan  1 01:00:00 1970
@@ -1,26 +0,0 @@
-/*
-  local-key-item.hh -- part of GNU LilyPond
-
-  (c) 1996--2002 Han-Wen Nienhuys
-*/
-
-#ifndef LOCALKEYITEM_HH
-#define LOCALKEYITEM_HH
-
-
-#include "array.hh"
-#include "pitch.hh"
-
-class Local_key_item
-{
-  static Molecule parenthesize (Grob*me, Molecule) ;
-public:
-  DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
-  DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
-  static void add_pitch (Grob*me, Pitch, bool cautionary, bool natural, Grob *tie_break_cautionary);
-  static bool has_interface (Grob*);
-};
-
-
-#endif // LOCALKEYITEM_HH
-
diff -purN ../lilypond-1.5.57/lily/include/note-collision.hh ./lily/include/note-collision.hh
--- ../lilypond-1.5.57/lily/include/note-collision.hh	Thu Jan  1 01:00:00 1970
+++ ./lily/include/note-collision.hh	Sun May 19 12:37:02 2002
@@ -0,0 +1,40 @@
+/*
+  collision.hh -- declare Collision
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+
+#ifndef COLLISION_HH
+#define COLLISION_HH
+
+#include "lily-proto.hh"
+#include "lily-guile.hh"
+
+
+/**
+  Resolve conflicts between various Note_columns (chords).
+  
+  TODO 
+
+  * multistaff support (see Chlapik: equal noteheads should be on the
+  same hpos.)  
+
+  * Make interface of this, similar to align-interface.
+  
+*/
+class Note_collision_interface
+{
+public:
+  static SCM automatic_shift (Grob*, Drul_array< Link_array <Grob>  >);
+  static SCM forced_shift (Grob*);
+  
+  static Drul_array< Link_array <Grob>  > get_clash_groups (Grob *me);
+  DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element, SCM axis));
+  static void do_shifts (Grob*);
+  static void add_column (Grob*me,Grob*ncol_l);
+  static bool has_interface(Grob*);
+};
+#endif // COLLISION_HH
diff -purN ../lilypond-1.5.57/lily/include/note-head.hh ./lily/include/note-head.hh
--- ../lilypond-1.5.57/lily/include/note-head.hh	Mon Mar 25 23:47:03 2002
+++ ./lily/include/note-head.hh	Tue May 21 00:05:06 2002
@@ -27,7 +27,7 @@ public:
   DECLARE_SCHEME_CALLBACK (brew_ez_molecule, (SCM ));
   static bool has_interface (Grob*);
   static Real stem_attachment_coordinate (Grob *, Axis a);
-  
+  static int balltype_i (Grob*) ;  
 };
 #endif // NOTEHEAD_HH
 
diff -purN ../lilypond-1.5.57/lily/include/rhythmic-head.hh ./lily/include/rhythmic-head.hh
--- ../lilypond-1.5.57/lily/include/rhythmic-head.hh	Sun Apr 21 01:02:56 2002
+++ ./lily/include/rhythmic-head.hh	Tue May 21 00:05:06 2002
@@ -16,7 +16,7 @@
 class Rhythmic_head
 {
 public:
-  static int balltype_i (Grob*) ;
+  static int duration_log (Grob*);
   static void set_dots (Grob*,Item *);
   static Item * stem_l (Grob*) ;
   static Item * dots_l (Grob*) ;
diff -purN ../lilypond-1.5.57/lily/local-key-item.cc ./lily/local-key-item.cc
--- ../lilypond-1.5.57/lily/local-key-item.cc	Sun May  5 21:35:34 2002
+++ ./lily/local-key-item.cc	Thu Jan  1 01:00:00 1970
@@ -1,236 +0,0 @@
-/*
-  local-key-item.cc -- implement Local_key_item, Pitch
-
-  source file of the GNU LilyPond music typesetter
-
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "local-key-item.hh"
-#include "molecule.hh"
-#include "staff-symbol-referencer.hh"
-#include "font-interface.hh"
-#include "paper-def.hh"
-#include "musical-request.hh"
-#include "rhythmic-head.hh"
-#include "misc.hh"
-#include "spanner.hh"
-#include "tie.hh"
-#include "lookup.hh"
-
-
-
-void
-Local_key_item::add_pitch (Grob*me, Pitch p, bool cautionary, bool natural,
-			   Grob* tie_break_reminder)
-{
-  SCM acs = me->get_grob_property ("accidentals");
-  SCM pitch = p.smobbed_copy ();
-  SCM opts = scm_assoc (pitch, acs);
-  bool new_pitch = !gh_pair_p (opts);
-  opts= new_pitch ? SCM_EOL : gh_cdr (opts);
-  
-  if (cautionary)
-    opts = gh_cons (ly_symbol2scm ("cautionary"), opts);
-  if (natural)
-    opts = gh_cons (ly_symbol2scm ("natural"), opts);
-  if (tie_break_reminder)
-    {
-      /* Ugh, these 'options' can't have a value, faking... */
-      opts = gh_cons (tie_break_reminder->self_scm (), opts);
-      opts = gh_cons (ly_symbol2scm ("tie-break-reminder"), opts);
-    }
-
-  if (new_pitch)
-    {
-      pitch = gh_cons (pitch, opts);
-      acs = scm_merge_x (acs, gh_cons (pitch, SCM_EOL), pitch_less_proc);
-    }
-  else
-    scm_assoc_set_x (acs, pitch, opts);
-
-  me->set_grob_property ("accidentals", acs);
-}
-
-Molecule
-Local_key_item::parenthesize (Grob*me, Molecule m)
-{
-  Molecule open = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-leftparen"));
-  Molecule close = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-rightparen"));
-  m.add_at_edge (X_AXIS, LEFT, Molecule (open), 0);
-  m.add_at_edge (X_AXIS, RIGHT, Molecule (close), 0);
-
-  return m;
-}
-
-/*
-  HW says: maybe move to tie.cc
-
-  Note, tie should not kill all accidentals when broken, only the ones
-  that are indicated by a property tie-break-reminder, I guess
-
-  Find if any of the accidentals were created because they're at the rhs of a
-  tie.  If that's the reason they exist, and the tie was NOT broken,
-  put the accidental up for deletion.  Clear molecule cache. */
-MAKE_SCHEME_CALLBACK (Local_key_item, after_line_breaking, 1);
-SCM
-Local_key_item::after_line_breaking (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-
-  SCM accs = me->get_grob_property ("accidentals");
-  for (SCM s = accs;
-	gh_pair_p (s); s = ly_cdr (s))
-    {
-      SCM opts = ly_cdar (s);
-
-      SCM t = scm_memq (ly_symbol2scm ("tie-break-reminder"), opts);
-      if (t != SCM_BOOL_F)
-	{
-	  Grob *tie = unsmob_grob (ly_cadr (t));
-	  Spanner *sp = dynamic_cast<Spanner*> (tie);
-	  if (!sp->original_l_)
-	    {
-	      /* there should be a better way to delete part of me */
-	      scm_set_car_x (s, scm_list_n (ly_caar (s),
-					    ly_symbol2scm ("deleted"),
-					    SCM_EOL));
-	      me->set_grob_property ("molecule", SCM_EOL);
-	    }
-	}
-    }
-  
-  return SCM_UNSPECIFIED;
-}
-
-/*
-  UGH. clean me, revise placement routine (See Ross & Wanske;
-  accidental placement is more complicated than this.
- */
-
-MAKE_SCHEME_CALLBACK (Local_key_item,brew_molecule,1);
-SCM
-Local_key_item::brew_molecule (SCM smob)
-{
-  Grob* me = unsmob_grob (smob);
-  
-  Molecule mol;
-
-  Real note_distance = Staff_symbol_referencer::staff_space (me)/2;
-  Molecule octave_mol;
-  bool oct_b = false;
-  int lastoct = -100;
-
-  SCM scm_style = me->get_grob_property ("style");
-  String style;
-  if (gh_symbol_p (scm_style))
-    {
-      style = ly_scm2string (scm_symbol_to_string (scm_style));
-    }
-  else
-    {
-      /*
-	preferably no name for the default style.
-       */
-      style = "";
-    }
-
-  SCM accs = me->get_grob_property ("accidentals");
-  for (SCM s = accs;
-	gh_pair_p (s); s = ly_cdr (s))
-    {
-      Pitch p (*unsmob_pitch (ly_caar (s)));
-      SCM opts = ly_cdar (s);
-      
-      if (scm_memq (ly_symbol2scm ("deleted"), opts) != SCM_BOOL_F)
-	continue;
-      
-      // do one octave
-      if (p.octave_i ()  != lastoct) 
-	{
-	  if (oct_b)
-	    {
-	      Real dy =lastoct*7* note_distance;
-	      octave_mol.translate_axis (dy, Y_AXIS);
-	      mol.add_molecule (octave_mol);
-	      octave_mol = Molecule ();
-	    }
-	  oct_b = true; 
-	}
-      
-      lastoct = p.octave_i () ;
-
-      bool cautionary = (scm_memq (ly_symbol2scm ("cautionary"), opts) != SCM_BOOL_F);
-      SCM font_rel_siz = me->get_grob_property("font-relative-size");
-      SCM caut_siz = me->get_grob_property("cautionary-size");
-      int frs = (gh_exact_p(font_rel_siz) ? gh_scm2int(font_rel_siz) : 0);
-      int cs = (gh_exact_p(caut_siz) ? gh_scm2int(caut_siz) : 0);
-
-      // Ugh. This will only work if only called once on each grob. --rz
-      if (cautionary && caut_siz!=0)
-	me->set_grob_property ("font-relative-size",gh_int2scm(frs+cs));
-
-      SCM c0 =  me->get_grob_property ("c0-position");
-      Real dy = (gh_number_p (c0) ? gh_scm2int (c0) : 0 + p.notename_i_)
-	* note_distance;
-
-      Molecule acc (Font_interface::get_default_font (me)->
-		    find_by_name (String ("accidentals-") +
-				  style +
-				  to_str (p.alteration_i_)));
-      
-      if (scm_memq (ly_symbol2scm ("natural"), opts) != SCM_BOOL_F)
-	{
-	  Molecule prefix = Font_interface::get_default_font (me)->
-	      find_by_name (String ("accidentals-") + style + String ("0"));
-	  acc.add_at_edge (X_AXIS, LEFT, Molecule (prefix), 0);
-	}
-
-      if (cautionary && to_boolean(me->get_grob_property("paren-cautionaries")))
-        acc = parenthesize (me, acc);
-
-      acc.translate_axis (dy, Y_AXIS);
-      octave_mol.add_at_edge (X_AXIS, RIGHT, acc, 0);
-    }
-
-  if (oct_b)
-    {
-      Real dy =lastoct*7*note_distance;
-      octave_mol.translate_axis (dy, Y_AXIS);
-      mol.add_molecule (octave_mol);
-      octave_mol = Molecule ();
-    }
-  
- if (gh_pair_p (accs))
-    {
-      Drul_array<SCM> pads;
-
-      /*
-	Use a cons?
-       */
-      pads[RIGHT] = me->get_grob_property ("right-padding");
-      pads[LEFT] = me->get_grob_property ("left-padding");
-
-
-      // unused ?
-      Direction d = LEFT;
-      do {
-	if (!gh_number_p (pads[d]))
-	  continue;
-
-	Box b (Interval (0, gh_scm2double (pads[d]) * note_distance),
-	      Interval (0,0));
-	Molecule m (Lookup::blank (b));
-	mol.add_at_edge (X_AXIS, d, m, 0);
-      } while (flip (&d)!= LEFT);
-    }
-
-  return mol.smobbed_copy ();
-}
-
-
-
-
-ADD_INTERFACE (Local_key_item, "accidentals-interface",
-  "Accidentals",
-  "accidentals left-padding right-padding paren-cautionaries cautionary-size");
diff -purN ../lilypond-1.5.57/lily/mensural-ligature-engraver.cc ./lily/mensural-ligature-engraver.cc
--- ../lilypond-1.5.57/lily/mensural-ligature-engraver.cc	Sun May 19 02:06:24 2002
+++ ./lily/mensural-ligature-engraver.cc	Tue May 21 00:05:05 2002
@@ -340,7 +340,7 @@ Mensural_ligature_engraver::transform_he
     have_last_pitch = have_pitch;
     Grob_info info = primitives_arr_[i];
     int duration_log =
-      Rhythmic_head::balltype_i (dynamic_cast<Item*> (info.grob_l_));
+      Note_head::balltype_i (dynamic_cast<Item*> (info.grob_l_));
     Note_req *nr = dynamic_cast<Note_req*> (info.music_cause ());
     if (!nr)
       {
diff -purN ../lilypond-1.5.57/lily/midi-stream.cc ./lily/midi-stream.cc
--- ../lilypond-1.5.57/lily/midi-stream.cc	Wed May 15 12:31:36 2002
+++ ./lily/midi-stream.cc	Wed May 22 11:32:06 2002
@@ -37,7 +37,7 @@ Midi_stream::operator << (String str)
 {
   Byte * b = str.byte_l();
   for (int sz = str.length_i (); sz--;)
-    *os_p_ << *b;
+    *os_p_ << *b ++;
   return *this;
 }
 
@@ -59,10 +59,12 @@ Midi_stream::operator << (Midi_item cons
     	i = str.index_i ("0a");
       }
     }
-
-  Byte * b = str.byte_l();
-  for (int sz = str.length_i (); sz--;)
-    *os_p_ << *b;
+  else
+    {
+      Byte * b = str.byte_l();
+      for (int sz = str.length_i (); sz--;)
+	*os_p_ << *b++;
+    }
   
   return *this;
 }
diff -purN ../lilypond-1.5.57/lily/new-accidental-engraver.cc ./lily/new-accidental-engraver.cc
--- ../lilypond-1.5.57/lily/new-accidental-engraver.cc	Sun May  5 21:34:05 2002
+++ ./lily/new-accidental-engraver.cc	Thu Jan  1 01:00:00 1970
@@ -1,474 +0,0 @@
-/*
-  accidental-engraver.cc -- implement accidental_engraver
-
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  Modified 2001-2002 by Rune Zedeler <rz@daimi.au.dk>
-*/
-
-#include "musical-request.hh"
-#include "command-request.hh"
-#include "local-key-item.hh"
-#include "item.hh"
-#include "tie.hh"
-#include "rhythmic-head.hh"
-#include "engraver-group-engraver.hh"
-#include "accidental-placement.hh"
-#include "side-position-interface.hh"
-#include "engraver.hh"
-#include "arpeggio.hh"
-#include "warn.hh"
-
-#include "translator-group.hh"
-
-/**
-
-
-FIXME: should not compute vertical positioning of accidentals, but
-get them from the noteheads
-
-The algorithm for accidentals should be documented, and made
-tweakable.
-
-*/
-
-struct Accidental_entry {
-  bool done_;
-  Note_req * melodic_;
-  Grob * accidental_;
-  Translator_group *origin_;
-  Grob*  head_;
-  Accidental_entry();
-};
-
-Accidental_entry::Accidental_entry()
-{
-  done_ = false;
-  melodic_ =0;
-  accidental_ = 0;
-  origin_ = 0;
-  head_ = 0;
-}
-
-struct New_accidental_engraver : Engraver {
-protected:
-  TRANSLATOR_DECLARATIONS (New_accidental_engraver);
-  virtual void process_music ();
-  virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
-  virtual void initialize ();
-  virtual void create_grobs ();
-  virtual void finalize ();
-public:
-
-  /*
-    TODO -> property.
-    
-    This is not a property, and it is not protected.  This poses a
-    very small risk of the value being GC'd from under us.
-
-    Oh well.
-  */
-  SCM last_keysig_;
-
-  /*
-    Urgh. Since the accidentals depend on lots of variables, we have to
-    store all information before we can really create the accidentals.
-  */
-  Link_array<Grob> arpeggios_;
-
-  Grob * accidental_placement_;
-  
-
-  /*
-    The next 
-   */
-  Array<Accidental_entry> accidental_arr_;
-  
-  Link_array<Grob> tie_arr_;
-
-
-};
-
-
-New_accidental_engraver::New_accidental_engraver ()
-{
-  accidental_placement_ = 0;
-  last_keysig_ = SCM_EOL;
-}
-
-void
-New_accidental_engraver::initialize ()
-{
-  last_keysig_ = get_property ("keySignature");
-
-  Translator_group * trans_ = daddy_trans_l_;
-  while (trans_)
-    {
-      trans_ -> set_property ("localKeySignature",  ly_deep_copy (last_keysig_));
-      trans_ = trans_->daddy_trans_l_;
-    }
-  daddy_trans_l_->set_children_property ("localKeySignature", last_keysig_);
-}
-
-/*
-
-calculates the number of accidentals on basis of the current local key sig
-  (passed as argument)
-  Returns number of accidentals (0, 1 or 2).
-    Negative (-1 or -2) if accidental has changed.
-
-*/
-static int
-number_accidentals (SCM sig, Note_req * note_l, Pitch *pitch, SCM curbarnum, SCM lazyness, 
-		    bool ignore_octave_b)
-{
-  int n = pitch->notename_i_;
-  int o = pitch->octave_i_;
-  int a = pitch->alteration_i_;
-  int curbarnum_i = gh_scm2int (curbarnum);
-  int accbarnum_i = 0;
-
-  SCM prev;
-  if (ignore_octave_b)
-    prev = ly_assoc_cdr (gh_int2scm (n), sig);
-  else
-    prev = gh_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), sig);
-
-  /* should really be true unless prev == SCM_BOOL_F */
-  if (gh_pair_p (prev) && gh_pair_p (ly_cdr (prev)))
-    {
-      accbarnum_i = gh_scm2int (ly_cddr (prev));
-      prev = gh_cons (ly_car (prev), ly_cadr (prev));
-    }
-  
-  /* If an accidental was not found or the accidental was too old */
-  if (prev == SCM_BOOL_F ||
-      (gh_number_p (lazyness) && curbarnum_i > accbarnum_i + gh_scm2int (lazyness)))
-    prev = gh_assoc (gh_int2scm (n), sig);
-
-
-  SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : ly_cdr (prev);
-
-  int p = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0;
-
-  int num;
-  if (a == p
-      && !to_boolean (note_l->get_mus_property ("force-accidental"))
-      && gh_number_p (prev_acc))
-    num = 0;
-  else if ( (abs (a)<abs (p) || p*a<0) && a != 0 )
-    num = 2;
-  else
-    num = 1;
-  
-  return a == p ? num : -num;
-}
-
-static int
-number_accidentals (Note_req * note_l, Pitch *pitch, Translator_group * origin_l, 
-		    SCM accidentals, SCM curbarnum)
-{
-  int number = 0;
-
-  bool diff = false;
-  if (gh_pair_p (accidentals) && !gh_symbol_p (ly_car (accidentals)))
-    warning (_f ("Accidental typesetting list must begin with context-name: %s", 
-		 ly_scm2string (ly_car (accidentals)).ch_C ()));
-  
-  while (gh_pair_p (accidentals) && origin_l)
-    {
-      // If pair then it is a new accidentals typesetting rule to be checked
-      if (gh_pair_p (ly_car (accidentals)))
-	{
-	  SCM type = gh_caar (accidentals);
-	  SCM lazyness = gh_cdar (accidentals);
-	  SCM localsig = origin_l->get_property ("localKeySignature");
-	  
-	  bool same_octave_b = 
-	    gh_eq_p (ly_symbol2scm ("same-octave"), type);
-	  bool any_octave_b = 
-	    gh_eq_p (ly_symbol2scm ("any-octave"), type);
-
-	  if (same_octave_b || any_octave_b)
-	    {
-	      int n = number_accidentals
-		(localsig, note_l, pitch, curbarnum, lazyness, any_octave_b);
-	      diff = diff || (n < 0);
-	      number = max (number, abs (n));     
-	    }
-	  else
-	    warning (_f ("unknown accidental typesetting: %s. Ignored", 
-			 ly_symbol2string (type).ch_C ()));
-	}
-      
-
-      /*
-	if symbol then it is a context name. Scan parent contexts to find it.
-      */
-      else if (gh_symbol_p (ly_car (accidentals)))
-	{
-	  String context = ly_symbol2string (ly_car (accidentals));
-	  
-	  while (origin_l && !origin_l->is_alias_b (context))
-	    origin_l = origin_l->daddy_trans_l_;
-      
-	  if (!origin_l)
-	    warning (_f ("Symbol is not a parent context: %s. Ignored", 
-			 context.ch_C ()));
-	}
-      else warning (_f ("Accidental typesetting must be pair or context-name: %s", 
-			ly_scm2string (ly_car (accidentals)).ch_C ()));
-      
-      accidentals = ly_cdr (accidentals);
-    }
-  return diff ? -number : number;
-}
-
-void
-New_accidental_engraver::create_grobs ()
-{
-  if (accidental_arr_.size () && !accidental_arr_.top().done_)
-    {
-      //SCM localsig = get_property ("localKeySignature");
-      SCM accidentals =  get_property ("autoAccidentals");
-      SCM cautionaries =  get_property ("autoCautionaries");
-      SCM barnum = get_property ("currentBarNumber");
-
-      bool extra_natural_b = get_property ("extraNatural") == SCM_BOOL_T;
-      for (int i = 0; i  < accidental_arr_.size (); i++) 
-	{
-	  if (accidental_arr_[i].done_ )
-	    continue;
-	  accidental_arr_[i].done_  = true;
-	  Grob * support_l = accidental_arr_[i].head_;
-	  Note_req * note_l = accidental_arr_[i].melodic_;
-	  Translator_group * origin_l = accidental_arr_[i].origin_;
-
-	  Pitch * pitch = unsmob_pitch (note_l->get_mus_property ("pitch"));
-	  int num = number_accidentals (note_l, pitch, origin_l, accidentals, barnum);
-	  int num_caut = number_accidentals (note_l, pitch, origin_l, cautionaries, barnum);
-	  bool cautionary = to_boolean (note_l->get_mus_property ("cautionary"));
-	  
-	  if (abs (num_caut) > abs (num))
-	    {
-	      num = num_caut;
-	      cautionary = true;
-	    }
-	  
-	  bool different = num < 0;
-	  num = abs (num);
-
-	  /* see if there's a tie that "changes" the accidental */
-	  /* works because if there's a tie, the note to the left
-	     is of the same pitch as the actual note */
-
-	  Grob *tie_break_reminder = 0;
-	  bool tie_changes = false;
-	  for (int j = 0; j < tie_arr_.size (); j++)
-	    if (support_l == Tie::head (tie_arr_[j], RIGHT))
-	      {
-		tie_changes = different;
-
-		/* Enable accidentals for broken tie
-
-		We only want an accidental on a broken tie, 
-		if the tie changes the accidental.
-		   
-		Maybe check property noTieBreakForceAccidental? */
-		if (different)
-		  tie_break_reminder = tie_arr_[j];
-		break;
-	      }
-
-	  if (num)
-	    {
-	      Grob * a = new Item (get_property ("Accidental"));
-	      a->set_parent (support_l, Y_AXIS);
-
-	      if (!accidental_placement_)
-		{
-		  accidental_placement_ = new Item (get_property ("AccidentalPlacement"));
-		  announce_grob (accidental_placement_, a->self_scm());
-		}
-	      
-	      Accidental_placement::add_accidental (accidental_placement_, a);
-	      announce_grob (a, SCM_EOL);
-
-	      
-	      SCM accs = gh_cons (gh_int2scm (pitch->alteration_i_), SCM_EOL);
-	      if (num == 2 && extra_natural_b)
-		accs = gh_cons (gh_int2scm (0), accs);
-
-	      /* TODO:
-
-	      add cautionary option in accidental.
-	       */
-	      
-	      if (tie_break_reminder)
-		{
-		  // TODO.
-		  a->set_grob_property ("tie", tie_break_reminder->self_scm());
-		}
-	      
-	      
-	      support_l->set_grob_property ("accidental-grob", a->self_scm ());
-
-	      a->set_grob_property ("accidentals", accs);
-	      accidental_arr_[i].accidental_ = a;
- /*
-	We add the accidentals to the support of the arpeggio, so it is put left of the
-	accidentals. 
-	
-      */
-	      for (int i = 0;  i < arpeggios_.size ();  i++)
-		Side_position_interface::add_support (arpeggios_[i], a);
-	    }
-	  
-
-	  /*
-	    We should not record the accidental if it is the first
-	    note and it is tied from the previous measure.
-
-	    Checking whether it is tied also works mostly, but will it
-	    always do the correct thing?
-	  */
-	  
-
-	  int n = pitch->notename_i_;
-	  int o = pitch->octave_i_;
-	  int a = pitch->alteration_i_;
-	  SCM on_s = gh_cons (gh_int2scm (o), gh_int2scm (n));
-
-	  /*
-	    TODO: Speed this up!
-	    
-	    Perhaps only check translators mentioned in the auto-accidentals?
-	    -rz
-
-	    TODO: profile this.
-	    
-	    I'd be surprised if the impact of this would be
-	    measurable.  Anyway, it seems localsig doesn't change
-	    every time-step, but a set_property() is done every
-	    time. We could save on that, probably.
-
-	    --hwn.
-	    
-	    
-	  */
-
-	  while (origin_l)
-	    {
-	      SCM localsig = origin_l->get_property ("localKeySignature");
-	      if (tie_changes)
-		{
-		  /*
-		    Remember an alteration that is different both from
-		    that of the tied note and of the key signature.
-		  */
-		  localsig = ly_assoc_front_x
-		    (localsig, on_s, gh_cons (SCM_BOOL_T, barnum));
-		}
-	      else
-		{
-		  /*
-		    not really really correct if there are more than one
-		    noteheads with the same notename.
-		  */
-		  localsig = ly_assoc_front_x
-		    (localsig, on_s, gh_cons (gh_int2scm (a), barnum)); 
-		}
-	      origin_l->set_property ("localKeySignature",  localsig);
-	      origin_l = origin_l->daddy_trans_l_;
-	    }
-	}
-    }
-}
-
-void
-New_accidental_engraver::finalize ()
-{
-
-}
-
-void
-New_accidental_engraver::stop_translation_timestep ()
-{
-  for (int i = 0; i < accidental_arr_.size(); i++)
-    {
-      Grob *a = accidental_arr_[i].accidental_;
-      if (a)
-	{
-	  typeset_grob (a);
-	}
-    }
-
-  if (accidental_placement_)
-    typeset_grob(accidental_placement_);
-  accidental_placement_ = 00;
-  
-  accidental_arr_.clear();
-  arpeggios_.clear ();
-  tie_arr_.clear ();
-}
-
-void
-New_accidental_engraver::acknowledge_grob (Grob_info info)
-{
-  Note_req * note_l =  dynamic_cast <Note_req *> (info.music_cause ());
-
-  if (note_l && Rhythmic_head::has_interface (info.grob_l_))
-    {
-      Accidental_entry entry ;
-      entry.head_ = info.grob_l_;
-      entry.origin_ = info.origin_trans_l_->daddy_trans_l_;
-      entry.melodic_ = note_l;
-
-      accidental_arr_.push (entry);
-    }
-  else if (Tie::has_interface (info.grob_l_))
-    {
-      tie_arr_.push (info.grob_l_);
-    }
-  else if (Arpeggio::has_interface (info.grob_l_))
-    {
-      arpeggios_.push (info.grob_l_); 
-    }
-  
-}
-
-void
-New_accidental_engraver::process_music ()
-{
-  SCM sig = get_property ("keySignature");
-
-  /* Detect key sig changes.
-     Update all parents and children
-  */
-  if (last_keysig_ != sig)
-    {
-      Translator_group * trans_ = daddy_trans_l_;
-      while (trans_)
-	{
-	  trans_ -> set_property ("localKeySignature",  ly_deep_copy (sig));
-	  trans_ = trans_->daddy_trans_l_;
-	}
-      daddy_trans_l_->set_children_property ("localKeySignature", sig);
-
-      last_keysig_ = sig;
-    }
-}
-
-
-
-
-
-ENTER_DESCRIPTION (New_accidental_engraver,
-"Make accidentals.  Catches note heads, ties and notices key-change
-events.  Due to interaction with ties (which don't come together
-with note heads), this needs to be in a context higher than Tie_engraver.",
-		   
-	       "Accidental",
-	       "rhythmic-head-interface tie-interface arpeggio-interface",
-	       "localKeySignature extraNatural autoAccidentals autoCautionaries",
-		   "localKeySignature");
diff -purN ../lilypond-1.5.57/lily/note-collision.cc ./lily/note-collision.cc
--- ../lilypond-1.5.57/lily/note-collision.cc	Thu Jan  1 01:00:00 1970
+++ ./lily/note-collision.cc	Mon May 20 13:48:55 2002
@@ -0,0 +1,431 @@
+
+/*
+  collision.cc -- implement Collision
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "debug.hh"
+#include "note-collision.hh"
+#include "note-column.hh"
+#include "note-head.hh"
+#include "rhythmic-head.hh"
+#include "paper-def.hh"
+#include "axis-group-interface.hh"
+#include "item.hh"
+#include "stem.hh"
+
+MAKE_SCHEME_CALLBACK (Note_collision_interface,force_shift_callback,2);
+
+SCM
+Note_collision_interface::force_shift_callback (SCM element_smob, SCM axis)
+{
+  Grob *me = unsmob_grob (element_smob);
+  Axis a = (Axis) gh_scm2int (axis);
+  assert (a == X_AXIS);
+  
+   me = me->get_parent (a);
+
+   if (! to_boolean (me->get_grob_property ("collision-done")))
+    {
+      me->set_grob_property ("collision-done", SCM_BOOL_T);
+      do_shifts (me);
+    }
+  
+  return gh_double2scm (0.0);
+}
+
+
+void
+check_meshing_chords (Grob*me,
+		      Drul_array< Array < Real > > *offsets,
+		      Drul_array< Array < Slice > > const &extents,
+		      Drul_array<Link_array<Grob> > const &clash_groups)
+	
+{
+  if (!extents[UP].size () || ! extents[DOWN].size ())
+    return ;
+  
+  
+  Grob *cu =clash_groups[UP][0];
+  Grob *cd =clash_groups[DOWN][0];
+
+  Grob * nu_l= Note_column::first_head (cu);
+  Grob * nd_l = Note_column::first_head (cd);
+      
+     
+
+  /*
+    this case (distant half collide), 
+    
+        |
+      x |
+     | x
+     |
+
+   the noteheads may be closer than this case (close half collide)
+
+       |
+       |
+      x 
+     x
+    |
+    |
+    
+   */
+  
+  bool close_half_collide = false;
+  bool distant_half_collide = false;  
+  bool full_collide = false;  
+
+  /*
+    TODO:
+
+    filter out the 'o's in this configuration, since they're no part
+    in the collision.
+
+     |
+    x|o
+    x|o
+    x
+
+    
+   */
+  Array<int> ups = Stem::note_head_positions (Note_column::stem_l (cu));
+  Array<int> dps = Stem::note_head_positions (Note_column::stem_l (cd));
+
+  /*
+    they're too far apart to collide. 
+    
+   */
+
+  if (ups[0] > dps.top () + 1)
+    return ; 
+
+  bool touch = (ups[0] - dps.top () >= 0);
+  
+  bool merge_possible = (ups[0] >= dps[0]) && (ups.top () >= dps.top ());
+
+  /*
+    don't merge whole notes (or longer, like breve, longa, maxima) 
+   */
+
+  int upball_type = Note_head::balltype_i (nu_l);
+  int dnball_type = Note_head::balltype_i (nd_l);
+  
+  merge_possible = merge_possible && (upball_type > 0);
+
+  if (!to_boolean (me->get_grob_property ("merge-differently-dotted")))
+    merge_possible = merge_possible && Rhythmic_head::dot_count (nu_l) == Rhythmic_head::dot_count (nd_l);
+
+  
+  if (!to_boolean (me->get_grob_property ("merge-differently-headed")))
+    merge_possible = merge_possible &&
+      upball_type == dnball_type;
+  else
+    /*
+      Can't merge quarter and half notes.
+     */
+    merge_possible = merge_possible &&
+      !((Rhythmic_head::duration_log (nu_l) == 1
+	 && Rhythmic_head::duration_log (nd_l) == 2)
+	||(Rhythmic_head::duration_log (nu_l) == 2
+	   && Rhythmic_head::duration_log (nd_l) == 1));
+
+  int i = 0, j=0;
+  while (i < ups.size () && j < dps.size ())
+  {
+    if (abs (ups[i] - dps[j]) == 1)
+      {
+	merge_possible = false;
+	if (ups[i] > dps[j])
+	  close_half_collide = true;
+	else
+	  distant_half_collide = true;
+      }
+    else if (ups[i]==dps[j])
+      full_collide = true;
+    else if (ups[i] >dps[0] && ups[i] < dps.top ())
+      merge_possible = false;
+    else if (dps[j] >ups[0] && dps[j] < ups.top ())
+      merge_possible = false;
+    
+    if (ups[i] < dps[j])
+      i++;
+    else if (ups[i] > dps[j])
+      j++;
+    else
+      {
+	i++;
+	j++;
+      }
+  }
+
+  Drul_array<Real> center_note_shifts;
+  center_note_shifts[LEFT] = 0.0;
+  center_note_shifts[RIGHT] = 0.0;
+
+  
+  Real shift_amount = 1;
+
+  if (touch)
+    shift_amount *= -1;
+
+  /*
+    for full collisions, the right hand head may obscure dots, so
+    make sure the dotted heads go to the right.
+   */
+  if ((Rhythmic_head::dot_count (nu_l) > Rhythmic_head::dot_count (nd_l)
+       && full_collide))
+    shift_amount = 1;
+
+  /*
+    TODO: these numbers are magic; should devise a set of grob props
+    to tune this behavior.  */
+  
+  if (merge_possible)
+    {
+      shift_amount *= 0.0;
+      Grob *wipe_ball = 0;
+      
+      if (upball_type  <  dnball_type)
+	wipe_ball = nd_l;
+      else if (upball_type > dnball_type)
+	wipe_ball = nu_l;
+
+      if (wipe_ball)
+	{
+	  wipe_ball->set_grob_property ("transparent", SCM_BOOL_T);
+	  wipe_ball->set_grob_property ("molecule", SCM_EOL);	  
+	}
+    }
+  else if (close_half_collide && !touch)
+    shift_amount *= 0.52;
+  else if (distant_half_collide && !touch)
+    shift_amount *= 0.4;
+  else if (distant_half_collide || close_half_collide || full_collide)
+    shift_amount *= 0.5;
+  
+  /*
+    we're meshing.
+  */
+  else if (Rhythmic_head::dot_count (nu_l) || Rhythmic_head::dot_count (nd_l))
+    shift_amount *= 0.1;
+  else
+    shift_amount *= 0.25;
+
+  Direction d = UP;
+  do
+    {
+      for (int i=0; i < clash_groups[d].size (); i++)
+	(*offsets)[d][i] += d * shift_amount;
+    }
+  while ((flip (&d))!= UP);
+}
+
+void
+Note_collision_interface::do_shifts (Grob* me)
+{
+  Drul_array< Link_array <Grob>  > cg = get_clash_groups (me);
+
+  SCM autos (automatic_shift (me, cg));
+  SCM hand (forced_shift (me));
+
+  
+  
+  Direction d = UP;
+  Real wid = 0.0;
+  do
+    {
+      if(cg[d].size())
+	{
+	  Grob  *h = cg[d][0];
+	  wid = Note_column::first_head(h)->extent(h,X_AXIS).length() ;
+	}
+    }
+  
+  while (flip (&d) != UP);
+
+  
+  Link_array<Grob> done;
+  for (; gh_pair_p (hand); hand =ly_cdr (hand))
+    {
+      Grob * s = unsmob_grob (ly_caar (hand));
+      Real amount = gh_scm2double (ly_cdar (hand));
+      
+      s->translate_axis (amount *wid, X_AXIS);
+      done.push (s);
+    }
+  for (; gh_pair_p (autos); autos =ly_cdr (autos))
+    {
+      Grob * s = unsmob_grob (ly_caar (autos));
+      Real amount = gh_scm2double (ly_cdar (autos));
+      
+      if (!done.find_l (s))
+	s->translate_axis (amount * wid, X_AXIS);
+    }
+}
+
+Drul_array< Link_array <Grob>  >
+Note_collision_interface::get_clash_groups (Grob *me)
+{
+  Drul_array<Link_array<Grob> > clash_groups;
+ 
+  SCM s = me->get_grob_property ("elements");
+  for (; gh_pair_p (s); s = ly_cdr (s))
+    {
+      SCM car = ly_car (s);
+
+      Grob * se = unsmob_grob (car);
+      if (Note_column::has_interface (se))
+	clash_groups[Note_column::dir (se)].push (se);
+    }
+  
+  Direction d = UP;
+  do
+    {
+      Link_array<Grob> & clashes (clash_groups[d]);
+      clashes.sort (Note_column::shift_compare);
+    }
+  while ((flip (&d))!= UP);
+
+  return clash_groups;
+}
+
+/** This complicated routine moves note columns around horizontally to
+  ensure that notes don't clash.
+
+  This should be put into Scheme.  
+  */
+SCM
+Note_collision_interface::automatic_shift (Grob *me,
+			    Drul_array< Link_array <Grob> > 
+			    clash_groups)
+{
+  Drul_array<Array<int> > shifts;
+  SCM  tups = SCM_EOL;
+
+  
+  Direction d = UP;
+  do
+    {
+      Array<int> & shift (shifts[d]);
+      Link_array<Grob> & clashes (clash_groups[d]);
+
+      for (int i=0; i < clashes.size (); i++)
+	{
+	  SCM sh
+	    = clashes[i]->get_grob_property ("horizontal-shift");
+
+	  if (gh_number_p (sh))
+	    shift.push (gh_scm2int (sh));
+	  else
+	    shift.push (0);
+	}
+      
+      for (int i=1; i < shift.size (); i++)
+	{
+	  if (shift[i-1] == shift[i])
+	    {
+	      me->warning (_ ("Too many clashing notecolumns.  Ignoring them."));
+	      return tups;
+	    }
+	}
+    }
+  while ((flip (&d))!= UP);
+
+  Drul_array< Array < Slice > > extents;
+  Drul_array< Array < Real > > offsets;
+  d = UP;
+  do
+    {
+      for (int i=0; i < clash_groups[d].size (); i++)
+	{
+	  Slice s (Note_column::head_positions_interval (clash_groups[d][i]));
+	  s[LEFT] --;
+	  s[RIGHT]++;
+	  extents[d].push (s);
+	  offsets[d].push (d * 0.5 * i);
+	}
+    }
+  while ((flip (&d))!= UP);
+
+  /*
+    do horizontal shifts of each direction 
+
+       | 
+      x||
+       x||
+        x|
+   */
+  
+  do
+    {
+      for (int i=1; i < clash_groups[d].size (); i++)
+	{
+	  Slice prev =extents[d][i-1];
+	  prev.intersect (extents[d][i]);
+	  if (prev.length ()> 0 ||
+ (extents[-d].size () && d * (extents[d][i][-d] - extents[-d][0][d]) < 0))
+	    for (int j = i; j <  clash_groups[d].size (); j++)
+	      offsets[d][j] += d * 0.5;
+	}
+    }	
+  while ((flip (&d))!= UP);
+
+
+  /*
+    Check if chords are meshing
+   */
+
+  check_meshing_chords (me, &offsets, extents, clash_groups);
+  
+  do
+    {
+      for (int i=0; i < clash_groups[d].size (); i++)
+	tups = gh_cons (gh_cons (clash_groups[d][i]->self_scm (), gh_double2scm (offsets[d][i])),
+				 tups);
+    }
+  while (flip (&d) != UP);
+  return tups;
+}
+
+
+SCM
+Note_collision_interface::forced_shift (Grob *me)
+{
+  SCM tups = SCM_EOL;
+  
+  SCM s = me->get_grob_property ("elements");
+  for (; gh_pair_p (s); s = ly_cdr (s))
+    {
+      Grob * se = unsmob_grob (ly_car (s));
+
+      SCM force =  se->remove_grob_property ("force-hshift");
+      if (gh_number_p (force))
+	{
+	  tups = gh_cons (gh_cons (se->self_scm (), force),
+			  tups);
+	}
+    }
+  return tups;
+}
+
+void
+Note_collision_interface::add_column (Grob*me,Grob* ncol_l)
+{
+  ncol_l->add_offset_callback (Note_collision_interface::force_shift_callback_proc, X_AXIS);
+  Axis_group_interface::add_element (me, ncol_l);
+  me->add_dependency (ncol_l);
+}
+
+
+ADD_INTERFACE (Note_collision_interface, "note-collision-interface",
+  "An object that handles collisions between notes with different stem
+directions and horizontal shifts. Most of the interesting properties
+are to be set in @ref{note-column-interface}: these are
+@code{force-hshift} and @code{horizontal-shift}.
+",
+  "merge-differently-dotted merge-differently-headed collision-done");
diff -purN ../lilypond-1.5.57/lily/note-head.cc ./lily/note-head.cc
--- ../lilypond-1.5.57/lily/note-head.cc	Fri May 17 00:38:05 2002
+++ ./lily/note-head.cc	Tue May 21 00:05:05 2002
@@ -81,13 +81,8 @@ Note_head::brew_ledger_lines (Grob *me,
 		  +0.5*(ledgerlinethickness));
       Box ledger_line (x_extent, y_extent);
 
-#if 1
       Molecule proto_ledger_line =
 	Lookup::roundfilledbox (ledger_line, blotdiameter);
-#else
-      Molecule proto_ledger_line = // if you like it the old way
-	Lookup::filledbox (ledger_line);
-#endif
       
       if (!take_space)
         proto_ledger_line.set_empty (true);
@@ -121,13 +116,17 @@ internal_brew_molecule (Grob *me,  bool 
 
     UGH: use grob-property.
   */
-  SCM log = gh_int2scm (Rhythmic_head::balltype_i (me));
+  SCM log = gh_int2scm (Note_head::balltype_i (me));
   SCM exp = scm_list_n (ly_symbol2scm ("find-notehead-symbol"), log,
 			ly_quote_scm (style),
 			SCM_UNDEFINED);
   String name = "noteheads-" + ly_scm2string (scm_primitive_eval (exp));
   Molecule out = Font_interface::get_default_font (me)->find_by_name (name);
-
+  if (out.empty_b())
+    {
+      warning (_f("Symbol not found, ", name.ch_C()));
+    }
+  
   int interspaces = Staff_symbol_referencer::line_count (me)-1;
   int pos = (int)rint (Staff_symbol_referencer::position_f (me));
   if (abs (pos) - interspaces > 1)
@@ -191,7 +190,7 @@ SCM
 Note_head::brew_ez_molecule (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  int l = Rhythmic_head::balltype_i (me);
+  int l = Note_head::balltype_i (me);
 
   int b = (l >= 2);
 
@@ -246,6 +245,15 @@ Note_head::stem_attachment_coordinate (G
   return gh_number_p (result) ?  gh_scm2double (result) : 0.0;
 }
 
+
+int
+Note_head::balltype_i (Grob*me) 
+{
+  SCM s = me->get_grob_property ("duration-log");
+  return gh_number_p (s) ? gh_scm2int (s) <? 2 : 0;
+}
+
 ADD_INTERFACE (Note_head,"note-head-interface",
   "Note head",
   "accidental-grob style stem-attachment-function");
+
diff -purN ../lilypond-1.5.57/lily/relative-octave-music.cc ./lily/relative-octave-music.cc
--- ../lilypond-1.5.57/lily/relative-octave-music.cc	Fri Feb  1 19:16:15 2002
+++ ./lily/relative-octave-music.cc	Tue May 21 00:05:05 2002
@@ -25,7 +25,7 @@ Relative_octave_music::Relative_octave_m
 
 Relative_octave_music::Relative_octave_music ()
 {
-    set_mus_property ("type", ly_symbol2scm ("relative-octave-music"));
+  set_mus_property ("type", ly_symbol2scm ("relative-octave-music"));
 }
 
 ADD_MUSIC (Relative_octave_music);
diff -purN ../lilypond-1.5.57/lily/rest-collision-engraver.cc ./lily/rest-collision-engraver.cc
--- ../lilypond-1.5.57/lily/rest-collision-engraver.cc	Sun Mar 24 21:46:54 2002
+++ ./lily/rest-collision-engraver.cc	Tue May 21 00:05:05 2002
@@ -9,7 +9,7 @@
 #include "debug.hh"
 #include "rest-collision.hh"
 #include "engraver.hh"
-#include "collision.hh"
+#include "note-collision.hh"
 #include "note-column.hh"
 
 class Rest_collision_engraver : public Engraver
diff -purN ../lilypond-1.5.57/lily/rhythmic-head.cc ./lily/rhythmic-head.cc
--- ../lilypond-1.5.57/lily/rhythmic-head.cc	Wed Apr 10 19:25:36 2002
+++ ./lily/rhythmic-head.cc	Tue May 21 00:05:05 2002
@@ -21,13 +21,6 @@ Rhythmic_head::dots_l (Grob*me) 
   return unsmob_item (s);
 }
 
-int
-Rhythmic_head::balltype_i (Grob*me) 
-{
-  SCM s = me->get_grob_property ("duration-log");
-  return gh_number_p (s) ? gh_scm2int (s) <? 2 : 0;
-}
-
 Item*
 Rhythmic_head::stem_l (Grob*me) 
 {
@@ -50,6 +43,13 @@ Rhythmic_head::set_dots (Grob*me,Item *d
 
 
 
+int
+Rhythmic_head::duration_log (Grob*me) 
+{
+  SCM s = me->get_grob_property ("duration-log");
+  return gh_number_p (s) ? gh_scm2int (s) : 0;
+}
+
 
 
 ADD_INTERFACE (Rhythmic_head,"rhythmic-head-interface",
diff -purN ../lilypond-1.5.57/lily/script-column.cc ./lily/script-column.cc
--- ../lilypond-1.5.57/lily/script-column.cc	Sun Mar 24 21:46:54 2002
+++ ./lily/script-column.cc	Wed May 22 11:32:07 2002
@@ -43,7 +43,6 @@ Script_column::before_line_breaking (SCM
   Link_array<Grob> staff_sided 
     = Pointer_group_interface__extract_grobs (me, (Grob*)0, "scripts");
 				     
-				     
   for (int i=0; i < staff_sided.size (); i++)
     {
       Direction d = Side_position_interface::get_direction (staff_sided[i]);
diff -purN ../lilypond-1.5.57/lily/script-engraver.cc ./lily/script-engraver.cc
--- ../lilypond-1.5.57/lily/script-engraver.cc	Sat Mar  2 02:53:32 2002
+++ ./lily/script-engraver.cc	Wed May 22 11:32:07 2002
@@ -10,6 +10,7 @@
 #include "stem.hh"
 #include "rhythmic-head.hh"
 #include "engraver.hh"
+#include "note-column.hh"
 
 class Script_engraver : public Engraver
 {
@@ -132,10 +133,6 @@ Script_engraver::acknowledge_grob (Grob_
 	{
 	  Grob *e = script_p_arr_[i];
 	  
-	  if (!e->get_parent (X_AXIS))
-	    {
-	      e->set_parent (inf.grob_l_, X_AXIS);
-	    }
 	  if (Side_position_interface::get_axis (e) == X_AXIS
 	      && !e->get_parent (Y_AXIS))
 	    {
@@ -144,7 +141,29 @@ Script_engraver::acknowledge_grob (Grob_
 	    }
 	  Side_position_interface::add_support (e,inf.grob_l_);
 	}
-    }  
+    }
+  else if (Note_column::has_interface (inf.grob_l_))
+    {
+
+      /*
+	We make note column the parent of the script. That's not
+	correct, but due to seconds in a chord, noteheads may be
+	swapped around horizontally. We don't know which note head to
+	put it on, so we postpone this decision to
+	Script_interface::before_line_breaking ().
+ 
+       */
+      for (int i=0; i < script_p_arr_.size (); i++)
+	{
+	  Grob *e = script_p_arr_[i];
+	  
+	  if (!e->get_parent (X_AXIS) &&
+	      Side_position_interface::get_axis (e) == Y_AXIS)
+	    {
+	      e->set_parent (inf.grob_l_, X_AXIS);
+	    }
+	}
+    }
 }
 
 void
@@ -180,6 +199,6 @@ ENTER_DESCRIPTION(Script_engraver,
 /* descr */       "    Handles note ornaments generated by @code{\\script}.  
 ",
 /* creats*/       "Script",
-/* acks  */       "stem-interface rhythmic-head-interface",
+/* acks  */       "stem-interface rhythmic-head-interface note-column-interface",
 /* reads */       "scriptDefinitions scriptHorizontal",
 /* write */       "");
diff -purN ../lilypond-1.5.57/lily/script.cc ./lily/script.cc
--- ../lilypond-1.5.57/lily/script.cc	Sat May  4 14:57:28 2002
+++ ./lily/script.cc	Wed May 22 11:32:07 2002
@@ -15,6 +15,8 @@
 #include "item.hh"
 #include "molecule.hh"
 #include "lookup.hh"
+#include "stem.hh"
+#include "note-column.hh"
 
 Molecule
 Script_interface::get_molecule (Grob * me, Direction d)
@@ -48,15 +50,24 @@ Script_interface::before_line_breaking (
 
   if (!d)
     {
-  /*
-    we should not have `arbitrary' directions. 
-   */
+      /*
+	we should not have `arbitrary' directions. 
+      */
       programming_error ("Script direction not yet known!");
       d = DOWN;
     }
   
   Side_position_interface::set_direction (me,d);
 
+  if (Grob * par = me->get_parent (X_AXIS))
+    {
+      Grob * stem = Note_column::stem_l (par);
+      if (stem && Stem::first_head (stem))
+	{
+	  me->set_parent (Stem::first_head (stem), X_AXIS);
+	}
+    }
+  
   return SCM_UNSPECIFIED;
 }
 
diff -purN ../lilypond-1.5.57/lily/spacing-spanner.cc ./lily/spacing-spanner.cc
--- ../lilypond-1.5.57/lily/spacing-spanner.cc	Mon May 13 12:19:43 2002
+++ ./lily/spacing-spanner.cc	Tue May 21 00:05:06 2002
@@ -508,7 +508,8 @@ Spacing_spanner::do_measure (Rational sh
 
 
 /*
-  Generate the space between two musical columns LC and RC, given spacing parameters INCR and SHORTEST.
+  Generate the space between two musical columns LC and RC, given
+  spacing parameters INCR and SHORTEST.
  */
 void
 Spacing_spanner::musical_column_spacing (Grob *me, Item * lc, Item *rc, Real increment, Rational shortest)
@@ -552,10 +553,20 @@ Spacing_spanner::musical_column_spacing 
   if (max_note_space < 0)
     {
       max_note_space = base_note_space;
-      max_fixed_note_space = increment;
+      max_fixed_note_space =  increment;
     }
 
   bool ragged = to_boolean (me->paper_l ()->get_scmvar ("raggedright"));
+
+  /*
+    Whatever we do, the fixed space is smaller than the real
+    space.
+
+    TODO: this criterion is discontinuous in the derivative.
+    Maybe it should be continuous?
+  */
+  max_fixed_note_space = max_fixed_note_space <?  max_note_space;
+  
   Real strength = (ragged) ? 1.0 : 1 / (max_note_space - max_fixed_note_space);
   Real distance = (ragged) ? max_fixed_note_space : max_note_space;
   //  Spaceable_grob::add_spring (lc, rc, distance, strength, expand_only);
@@ -563,6 +574,11 @@ Spacing_spanner::musical_column_spacing 
   Spaceable_grob::add_spring (lc, rc, distance, strength, false);  
 }
 
+
+/*
+  The one-size-fits all spacing. It doesn't take into account
+  different spacing wishes from one to the next column.
+ */
 void
 Spacing_spanner::standard_breakable_column_spacing (Grob * me, Item*l, Item*r,
 				   Real * fixed, Real * space,
@@ -634,10 +650,21 @@ Spacing_spanner::breakable_column_spacin
 
   
   
-
+    
   if (isinf (max_space))
     {
-      programming_error ("No pref spacing found");
+    /*
+      One situation where this can happen is when there is a column
+      that only serves as a spanning point for a short staff-symbol.
+
+     ===============X===
+
+         |=======Y
+
+
+      (here no StaffSpacing from Y to X is found.)
+    */      
+      programming_error ("No StaffSpacing wishes found");
       max_space = 2.0;
       max_fixed = 1.0;
     }
diff -purN ../lilypond-1.5.57/lily/stem.cc ./lily/stem.cc
--- ../lilypond-1.5.57/lily/stem.cc	Sun May 19 02:12:07 2002
+++ ./lily/stem.cc	Tue May 21 00:05:06 2002
@@ -122,7 +122,7 @@ Stem::set_stemend (Grob*me, Real se)
 int
 Stem::type_i (Grob*me) 
 {
-  return first_head (me) ?  Rhythmic_head::balltype_i (first_head (me)) : 2;
+  return first_head (me) ?  Note_head::balltype_i (first_head (me)) : 2;
 }
 
 /*
@@ -238,7 +238,7 @@ Stem::add_head (Grob*me, Grob *n)
 bool
 Stem::invisible_b (Grob*me)
 {
-  return ! (head_count (me) && Rhythmic_head::balltype_i (support_head (me)) >= 1);
+  return ! (head_count (me) && Note_head::balltype_i (support_head (me)) >= 1);
 }
 
 Direction
diff -purN ../lilypond-1.5.57/lily/time-signature.cc ./lily/time-signature.cc
--- ../lilypond-1.5.57/lily/time-signature.cc	Sun Mar 24 21:46:54 2002
+++ ./lily/time-signature.cc	Tue May 21 00:05:06 2002
@@ -82,12 +82,10 @@ Time_signature::special_time_signature (
   if (!m.empty_b ()) 
     return m;
 
-  String message =
-      "unknown time signature `" + s +
-      "'; resorting to default layout with numbers";
-  warning (_ (message.ch_C ()));
-
-  // Resort to default layout with numbers
+  /*
+    If there is no such symbol, we default without warning to the
+    numbered style.
+   */
   return time_signature (me, n, d);
 }
 
diff -purN ../lilypond-1.5.57/ly/engraver-init.ly ./ly/engraver-init.ly
--- ../lilypond-1.5.57/ly/engraver-init.ly	Wed May 15 13:36:12 2002
+++ ./ly/engraver-init.ly	Tue May 21 00:05:06 2002
@@ -27,7 +27,7 @@ StaffContext=\translator {
 	\consists "Staff_symbol_engraver"
 	\consists "Collision_engraver"
 	\consists "Rest_collision_engraver"
-	\consists "New_accidental_engraver"
+	\consists "Accidental_engraver"
 	\consists "Piano_pedal_engraver"
 	\consists "Instrument_name_engraver"
 	\consists "Grob_pq_engraver"
diff -purN ../lilypond-1.5.57/ly/grace-init.ly ./ly/grace-init.ly
--- ../lilypond-1.5.57/ly/grace-init.ly	Wed Apr 24 15:51:57 2002
+++ ./ly/grace-init.ly	Wed May 22 11:32:08 2002
@@ -26,13 +26,13 @@ startGraceMusic = {
     % be smaller as well.
 
     \property Voice.fontSize = #-2
-    \property Staff.Accidentals \override #'font-relative-size = #-2
+    \property Staff.Accidental \override #'font-relative-size = #-2
     \property Voice.Slur \override #'direction = #-1
 }
 
 stopGraceMusic = {
     \property Voice.Slur \revert #'direction
-    \property Staff.Accidentals \revert #'font-relative-size
+    \property Staff.Accidental \revert #'font-relative-size
     \property Voice.Beam \revert #'thickness
 
     \property Voice.Stem \revert #'flag-style
diff -purN ../lilypond-1.5.57/mf/GNUmakefile ./mf/GNUmakefile
--- ../lilypond-1.5.57/mf/GNUmakefile	Tue May 14 14:43:28 2002
+++ ./mf/GNUmakefile	Wed May 22 11:32:08 2002
@@ -13,9 +13,11 @@ EXTRA_DIST_FILES += README feta.tex
 # don't try to make fonts from test files
 TEST_FILES = $(wildcard *test*.mf)
 FET_FILES = $(filter-out $(TEST_FILES),\
-  $(wildcard feta[0-9]*.mf) $(wildcard parmesan[0-9]*.mf))
+	$(wildcard feta[0-9]*.mf) $(wildcard parmesan[0-9]*.mf))\
+	$(wildcard feta-braces*[0-9].mf)
+
 FONT_FILES = $(filter-out $(TEST_FILES),\
-$(wildcard feta*[0-9].mf) $(wildcard parmesan*[0-9].mf))
+	$(wildcard feta*[0-9].mf) $(wildcard parmesan*[0-9].mf)) \
 
 XPM_FONTS = feta20 feta-nummer10 feta-braces20
 #CM_AFM_FILES = cmr10
diff -purN ../lilypond-1.5.57/mf/feta-beugel.mf ./mf/feta-beugel.mf
--- ../lilypond-1.5.57/mf/feta-beugel.mf	Thu May 10 11:52:20 2001
+++ ./mf/feta-beugel.mf	Wed May 22 11:32:08 2002
@@ -11,6 +11,16 @@ save code;
 code := 0;
 
 
+def abc_encode_int (expr i) =
+	if i > 0:
+		abc_encode_int(i div 26)&char(65 + i mod 26)
+	else:
+		"A"
+	fi
+enddef ;
+
+message (abc_encode_int (26));
+
 def draw_brace (expr height_sharp, width_sharp, slt_sharp) =
 
 	save pendir, height, width, thin, thick, slt;
@@ -19,8 +29,10 @@ def draw_brace (expr height_sharp, width
 	width# := width_sharp;
 	slt# := slt_sharp;
 
-	beginchar(code, width#, height#/2, height#/2);
-	code := incr code;
+fet_beginchar("brace number "&(decimal code), "brace"&abc_encode_int(code),
+		"brace"&abc_encode_int (code))
+
+	set_char_box (0, width#, height#/2, height#/2);
 	  
 	define_pixels (height, width, slt);
 	thin = 2 slt;
@@ -44,7 +56,7 @@ def draw_brace (expr height_sharp, width
 		.. z2l .. simple_serif (z1l, z1r, 90) ..cycle;
 
 	addto currentpicture also currentpicture yscaled -1;
-endchar;
+fet_endchar;
 enddef;
 
 
diff -purN ../lilypond-1.5.57/scm/grob-description.scm ./scm/grob-description.scm
--- ../lilypond-1.5.57/scm/grob-description.scm	Sun May 19 02:16:29 2002
+++ ./scm/grob-description.scm	Wed May 22 11:32:09 2002
@@ -13,23 +13,11 @@
 ;; TODO: junk the meta field in favor of something more compact?
 (define all-grob-descriptions
   `(
-    (Accidentals
-     . (
-	(molecule-callback . ,Local_key_item::brew_molecule)
-	(X-offset-callbacks . (,Side_position_interface::aligned_side))
-	(Y-offset-callbacks . (,Staff_symbol_referencer::callback))	
-	(after-line-breaking-callback . ,Local_key_item::after_line_breaking)
-	(direction . -1)
-	(left-padding . 0.2)
-	(right-padding . 0.5)
-	(paren-cautionaries . #t)
-	(font-family . music)
-	(meta . ((interfaces . (accidentals-interface staff-symbol-referencer-interface font-interface side-position-interface))))
-	))
     (Accidental
      . (
 	(molecule-callback . ,Accidental_interface::brew_molecule)
 	(font-family . music)
+	(cautionary-style . smaller)
 	(after-line-breaking-callback . ,Accidental_interface::after_line_breaking)		(meta . ((interfaces . (accidental-interface font-interface))))
 	))
     (AccidentalPlacement
@@ -90,9 +78,13 @@
 	(font-family . roman)
 	(font-relative-size . -1)
 	(Y-offset-callbacks . (,Side_position_interface::aligned_side))
+	(X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
+	(self-alignment-X . 1)
+	(extra-offset . (1.3 . 0))
 	(meta .
 	      ((interfaces . (side-position-interface
 			      text-interface
+			      self-alignment-interface
 			      font-interface break-aligned-interface))))
 
 	     ))
diff -purN ../lilypond-1.5.57/scm/grob-property-description.scm ./scm/grob-property-description.scm
--- ../lilypond-1.5.57/scm/grob-property-description.scm	Sun May 19 02:16:29 2002
+++ ./scm/grob-property-description.scm	Tue May 21 00:05:07 2002
@@ -87,7 +87,7 @@ column as start/begin point. Only column
 (grob-property-description 'break-glyph-function procedure? "function taking glyph and break-direction, returning the glyph at a line break.")
 (grob-property-description 'breakable boolean? "boolean indicating if this is a breakable item (clef, barline, key sig, etc.).")
 (grob-property-description 'c0-position integer? "integer indicating the position of central C.")
-(grob-property-description 'cautionary-size integer? "size of cautionary accidentals (relative to size of accidentals)")
+(grob-property-description 'cautionary-style symbol? "style  of cautionary accidentals. Choices are 'smaller (one size smaller) or 'parentheses.")
 (grob-property-description 'center-element ly-grob? "grob which will
 be at the center of the group after aligning (when using
 Align_interface::center_on_element). .")
@@ -223,7 +223,17 @@ and will have no effect.
 (grob-property-description 'measure-length moment? "Length of a
 measure. Used in some spacing situations.")
 (grob-property-description 'measure-count integer? "number of measures for a multimeasure rest.")
-(grob-property-description 'merge-differently-dotted boolean? " Merge noteheads in collisions, even if they have a different number of dots. This normal notation for some types of polyphonic music. The value of this setting is used by @ref{note-collision-interface} .")
+
+(grob-property-description 'merge-differently-headed boolean? "Merge
+noteheads in collisions, even if they have different note heads. The
+smaller of the two heads will be rendered invisible. This used
+polyphonic guitar notation. The value of this setting is used by
+@ref{note-collision-interface} .")
+
+(grob-property-description 'merge-differently-dotted boolean? " Merge
+noteheads in collisions, even if they have a different number of
+dots. This normal notation for some types of polyphonic music. The
+value of this setting is used by @ref{note-collision-interface} .")
 
 (grob-property-description 'meta list? "Alist of meta information of this grob.")
 (grob-property-description 'minimum-distance number? "minimum distance between notes and rests.")
@@ -254,13 +264,10 @@ FIXME: also pair? (cons LEFT RIGHT)
 (grob-property-description 'no-spacing-rods boolean? "read from grobs: boolean that makes Separation_item ignore this item (MOVE ME TO ITEM).")
 (grob-property-description 'no-stem-extend boolean? "should stem not be extended to middle staff line?.")
 (grob-property-description 'non-default boolean? "not set because of existence of a bar?.")
-(grob-property-description 'note-width number? "unit for horizontal translation, measured in staff-space.")
 (grob-property-description 'note-heads list? "List of note head grobs")
 (grob-property-description 'number-threshold number? "only put numbers bigger than this threshold over multi measuer rest.")
 (grob-property-description 'old-accidentals list? "list of (pitch, accidental) pairs.")
 (grob-property-description 'padding number? "add this much extra space between objects that are next to each other.")
-(grob-property-description 'paren-cautionaries boolean? "Whether to add parenthesis around cautionary accidentals.")
-
 (grob-property-description 'pedal-type symbol? "Style of piano pedal: text, bracket or mixed.")
 (grob-property-description 'penalty number? "Penalty for breaking at
 this column. 10000 or more means forbid linebreak, -10000 or less
diff -purN ../lilypond-1.5.57/scm/lily.scm ./scm/lily.scm
--- ../lilypond-1.5.57/scm/lily.scm	Sun May 19 02:12:33 2002
+++ ./scm/lily.scm	Tue May 21 00:05:08 2002
@@ -132,6 +132,7 @@
 	     (scm pysk)
 	     (scm ascii-script)
 	     (scm sketch)
+	     (scm pdftex)
 	     )
 
 (define output-alist
@@ -142,6 +143,7 @@
     ("as" . ,as-output-expression)
     ("pysk" . ,pysk-output-expression)
     ("sketch" . ,sketch-output-expression)
+    ("pdftex" . ,pdftex-output-expression)
 ))
 
 
diff -purN ../lilypond-1.5.57/scm/pdf.scm ./scm/pdf.scm
--- ../lilypond-1.5.57/scm/pdf.scm	Mon Apr  1 21:43:39 2002
+++ ./scm/pdf.scm	Tue May 21 00:05:08 2002
@@ -229,9 +229,18 @@
 (define (define-origin a b c ) "")
 (define (no-origin) "")
 
+(define my-eval-in-module eval)
+
+(if (or (equal? (minor-version) "4")
+	(equal? (minor-version) "3.4"))
+    (begin
+      (set! my-eval-in-module eval-in-module)
+
+    ))
+
+(define-public (pdf-output-expression expr port)
+  (display (my-eval-in-module expr this-module) port) )
 
-(define (scm-pdf-output)
-  (primitive-eval (pdf-scm 'all-definitions)))
 
 ; Local Variables:
 ; scheme-program-name: "guile"
diff -purN ../lilypond-1.5.57/scm/pdftex.scm ./scm/pdftex.scm
--- ../lilypond-1.5.57/scm/pdftex.scm	Mon Apr  1 21:43:39 2002
+++ ./scm/pdftex.scm	Tue May 21 00:05:08 2002
@@ -12,6 +12,13 @@
 
 (define-module (scm pdftex))
 
+(use-modules (scm pdf)
+	     (guile)
+	     (ice-9 regex)
+	     (ice-9 string-fun)	  
+	     )
+
+(define this-module (current-module))
 (define (unknown) 
   "%\n\\unknown%\n")
 
@@ -40,19 +47,19 @@
     ))
 
 (define (beam width slope thick)
-  (embedded-pdf ((pdf-scm 'beam) width slope thick)))
+  (embedded-pdf (list 'beam  width slope thick)))
 
 (define (bracket arch_angle arch_width arch_height height arch_thick thick)
-  (embedded-pdf ((pdf-scm 'bracket) arch_angle arch_width arch_height height arch_thick thick)))
+  (embedded-pdf (list 'bracket  arch_angle arch_width arch_height height arch_thick thick)))
 
 (define (dashed-slur thick dash l)
-  (embedded-pdf ((pdf-scm 'dashed-slur)  thick dash l)))
+  (embedded-pdf (list 'dashed-slur   thick dash l)))
 
 (define (char i)
   (string-append "\\char" (inexact->string i 10) " "))
 
 (define (dashed-line thick on off dx dy)
-  (embedded-pdf ((pdf-scm 'dashed-line) thick on off dx dy)))
+  (embedded-pdf (list 'dashed-line  thick on off dx dy)))
 
 (define (font-load-command name-mag command)
   (string-append
@@ -63,13 +70,26 @@
    "\n"))
 
 (define (ez-ball c l b)
-  (embedded-pdf ((pdf-scm 'ez-ball) c  l b)))
+  (embedded-pdf (list 'ez-ball  c  l b)))
+
+
+
+(if (or (equal? (minor-version) "4")
+	(equal? (minor-version) "3.4"))
+    (define (embedded-pdf expr)
+      (let ((ps-string
+	     (with-output-to-string
+	       (lambda () (pdf-output-expression expr (current-output-port))))))
+	(string-append "\\embeddedpdf{" ps-string "}")))
+    (define (embedded-pdf expr)
+      (let
+	  ((os (open-output-string)))
+	(pdf-output-expression expr os)
+	(string-append "\\embeddedpdf{" (get-output-string os) "}"))))
 
-(define (embedded-pdf s)
-  (string-append "\\embeddedpdf{ " s "}"))
 
 (define (comment s)
-  (string-append "% " s))
+  (simple-format #f "% ~a\n" s))
 
 (define (end-output) 
   (begin
@@ -83,7 +103,31 @@
   "")
 
 (define (repeat-slash w a t)
-  (embedded-pdf ((pdf-scm 'repeat-slash) w a t)))
+  (embedded-pdf (list 'repeat-slash w a t)))
+(define (fontify name-mag-pair exp)
+  (string-append (select-font name-mag-pair)
+		 exp))
+
+
+(define (tex-encoded-fontswitch name-mag)
+  (let* ((iname-mag (car name-mag))
+	 (ename-mag (cdr name-mag)))
+    (cons iname-mag
+	  (cons ename-mag
+		(string-append  "magfont"
+			  (string-encode-integer
+			   (hashq (car ename-mag) 1000000))
+			  "m"
+			  (string-encode-integer
+			   (inexact->exact (* 1000 (cdr ename-mag)))))))))
+(define (define-fonts internal-external-name-mag-pairs)
+  (set! font-name-alist (map tex-encoded-fontswitch
+			     internal-external-name-mag-pairs))
+  (apply string-append
+	 (map (lambda (x)
+		(font-load-command (car x) (cdr x)))
+	      (map cdr font-name-alist))))
+
 
 (define (font-switch i)
   (string-append
@@ -140,7 +184,7 @@
    (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
 
 (define (bezier-sandwich l thick)
-  (embedded-pdf ((pdf-scm 'bezier-sandwich) l thick)))
+  (embedded-pdf (list 'bezier-sandwich  `(quote ,l) thick)))
 
 (define (start-system ht)
   (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
@@ -157,7 +201,7 @@
    "height " (number->dim height) " "))
 
 (define (roundfilledbox x width y height blotdiam)
-  (embedded-pdf ((pdf-scm 'roundfilledbox) x width y height blotdiam)))
+  (embedded-pdf (list 'roundfilledbox  x width y height blotdiam)))
 
 (define (text s)
   (string-append "\\hbox{" (output-tex-string s) "}"))
@@ -175,5 +219,15 @@
 (define (no-origin) "")
 
 
-(define (scm-pdftex-output)
-  (primitive-eval (pdftex-scm 'all-definitions)))
+
+(define my-eval-in-module eval)
+
+(if (or (equal? (minor-version) "4")
+	(equal? (minor-version) "3.4"))
+    (begin
+      (set! my-eval-in-module eval-in-module)
+
+    ))
+
+(define-public (pdftex-output-expression expr port)
+  (display (my-eval-in-module expr this-module) port) )
diff -purN ../lilypond-1.5.57/scripts/lilypond-book.py ./scripts/lilypond-book.py
--- ../lilypond-1.5.57/scripts/lilypond-book.py	Sun May 19 02:22:25 2002
+++ ./scripts/lilypond-book.py	Tue May 21 00:05:08 2002
@@ -1246,6 +1246,7 @@ def compile_all_files (chunks):
 		texfiles = string.join (tex, ' ')
 		cmd = 'lilypond --header=texidoc %s %s %s' \
 		      % (lilyopts, g_extra_opts, texfiles)
+
 		system (cmd)
 
 		#
@@ -1452,15 +1453,6 @@ def fix_epswidth (chunks):
 ##docme: why global?
 foutn=""
 def do_file(input_filename):
-	global foutn
-	file_settings = {}
-	if outname:
-		my_outname = outname
-	elif input_filename == '-' or input_filename == "/dev/stdin":
-		my_outname = '-'
-	else:
-		my_outname = os.path.basename (os.path.splitext(input_filename)[0]) + '.' + format
-	my_depname = my_outname + '.dep'		
 
 	chunks = read_doc_file(input_filename)
 	chunks = chop_chunks(chunks, 'lilypond', make_lilypond, 1)
@@ -1485,6 +1477,18 @@ def do_file(input_filename):
 
 	x = 0
 	chunks = completize_preamble (chunks)
+
+
+	global foutn
+
+	if outname:
+		my_outname = outname
+	elif input_filename == '-' or input_filename == "/dev/stdin":
+		my_outname = '-'
+	else:
+		my_outname = os.path.basename (os.path.splitext(input_filename)[0]) + '.' + format
+	my_depname = my_outname + '.dep'		
+	
 	if my_outname == '-' or my_outname == '/dev/stdout':
 		fout = sys.stdout
 		foutn = "<stdout>"
diff -purN ../lilypond-1.5.57/scripts/ly2dvi.py ./scripts/ly2dvi.py
--- ../lilypond-1.5.57/scripts/ly2dvi.py	Fri May 17 00:38:09 2002
+++ ./scripts/ly2dvi.py	Tue May 21 00:05:08 2002
@@ -130,8 +130,6 @@ def user_error (s, e=1):
 	sys.exit (e)
 	
 def error (s):
-
-
 	'''Report the error S.  Exit by raising an exception. Please
 	do not abuse by trying to catch this error. If you do not want
 	a stack trace, write to the output directly.
@@ -322,6 +320,7 @@ errorport = sys.stderr
 keep_temp_dir_p = 0
 verbose_p = 0
 preview_p = 0
+preview_resolution = 90
 
 help_summary = _ ("Generate .dvi with LaTeX for LilyPond")
 
@@ -336,6 +335,7 @@ option_definitions = [
 	(_ ("FILE"), 'f', 'find-pfa', _ ("find pfa fonts used in FILE")),
 	# why capital P?
 	('', '', 'preview', _("Make a picture of the first system.")),
+	(_ ('RES'), '', 'preview-resolution', _("Set the resolution of the preview to RES.")),
 	('', 'P', 'postscript', _ ("generate PostScript output")),
 	(_ ("KEY=VAL"), 's', 'set', _ ("change global setting KEY to VAL")),
 	('', 'V', 'verbose', _ ("verbose")),
@@ -734,14 +734,12 @@ def make_preview (name, extra):
 	fo.write ('%d %d translate\n' % (-bbox[0]+margin, -bbox[1]+margin))
 	fo.close ()
 	
-	res = 90
-
-	x = (2* margin + bbox[2] - bbox[0]) * res / 72.
-	y = (2* margin + bbox[3] - bbox[1]) * res / 72.
+	x = (2* margin + bbox[2] - bbox[0]) * preview_resolution / 72.
+	y = (2* margin + bbox[3] - bbox[1]) * preview_resolution / 72.
 
 	cmd = r'''gs -g%dx%d -sDEVICE=pgm  -dTextAlphaBits=4 -dGraphicsAlphaBits=4  -q -sOutputFile=- -r%d -dNOPAUSE %s %s -c quit | pnmtopng > %s'''
 	
-	cmd = cmd % (x, y, res, name + '.trans.eps', name + '.preview.ps',name + '.png')
+	cmd = cmd % (x, y, preview_resolution, name + '.trans.eps', name + '.preview.ps',name + '.png')
 	quiet_system (cmd, 'gs')
 
 	try:
@@ -832,9 +830,9 @@ for opt in options:	
 	elif o == '--preview':
 		preview_p = 1
 		targets.append ('PNG')
-		
+	elif o == '--preview-resolution':
+		preview_resolution = string.atoi (a)
 	elif o == '--no-paper' or o == '-m':
-
 		targets = ['MIDI'] 
 		paper_p = 0
 	elif o == '--output' or o == '-o':
diff -purN ../lilypond-1.5.57/scripts/update-lily.py ./scripts/update-lily.py
--- ../lilypond-1.5.57/scripts/update-lily.py	Fri May 17 00:38:09 2002
+++ ./scripts/update-lily.py	Tue May 21 00:05:08 2002
@@ -26,6 +26,7 @@ import re
 import operator
 import os
 import tempfile
+import shutil
 import stat
 import string
 import sys
@@ -386,13 +387,44 @@ def version_str_to_tuple (s):
 	return (string.atoi (t[0]), string.atoi (t[1]), string.atoi (t[2]),
 		my_name, my_number)
 
+def next_version (t):
+	l = list (t)
+	if len (l) >= 4:
+		if l[4]:
+			l[4] += 1
+		else:
+			l[3] = l[4] = ''
+			l[2] += 1
+	else:
+		l[2] += 1
+
+	return tuple (l)
+
+def prev_version(t):
+	l = list (t)
+	if len (l) >= 4:
+		if l[4]:
+			l[4] += 1
+		else:
+			l[3] = l[4] = ''
+			l[2] -= 1
+	else:
+		l[2] -= 1
+		
+	return tuple (l)
+
 def split_package (p):
-	m = re.match ('(.*)-([0-9]*.*).tar.gz', p)
+	m = re.match ('(.*)-([0-9]*.*?)(.tar.gz)?$', p)
 	return (m.group (1), version_str_to_tuple (m.group (2)))
 
 def join_package (t):
 	return t[0] + '-' + version_tuple_to_str (t[1])
 
+def diff_name (p):
+	t = split_package (p)
+	return '%s-%s-%s' % (t[0], version_tuple_to_str (prev_version (t[1])),
+			     version_tuple_to_str (t[1]))
+	
 def find_latest (url):
 	progress (_ ("Listing `%s'...") % url)
 	list = map (split_package, list_url (url))
@@ -469,8 +501,9 @@ if 1:
 	get_base = url[:string.rindex (url, '/')] + '/'
 	if os.path.isdir (patch_dir):
 		os.chdir (patch_dir)
-		if not os.path.isfile (latest + '.diff.gz'):
-			get = get_base + latest + '.diff.gz'
+		latest_diff = diff_name (latest)
+		if not os.path.isfile (latest_diff + '.diff.gz'):
+			get = get_base + latest_diff + '.diff.gz'
 			progress (_ ("Fetching `%s'...") % get)
 			copy_url (get, '.')
 
diff -purN ../lilypond-1.5.57/stepmake/aclocal.m4 ./stepmake/aclocal.m4
--- ../lilypond-1.5.57/stepmake/aclocal.m4	Sun May 19 02:12:35 2002
+++ ./stepmake/aclocal.m4	Tue May 21 00:05:08 2002
@@ -55,11 +55,11 @@ AC_DEFUN(STEPMAKE_OPTIONAL_REQUIRED, [
 # Return if tested proram ($1) was found (true) or not (false).
 AC_DEFUN(STEPMAKE_CHECK_SEARCH_RESULT, [
     r="`eval echo '$'"$1"`"
-    if test -n "$r" -a "$r" != "error" -a "$r" != "no" && ! expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
+    if test -n "$r" -a "$r" != "error" -a "$r" != "no" && expr '`eval echo '$'"$1"`' : '.*\(echo\)' > /dev/null; then
+	true
+    else
 	##STEPMAKE_WARN(cannot find $2. $3)
 	false
-    else
-	true
     fi
 ])
 
@@ -596,8 +596,9 @@ AC_DEFUN(STEPMAKE_INIT, [
     AC_SUBST(INSTALL)
     AC_DEFINE_UNQUOTED(DIRSEP, '${DIRSEP}')
     AC_DEFINE_UNQUOTED(PATHSEP, '${PATHSEP}')
-    AC_SUBST(PATHSEP)
     AC_SUBST(DIRSEP)
+    AC_SUBST(PATHSEP)
+    AC_SUBST(ROOTSEP)
   
     STEPMAKE_DATADIR
 ])
diff -purN ../lilypond-1.5.57/stepmake/autogen.sh ./stepmake/autogen.sh
--- ../lilypond-1.5.57/stepmake/autogen.sh	Fri May 17 14:09:11 2002
+++ ./stepmake/autogen.sh	Tue May 21 00:05:08 2002
@@ -4,19 +4,14 @@
 srcdir=`dirname $0`
 DIE=0
 
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
-  echo
-  echo "ERROR: You must have \`autoconf' installed to."
-  echo "Download the appropriate package for your distribution,"
-  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-  DIE=1
-}
-
-if test "$DIE" -eq 1; then
+# autoconf > 2.50 is not very common yet,
+# and disappointingly incompatible with the widely available 2.13
+version=`autoconf --version 2>/dev/null | awk '{print $3}'`
+if test "$version" != "2.13"; then
+  echo "ERROR: Please install autoconf 2.13"
   exit 1
 fi
 
-
 if test -z "$*"; then
   echo "WARNING: I am going to run \`configure' with no arguments."
   echo "If you wish to pass any to it, please specify them on the"
