Generated with 

	make_patch 0.1.2 0.1.3 lilypond

usage 

	cd lilypond-source-dir; patch -E -p0 < patch-0.1.3
	
Patches do not contain automatically generated files, 
i.e. you should rerun configure
diff -urN ../lilypond-0.1.2/ANNOUNCE ./ANNOUNCE
--- ../lilypond-0.1.2/ANNOUNCE	Fri Aug  1 01:46:20 1997
+++ ./ANNOUNCE	Fri Aug  8 11:41:58 1997
@@ -115,7 +115,7 @@
 Sources for this project are on
 
 	ftp://pcnov095.win.tue.nl/pub/lilypond/ (Europe)
-	ftp://alpha.gnu.ai.mit.edu/gnu/ (US)
+	ftp://alpha.gnu.ai.mit.edu/gnu/lilypond (US)
 
 More detailed info and examples can be found on the webpage at
 
diff -urN ../lilypond-0.1.2/Documentation/INSTALL.pod ./Documentation/INSTALL.pod
--- ../lilypond-0.1.2/Documentation/INSTALL.pod	Wed Aug  6 15:01:36 1997
+++ ./Documentation/INSTALL.pod	Fri Aug  8 13:52:53 1997
@@ -311,18 +311,17 @@
 A Debian package is in the works
 
 
-=head1 WINDOZE
+=head1 WINDOWS NT/95
 
-Windows NT:
+So, you're stuck with Windows, eh?  Well, don't worry, you just 
+need (to get) Cygnus' windows32 port of gnu development stuff; 
+have a look at http://www.cygnus.com/gnu-win32.
 
-you need the cygnus windows32 gnu port development stuff; have a look
-at http://www.cygnus.com/gnu-win32.
-
-to make GNU LilyPond under, brr, aargh, shudder.. windows32, well,
+To make GNU LilyPond under, brr, aargh, shudder... windows32, well,
 simply type:
 
 	bash configure
-	make windows32
+	make
 
 =head1 AUTHORS
 
diff -urN ../lilypond-0.1.2/Documentation/faq.pod ./Documentation/faq.pod
--- ../lilypond-0.1.2/Documentation/faq.pod	Fri Aug  1 01:17:05 1997
+++ ./Documentation/faq.pod	Fri Aug  8 13:52:53 1997
@@ -199,21 +199,21 @@
 
 A.0: Reconsider.  Try Linux.  It's fun!
 
-A.1: Currently (patchlevel 27), GNU LilyPond (and flowerLib) compiles, links
-and runs on windhoos-nt, using the cygnus gnu port (release b17.1). 
+A.1: Currently (patchlevel 27), GNU LilyPond (and flowerLib) compiles, 
+links and runs on Windows-nt, using Cygnus' gnu port (release b17.1). 
 I (JCN) only had to make a minor workaround for missing library calls.  
-Have a look at http://www.cygnus.com/gnu-win32.  To make GNU LilyPond type
-C<make $OSTYPE>. (I am not promising to maintain this platform, it is just 
-that when having to use doze, i-m sometimes too lazy to reboot.)
+Have a look at http://www.cygnus.com/gnu-win32.  To make GNU LilyPond 
+type C<make>. (I am not promising to maintain this platform, it is just
+that when forced into doze, i'm sometimes too lazy to reboot.)
 
 A.2: I haven't had time to find a GCC crosscompiler (I<with> g++ and
-libg++, mind you) to DOS/win (in rpm, please :-)
+libg++, mind you) to DOS/Windows (in rpm, please :-)
 
 
-Q: I-m dozed enough to run the (sometimes bit stale) .exe-s you distribute. 
+Q: I just love to blindly run the (sometimes bit stale) .exe's you distribute. 
 Why do i need cygwin.dll?
 
-A: It-s all in this cut-n-paste:
+A: It's all in this cut-n-paste:
 
 Minimalist GNU-Win32 Readme                   
 version 0.1.3                           
diff -urN ../lilypond-0.1.2/Documentation/lilyliterature.pod ./Documentation/lilyliterature.pod
--- ../lilypond-0.1.2/Documentation/lilyliterature.pod	Tue Aug  5 22:55:56 1997
+++ ./Documentation/lilyliterature.pod	Fri Aug  8 14:21:00 1997
@@ -275,9 +275,10 @@
 SMDL, Standard Musical Description Language,
 ftp://ftp.ornl.gov/pub/sgml/wg8/smdl/10743.pdf. ISO/IEC DIS 10743. 
 
-[An ISO defined SGML language. A much more thorough treatment of
-music/representation/performance definition than Mudela,  not
-suited for manual entry  HWN] 
+[An ISO defined SGML language. A much more thorough treatment of music
+definition than Mudela  (but not suited for manual entry). It deals
+with notation and perfomance issues by (basically) saying "You can
+embed a MIDI or NIFF file" (sic) HWN]
 
 MPDL,
 
diff -urN ../lilypond-0.1.2/Documentation/lilypond.pod ./Documentation/lilypond.pod
--- ../lilypond-0.1.2/Documentation/lilypond.pod	Wed Aug  6 02:07:12 1997
+++ ./Documentation/lilypond.pod	Fri Aug  8 13:52:53 1997
@@ -10,7 +10,7 @@
 
 GNU LilyPond is a program which converts music definition files into
 visual or auditive output: it can typeset formatted sheet music to a
-TeX file and and (mechanical) performances to MIDI files.
+TeX file and play (mechanical) performances to MIDI files.
 
 =head1 OPTIONS
 
@@ -22,12 +22,12 @@
 
 =item B<-M,--midi>
 
-do midi output only
+do midi output only.
 
 =item B<-d,--debug>,
 
-Turn debugging info. GNU LilyPond will read the file F<.dstreamrc>, which
-tells for what functions and classes may produce copious debugging
+Turn debugging info on.  GNU LilyPond reads the file F<.dstreamrc>, 
+which lists what functions and classes may produce copious debugging
 output.
 
 =item B<-w,--warranty>,
@@ -41,11 +41,11 @@
 
 =item B<-h,--help>,
 
-Show a summary of usage
+Show a summary of usage.
 
 =item B<-i,--init=>F<FILE>
 
-set init file to F<FILE> (default: F<symbol.ly>)
+set init file to F<FILE> (default: F<symbol.ly>).
 
 =item B<--include, -I>=F<DIRECTORY>
 
@@ -53,21 +53,21 @@
 
 =item B<--ignore-version, -V>
 
-make incompatible mudela version non-fatal 
+make incompatible mudela version non-fatal.
 
 =back
 
 =head1 FEATURES
 
-This is an overview of the features that GNU LilyPond supports. For
-details on how to use them, you should consult mudela(5)
+This is an overview of the features that GNU LilyPond supports.  For
+details on how to use them, you should consult mudela(5).
 
 =over 5
 
 =item *
 
 ASCII script input, with identifiers (for music reuse),
-customizable notenames, customizable fontset
+customizable notenames, customisable fontset.
 
 =item *
 
@@ -79,7 +79,7 @@
 
 =item *
 
-Multiple staffs in one score. Each staff can have a different meters.
+Multiple staffs in one score.  Each staff can have a different meters.
 
 =item *
 
@@ -90,11 +90,11 @@
 =item *
 
 multiple voices within one staff; beams optionally shared
-between voices. Up to four voices is handled cleanly.
+between voices.  Up to four voices is handled cleanly.
 
 =item *
 
-multiple scores within one input file. Each score is output to
+multiple scores within one input file.  Each score is output to
 a different file.
 
 =item *
@@ -105,11 +105,11 @@
 
 =head1 DISCLAIMER & COPYING POLICY
 
-GNU LilyPond is copyright 1996,97 by its authors. GNU LilyPond is
-distributed under the terms of the GNU General Public
-License. GNU LilyPond is provided without any warranty what so ever.
-GNU LilyPond may be freely distributed.  For further information consult
-the GNU General Public License, which is in the file F<COPYING>
+GNU LilyPond is copyright 1996, 1997 by its authors.  GNU LilyPond is
+distributed under the terms of the GNU General Public License.  GNU LilyPond 
+is provided without any warranty what so ever.
+GNU LilyPond may be freely distributed.  For further information consult 
+the GNU General Public License, from the file F<COPYING>.
 
 =head1 AUTHORS
 
@@ -132,7 +132,7 @@
 =head1 PROBLEMS
 
 
-There is an extensive list of todoes and bugs. See F<TODO>. In
+There is an extensive list of todoes and bugs.  See F<TODO>.  In
 general, try to find out 
 
 =over 4
@@ -171,8 +171,8 @@
 
 It does help if you can find out where the bug comes from: if GNU
 LilyPond bombs out, then please recompile using with debugging info
-turned on, and send gdb stacktrace of the crash. It also helps if you
-can print the values of the objects. So if your trace is
+turned on, and send gdb stacktrace of the crash.  It also helps if you
+can print the values of the objects.  So if your trace is
 
 	received SIGSEGV 
 	(gdb) backtrace 12
@@ -193,7 +193,7 @@
 
 =item F<symbol.ly>
 
-The initialisation file with symbol tables etc. It
+The initialisation file with symbol tables etc.  It
 includes files from the directory F<init/>.
 
 =back
@@ -214,7 +214,7 @@
 
 =item mudela-man
 
-On the input format. This is a LilyPond-enhanced LaTeX document.
+On the input format.  This is a LilyPond-enhanced LaTeX document.
 
 =item MANIFESTO
 
@@ -227,7 +227,7 @@
 =item http://www.stack.nl/~hanwen/lilypond/index.html
 
 GNU LilyPond has her own webpage.  This webpage contains the MIDI, GIF
-and PS files for some standard music files. It also has the complete
+and PS files for some standard music files.  It also has the complete
 LilyPond documentation
 
 =back
@@ -235,7 +235,7 @@
 GNU LilyPond is
 updated very frequently, the latest version is always available at:
 ftp://pcnov095.win.tue.nl/pub/lilypond and
-ftp://alpha.gnu.ai.mit.edu/gnu/
+ftp://alpha.gnu.ai.mit.edu/gnu/lilypond/
 
 
 For programs which are part of the GNU music project, the following
@@ -251,13 +251,13 @@
 
 =item help-gnu-music@vuse.vanderbilt.edu
 
-For help with programs from the GNU music project. To subscribe: send
+For help with programs from the GNU music project.  To subscribe: send
 mail with subject "subscribe" to
 help-gnu-music-request@vuse.vanderbilt.edu
 
 =item bug-gnu-music@vuse.vanderbilt.edu
 
-If you have bugreports, you should send them to this list. If you want
+If you have bugreports, you should send them to this list.  If you want
 to read all bugreports, you should subscribe to this list.  To
 subscribe: send mail with subject "subscribe" to
 bug-gnu-music-request@vuse.vanderbilt.edu
@@ -284,19 +284,19 @@
 (for a  detailed changelog, see F<NEWS>)
 
 GNU LilyPond's roots lie in MPP, a preprocessor to the rather arcane
-MusiXTeX macro package for TeX. A friend of mine, Jan Nieuwenhuizen
+MusiXTeX macro package for TeX.  A friend of mine, Jan Nieuwenhuizen
 wrote the first 44 versions (0.01 to 0.44), then his program caught my
 attention, and I was slowly sucked in to the interesting problem of
-easily producing beautifully printed music. I contributed some
-code. We soon realised that MPP's design was too fundamentally broken
+easily producing beautifully printed music.  I contributed some
+code.  We soon realised that MPP's design was too fundamentally broken
 to be repaired, so it was decided to rewrite MPP.  We debated a lot about
-the requirements to an inputformat (fall 1995). I sat down and started
+the requirements to an inputformat (fall 1995).  I sat down and started
 with a parser-first, bottom-up rewrite called mpp95 (which totally
 failed, obviously).
 
 After long and hard thinking, I came up with an algorithm for the
 horizontal spacing of multiple staffs (april 1996) I coded it (and did
-not test it). After starting with this fundamental piece, I slowly
+not test it).  After starting with this fundamental piece, I slowly
 added the stages which come before spacing, and after.  A half year
 later, I had a first working version, (october 1996).  I announced
 Patchlevel 0.0.7 (or 8) to the mutex list after asking some technical
@@ -304,7 +304,7 @@
 got the hang of it, and in the subsequent two months, I coded until it
 had doubled in size (pl 23).
 
-Most the other history is described in the NEWS file. The first large
+Most the other history is described in the NEWS file.  The first large
 scale release (0.1) was done after approximately 78 patchlevels on
 August 1, 1997.
 
diff -urN ../lilypond-0.1.2/Documentation/links.pod ./Documentation/links.pod
--- ../lilypond-0.1.2/Documentation/links.pod	Tue Aug  5 17:39:45 1997
+++ ./Documentation/links.pod	Fri Aug  8 11:42:49 1997
@@ -39,8 +39,8 @@
 
 =item ftp://ftp.redhat.com/pub/contrib/
 
-RedHat Software develops and markets a GNU/Linux distribution (of
-which we are avid users)
+The FTP site of RedHat Software.
+
 
 =back
 
@@ -50,7 +50,7 @@
 
 =item ftp://pcnov095.win.tue.nl/pub/lilypond
 
-=item ftp://alpha.gnu.ai.mit.edu/gnu/
+=item ftp://alpha.gnu.ai.mit.edu/gnu/lilypond/
 
 =back
 
@@ -130,5 +130,11 @@
 
 Transcriptions of the music of Thomas Ravenscroft, partly using
 LilyPond
+
+=item http://www.redhat.com/
+
+develops and markets a GNU/Linux distribution (of
+which we are avid users)
+
 
 =back
diff -urN ../lilypond-0.1.2/Documentation/mi2mu.pod ./Documentation/mi2mu.pod
--- ../lilypond-0.1.2/Documentation/mi2mu.pod	Fri Aug  1 01:56:35 1997
+++ ./Documentation/mi2mu.pod	Fri Aug  8 13:52:53 1997
@@ -80,11 +80,11 @@
 =head1
 DISCLAIMER & COPYING POLICY
 
-Mi2mu is copyright 1996,97 by its authors. Mi2mu is distributed 
+Mi2mu is copyright 1996, 1997 by its authors. Mi2mu is distributed 
 as part of GNU LilyPond, under the terms of the GNU General Public
 License.  Mi2mu is provided without any warranty what so ever.
 Mi2mu may be freely distributed.  For further information consult
-the GNU General Public License, which is in the file F<COPYING>.
+the GNU General Public License, from the file F<COPYING>.
 
 =head1 AUTHORS
 
diff -urN ../lilypond-0.1.2/NEWS ./NEWS
--- ../lilypond-0.1.2/NEWS	Thu Aug  7 14:09:58 1997
+++ ./NEWS	Fri Aug  8 14:58:48 1997
@@ -1,6 +1,22 @@
 
+pl 0.1.3 
+	- don't crash if no Clef_engraver.
+	- PScore -> Paper_score
+	- bf: Score_elem::extent() init of interval
+	- bfs: {Horizontal,Vertical}_group related
+	- bf: don't change original Item while doing making 
+	multiple copies
+	- bf: configure DATADIR
 
+pl 0.1.2.jcn2
+	- minor doco fixes
+	- revived Midi_walker
+	- moved midi out of performer-* to audio-*
+	- Audio_staff
+	- removed all <ugh> members from performers
 
+*******
+aug 7
 pl 0.1.2
 	- junked Line_of_staff
 	- bf: --output
@@ -8,7 +24,7 @@
 	- bf: mi2mu version number.
 	- bf: in mudela-book
 	- bf: don't forget to make mi2mu
-	- Bar_number_grav
+	- Bar_number_grav: measure numbers (experimental)
 	- Bar_column_engraver, Bar_column: scripts on bars
 	- rewrite of {Horizontal,Vertical}_group. Yes, again. 
 Now neatly integrated into class hierarchy
diff -urN ../lilypond-0.1.2/README ./README
--- ../lilypond-0.1.2/README	Wed Aug  6 21:30:17 1997
+++ ./README	Fri Aug  8 14:51:21 1997
@@ -57,7 +57,7 @@
 package, since it might contain more documentation
 
 	ftp://pcnov095.win.tue.nl/pub/lilypond/ (Europe)
-	ftp://alpha.gnu.ai.mit.edu/gnu/ (US)
+	ftp://alpha.gnu.ai.mit.edu/gnu/lilypond/ (US)
 
 The website also contains the complete documentation
 
@@ -69,7 +69,7 @@
 
 Solaris
 
-Stack frame overwrite in on Solaris 2.x (this will produce a seg
+Stack frame overwrite on Solaris 2.x (this will produce a seg
 fault, signal 11).  Stacktrace
 
 	Engraver_group_engraver::Engraver_group_engraver(int)
@@ -77,8 +77,8 @@
 	get_group_engraver_p()
 
 We don't know a fix or workaround, but compiling without optimisation
-might help (Without -O2 optimisation, my execs run fine on Solaris,
-without -O2, but with purify it dumps core)
+might help (Without -O2 optimisation, my execs run fine on Solaris;
+without -O2, but with purify, it dumps core)
 
 
 
diff -urN ../lilypond-0.1.2/TODO ./TODO
--- ../lilypond-0.1.2/TODO	Thu Aug  7 14:19:52 1997
+++ ./TODO	Fri Aug  8 13:54:11 1997
@@ -6,12 +6,23 @@
 Most of the items are marked in the code as well, with full explanation. 
 grep for TODO and ugh/ugr
 
+	* integrate midi-elts from mi2mu and lily
+
 	* virtualise PCols to make encapsulated spacing problems
 
+	* fix spacing: standchen: distance bar-note, 
+ 	  strange stretching and compressing of 8's
+ 
+	* Doc Mutopia (Music To The People) 
+
+	* context in spring-spacer.
+
+	* don't count bars which are not on first beat.
+
 	* generate stuff in out/default, out/sun5-irix etc iso out/ 
-and out-sun5/
+	and out-sun5/
 
-	* derive dstream, texstream from ostream?
+	* derive Dstream, texstream from ostream?
 
 	* A typical pop-music example.
 
@@ -33,8 +44,6 @@
 
 	* get rid of gif files.
 
-	* set_midi_channel/staff() out of performer.
-
 	* dots into separate item.
 
 	* use String iso Text_def for lyrics.
@@ -47,7 +56,7 @@
 
 	* rewire acknowledge_element() logic with a process_acknowledged()
 	
-	* Global type registration.  
+	* Global type registration.
 
 		My_class * p = create_object( My_class )
 		Type t = get_type ( *p );
@@ -75,7 +84,7 @@
 	* bugreport to doc++ devel: struct not in class hier; public
 	virtual baseclasses
 
-	* DOC++ bugs/ newer version?
+	* DOC++ bugs/newer version?
 
 	* Rational infty(HUGE_VAL) on glibc / w32
 
@@ -87,7 +96,6 @@
 	* (where are the) gcc compile warnings on linux
 
 LILY BUGS
-	* '.' -> lilypond: lexer.l:258: int My_lily_lexer::yylex(): Assertion `cnv == 1' failed.
 
 
 	\score { < 
@@ -101,6 +109,7 @@
 
 
 PROJECTS
+	* emacs-mode for mudela
 
 	* input converters
 	- NIFF?
diff -urN ../lilypond-0.1.2/VERSION ./VERSION
--- ../lilypond-0.1.2/VERSION	Tue Aug  5 17:19:31 1997
+++ ./VERSION	Fri Aug  8 14:41:26 1997
@@ -1,6 +1,6 @@
 TOPLEVEL_MAJOR_VERSION = 0
 TOPLEVEL_MINOR_VERSION = 1
-TOPLEVEL_PATCH_LEVEL = 2
+TOPLEVEL_PATCH_LEVEL = 3
 
 # use to send patches, always empty for released version:
 TOPLEVEL_MY_PATCH_LEVEL = 
diff -urN ../lilypond-0.1.2/configure.in ./configure.in
--- ../lilypond-0.1.2/configure.in	Mon Aug  4 15:53:47 1997
+++ ./configure.in	Fri Aug  8 14:24:17 1997
@@ -119,10 +119,9 @@
 AC_CHECK_PROGS(FIND, find, error)
 
 dnl should check out -print
-if test FIND = error; then
-   AC_LILY_WARN(Couldn't find \`find'.  Please use --enable-tex-dir)
-fi
+AC_CHECK_SEARCH_RESULT($FIND, \`find\'. Please use --enable-tex-dir)
 
+    
 AC_SUBST(OUTDIR_NAME)
 AC_SUBST(CXXFLAGS)
 AC_SUBST(CPPFLAGS)
@@ -160,10 +159,11 @@
     AC_TEX_SUBDIR(TEXDIR)
 fi
 
-dnl if test "x$MFDIR" = xauto; then
-dnl     AC_MF_SUBDIR(MFDIR)
-dnl fi
-    
+
+AC_JUNK_ARGS( [if test "x$MFDIR" = xauto; then
+     AC_MF_SUBDIR(MFDIR)
+ fi]
+)
 
 AC_CHECK_SEARCH_RESULT($MAKE, GNU make,  You should install GNU make)
 AC_CHECK_SEARCH_RESULT( $BISON, bison,  Please install Bison, 1.25 or better)
@@ -197,7 +197,7 @@
 AC_CHECK_HEADER(FlexLexer.h, true,
 	AC_LILY_WARN(can't find flex header. Please install Flex headers correctly))
 
-for a in `find -type d -and -not -name 'out*'`; do
+for a in `find . -type d -and -not -name 'out*' -print`; do
     if test ! -d  $a/$OUTDIR_NAME; then
 	mkdir $a/$OUTDIR_NAME
     fi
@@ -205,11 +205,8 @@
 
 AC_CONFIG_SUBDIRS(flower)
 
-# ugh
-eval "DIR_DATADIR=$datadir/lilypond"
     
 AC_OUTPUT(make/$OUTDIR_NAME/Configure_variables.make:make/Configure_variables.make.in
-    lib/$OUTDIR_NAME/config.hh:lib/config.hh.in
     Makefile:make/Toplevel.make.in)
 
 touch make/$OUTDIR_NAME/Site.make
diff -urN ../lilypond-0.1.2/init/engraver.ly ./init/engraver.ly
--- ../lilypond-0.1.2/init/engraver.ly	Thu Aug  7 15:52:15 1997
+++ ./init/engraver.ly	Fri Aug  8 12:08:34 1997
@@ -13,8 +13,6 @@
 		  \consists "Staff_sym_engraver";
 		  \consists "Collision_engraver";
 		  \consists "Rest_collision_engraver";
-%	\consists "Bar_column_engraver";
-%	\consists "Bar_number_grav";
 
 		  \consists "Line_group_engraver";
 		  \contains \requesttranslator {
@@ -41,9 +39,6 @@
 	\consists "Span_bar_engraver";
 	\consists "Vertical_align_engraver";
 	\consists "Piano_bar_engraver";
-	\consists "Bar_column_engraver";
-	\consists "Bar_number_grav";
-
 
 	% This should come last
 	\consists "Line_group_engraver";
@@ -76,6 +71,9 @@
 orchestral_score_translator = \requesttranslator {
 	Engraver Score_engraver
 	\alias "Score";
+
+	\consists "Bar_column_engraver";
+	\consists "Bar_number_grav";
 
 	\consists "Bar_align_engraver";
 	\consists "Clef_align_engraver";
diff -urN ../lilypond-0.1.2/input/rock.ly ./input/rock.ly
--- ../lilypond-0.1.2/input/rock.ly	Mon Aug  4 22:04:48 1997
+++ ./input/rock.ly	Thu Jan  1 01:00:00 1970
@@ -1,4 +0,0 @@
-
-mel = \melodic { 
-	[c8 c32 c16] 
-}
diff -urN ../lilypond-0.1.2/lib/Makefile ./lib/Makefile
--- ../lilypond-0.1.2/lib/Makefile	Mon Aug  4 15:15:13 1997
+++ ./lib/Makefile	Fri Aug  8 14:55:20 1997
@@ -52,7 +52,7 @@
 # MAINTARGET = $(bindir)/$(EXECUTABLE)# huh?
 MAINTARGET = $(outdir)/$(LIBRARY)# huh?
 
-default: $(MAINTARGET)
+default: configheader $(MAINTARGET)
 #
 
 localclean:
@@ -68,3 +68,10 @@
 -include $(DEPFILES)
 #
 
+.PHONY: configheader
+
+configheader: $(outdir)/config.hh
+
+# Ugh ugh
+$(outdir)/config.hh: config.hh.in
+	sed 's!@datadir@!$(datadir)!'<  $< > $@
diff -urN ../lilypond-0.1.2/lib/config.hh.in ./lib/config.hh.in
--- ../lilypond-0.1.2/lib/config.hh.in	Mon Aug  4 15:15:13 1997
+++ ./lib/config.hh.in	Fri Aug  8 14:54:57 1997
@@ -1,6 +1,6 @@
 /* @configure_input@ */
 #ifndef CONFIG_HH
 #define CONFIG_HH
-#define  DIR_DATADIR "@DIR_DATADIR@"
+#define  DIR_DATADIR "@datadir@/lilypond"
 
 #endif
diff -urN ../lilypond-0.1.2/lib/duration-convert.cc ./lib/duration-convert.cc
--- ../lilypond-0.1.2/lib/duration-convert.cc	Sat May 17 10:28:58 1997
+++ ./lib/duration-convert.cc	Fri Aug  8 13:52:54 1997
@@ -4,6 +4,7 @@
   source file of the LilyPond music typesetter
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+	   Jan Nieuwenhuizen <jan@digicash.com>
 */
 #include <assert.h>
 #include "duration-convert.hh"
diff -urN ../lilypond-0.1.2/lib/duration.cc ./lib/duration.cc
--- ../lilypond-0.1.2/lib/duration.cc	Wed May 14 23:56:34 1997
+++ ./lib/duration.cc	Fri Aug  8 13:52:54 1997
@@ -3,9 +3,8 @@
 
   source file of the LilyPond music typesetter
 
-  copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
-
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+           Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
 #include "proto.hh"
diff -urN ../lilypond-0.1.2/lily/Makefile ./lily/Makefile
--- ../lilypond-0.1.2/lily/Makefile	Thu Aug  7 13:45:04 1997
+++ ./lily/Makefile	Fri Aug  8 14:16:01 1997
@@ -37,7 +37,7 @@
 
 # list of custom libraries:
 #
-MODULE_LIBDEPS= check-flower-deps check-lily-deps
+MODULE_LIBDEPS= check-flower-deps check-lib-deps
 MODULE_LIBES= -llily -lflower
 
 #
@@ -70,3 +70,7 @@
 localuninstall: uninstallexe
 
 $(outdir)/lily-version.o: $(outdir)/version.hh
+
+# make config.hh. Ugh
+$(outdir)/main.o: check-lib-deps
+	$(MAKE) -C $(depth)/lib configheader
diff -urN ../lilypond-0.1.2/lily/Stable.make ./lily/Stable.make
--- ../lilypond-0.1.2/lily/Stable.make	Sat Aug  2 16:21:15 1997
+++ ./lily/Stable.make	Fri Aug  8 02:27:19 1997
@@ -4,7 +4,7 @@
 stablecc=atom.cc command-request.cc musical-request.cc bar.cc boxes.cc \
 	keyword.cc leastsquares.cc \
 	lookup.cc meter.cc\
-	parser.cc \
+	parser.cc notename-table.cc lexer.cc\
 	qlp.cc qlpsolve.cc\
-	template*.cc  template6.cc version.cc tex-stream.cc  tex.cc\
+	template*.cc  version.cc tex-stream.cc  tex.cc\
 	identifier.cc note.cc
diff -urN ../lilypond-0.1.2/lily/VERSION ./lily/VERSION
--- ../lilypond-0.1.2/lily/VERSION	Wed Aug  6 22:50:26 1997
+++ ./lily/VERSION	Thu Aug  7 21:42:51 1997
@@ -1,6 +1,6 @@
 MAJOR_VERSION = 0
 MINOR_VERSION = 1
-PATCH_LEVEL = 2
+PATCH_LEVEL = 3
 # use to send patches, always empty for released version:
 # include separator: ".postfix", "-pl" makes rpm barf
 
diff -urN ../lilypond-0.1.2/lily/audio-item.cc ./lily/audio-item.cc
--- ../lilypond-0.1.2/lily/audio-item.cc	Thu Aug  7 13:45:04 1997
+++ ./lily/audio-item.cc	Fri Aug  8 13:52:54 1997
@@ -9,12 +9,17 @@
 #include "audio-item.hh"
 #include "midi-item.hh"
 
-#if 0
 Audio_instrument::Audio_instrument( String instrument_str )
 	: Audio_item( 0 )
 {
+    str_ = instrument_str;
+}
+
+Midi_item*
+Audio_instrument::midi_item_p()
+{
+    return new Midi_instrument( 0, str_ );
 }
-#endif
                                       
 Audio_item::Audio_item( Request* req_l )
 {
@@ -34,10 +39,9 @@
 }
 
 
-Audio_note::Audio_note( Request* req_l, bool on_b )
+Audio_note::Audio_note( Request* req_l )
 	: Audio_item( req_l )
 {
-    on_b_ = on_b;
 }
 
 Midi_item*
diff -urN ../lilypond-0.1.2/lily/audio-score.cc ./lily/audio-score.cc
--- ../lilypond-0.1.2/lily/audio-score.cc	Thu Aug  7 13:45:04 1997
+++ ./lily/audio-score.cc	Fri Aug  8 13:52:54 1997
@@ -6,49 +6,92 @@
   (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
 */
 
+#include <time.h>
 #include "debug.hh"
+#include "string.hh"
+#include "string-convert.hh"
+#include "main.hh"
 #include "midi-def.hh"
+#include "midi-item.hh"
+#include "midi-stream.hh"
 #include "audio-column.hh"
+#include "audio-staff.hh"
 #include "audio-score.hh"
+#include "score.hh"
 
-Audio_score::Audio_score( Midi_def* l )
+Audio_score::Audio_score( Score* l )
 {
-    midi_l_ = l;
+    score_l_ = l;
 }
 
 void
-Audio_score::play( Audio_item* i, Audio_column* c )
+Audio_score::add( Audio_column* p )
 {
-    assert( c );
-    assert( i );
+    p->audio_score_l_ = this;
+    audio_column_p_list_.bottom().add(p);
+}
 
-    c->add( i );
-//    typeset_element( i );
+void
+Audio_score::output( Midi_stream& midi_stream_r )
+{
+    int tracks_i = audio_staff_p_list_.size() + 1;
+    // ugh
+    int clocks_per_4_i = 384;
+    midi_stream_r << Midi_header( 1, tracks_i, clocks_per_4_i );
+    output_header_track( midi_stream_r );
+    int n = 1;
+    for ( PCursor<Audio_staff*> i( audio_staff_p_list_ ); i.ok(); i++ )
+	i->output( midi_stream_r, n++ );
 }
 
 void
-Audio_score::add( Audio_column* p )
+Audio_score::output_header_track( Midi_stream& midi_stream_r )
 {
-    p->audio_score_l_ = this;
-    audio_column_p_list_.bottom().add(p);
+    Midi_track midi_track;
+    
+    time_t t = time( 0 );
+
+    // perhaps multiple text events?
+    String str = String( "Creator: " ) + get_version_str() + "\n";
+
+    Midi_text creator( Midi_text::TEXT, str );
+    midi_track.add( Moment( 0 ), &creator );
+
+    str = "Automatically generated at ";
+    str += ctime( &t );
+    str = str.left_str( str.length_i() - 1 );
+    str += "\n";
+    Midi_text generate( Midi_text::TEXT, str );
+    midi_track.add( Moment( 0 ), &generate );
+
+    str = "from musical definition: ";
+
+    str += score_l_->location_str();
+    Midi_text from( Midi_text::TEXT, str );
+    midi_track.add( Moment( 0 ), &from );
+
+    Midi_text track_name( Midi_text::TRACK_NAME, "Track " 
+			  + String_convert::i2dec_str( 0, 0, '0' ) );
+    midi_track.add( Moment( 0 ), &track_name );
+
+    Midi_tempo tempo( score_l_->midi_p_->get_tempo_i( Moment( 1, 4 ) ) );
+    midi_track.add( Moment(0), &tempo);
+
+    midi_stream_r  << midi_track;
 }
 
-#if 0
 void
-Audio_score::output(Tex_stream &ts)
+Audio_score::play( Audio_staff* p )
 {
-    ts << "\n "<<  midi_l_->lookup_l()->texsetting << "%(Tex id)\n";
-    ts<< super_elem_l_->TeX_string();
-    ts << "\n\\EndLilyPondOutput";
+    audio_staff_p_list_.bottom().add( p );
 }
-#endif
 
 void
 Audio_score::print() const
 {    
 #ifndef NPRINT
     mtor << "Audio_score { ";
-    midi_l_->print();
+    score_l_->midi_p_->print();
     mtor << "\ncolumns: ";
     for ( PCursor<Audio_column*> i( audio_column_p_list_ ); i.ok(); i++ )
 	i->print();
diff -urN ../lilypond-0.1.2/lily/audio-staff.cc ./lily/audio-staff.cc
--- ../lilypond-0.1.2/lily/audio-staff.cc	Thu Jan  1 01:00:00 1970
+++ ./lily/audio-staff.cc	Fri Aug  8 13:52:54 1997
@@ -0,0 +1,29 @@
+/*
+  audio-staff.cc -- implement Audio_staff
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ */
+
+#include "audio-staff.hh"
+#include "audio-item.hh"
+#include "midi-item.hh"
+#include "midi-stream.hh"
+#include "midi-walker.hh"
+
+void
+Audio_staff::add( Audio_item* p )
+{
+    audio_item_p_list_.bottom().add( p );
+}
+
+void
+Audio_staff::output( Midi_stream& midi_stream_r, int track_i )
+{
+    Midi_track midi_track;
+    midi_track.number_i_ =  track_i;
+    for ( Midi_walker i( this, &midi_track ); i.ok(); i++ )
+	i.process();
+    midi_stream_r << midi_track;
+}
diff -urN ../lilypond-0.1.2/lily/axis-group-item.cc ./lily/axis-group-item.cc
--- ../lilypond-0.1.2/lily/axis-group-item.cc	Thu Aug  7 15:47:52 1997
+++ ./lily/axis-group-item.cc	Fri Aug  8 01:47:07 1997
@@ -13,7 +13,14 @@
 void
 Axis_group_item::OK() const
 {
+    Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; 
+    for (int i=0; i < elems.size(); i++) {
+	Item * it_l = elems[i]->item();
+	assert(it_l);
   
+	// somebody probably broke it in pieces
+	assert (it_l->pcol_l_ == pcol_l_ );
+    }
 }
 
 void
@@ -21,28 +28,19 @@
 {
     if (!pcol_l_->breakable_b())
 	return;
+    OK();
     copy_breakable_items();
     
+	    
     Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; 
     for (int i=0; i < elems.size(); i++) {
-	Item * it_l = elems[i]->item();
-	assert(it_l);
-	
-	// somebody probably broke it in pieces
-	if (it_l->pcol_l_ != pcol_l_ ) {
-	    remove_element( it_l );
-	}
-    }
-    
-    elems=axis_admin_.elem_l_arr_;
-
-    for (int i=0; i < elems.size(); i++) {
 	Item* it_l = elems[i]->item();
 	for ( int j=0; j < 2; j++) {
 	    Item *new_l = it_l->find_prebroken_piece(broken_to_a_[j]->pcol_l_);
 	    ((Axis_group_item*)broken_to_a_[j])->add_element( new_l );
 	}
     }
+    Item::do_breakable_col_processing();
 }
 
 void
diff -urN ../lilypond-0.1.2/lily/axis-group-spanner.cc ./lily/axis-group-spanner.cc
--- ../lilypond-0.1.2/lily/axis-group-spanner.cc	Thu Aug  7 14:22:59 1997
+++ ./lily/axis-group-spanner.cc	Fri Aug  8 02:29:10 1997
@@ -10,24 +10,54 @@
 #include "item.hh"
 #include "p-col.hh"
 
+/** Do stuff if we're not broken. In this case the last and first
+  columns usually are pre- and postbreak respectively,
+  so the items from these columns need adjusting.
+  */
+void
+Axis_group_spanner::do_break_processing_if_unbroken()
+{
+    Link_array<Score_elem> elems = axis_admin_.elem_l_arr_;
+    Line_of_score *my_line = line_l();
+    for (int i=0; i < elems.size(); i++) {
+	if (!elems[i]->line_l()) {
+	    Item * item_l = elems[i]->item();
+	    if  (item_l
+		 && item_l->breakable_b_ 
+		 && item_l->break_status_i() == 0) {
+		// last two checks are paranoia
+		Item * broken_item_l = 
+		    item_l->find_prebroken_piece( my_line );
+		add_element( broken_item_l );
+	    }
+	    remove_element( elems[i] );  
+	}
+    }
+    
+}
 void
 Axis_group_spanner::do_break_processing()
 {
     set_my_columns();
-    if ( Spanner::line_l() ) {
-	Score_elem::handle_broken_dependencies();
+    bool breaking_self_b = ! Spanner::line_l();
+    if (!breaking_self_b)  {
+	do_break_processing_if_unbroken();
+	Spanner::do_break_processing();
 	return;
     }
+
     break_into_pieces( true );
-    Link_array<Score_elem> elem_l_arr = axis_admin_.elem_l_arr_;
+    Link_array<Score_elem> loose_elems = axis_admin_.elem_l_arr_;
     remove_all();
-
     
-    for (int i=0; i < elem_l_arr.size(); i++) {
-	Score_elem * elt = elem_l_arr[i];
+    for (int i=0; i < loose_elems.size(); i++) {
+	Score_elem * elt = loose_elems[i];
 	Line_of_score *elt_line = elt->line_l();
 	
-	if ( ! elt_line ){ 
+	if ( ! elt_line ){
+	    /* this piece doesn't know where it belongs.
+	       Find out if it was broken, and use the broken remains
+	       */
 	    if (elt->spanner()) {
 		Spanner * sp = elt->spanner();
 		
@@ -36,28 +66,35 @@
 			 = (Axis_group_spanner*)broken_into_l_arr_[j];
 		    
 		    Spanner * broken_span_l 
-			= sp->find_broken_piece(((Score_elem*)my_broken_l)->line_l());
+			= sp->find_broken_piece(
+			    ((Score_elem*)my_broken_l)->line_l());
 		    
-		    if (broken_span_l) {
+		    if (broken_span_l) 
 			my_broken_l->add_element(broken_span_l );
-		    }
+		    
 		}
-	    } else if (0&&elt->item() && elt->item()->pcol_l_->breakpoint_b()
+	    } else if (elt->item() 
+		       && elt->item()->breakable_b_ 
 		       && elt->item()->break_status_i() == 0) {
+
+		// broken items
 		for (int j =0; j < 2; j++) {
 		    Item * my_item = elt->item()->broken_to_a_[j];
-		    Line_of_score * item_line_l_ = my_item->line_l() ;
-		    if ( ! item_line_l_ ) 
+		    Line_of_score * item_line_l = my_item->line_l() ;
+		    if ( ! item_line_l ) 
 			continue;
 		    
 		    Axis_group_spanner * v
-			= (Axis_group_spanner*)find_broken_piece( item_line_l_);
-		    if (v) {
+			= (Axis_group_spanner*)find_broken_piece( item_line_l );
+		    if (v)
 			v->add_element( my_item );
-		    }
 		}
+		    
 	    }
 	} else {
+	  /* this piece *does* know where it belongs.
+	     Put it in appropriate piece of this spanner
+	     */
 	    Axis_group_spanner * my_broken_l
 		= (Axis_group_spanner*)find_broken_piece( elt->line_l() );
 	    my_broken_l->add_element( elt );
diff -urN ../lilypond-0.1.2/lily/bar-column-grav.cc ./lily/bar-column-grav.cc
--- ../lilypond-0.1.2/lily/bar-column-grav.cc	Wed Aug  6 13:49:55 1997
+++ ./lily/bar-column-grav.cc	Fri Aug  8 02:02:46 1997
@@ -23,8 +23,9 @@
 void
 Bar_column_engraver::acknowledge_element(Score_elem_info info)
 {
-    if (info.elem_l_->is_type_b(Script::static_name()) &&
-	info.req_l_->command()) {
+    if (info.elem_l_->is_type_b(Script::static_name()) 
+	&& info.req_l_->command()
+	&& info.origin_grav_l_arr_.size() == 1) {
 	script_l_arr_.push( (Script*)info.elem_l_->item());
     } else {
 	if  (info.origin_grav_l_arr_.size() == 1 
diff -urN ../lilypond-0.1.2/lily/bar-column.cc ./lily/bar-column.cc
--- ../lilypond-0.1.2/lily/bar-column.cc	Tue Aug  5 22:23:25 1997
+++ ./lily/bar-column.cc	Fri Aug  8 01:08:56 1997
@@ -25,6 +25,7 @@
 void
 Bar_column::do_substitute_dependency(Score_elem*o,Score_elem*n)
 {
+    Script_column::do_substitute_dependency(o,n);
     if ( o == bar_l_ ) {
 	bar_l_ = n ? (Bar*)n->item() : 0;
     }
diff -urN ../lilypond-0.1.2/lily/bar.cc ./lily/bar.cc
--- ../lilypond-0.1.2/lily/bar.cc	Tue Aug  5 21:19:14 1997
+++ ./lily/bar.cc	Fri Aug  8 02:34:00 1997
@@ -41,13 +41,15 @@
 }
 
 /**
+  Prescriptions for splitting bars.
   TODO: parametrise this (input-settable)
  */
-char const *bar_breaks[][3] ={
+static char const *bar_breaks[][3] ={
     {":|", ":|:", "|:"},
     {"|", "|", ""},
     {"", "|:", "|:"},
     {"||.", "||.", ""},
+    {":|", ":|", ""},
     {0,0,0}
 };
 
@@ -59,7 +61,11 @@
 	    type_str_ = bar_breaks[i][break_status_i()+1];
     }
   
-    // span_score_bar needs dims.
-//    transparent_b_ = empty_b_ = (type_str_ == "");
+    /*
+      span_score_bar needs dims, so don't do
+    
+      transparent_b_ = empty_b_ = (type_str_ == "");
+      
+      */
 }
     
diff -urN ../lilypond-0.1.2/lily/break.cc ./lily/break.cc
--- ../lilypond-0.1.2/lily/break.cc	Sun Aug  3 14:29:17 1997
+++ ./lily/break.cc	Fri Aug  8 09:39:06 1997
@@ -120,7 +120,7 @@
 }
 
 void
-Break_algorithm::set_pscore(PScore*s)
+Break_algorithm::set_pscore(Paper_score*s)
 {
     pscore_l_ = s;
     linelength = s->paper_l_->linewidth_f();
diff -urN ../lilypond-0.1.2/lily/command-request.cc ./lily/command-request.cc
--- ../lilypond-0.1.2/lily/command-request.cc	Sun Aug  3 01:32:13 1997
+++ ./lily/command-request.cc	Fri Aug  8 13:58:19 1997
@@ -13,6 +13,7 @@
 void
 Command_script_req::do_print() const
 {}
+Command_script_req::Command_script_req(){}
 
 IMPLEMENT_IS_TYPE_B1(Command_script_req,Command_req);
 
diff -urN ../lilypond-0.1.2/lily/elem-group-item.cc ./lily/elem-group-item.cc
--- ../lilypond-0.1.2/lily/elem-group-item.cc	Tue Aug  5 01:17:45 1997
+++ ./lily/elem-group-item.cc	Fri Aug  8 09:56:48 1997
@@ -13,7 +13,7 @@
 void
 Horizontal_vertical_group_item::do_print()const
 {
-    Horizontal_vertical_group::do_print();
+    Horizontal_vertical_group_element::do_print();
 }
 
-IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group,Item);
+IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group_element,Item);
diff -urN ../lilypond-0.1.2/lily/elem-group.cc ./lily/elem-group.cc
--- ../lilypond-0.1.2/lily/elem-group.cc	Thu Aug  7 01:35:20 1997
+++ ./lily/elem-group.cc	Fri Aug  8 09:56:48 1997
@@ -1,5 +1,5 @@
 /*
-  elem-group.cc -- implement Horizontal_vertical_group
+  elem-group.cc -- implement Horizontal_vertical_group_element
 
   source file of the GNU LilyPond music typesetter
 
@@ -12,10 +12,9 @@
 #include "debug.hh"
 
 void
-Axis_group_element::unlink()
+Axis_group_element::do_unlink()
 {
     remove_all();
-    Score_elem::unlink();
 }
 
 
@@ -40,63 +39,63 @@
 
 
 void
-Vertical_group::add_element(Score_elem*e)
+Vertical_group_element::add_element(Score_elem*e)
 {
     axis_admin_.add_element(e, this, Y_AXIS, Y_AXIS);
 }
 
 void
-Vertical_group::remove_element(Score_elem*e)
+Vertical_group_element::remove_element(Score_elem*e)
 {
     axis_admin_.remove_element(e, Y_AXIS, Y_AXIS);
 }
 
 
 void
-Vertical_group::translate_y(Real dy)
+Vertical_group_element::translate_y(Real dy)
 {
     axis_admin_.translate(dy, Y_AXIS);
 }
 
 Interval
-Vertical_group::do_height() const
+Vertical_group_element::do_height() const
 {
     return axis_admin_.extent(Y_AXIS);
 }
 void
-Vertical_group::remove_all()
+Vertical_group_element::remove_all()
 {
     axis_admin_.remove_all(Y_AXIS,Y_AXIS);
 }
 // ****************
 
 void
-Horizontal_group::remove_all()
+Horizontal_group_element::remove_all()
 {
     axis_admin_.remove_all(X_AXIS,X_AXIS);
 }
 
 void
-Horizontal_group::add_element(Score_elem*e)
+Horizontal_group_element::add_element(Score_elem*e)
 {
     axis_admin_.add_element(e,this, X_AXIS,X_AXIS);
 }
 
 void
-Horizontal_group::remove_element(Score_elem*e)
+Horizontal_group_element::remove_element(Score_elem*e)
 {
     axis_admin_.remove_element(e,X_AXIS,X_AXIS);
 }
 
 
 void
-Horizontal_group::translate_x(Real dx)
+Horizontal_group_element::translate_x(Real dx)
 {
     axis_admin_.translate(dx, X_AXIS);
 }
 
 Interval
-Horizontal_group::do_width()const
+Horizontal_group_element::do_width()const
 {
     return axis_admin_.extent(X_AXIS);
 }
@@ -105,18 +104,18 @@
 // ****************
 
 void
-Horizontal_vertical_group::remove_all()
+Horizontal_vertical_group_element::remove_all()
 {
     axis_admin_.remove_all(X_AXIS,Y_AXIS);
 }
 void
-Horizontal_vertical_group::add_element(Score_elem *e)
+Horizontal_vertical_group_element::add_element(Score_elem *e)
 {
     axis_admin_.add_element(e, this, X_AXIS, Y_AXIS);
 }
 
 void
-Horizontal_vertical_group::remove_element(Score_elem*e)
+Horizontal_vertical_group_element::remove_element(Score_elem*e)
 {
     axis_admin_.remove_element(e, X_AXIS, Y_AXIS);
 }
@@ -124,6 +123,6 @@
 
 
 IMPLEMENT_IS_TYPE_B1(Axis_group_element, Score_elem);
-IMPLEMENT_IS_TYPE_B1(Horizontal_group, Axis_group_element);
-IMPLEMENT_IS_TYPE_B1(Vertical_group, Axis_group_element);
-IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group, Horizontal_group, Vertical_group);
+IMPLEMENT_IS_TYPE_B1(Horizontal_group_element, Axis_group_element);
+IMPLEMENT_IS_TYPE_B1(Vertical_group_element, Axis_group_element);
+IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_element, Horizontal_group_element, Vertical_group_element);
diff -urN ../lilypond-0.1.2/lily/head-grav.cc ./lily/head-grav.cc
--- ../lilypond-0.1.2/lily/head-grav.cc	Mon Jul 28 23:56:54 1997
+++ ./lily/head-grav.cc	Fri Aug  8 10:15:44 1997
@@ -40,8 +40,10 @@
     n_p->set_rhythmic(note_req_l_->rhythmic());
 
     if (note_req_l_->note()) {
-	n_p->position_i_ = note_req_l_->note()->height() +
-	    *get_staff_info().c0_position_i_l_;
+	n_p->position_i_ = note_req_l_->note()->height();
+	Staff_info inf = get_staff_info();
+	if (inf.c0_position_i_l_)
+	    n_p->position_i_ += *inf.c0_position_i_l_;
     } else if (note_req_l_->rest()) {
 	n_p->rest_b_ = true;
     }
diff -urN ../lilypond-0.1.2/lily/horizontal-group-item.cc ./lily/horizontal-group-item.cc
--- ../lilypond-0.1.2/lily/horizontal-group-item.cc	Thu Aug  7 13:21:03 1997
+++ ./lily/horizontal-group-item.cc	Fri Aug  8 09:55:39 1997
@@ -9,7 +9,7 @@
 #include "p-col.hh"
 #include "horizontal-group-item.hh"
 
-IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group, Axis_group_item);
+IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group_element, Axis_group_item);
 
 void
 Horizontal_group_item::do_print() const
diff -urN ../lilypond-0.1.2/lily/include/audio-item.hh ./lily/include/audio-item.hh
--- ../lilypond-0.1.2/lily/include/audio-item.hh	Thu Aug  7 13:45:05 1997
+++ ./lily/include/audio-item.hh	Fri Aug  8 13:52:54 1997
@@ -43,16 +43,15 @@
     virtual Midi_item* midi_item_p();
 };
 
-#if 0
 struct Audio_instrument : public Audio_item {
-    Audio_instrument( Request* req_l );
+    Audio_instrument( String instrument_str );
+    virtual Midi_item* midi_item_p();
+    String str_;
 };
-#endif
                                       
 struct Audio_note : public Audio_item {
-    Audio_note( Request* req_l, bool on_b );
+    Audio_note( Request* req_l );
     virtual Midi_item* midi_item_p();
-    bool on_b_;
 };
 
 struct Audio_text : Audio_item {
diff -urN ../lilypond-0.1.2/lily/include/audio-score.hh ./lily/include/audio-score.hh
--- ../lilypond-0.1.2/lily/include/audio-score.hh	Thu Aug  7 13:45:05 1997
+++ ./lily/include/audio-score.hh	Fri Aug  8 13:52:54 1997
@@ -8,7 +8,6 @@
 #define AUDIO_SCORE_HH
 
 #include "proto.hh"
-#include "parray.hh"
 #include "plist.hh"
 
 /** all stuff which goes onto midi. notes, signs, symbols in a score
@@ -18,18 +17,20 @@
 
 class Audio_score {
 public:
-    Audio_score( Midi_def* );
+    Audio_score( Score* l );
 
     void add( Audio_column* );
 
-//    void output(Tex_stream &ts);
+    void output( Midi_stream& midi_stream_r );
+    void output_header_track( Midi_stream& midi_stream_r );
 
-    void play( Audio_item* i, Audio_column* c );
+    void play( Audio_staff* p );
     void print() const;
     void process();
 
     Pointer_list<Audio_column*> audio_column_p_list_;
-    Midi_def *midi_l_;
+    Pointer_list<Audio_staff*> audio_staff_p_list_;
+    Score* score_l_;
 };
 
 #endif // AUDIO_SCORE_HH
diff -urN ../lilypond-0.1.2/lily/include/audio-staff.hh ./lily/include/audio-staff.hh
--- ../lilypond-0.1.2/lily/include/audio-staff.hh	Thu Jan  1 01:00:00 1970
+++ ./lily/include/audio-staff.hh	Fri Aug  8 13:52:54 1997
@@ -0,0 +1,21 @@
+/*
+  audio-staff.hh -- declare Audio_staff
+
+  (c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ */
+
+#ifndef AUDIO_STAFF_HH
+#define AUDIO_STAFF_HH
+
+#include "proto.hh"
+#include "plist.hh"
+#include "lily-proto.hh"
+
+struct Audio_staff {
+    void add( Audio_item* p );
+    void output( Midi_stream& midi_stream_r, int track_i );
+
+    Pointer_list<Audio_item*> audio_item_p_list_;
+};
+
+#endif // AUDIO_STAFF_HH
diff -urN ../lilypond-0.1.2/lily/include/axis-group-item.hh ./lily/include/axis-group-item.hh
--- ../lilypond-0.1.2/lily/include/axis-group-item.hh	Wed Jan  1 00:00:00 1997
+++ ./lily/include/axis-group-item.hh	Fri Aug  8 09:49:28 1997
@@ -13,6 +13,10 @@
 #include "axis-group.hh" 
 #include "item.hh"
 
+/**
+  A grouping item. Its special support is in do_breakable_col_processing().
+ */
+
 class Axis_group_item : public virtual Axis_group_element, public Item {
 protected:
     virtual void do_breakable_col_processing();
diff -urN ../lilypond-0.1.2/lily/include/axis-group-spanner.hh ./lily/include/axis-group-spanner.hh
--- ../lilypond-0.1.2/lily/include/axis-group-spanner.hh	Wed Jan  1 00:00:00 1997
+++ ./lily/include/axis-group-spanner.hh	Thu Aug  7 22:21:22 1997
@@ -13,10 +13,11 @@
 #include "spanner.hh"
 #include "axis-group.hh"
 
-/** An element which groups a line. Due to technical problems, this
-   cannot be used as a baseclass */
+/** An element which groups a line in a certain direction. The most
+  useful example of this is the Vertical_group_spanner */
 class Axis_group_spanner : public Spanner, public virtual Axis_group_element
 {
+    void do_break_processing_if_unbroken();
 protected:
     virtual void do_break_processing();
     virtual void do_print()const;
diff -urN ../lilypond-0.1.2/lily/include/axis-group.hh ./lily/include/axis-group.hh
--- ../lilypond-0.1.2/lily/include/axis-group.hh	Wed Jan  1 00:00:00 1997
+++ ./lily/include/axis-group.hh	Fri Aug  8 09:33:27 1997
@@ -42,7 +42,7 @@
     Axis_group_administration axis_admin_;
     virtual void do_print()const;
     virtual Link_array<Score_elem> get_extra_dependencies()const;
-    virtual void unlink();
+    virtual void do_unlink();
 
 public:
     virtual void remove_all()=0;
diff -urN ../lilypond-0.1.2/lily/include/bar-column.hh ./lily/include/bar-column.hh
--- ../lilypond-0.1.2/lily/include/bar-column.hh	Wed Aug  6 14:06:33 1997
+++ ./lily/include/bar-column.hh	Thu Aug  7 23:58:31 1997
@@ -20,13 +20,11 @@
 
 public:
     Bar_column();
-    void set_bar ( Bar*);
+    void set_bar( Bar*);
 protected:
     SCORE_ELEM_CLONE(Bar_column);
     void do_substitute_dependency(Score_elem*,Score_elem*);
     DECLARE_MY_RUNTIME_TYPEINFO;
-protected:
-    
 };
 
 #endif // BAR_COLUMN_HH
diff -urN ../lilypond-0.1.2/lily/include/bar.hh ./lily/include/bar.hh
--- ../lilypond-0.1.2/lily/include/bar.hh	Wed Jul 30 23:27:32 1997
+++ ./lily/include/bar.hh	Fri Aug  8 09:48:03 1997
@@ -8,6 +8,8 @@
 #define BAR_HH
 #include "item.hh"
 /**
+  A vertical bar.
+  
   TODO: connections with pre and postbreak
  */
 class Bar:public Item {
diff -urN ../lilypond-0.1.2/lily/include/break.hh ./lily/include/break.hh
--- ../lilypond-0.1.2/lily/include/break.hh	Tue Aug  5 02:59:32 1997
+++ ./lily/include/break.hh	Fri Aug  8 09:39:35 1997
@@ -36,7 +36,7 @@
 class Break_algorithm {
 protected:
 
-    PScore *pscore_l_;
+    Paper_score *pscore_l_;
     Real linelength;
 
     /// search all pcols which are breakable.
@@ -69,7 +69,7 @@
     Line_spacer* (*get_line_spacer)();
     
     Break_algorithm();
-    void set_pscore(PScore*);
+    void set_pscore(Paper_score*);
 
     /// check if the spacing/breaking problem is well-stated
     void problem_OK()const;
diff -urN ../lilypond-0.1.2/lily/include/command-request.hh ./lily/include/command-request.hh
--- ../lilypond-0.1.2/lily/include/command-request.hh	Sat Jul 26 13:39:07 1997
+++ ./lily/include/command-request.hh	Fri Aug  8 13:57:53 1997
@@ -34,6 +34,8 @@
 
 class Command_script_req : public Command_req,  public Script_req {
 public:
+    // huh? 
+    Command_script_req();
     REQUESTMETHODS(Command_script_req, commandscript);
 };
 
diff -urN ../lilypond-0.1.2/lily/include/elem-group-item.hh ./lily/include/elem-group-item.hh
--- ../lilypond-0.1.2/lily/include/elem-group-item.hh	Thu Aug  7 13:40:06 1997
+++ ./lily/include/elem-group-item.hh	Fri Aug  8 09:57:40 1997
@@ -17,13 +17,13 @@
 /**
   Treat a collection of items as a unity
  */
-class Horizontal_vertical_group_item  : public Axis_group_item, public Horizontal_vertical_group {
+class Horizontal_vertical_group_item  : public Axis_group_item, public Horizontal_vertical_group_element {
 protected:
     virtual void do_print() const;
-    virtual void remove_all() { Horizontal_vertical_group::remove_all(); }
+    virtual void remove_all() { Horizontal_vertical_group_element::remove_all(); }
 public:
-    virtual void add_element(Score_elem*e) { Horizontal_vertical_group::add_element(e); }
-    virtual void remove_element(Score_elem*e) { Horizontal_vertical_group::remove_element(e); }
+    virtual void add_element(Score_elem*e) { Horizontal_vertical_group_element::add_element(e); }
+    virtual void remove_element(Score_elem*e) { Horizontal_vertical_group_element::remove_element(e); }
 
     DECLARE_MY_RUNTIME_TYPEINFO;
     SCORE_ELEM_CLONE(Horizontal_vertical_group_item);
diff -urN ../lilypond-0.1.2/lily/include/elem-group.hh ./lily/include/elem-group.hh
--- ../lilypond-0.1.2/lily/include/elem-group.hh	Thu Aug  7 13:24:44 1997
+++ ./lily/include/elem-group.hh	Fri Aug  8 09:57:40 1997
@@ -1,5 +1,5 @@
 /*
-  elem-group.hh -- declare Horizontal_vertical_group
+  elem-group.hh -- declare Horizontal_vertical_group_element
 
   source file of the GNU LilyPond music typesetter
 
@@ -19,7 +19,7 @@
   Treat a group of elements a unity in horizontal sense .
   A column is a typical Vertical_group.
  */
-class Horizontal_group : public virtual Axis_group_element {
+class Horizontal_group_element : public virtual Axis_group_element {
 protected:
     virtual void remove_all();
     virtual void translate_x(Real);
@@ -32,9 +32,9 @@
 
 };
 /**
-  Like Horizontal_group, but in X direction
+  Like Horizontal_group_element, but in X direction
  */
-class Vertical_group : public virtual Axis_group_element {
+class Vertical_group_element : public virtual Axis_group_element {
 protected:
     virtual void translate_y(Real);
     virtual Interval do_height()const;
@@ -50,8 +50,8 @@
   dimensions are the unions of the dimensions of what it contains.
   Translation means translating the contents.
   */
-class Horizontal_vertical_group : public Vertical_group, 
-				  public Horizontal_group 
+class Horizontal_vertical_group_element : public Vertical_group_element, 
+				  public Horizontal_group_element 
 {  
 protected:
     virtual void remove_all();
diff -urN ../lilypond-0.1.2/lily/include/horizontal-group-item.hh ./lily/include/horizontal-group-item.hh
--- ../lilypond-0.1.2/lily/include/horizontal-group-item.hh	Thu Aug  7 14:09:31 1997
+++ ./lily/include/horizontal-group-item.hh	Fri Aug  8 09:51:28 1997
@@ -13,13 +13,13 @@
 #include "elem-group.hh"
 #include "axis-group-item.hh"
 
-class Horizontal_group_item : public Axis_group_item, public Horizontal_group {
+class Horizontal_group_item : public Axis_group_item, public Horizontal_group_element {
 protected:
-    virtual void remove_all() { Horizontal_group::remove_all(); }
+    virtual void remove_all() { Horizontal_group_element::remove_all(); }
     virtual void do_print() const;
 public:
-    virtual void add_element(Score_elem*e) { Horizontal_group::add_element(e); }
-    virtual void remove_element(Score_elem*e) { Horizontal_group::remove_element(e); }
+    virtual void add_element(Score_elem*e) { Horizontal_group_element::add_element(e); }
+    virtual void remove_element(Score_elem*e) { Horizontal_group_element::remove_element(e); }
     DECLARE_MY_RUNTIME_TYPEINFO;
     SCORE_ELEM_CLONE(Horizontal_group_item);
   
diff -urN ../lilypond-0.1.2/lily/include/lily-proto.hh ./lily/include/lily-proto.hh
--- ../lilypond-0.1.2/lily/include/lily-proto.hh	Wed Jan  1 00:00:00 1997
+++ ./lily/include/lily-proto.hh	Wed Jan  1 00:00:00 1997
@@ -20,7 +20,9 @@
 struct Audio_key;
 struct Audio_meter;
 struct Audio_note;
+struct Audio_note_off;
 struct Audio_score;
+struct Audio_staff;
 struct Audio_tempo;
 struct Atom;
 struct Bar;
@@ -69,7 +71,7 @@
 struct Group_feature_req;
 struct Head_column;
 struct Horizontal_align_item;
-struct Horizontal_group;
+struct Horizontal_group_element;
 struct Horizontal_group_item;
 struct Horizontal_vertical_group;
 struct Idealspacing;
@@ -111,11 +113,14 @@
 struct Midi_key;
 struct Midi_meter;
 struct Midi_note;
+struct Midi_note_event;
+struct Midi_note_off;
 struct Midi_output;
 struct Midi_score;
 struct Midi_stream;
 struct Midi_tempo;
 struct Midi_track;
+struct Midi_walker;
 struct Mixed_qp;
 struct Molecule;
 struct Music_general_chord;
@@ -136,7 +141,7 @@
 struct Output;
 struct Performer;
 struct PCol;
-struct PScore;
+struct Paper_score;
 struct Paper_def;
 struct Partial_measure_req;
 struct Plet;
@@ -203,7 +208,7 @@
 struct Timing_req;
 struct Vertical_brace;
 struct Vertical_spanner;
-struct Vertical_group;
+struct Vertical_group_element;
 struct Vertical_align_spanner;
 struct Vertical_align_engraver;
 struct Vertical_align_element;
diff -urN ../lilypond-0.1.2/lily/include/midi-item.hh ./lily/include/midi-item.hh
--- ../lilypond-0.1.2/lily/include/midi-item.hh	Thu Aug  7 13:49:49 1997
+++ ./lily/include/midi-item.hh	Fri Aug  8 13:52:54 1997
@@ -9,6 +9,8 @@
 
 #include "string.hh"
 #include "lily-proto.hh"
+#include "virtual-methods.hh"
+#include "moment.hh"
 
 /**
   Any piece of midi information.
@@ -16,6 +18,7 @@
   Maybe use base classes for RIFF files?
  */
 struct Midi_item {
+    DECLARE_MY_RUNTIME_TYPEINFO;
     Midi_item( Audio_item* audio_item_l ); 
     static String i2varint_str( int i );
     void output( Midi_stream* midi_stream_l ) const;
@@ -29,106 +32,122 @@
     Midi_item& operator =( Midi_item const& );
 };
 
-struct Midi_key : public Midi_item {
-    Midi_key( Audio_item* audio_item_l );
-	
+/**
+  variable sized MIDI data
+ */
+struct Midi_chunk : Midi_item {
+    DECLARE_MY_RUNTIME_TYPEINFO;
+    Midi_chunk();
+
+    void add( String str );
+    void set( String header_str, String data_str, String footer_str );
+    virtual String str() const;
+
+private:
+    String data_str_;
+    String footer_str_;
+    String header_str_;
+};
+
+struct Midi_duration : public Midi_item {
+    DECLARE_MY_RUNTIME_TYPEINFO;
+    Midi_duration( Real seconds_f );
+
     virtual String str() const;
+    Real seconds_f_;
+};
+
+struct Midi_header : Midi_chunk {
+    DECLARE_MY_RUNTIME_TYPEINFO;
+
+    Midi_header( int format_i, int tracks_i, int clocks_per_4_i );
+
 };
 
 /**
   Change instrument event
  */
 struct Midi_instrument : public Midi_item {
+    DECLARE_MY_RUNTIME_TYPEINFO;
     Midi_instrument( int channel_i, String instrument_str );
 
     virtual String str() const;
     String instrument_str_;
 };
                                       
-/**
-  Turn a note on or off. (blond / dark? :)
- */
-struct Midi_note : public Midi_item {
-    /**
-      Generate a note-event on a channel.
-
-      @param #melreq_l# is the pitch. 
-     */
-    Midi_note( Audio_item* audio_item_l ); 
 
+struct Midi_key : public Midi_item {
+    DECLARE_MY_RUNTIME_TYPEINFO;
+    Midi_key( Audio_item* audio_item_l );
+	
     virtual String str() const;
-
-    /* *************** */
-    int const c0_pitch_i_c_ = 60;
-    bool on_b_;
-    Byte dynamic_byte_;
 };
 
-struct Midi_duration : public Midi_item {
-    Midi_duration( Real seconds_f );
+struct Midi_meter : Midi_item {
 
+    DECLARE_MY_RUNTIME_TYPEINFO;
+    Midi_meter( Audio_item* audio_item_l ); 
+  
     virtual String str() const;
-    /* *************** */
-    Real seconds_f_;
+    int clocks_per_1_i_;
 };
 
 /**
-  variable sized MIDI data
+  Turn a note on (blond).
  */
-struct Midi_chunk : Midi_item {
-    Midi_chunk();
+struct Midi_note : public Midi_item {
+    DECLARE_MY_RUNTIME_TYPEINFO;
+    Midi_note( Audio_item* audio_item_l ); 
 
-    void add( String str );
-    void set( String header_str, String data_str, String footer_str );
+    Moment duration() const;
+    int pitch_i() const;
     virtual String str() const;
-private:
-    String data_str_;
-    String footer_str_;
-    String header_str_;
+
+    int const c0_pitch_i_c_ = 60;
+    Byte dynamic_byte_;
 };
 
-struct Midi_header : Midi_chunk {
+/**
+  Turn a note off (dark).
+ */
+struct Midi_note_off : public Midi_item {
+    DECLARE_MY_RUNTIME_TYPEINFO;
+    Midi_note_off( Midi_note* midi_note_l ); 
 
-    Midi_header( int format_i, int tracks_i, int clocks_per_4_i );
+    int pitch_i() const;
+    virtual String str() const;
 
+    Byte aftertouch_byte_;
 };
 
 struct Midi_text : Midi_item {
+    DECLARE_MY_RUNTIME_TYPEINFO;
     
     enum Type { 
 	TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC, 
 	MARKER, CUE_POINT
     };
     Midi_text( Midi_text::Type type, String text_str );
-   Midi_text( Audio_item* audio_item_l );
+    Midi_text( Audio_item* audio_item_l );
     
-
     virtual String str() const;
-    /* *************** */
+
     Type type_;
     String text_str_;
-    
 };
 
 struct Midi_tempo : Midi_item {
+    DECLARE_MY_RUNTIME_TYPEINFO;
     Midi_tempo( int per_minute_4_i );
-   Midi_tempo( Audio_item* audio_item_l ); 
+    Midi_tempo( Audio_item* audio_item_l ); 
   
-
     virtual String str() const;
-    /* *************** */
 
     int per_minute_4_i_;
 };
 
-struct Midi_meter : Midi_item {
-     Midi_meter( Audio_item* audio_item_l ); 
-  
-      virtual String str() const;
-      int clocks_per_1_i_;
-};
-
 struct Midi_track : Midi_chunk {
+    DECLARE_MY_RUNTIME_TYPEINFO;
     int number_i_;
     
     Midi_track();
diff -urN ../lilypond-0.1.2/lily/include/midi-output.hh ./lily/include/midi-output.hh
--- ../lilypond-0.1.2/lily/include/midi-output.hh	Tue Aug  5 23:36:43 1997
+++ ./lily/include/midi-output.hh	Thu Jan  1 01:00:00 1970
@@ -1,30 +0,0 @@
-/*
-  midioutput.hh -- declare Midi_output
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef MIDIOUTPUT_HH
-#define MIDIOUTPUT_HH
-#include "lily-proto.hh"
-
-
-struct Midi_output {
-#if 0
-    Midi_output(Score* score_l, Midi_def* );
-
-    void do_staff(Staff*st_l, int count);
-    void header();
-    void staffs();
-
-    Score* score_l_;
-    Midi_def* midi_l_;
-    Midi_stream* midi_stream_l_;
-#endif
-};
-
-#endif // MIDIOUTPUT_HH
-
diff -urN ../lilypond-0.1.2/lily/include/midi-stream.hh ./lily/include/midi-stream.hh
--- ../lilypond-0.1.2/lily/include/midi-stream.hh	Tue Aug  5 23:36:43 1997
+++ ./lily/include/midi-stream.hh	Fri Aug  8 13:52:54 1997
@@ -1,7 +1,8 @@
-//
-//  midistream.hh -- part of GNU LilyPond
-//
-//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
+/*
+  midi-stream.hh -- declare Midi_stream
+
+  (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
+ */
 
 #ifndef MIDI_STREAM_HH
 #define MIDI_STREAM_HH
@@ -11,22 +12,17 @@
 
 /// Midi outputfile
 struct Midi_stream {
-    ostream* os_p_;
-    String filename_str_;
-    int clocks_per_4_i_;
-    int tracks_i_;
-    
-    Midi_stream( String filename_str, int tracks_i, int clocks_per_4_i_ );
+    Midi_stream( String filename_str );
     ~Midi_stream();
 
     Midi_stream& operator <<( String str );
     Midi_stream& operator <<( Midi_item const& mitem_c_r );
     Midi_stream& operator <<( int i );
 
-    void header();
     void open();
 
-//private:
-//    Midi_stream(Midi_stream const&);
+    ostream* os_p_;
+    String filename_str_;
 };
-#endif // MIDI_STREAM_HH //
+
+#endif // MIDI_STREAM_HH
diff -urN ../lilypond-0.1.2/lily/include/midi-walker.hh ./lily/include/midi-walker.hh
--- ../lilypond-0.1.2/lily/include/midi-walker.hh	Thu Jan  1 01:00:00 1970
+++ ./lily/include/midi-walker.hh	Fri Aug  8 13:52:54 1997
@@ -0,0 +1,47 @@
+/*
+  midi-walker.hh -- declare Midi_walker
+
+  (c) 1996, 1997 Han-Wen Nienhuys  <hanwen@stack.nl>
+                 Jan Nieuwenhuizen <jan@digicash.com>
+ */
+
+#ifndef MIDI_WALKER_HH
+#define MIDI_WALKER_HH
+
+#include "proto.hh"
+#include "plist.hh"
+#include "pcursor.hh"
+#include "pqueue.hh"
+#include "lily-proto.hh"
+#include "moment.hh"
+
+struct Midi_note_event : PQueue_ent<Moment, Midi_note_off*>
+{
+    bool ignore_b_;
+};
+
+int compare(Midi_note_event const& left, Midi_note_event const& right );
+
+/**
+  walk audio and output midi
+  */
+class Midi_walker : public PCursor<Audio_item*> 
+{
+public:
+    Midi_walker( Audio_staff* audio_staff_l, Midi_track* midi_track_l );
+    ~Midi_walker();
+
+    void process();
+
+private:
+    void do_start_note( Midi_note* note_l );
+    void do_stop_notes( Moment now_mom );
+    void output_event( Moment now_mom, Midi_item* l );
+
+    Midi_track* track_l_;
+    PQueue<Midi_note_event> stop_note_queue;
+    Moment last_mom_;
+};
+
+
+#endif // MIDI_WALKER_HH
diff -urN ../lilypond-0.1.2/lily/include/note-performer.hh ./lily/include/note-performer.hh
--- ../lilypond-0.1.2/lily/include/note-performer.hh	Wed Jul 30 23:27:33 1997
+++ ./lily/include/note-performer.hh	Fri Aug  8 13:52:54 1997
@@ -18,7 +18,6 @@
     DECLARE_MY_RUNTIME_TYPEINFO;
 
     Note_performer();
-    ~Note_performer();
 
 protected:
     virtual void process_requests();
@@ -28,7 +27,6 @@
 
 private:
     Melodic_req * note_req_l_;
-    Moment off_mom_;
 };
 
 #endif // NOTE_PERFORMER_HH
diff -urN ../lilypond-0.1.2/lily/include/p-col.hh ./lily/include/p-col.hh
--- ../lilypond-0.1.2/lily/include/p-col.hh	Fri Aug  1 21:24:33 1997
+++ ./lily/include/p-col.hh	Fri Aug  8 09:39:35 1997
@@ -49,7 +49,7 @@
     bool error_mark_b_;
     bool used_b_ ;		// manual override.. 
     
-    PScore * pscore_l_;
+    Paper_score * pscore_l_;
 
     /* *************** */
     /// which  one (left =0)
diff -urN ../lilypond-0.1.2/lily/include/p-score.hh ./lily/include/p-score.hh
--- ../lilypond-0.1.2/lily/include/p-score.hh	Fri Jul 25 12:29:49 1997
+++ ./lily/include/p-score.hh	Fri Aug  8 09:39:35 1997
@@ -1,5 +1,5 @@
 /*
-  p-score.hh -- declare PScore
+  p-score.hh -- declare Paper_score
 
   source file of the GNU LilyPond music typesetter
 
@@ -16,11 +16,11 @@
 #include "plist.hh"
 
 /** all stuff which goes onto paper. notes, signs, symbols in a score
-     #PScore# contains the items, the columns.
+     #Paper_score# contains the items, the columns.
     
     */
 
-class PScore {
+class Paper_score {
 public:
     Paper_def *paper_l_;
 
@@ -41,7 +41,7 @@
     /* *************** */
     /* CONSTRUCTION */
     
-    PScore(Paper_def*);
+    Paper_score(Paper_def*);
     /// add a line to the broken stuff. Positions given in #config#
     void set_breaking(Array<Col_hpositions> const &);
 
@@ -75,7 +75,7 @@
     /* STANDARD ROUTINES */
     void OK()const;
     void print() const;
-    ~PScore();
+    ~Paper_score();
     void typeset_element(Score_elem*);
     void typeset_broken_spanner(Spanner*);
     /// add a Spanner
diff -urN ../lilypond-0.1.2/lily/include/performer-group-performer.hh ./lily/include/performer-group-performer.hh
--- ../lilypond-0.1.2/lily/include/performer-group-performer.hh	Thu Jul 31 22:01:46 1997
+++ ./lily/include/performer-group-performer.hh	Fri Aug  8 13:52:54 1997
@@ -23,22 +23,12 @@
     DECLARE_MY_RUNTIME_TYPEINFO;
     Input_translator* itrans_l_;
 
-    Performer_group_performer();
-    ~Performer_group_performer();
-
     virtual void add( Performer* perf_p );
-    virtual void print()const { Performer::print() ; }
-    virtual Moment get_mom() const;
     virtual bool do_try_request( Request* req_l );
-    virtual bool try_request(Request*r) { return Performer::try_request(r) ; }
-
-    // <ugh>
-    virtual void set_track( int& track_i_r );
-    virtual int get_track_i() const;
-    // </ugh>
+    virtual void print() const;
+    virtual bool try_request(Request* r);
 
 protected:
-
     virtual Translator* find_get_translator_l( String name, String id );
     virtual Translator* get_default_interpreter();
 
diff -urN ../lilypond-0.1.2/lily/include/performer.hh ./lily/include/performer.hh
--- ../lilypond-0.1.2/lily/include/performer.hh	Thu Aug  7 13:45:05 1997
+++ ./lily/include/performer.hh	Fri Aug  8 13:52:55 1997
@@ -27,16 +27,9 @@
     Performer();
     virtual ~Performer();
 
-    
     void print() const;
     virtual void process_requests();
 
-    virtual void set( Moment mom );
-    // <ugh>
-    virtual void set_track( int& track_i_r );
-    virtual int get_track_i() const;
-    // </ugh>
-
     virtual bool try_request( Request* req_l );
 
     virtual void do_removal_processing();
@@ -44,13 +37,11 @@
 
 protected:
     virtual void do_creation_processing();
-
     virtual bool do_try_request(Request*);
     virtual int get_tempo_i() const;
     virtual void do_print() const;
-    virtual Moment get_mom() const;
     virtual void play( Audio_item* p );
-    virtual void play( Midi_item* l );
+    virtual void play( Audio_staff* p );
 };
 
 #include "global-performers.hh"
diff -urN ../lilypond-0.1.2/lily/include/score-elem.hh ./lily/include/score-elem.hh
--- ../lilypond-0.1.2/lily/include/score-elem.hh	Thu Aug  7 01:32:16 1997
+++ ./lily/include/score-elem.hh	Fri Aug  8 09:51:28 1997
@@ -58,8 +58,12 @@
     
     Status status_;
 
+    Score_elem* dependency(int) const;
+    Score_elem* dependent(int) const;
+    int dependent_size() const;
+    int dependency_size() const;
 public:
-    PScore *pscore_l_;    
+    Paper_score *pscore_l_;    
     Axis_group_element * axis_group_l_a_[2];
 
     Score_elem(Score_elem const&);
@@ -95,11 +99,9 @@
     void molecule_processing();
 
     /**
-      Axis group has to remove all its links.
-      Sigh... too many virtual functions. 
-      
+      Remove all  links (dependencies, dependents, Axis_group_elements.
      */
-    virtual void unlink();
+    void unlink();
     void unlink_all();
     void substitute_dependency(Score_elem*,Score_elem*);
     void remove_dependency(Score_elem*);
@@ -117,19 +119,12 @@
     /*
       virtual accessors
      */
-    virtual Vertical_group * vertical_group() { return 0; }
-    virtual Horizontal_group * horizontal_group() { return 0; }
 
     virtual Spanner* spanner()  { return 0; }
-    virtual Horizontal_vertical_group* elem_group() { return 0; }
     virtual Item * item() { return 0; }
     virtual Line_of_score * line_l() const;
     SCORE_ELEM_CLONE(Score_elem);
-    Score_elem* dependency(int) const;
-    Score_elem* dependent(int) const;
-    int dependent_size() const;
-    int dependency_size() const;
-    
+ 
     /// no dimension, translation is noop
     bool empty_b_;
     /// do not print anything black
@@ -143,7 +138,7 @@
     virtual void do_print() const {}
     /// generate the molecule    
     virtual Molecule* brew_molecule_p()const;
-    ///executed directly after the item is added to the PScore
+    ///executed directly after the item is added to the Paper_score
     virtual void do_add_processing();
     /// do calculations before determining horizontal spacing
     virtual void do_pre_processing();
@@ -158,6 +153,7 @@
     virtual void handle_broken_dependencies();
     virtual void handle_prebroken_dependencies();
     virtual Link_array<Score_elem> get_extra_dependencies()const;
+    virtual void do_unlink();
 
 };
 
diff -urN ../lilypond-0.1.2/lily/include/score-performer.hh ./lily/include/score-performer.hh
--- ../lilypond-0.1.2/lily/include/score-performer.hh	Thu Aug  7 13:45:05 1997
+++ ./lily/include/score-performer.hh	Fri Aug  8 13:52:55 1997
@@ -27,25 +27,19 @@
     virtual int depth_i() const;
 
     virtual void finish();
-    virtual Moment get_mom() const;
     virtual void prepare( Moment mom );
     virtual void process();
     virtual void set_score( Score* score_l );
     virtual void start();
     virtual int get_tempo_i() const;
-    virtual void play(Audio_item*);
-    virtual void play(Midi_item*);
+    virtual void play( Audio_item* p );
+    virtual void play( Audio_staff* p );
 
 private:
     void header(Midi_stream&);
 
-    Midi_def* midi_l_;
-
-    Moment prev_mom_;
     Moment now_mom_;
     Audio_column* audio_column_l_;
-
-    Link_array<Midi_item> midi_item_l_arr_;
 };
 
 #endif // SCORE_PERFORMER_HH
diff -urN ../lilypond-0.1.2/lily/include/score.hh ./lily/include/score.hh
--- ../lilypond-0.1.2/lily/include/score.hh	Thu Aug  7 13:45:05 1997
+++ ./lily/include/score.hh	Fri Aug  8 13:52:55 1997
@@ -26,7 +26,7 @@
     Paper_def *paper_p_;
     Midi_def *midi_p_;
     Music * music_p_;
-    PScore *pscore_p_;
+    Paper_score *pscore_p_;
     Audio_score* audio_score_p_;
 
     int errorlevel_i_;
@@ -44,7 +44,6 @@
     /// output to file
     void output(String fn);
 
-    
     ///
     void set(Midi_def* midi_p);
     ///
@@ -65,7 +64,6 @@
 
     // utils:
     PCursor<Score_column*> create_cols(Moment, PCursor<Score_column*> &last);
-
 
     /**
       make the pcol_l_ fields of each Score_column point to the correct PCol,
diff -urN ../lilypond-0.1.2/lily/include/span-bar.hh ./lily/include/span-bar.hh
--- ../lilypond-0.1.2/lily/include/span-bar.hh	Wed Jul 30 23:27:33 1997
+++ ./lily/include/span-bar.hh	Fri Aug  8 02:19:46 1997
@@ -17,6 +17,7 @@
     Link_array<Bar> spanning_l_arr_;
 
 public:
+    Span_bar();
     DECLARE_MY_RUNTIME_TYPEINFO;
     SCORE_ELEM_CLONE(Span_bar);
     void add(Bar* );
diff -urN ../lilypond-0.1.2/lily/include/spanner-elem-group.hh ./lily/include/spanner-elem-group.hh
--- ../lilypond-0.1.2/lily/include/spanner-elem-group.hh	Wed Jul 30 23:27:33 1997
+++ ./lily/include/spanner-elem-group.hh	Fri Aug  8 09:57:40 1997
@@ -13,7 +13,7 @@
 #include "spanner.hh"
 #include "elem-group.hh"
 
-class Spanner_elem_group : public Spanner, public Horizontal_vertical_group {
+class Spanner_elem_group : public Spanner, public Horizontal_vertical_group_element {
     
 protected:
     virtual Interval do_width()const;
diff -urN ../lilypond-0.1.2/lily/include/staff-performer.hh ./lily/include/staff-performer.hh
--- ../lilypond-0.1.2/lily/include/staff-performer.hh	Thu Aug  7 13:45:05 1997
+++ ./lily/include/staff-performer.hh	Fri Aug  8 13:52:55 1997
@@ -21,22 +21,12 @@
     String instrument_str();
 
 protected:
-    virtual void play( Midi_item* l );
-    virtual void play( Audio_item* l );
+    virtual void play( Audio_item* p );
     virtual void do_removal_processing();
     virtual void do_creation_processing();
-    // <ugh>
-    virtual void set_track( int& track_i_r );
-    virtual int get_track_i() const;
-    // </ugh>
 
 private:
-    void header();
-
-    Moment midi_mom_;
-    Midi_track* midi_track_p_;
-    Pointer_list<Audio_item*> audio_item_p_list_;
-    int track_i_;
+    Audio_staff* audio_staff_p_;
 };
 
 #endif // STAFF_PERFORMER_HH
diff -urN ../lilypond-0.1.2/lily/include/super-elem.hh ./lily/include/super-elem.hh
--- ../lilypond-0.1.2/lily/include/super-elem.hh	Wed Jul 30 23:27:33 1997
+++ ./lily/include/super-elem.hh	Fri Aug  8 12:53:28 1997
@@ -11,10 +11,10 @@
 #define SUPER_ELEM_HH
 
 #include "score-elem.hh"
-/** The toplevel element. The PScore contains this element, and any
+/** The toplevel element. The Paper_score contains this element, and any
   element shoud be a dependency for the super element.
   */
-class Super_elem : public virtual Score_elem {
+class Super_elem : public Score_elem {
 public:
     Link_array<Line_of_score> lines_arr_;
     Line_of_score * line_of_score_l_;
diff -urN ../lilypond-0.1.2/lily/include/vertical-group-spanner.hh ./lily/include/vertical-group-spanner.hh
--- ../lilypond-0.1.2/lily/include/vertical-group-spanner.hh	Thu Aug  7 14:27:01 1997
+++ ./lily/include/vertical-group-spanner.hh	Fri Aug  8 09:52:44 1997
@@ -15,15 +15,15 @@
 
 /** An element which groups a line. 
  */
-class Vertical_group_spanner : public Axis_group_spanner, public Vertical_group
+class Vertical_group_spanner : public Axis_group_spanner, public Vertical_group_element
 {
 protected:
     SCORE_ELEM_CLONE(Vertical_group_spanner);
-    virtual void remove_all() { Vertical_group::remove_all(); }
+    virtual void remove_all() { Vertical_group_element::remove_all(); }
 public:
     DECLARE_MY_RUNTIME_TYPEINFO;
-    virtual void add_element(Score_elem*e) { Vertical_group::add_element(e); }
-    virtual void remove_element(Score_elem*e) { Vertical_group::remove_element(e); }
+    virtual void add_element(Score_elem*e) { Vertical_group_element::add_element(e); }
+    virtual void remove_element(Score_elem*e) { Vertical_group_element::remove_element(e); }
   
 };
 
diff -urN ../lilypond-0.1.2/lily/item.cc ./lily/item.cc
--- ../lilypond-0.1.2/lily/item.cc	Wed Aug  6 16:27:12 1997
+++ ./lily/item.cc	Fri Aug  8 12:01:53 1997
@@ -36,8 +36,6 @@
     return pcol_l_->hpos_f_ + offset()[X_AXIS];
 }
 
-
-
 Line_of_score *
 Item::line_l()const
 {
@@ -61,30 +59,36 @@
 void
 Item::copy_breakable_items()
 {
+    if ( broken_to_a_[0] || broken_to_a_[1] )
+	return;
+    Item *new_copies[2];
     for (int i=0; i < 2; i++) {
 	Item * item_p = clone()->item();
 	item_p->copy_dependencies(*this);
 	
-	/* add our pre and postbreaks blondly to our own y_group
-	   Let Vertical_group_spanner figure out the mess.
-	 */
-	if  ( axis_group_l_a_[Y_AXIS] )
-	    axis_group_l_a_[Y_AXIS]->add_element( item_p );
+
 	pscore_l_->typeset_item(item_p, pcol_l_, -1+ 2*i);
 	item_p->handle_prebroken_dependencies();
-	broken_to_a_[i] = item_p;
+	new_copies[i] =item_p;
     }
+    broken_to_a_= new_copies;
 }
 
 void
 Item::do_breakable_col_processing()
 {
-    PCol * c = pcol_l_;
-    if (!c->breakable_b())
+    if (!breakable_b_ || !pcol_l_->breakable_b() )
 	return;
-    
+
     copy_breakable_items();
     handle_prebroken_dependencies();
+
+    /*
+      Otherwise the broken items won't be pre_process()'ed.
+     */
+    add_dependency( broken_to_a_[0] );
+    add_dependency( broken_to_a_[1] );    
+
 }
 
 Item*
@@ -117,6 +121,6 @@
 void
 Item::handle_prebroken_dependencies()
 {
-    if ( pcol_l_->breakable_b() || pcol_l_->daddy_l_ )
+    if ( breakable_b_ )
 	Score_elem::handle_prebroken_dependencies();
 }
diff -urN ../lilypond-0.1.2/lily/key-grav.cc ./lily/key-grav.cc
--- ../lilypond-0.1.2/lily/key-grav.cc	Tue Aug  5 21:43:15 1997
+++ ./lily/key-grav.cc	Fri Aug  8 10:15:46 1997
@@ -28,7 +28,11 @@
 Key_engraver::create_key()
 {
     if (!kit_p_) {
-	int c0_i= *get_staff_info().c0_position_i_l_;	
+	int c0_i=0;
+
+	Staff_info inf = get_staff_info();
+	if (inf.c0_position_i_l_)
+	    c0_i = *get_staff_info().c0_position_i_l_;	
 	
 	kit_p_ = new Key_item(c0_i);
 	announce_element(Score_elem_info(kit_p_,keyreq_l_));
diff -urN ../lilypond-0.1.2/lily/local-key-grav.cc ./lily/local-key-grav.cc
--- ../lilypond-0.1.2/lily/local-key-grav.cc	Mon Jul 28 23:56:54 1997
+++ ./lily/local-key-grav.cc	Fri Aug  8 10:20:44 1997
@@ -40,8 +40,15 @@
 		
 		
 
-	    if (!key_item_p)
-		key_item_p = new Local_key_item(*get_staff_info().c0_position_i_l_);
+	    if (!key_item_p) {
+		int c0_i=0;
+
+		Staff_info inf = get_staff_info();
+		if (inf.c0_position_i_l_)
+		    c0_i = *get_staff_info().c0_position_i_l_;	
+		
+		key_item_p = new Local_key_item(c0_i);
+	    }
 	    key_item_p->add(note_l);
 	    key_item_p->add_support(support_l);
 	    local_key_.oct(note_l->octave_i_)
@@ -62,7 +69,9 @@
     support_l_arr_.set_size(0);
     forced_l_arr_.set_size(0);	
 }
-
+/*
+  whoah .. this looks hairy!
+ */
 void
 Local_key_engraver::acknowledge_element(Score_elem_info info)
 {    
@@ -95,11 +104,9 @@
 Local_key_engraver::do_process_requests()
 {
     Time_description const * time_C_ = get_staff_info().time_C_;
-    if (! time_C_->whole_in_measure_){
+    if (time_C_ && !time_C_->whole_in_measure_){
 	if (key_C_)
 	    local_key_= *key_C_;
-	else if(0&& time_C_->when_ >Moment(0))
-	    warning ("Help me! can't figure out current key");
     }
 }
 
diff -urN ../lilypond-0.1.2/lily/midi-item.cc ./lily/midi-item.cc
--- ../lilypond-0.1.2/lily/midi-item.cc	Thu Aug  7 13:45:06 1997
+++ ./lily/midi-item.cc	Fri Aug  8 13:52:55 1997
@@ -18,6 +18,19 @@
 #include "midi-stream.hh"
 #include "audio-item.hh"
 
+IMPLEMENT_IS_TYPE_B(Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_chunk, Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_duration, Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_header, Midi_chunk);
+IMPLEMENT_IS_TYPE_B1(Midi_instrument, Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_key,Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_meter, Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_note, Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_note_off, Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_tempo, Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_text, Midi_item);
+IMPLEMENT_IS_TYPE_B1(Midi_track, Midi_chunk);
+
 Midi_chunk::Midi_chunk()
     : Midi_item( 0 )
 {
@@ -256,20 +269,19 @@
 String
 Midi_instrument::str() const
 {
-    // ugh, does not work...
-    return String( "" );
     Byte program_byte = 0;
     for ( int i = 0; instrument_name_sz_a_[i]; i++ )
 	if ( instrument_str_ == String(instrument_name_sz_a_[ i ] )) { 
 	    program_byte = (Byte)i;
 	    break;
 	}
-    if ( program_byte ) {
-	String str = String( (char)( 0xc0 + channel_i_ ) );
-	str += String( (char)program_byte );
-	return str;
-    }
-    return String( "" );
+
+    if ( !program_byte )
+	return String( "" );
+
+    String str = String( (char)( 0xc0 + channel_i_ ) );
+    str += String( (char)program_byte );
+    return str;
 }
 
 Midi_item::Midi_item( Audio_item* audio_item_l )
@@ -329,32 +341,88 @@
     return String_convert::hex2bin_str( str );
 }
 
+Midi_meter::Midi_meter( Audio_item* audio_item_l )
+    : Midi_item( audio_item_l )
+{
+    clocks_per_1_i_ = 18;
+}
+
+String
+Midi_meter::str() const
+{
+    Meter_change_req* m = audio_item_l_->req_l_->command()->meterchange();
+    int num_i = m->beats_i_;
+    int den_i = m->one_beat_i_;
+
+    String str = "ff5804";
+    str += String_convert::i2hex_str( num_i, 2, '0' );
+    str += String_convert::i2hex_str( intlog2( den_i ) , 2, '0' );
+    str += String_convert::i2hex_str( clocks_per_1_i_, 2, '0' );
+    str += String_convert::i2hex_str( 8, 2, '0' );
+    return String_convert::hex2bin_str( str );
+}
+
 Midi_note::Midi_note( Audio_item* audio_item_l )
     : Midi_item( audio_item_l )
 {
-    // ugh
-    dynamic_byte_ = 0x64;
-    on_b_ = ( (Audio_note*)audio_item_l_ )->on_b_;
-    if ( on_b_ ) // poor man-s staff dynamics:
-	dynamic_byte_ -= 0x10 * channel_i_;
-    else
-    	dynamic_byte_ += 0x32; // 0x64 is supposed to be neutral, but let-s try
+    dynamic_byte_ = 0x7f;
+}
+
+Moment
+Midi_note::duration() const
+{
+    return audio_item_l_->req_l_->musical()->rhythmic()->duration();
+}
+
+int
+Midi_note::pitch_i() const
+{
+    return audio_item_l_->req_l_->musical()->melodic()->pitch();
 }
 
 String
 Midi_note::str() const
 {
-    Note_req* n = audio_item_l_->req_l_->musical()->melodic()->note();
-    int pitch_i = n->pitch() + c0_pitch_i_c_;
-    if ( pitch_i != INT_MAX ) {
-	Byte status_byte = ( on_b_ ? 0x90 : 0x80 ) + channel_i_;
-	String str = String( (char)status_byte );
-	str += (char)pitch_i;
-	// poor man-s staff dynamics:
-	str += (char)dynamic_byte_;
-	return str;
-    }
-    return String( "" );
+    if ( pitch_i() == INT_MAX )
+    	return String( "" );
+
+    Byte status_byte = (char)( 0x90 + channel_i_ );
+
+    String str = String( (char)status_byte );
+    str += (char)( pitch_i() + c0_pitch_i_c_ );
+
+    // poor man's staff dynamics:
+    str += (char)( dynamic_byte_ - 0x10 * channel_i_ );
+
+    return str;
+}
+
+Midi_note_off::Midi_note_off( Midi_note* midi_note_l )
+    : Midi_item( midi_note_l->audio_item_l_ )
+{
+    // 0x64 is supposed to be neutral, but let's try
+    aftertouch_byte_ = 0x64;
+    channel_i_ = midi_note_l->channel_i_;
+}
+
+int
+Midi_note_off::pitch_i() const
+{
+    return audio_item_l_->req_l_->musical()->melodic()->pitch();
+}
+
+String
+Midi_note_off::str() const
+{
+    if ( pitch_i() == INT_MAX )
+    	return String( "" );
+
+    Byte status_byte = (char)( 0x80 + channel_i_ );
+
+    String str = String( (char)status_byte );
+    str += (char)( pitch_i() + Midi_note::c0_pitch_i_c_ );
+    str += (char)aftertouch_byte_;
+    return str;
 }
 
 Midi_tempo::Midi_tempo( Audio_item* audio_item_l )
@@ -375,27 +443,6 @@
     int useconds_per_4_i = 60 * (int)1e6 / per_minute_4_i_;
     String str = "ff5103";
     str += String_convert::i2hex_str( useconds_per_4_i, 6, '0' );
-    return String_convert::hex2bin_str( str );
-}
-
-Midi_meter::Midi_meter( Audio_item* audio_item_l )
-    : Midi_item( audio_item_l )
-{
-    clocks_per_1_i_ = 18;
-}
-
-String
-Midi_meter::str() const
-{
-    Meter_change_req* m = audio_item_l_->req_l_->command()->meterchange();
-    int num_i = m->beats_i_;
-    int den_i = m->one_beat_i_;
-
-    String str = "ff5804";
-    str += String_convert::i2hex_str( num_i, 2, '0' );
-    str += String_convert::i2hex_str( intlog2( den_i ) , 2, '0' );
-    str += String_convert::i2hex_str( clocks_per_1_i_, 2, '0' );
-    str += String_convert::i2hex_str( 8, 2, '0' );
     return String_convert::hex2bin_str( str );
 }
 
diff -urN ../lilypond-0.1.2/lily/midi-stream.cc ./lily/midi-stream.cc
--- ../lilypond-0.1.2/lily/midi-stream.cc	Thu Aug  7 13:45:06 1997
+++ ./lily/midi-stream.cc	Fri Aug  8 13:52:55 1997
@@ -15,14 +15,11 @@
 #include "midi-stream.hh"
 #include "debug.hh"
 
-Midi_stream::Midi_stream( String filename_str, int tracks_i, int clocks_per_4_i ) 
+Midi_stream::Midi_stream( String filename_str )
 {
     filename_str_ = filename_str;
-    tracks_i_ = tracks_i;
-    clocks_per_4_i_ = clocks_per_4_i;
     os_p_ = 0;
     open();
-    header();
 }
 
 Midi_stream::~Midi_stream()
@@ -60,20 +57,6 @@
     // output binary string ourselves
     *this << Midi_item::i2varint_str( i );
     return *this;
-}
-
-void
-Midi_stream::header()
-{
-/*
-                4D 54 68 64     MThd
-    String str = "MThd";
-                00 00 00 06     chunk length
-                00 01   format 1
-                00 01   one track
-                00 60   96 per quarter-note
-*/
-      *this << Midi_header( 1, tracks_i_, clocks_per_4_i_ );
 }
 
 void
diff -urN ../lilypond-0.1.2/lily/midi-walker.cc ./lily/midi-walker.cc
--- ../lilypond-0.1.2/lily/midi-walker.cc	Thu Jul 24 13:34:41 1997
+++ ./lily/midi-walker.cc	Fri Aug  8 13:52:55 1997
@@ -3,135 +3,108 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>, Jan Nieuwenhuizen <jan@digicash.com>
-  
-  TODO
-
-  Ideally this should also use a register system, to process slurs,
-  dynamics, etc.
-  
-*/
-
-/* reincluded for code jatting */
-#if 0
-
-#include "command-request.hh"
-#include "musical-request.hh"
-#include "p-score.hh"
-#include "staff.hh"
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+           Jan Nieuwenhuizen <jan@digicash.com>
+ */
+
 #include "midi-walker.hh"
+#include "audio-column.hh"
+#include "audio-item.hh"
+#include "audio-staff.hh"
 #include "midi-item.hh"
 #include "midi-stream.hh"
 #include "debug.hh"
-#include "staff-column.hh"
 
-Midi_walker::Midi_walker(Staff *st_l, Midi_track* track_l)
-    : PCursor<Staff_column*>(st_l->cols_)
+Midi_note_event::Midi_note_event() 
+{ 
+    ignore_b_ = false;
+}
+
+int
+compare( Midi_note_event const& left, Midi_note_event const& right )
 {
-    track_l_ = track_l;
-    last_moment_= 0;
+    return sign( left.key - right.key );
 }
 
-/**
-  output notestop events for all notes which end before #max_moment#
- */
-void
-Midi_walker::do_stop_notes(Moment max_moment)
+Midi_walker::Midi_walker( Audio_staff* audio_staff_l, Midi_track* track_l )
+    : PCursor<Audio_item*>( audio_staff_l->audio_item_p_list_ )
 {
-    while (stop_notes.size() && stop_notes.front().key <= max_moment) {
-	Note_event  ent=stop_notes.get();
-	if (ent.ignore_b_) 
-	    continue;
-	
-	Moment stop_moment = ent.key;
-	Melodic_req * req_l = ent.val;
-	
-	Midi_note note(req_l, track_l_->number_i_, false);
-	output_event(note, stop_moment);
-    }
+    track_l_ = track_l;
+    last_mom_ = 0;
+}
+
+Midi_walker::~Midi_walker()
+{ 
+    // ugh
+    do_stop_notes( last_mom_ + Moment( 10, 1 ) );
 }
+
 /**
-  Find out if start_note event is needed,  and do it if needed.
+  Find out if start_note event is needed, and do it if needed.
  */
 void 
-Midi_walker::do_start_note(Note_req*note_l)
+Midi_walker::do_start_note( Midi_note* note_l )
 {
-    Moment stop = note_l->duration() + ptr()->when();
-    for(int i=0; i < stop_notes.size(); i++) {
-	if (stop_notes[i].val->melodic()->pitch() ==
-	    note_l->pitch()) {
-	    if ( stop_notes[i].key < stop){
-		stop_notes[i].ignore_b_=true;
-	    }
-	    else
-		return; // skip the stop note 
+    Moment stop_mom = note_l->duration() + ptr()->audio_column_l_->at_mom();
+    for ( int i=0; i < stop_note_queue.size(); i++ ) {
+	if ( stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i() ) {
+	    if ( stop_note_queue[ i ].key < stop_mom )
+		stop_note_queue[ i ].ignore_b_ = true;
+	    else // skip the stopnote 
+		return; 
 	}
     }
-    Note_event e;
-    e.val = note_l;
-    e.key = stop;
-    
-    stop_notes.insert(e);
-    
-    Midi_note note(note_l, track_l_->number_i_, true);
-    output_event(note, ptr()->when());
-}
-
 
-/** advance the track to #now#, output the item, and adjust current
-  "moment".  */
-void
-Midi_walker::output_event(Midi_item &i, Moment now)
-{
-    Moment delta_t = now - last_moment_ ;
-    last_moment_ += delta_t;
-    track_l_->add(delta_t, &i );    
+    Midi_note_event e;
+    e.val = new Midi_note_off( note_l );
+    e.key = stop_mom;
+    stop_note_queue.insert( e );
+    
+    output_event( ptr()->audio_column_l_->at_mom(), note_l );
 }
 
+/**
+  Output note events for all notes which end before #max_mom#
+ */
 void
-Midi_walker::process_requests()
+Midi_walker::do_stop_notes( Moment max_mom )
 {
-    do_stop_notes(ptr()->when());
-
-    for ( int i = 0; i < ptr()->commandreq_l_arr_.size(); i++ )  {
-	Command_req *c_l = ptr()->commandreq_l_arr_[i]->command();
-	Meter_change_req* meter_l = c_l->meterchange();
-	if ( meter_l )
-	    output_event( Midi_time( meter_l->beats_i_, meter_l->one_beat_i_, 18 ),  ptr()->when() );
-	Key_change_req* key_l = c_l->keychange();
-	if ( key_l ) {
-	    int sharps_i = key_l->sharps_i();
-	    int flats_i = key_l->flats_i();
-	    // midi cannot handle non-conventional keys
-	    if ( !( flats_i && sharps_i ) )
-		output_event( Midi_key( sharps_i - flats_i, key_l->minor_b() ), ptr()->when() );
-	}
-    }
-
-    for ( int i = 0; i < ptr()->musicalreq_l_arr_.size(); i++ )  {
-	Musical_req *m = ptr()->musicalreq_l_arr_[i]->musical();
-	if (!m)
-	    return;
-	Rhythmic_req *n = m->rhythmic();
-	if ( !n)
+    while ( stop_note_queue.size() && stop_note_queue.front().key <= max_mom ) {
+	Midi_note_event e = stop_note_queue.get();
+	if ( e.ignore_b_ ) 
 	    continue;
-	Note_req * note_l = n->note();
-	if (!note_l)
-	    continue;
-	do_start_note(note_l);
+	
+	Moment stop_mom = e.key;
+	Midi_note_off* note_l = e.val;
+	
+	output_event( stop_mom, note_l );
     }
 }
 
-Midi_walker::~Midi_walker()
+/** 
+  Advance the track to #now#, output the item, and adjust current "moment". 
+ */
+void
+Midi_walker::output_event( Moment now_mom, Midi_item* l )
 {
-    do_stop_notes( last_moment_ + Moment(10,1)); // ugh
+    Moment delta_t = now_mom - last_mom_ ;
+    last_mom_ += delta_t;
+    track_l_->add( delta_t, l );
 }
 
-
-int
-compare(Note_event const&e1, Note_event const&e2)
+void
+Midi_walker::process()
 {
-    return sign(e1.key - e2.key);
+    do_stop_notes( ptr()->audio_column_l_->at_mom() );
+
+    Midi_item* p = ptr()->midi_item_p();
+    p->channel_i_ = track_l_->number_i_;
+    
+    if ( p->name() != Midi_note::static_name() )
+	output_event( ptr()->audio_column_l_->at_mom(), p );
+    else
+	do_start_note( (Midi_note*)p );
+	
+    delete p;
 }
 
-#endif
diff -urN ../lilypond-0.1.2/lily/note-performer.cc ./lily/note-performer.cc
--- ../lilypond-0.1.2/lily/note-performer.cc	Thu Aug  7 13:45:06 1997
+++ ./lily/note-performer.cc	Fri Aug  8 14:41:25 1997
@@ -20,11 +20,6 @@
 Note_performer::Note_performer()
 {
     note_req_l_ = 0;
-    off_mom_ = 0;
-}
-
-Note_performer::~Note_performer()
-{
 }
 
 void 
@@ -33,7 +28,6 @@
 #ifndef NPRINT
     if ( note_req_l_ ) {
     	note_req_l_->print();
-	mtor << ( off_mom_ ? "on" : "off" ) << "\n";
     }
 #endif
 }
@@ -45,17 +39,8 @@
     if ( !note_req_l_ || !note_req_l_->melodic()  || !note_req_l_->rhythmic() )
 	return;
 
-    // ugh! Midi specific
-    Moment mom = get_mom();
-    if ( !off_mom_ ) { // start note
-	off_mom_ = mom + note_req_l_->duration();
-	play( new Audio_note( note_req_l_, true ) );
-    }
-    else if ( mom == off_mom_ ) { // stop note
-	play( new Audio_note( note_req_l_, false ) );
-	note_req_l_ = 0;
-	off_mom_ = 0;
-    }
+    play( new Audio_note( note_req_l_ ) );
+    note_req_l_ = 0;
 }
 
 bool 
@@ -64,14 +49,9 @@
     if ( note_req_l_ )
 	return false;
     
- // huh?
-//    if (req_l->musical() && (req_l->musical()->note() || req_l->musical()->rest()))
-//	note_req_l_ = req_l->musical()->rhythmic();
-    if ( req_l->musical() && req_l->musical()->note() )
-// huh?
-	note_req_l_ = req_l->musical()->melodic();
-    else
+    if ( !req_l->musical() || !req_l->musical()->note() )
 	return false;
 
+    note_req_l_ = req_l->musical()->melodic();
     return true;
 }
diff -urN ../lilypond-0.1.2/lily/p-score.cc ./lily/p-score.cc
--- ../lilypond-0.1.2/lily/p-score.cc	Thu Aug  7 02:17:24 1997
+++ ./lily/p-score.cc	Fri Aug  8 13:10:08 1997
@@ -1,5 +1,5 @@
 /*
-  p-score.cc -- implement PScore
+  p-score.cc -- implement Paper_score
 
   source file of the GNU LilyPond music typesetter
 
@@ -19,20 +19,20 @@
 #include "word-wrap.hh"
 #include "gourlay-breaking.hh"
 
-PScore::PScore(Paper_def*p)
+Paper_score::Paper_score(Paper_def*p)
 {
     paper_l_ = p;
     super_elem_l_   = new Super_elem;
     typeset_element(super_elem_l_);
 }
 
-PScore::~PScore()
+Paper_score::~Paper_score()
 {
     super_elem_l_->unlink_all();
 }
 
 void
-PScore::typeset_element(Score_elem * elem_p)
+Paper_score::typeset_element(Score_elem * elem_p)
 {
     elem_p_list_.bottom().add(elem_p);
     elem_p->pscore_l_ = this;
@@ -41,7 +41,7 @@
 }
 
 void
-PScore::typeset_item(Item *i, PCol *c, int breakstat)
+Paper_score::typeset_item(Item *i, PCol *c, int breakstat)
 {
     assert(c && i);
 
@@ -60,7 +60,7 @@
 }
 
 void
-PScore::typeset_broken_spanner(Spanner*span_p)
+Paper_score::typeset_broken_spanner(Spanner*span_p)
 {
     span_p->left_col_l_->starters.bottom().add (span_p);
     span_p->right_col_l_->stoppers.bottom().add(span_p);
@@ -71,7 +71,7 @@
 
 
 void
-PScore::typeset_unbroken_spanner(Spanner*span_p)
+Paper_score::typeset_unbroken_spanner(Spanner*span_p)
 {
     span_p_list_.bottom().add(span_p);
     span_p->pscore_l_=this;
@@ -87,7 +87,7 @@
 
 
 void
-PScore::clean_cols()
+Paper_score::clean_cols()
 {
     int rank_i = 0;
     for (iter_top(col_p_list_,c); c.ok(); )
@@ -100,7 +100,7 @@
 }
 
 void
-PScore::add(PCol *p)
+Paper_score::add(PCol *p)
 {
     p->pscore_l_ = this;
     if (p->breakable_b()){
@@ -111,7 +111,7 @@
 }
 
 void
-PScore::output(Tex_stream &ts)
+Paper_score::output(Tex_stream &ts)
 {
     ts << "\n "<<  paper_l_->lookup_l()->texsetting << "%(Tex id)\n";
     ts<< super_elem_l_->TeX_string();
@@ -120,7 +120,7 @@
 
 
 void
-PScore::OK()const
+Paper_score::OK()const
 {
 #ifndef NDEBUG
     for (iter_top(col_p_list_,cc); cc.ok(); cc++)
@@ -131,12 +131,12 @@
 }
 
 void
-PScore::print() const
+Paper_score::print() const
 {    
 #ifndef NPRINT
     if ( !check_debug)
 	return ;
-    mtor << "PScore { ";
+    mtor << "Paper_score { ";
     paper_l_->print();
     mtor << "\n elements: ";
     for (iter_top(elem_p_list_,cc); cc.ok(); cc++)	
@@ -153,21 +153,21 @@
 }
 
 void
-PScore::preprocess()
+Paper_score::preprocess()
 {
     super_elem_l_->breakable_col_processing();
     super_elem_l_->pre_processing();
 }
 
 void
-PScore::postprocess()
+Paper_score::postprocess()
 {
     super_elem_l_->post_processing();
     super_elem_l_->molecule_processing();
 }
 
 PCursor<PCol *>
-PScore::find_col(PCol const *c)const
+Paper_score::find_col(PCol const *c)const
 {
     PCol const *what = c;
     if (what->daddy_l_ )
@@ -178,7 +178,7 @@
 
 
 void
-PScore::set_breaking(Array<Col_hpositions> const &breaking)
+Paper_score::set_breaking(Array<Col_hpositions> const &breaking)
 {
     super_elem_l_->line_of_score_l_->set_breaking( breaking);
     super_elem_l_->break_processing();
@@ -207,7 +207,7 @@
 }
 
 void
-PScore::calc_breaking()
+Paper_score::calc_breaking()
 {
     Break_algorithm *algorithm_p;
     Array<Col_hpositions> sol;
@@ -233,7 +233,7 @@
 }
 
 void
-PScore::process()
+Paper_score::process()
 {
     clean_cols();
     print();
@@ -243,11 +243,16 @@
     calc_breaking();
     *mlog << "\nPostprocessing elements..." << endl;
     postprocess();
+    
+#ifndef NDEBUGA
+    for(PCursor<Score_elem*> i(elem_p_list_.top()); i.ok(); i++) 
+	assert (i->status() >= 9);
+#endif
 }
 
 /** Get all breakable columns between l and r, (not counting l and r).  */
 Link_array<PCol>
-PScore::breakable_col_range(PCol*l,PCol*r)const
+Paper_score::breakable_col_range(PCol*l,PCol*r)const
 {
     Link_array<PCol> ret;
 
@@ -266,7 +271,7 @@
     return ret;
 }
 Link_array<PCol>
-PScore::col_range(PCol*l,PCol*r)const
+Paper_score::col_range(PCol*l,PCol*r)const
 {
     Link_array<PCol> ret;
     
@@ -284,7 +289,7 @@
 }
 
 Link_array<PCol>
-PScore::broken_col_range(PCol*l,PCol*r)const
+Paper_score::broken_col_range(PCol*l,PCol*r)const
 {
     Link_array<PCol> ret;
 
diff -urN ../lilypond-0.1.2/lily/performer-group-performer.cc ./lily/performer-group-performer.cc
--- ../lilypond-0.1.2/lily/performer-group-performer.cc	Thu Aug  7 13:45:06 1997
+++ ./lily/performer-group-performer.cc	Fri Aug  8 13:52:55 1997
@@ -15,14 +15,6 @@
 
 ADD_THIS_PERFORMER(Performer_group_performer);
 
-Performer_group_performer::Performer_group_performer()
-{
-}
-
-Performer_group_performer::~Performer_group_performer()
-{
-}
-
 void
 Performer_group_performer::add( Performer *perf_p )
 {
@@ -51,6 +43,42 @@
     return daddy_perf_l_->depth_i() + 1;
 }
 
+void
+Performer_group_performer::do_creation_processing()
+{
+    for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ )
+	i->creation_processing();
+}
+
+void
+Performer_group_performer::do_print()const
+{
+#ifndef NPRINT
+    if ( !check_debug)
+	return ;
+    for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ )
+	i->print();
+#endif
+}
+
+void
+Performer_group_performer::do_removal_processing()
+{
+    for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ )
+	i->do_removal_processing();
+}
+
+bool
+Performer_group_performer::do_try_request( Request* req_l )
+{
+    bool hebbes_b =false;
+    for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++)
+	hebbes_b =nongroup_l_arr_[i]->try_request(req_l);
+    if ( !hebbes_b && daddy_perf_l_ )
+	hebbes_b = daddy_perf_l_->try_request(req_l);
+    return hebbes_b ;
+}
+
 Translator*
 Performer_group_performer::find_get_translator_l( String n,String id )
 {
@@ -109,83 +137,27 @@
 	return perf_p->get_default_interpreter();
 }
 
-Moment
-Performer_group_performer::get_mom() const
-{
-    Moment mom = Performer::get_mom();
-
-    for ( int i = 0; i < nongroup_l_arr_.size(); i++ )
-	nongroup_l_arr_[ i ]->set( mom );
-    
-    return mom;
-}
-
 bool
 Performer_group_performer::is_bottom_performer_b() const
 {
     return !itrans_l_->get_default_itrans_l();
 }
 
-
-void
-Performer_group_performer::process_requests()
-{
-    for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ )
-	i->process_requests();
-}
-
-//<ugh>
-int
-Performer_group_performer::get_track_i() const
-{
-    int track_i = Performer::get_track_i();
-
-    for ( int i = 0; i < nongroup_l_arr_.size(); i++ )
-	nongroup_l_arr_[ i ]->set_track( track_i );
-    
-    return track_i;
-}
-
-void
-Performer_group_performer::set_track( int& track_i_r )
-{
-    for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ )
-        i->set_track( track_i_r );
-}
-//</ugh>
-
-bool
-Performer_group_performer::do_try_request( Request* req_l )
-{
-    bool hebbes_b =false;
-    for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++)
-	hebbes_b =nongroup_l_arr_[i]->try_request(req_l);
-    if ( !hebbes_b && daddy_perf_l_ )
-	hebbes_b = daddy_perf_l_->try_request(req_l);
-    return hebbes_b ;
-}
-
 void
-Performer_group_performer::do_print()const
-{
-#ifndef NPRINT
-    if ( !check_debug)
-	return ;
-    for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ )
-	i->print();
-#endif
+Performer_group_performer::print() const 
+{ 
+    Performer::print();
 }
 
 void
-Performer_group_performer::do_creation_processing()
+Performer_group_performer::process_requests()
 {
     for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ )
-	i->creation_processing();
+	i->process_requests();
 }
 
-void
-Performer_group_performer::do_removal_processing()
+bool 
+Performer_group_performer::try_request( Request* r )
 {
-    for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ )
-	i->do_removal_processing();
+    return Performer::try_request( r ); 
 }
diff -urN ../lilypond-0.1.2/lily/performer.cc ./lily/performer.cc
--- ../lilypond-0.1.2/lily/performer.cc	Thu Aug  7 13:45:06 1997
+++ ./lily/performer.cc	Fri Aug  8 13:52:55 1997
@@ -29,12 +29,6 @@
 {
 }
 
-Moment
-Performer::get_mom() const
-{
-    return daddy_perf_l_->get_mom();
-}
-
 void 
 Performer::play( Audio_item* p ) 
 { 
@@ -42,9 +36,9 @@
 }
 
 void 
-Performer::play( Midi_item* l ) 
+Performer::play( Audio_staff* p )
 { 
-    daddy_perf_l_->play( l ); 
+    daddy_perf_l_->play( p ); 
 }
 
 int
@@ -68,24 +62,6 @@
 {
 }
 
-void
-Performer::set( Moment )
-{
-} 
-
-//<ugh>
-int
-Performer::get_track_i() const
-{
-    return daddy_perf_l_->get_track_i();
-}
-
-void
-Performer::set_track( int& )
-{
-}
-//</ugh>
-
 bool 
 Performer::do_try_request( Request* req_l )
 {
@@ -105,17 +81,18 @@
 Performer::creation_processing()
 {
     if (!init_b_) { 
-/*	if ( daddy_perf_l_ ) {
+#if 0
+	if ( daddy_perf_l_ ) {
 	    init_b_ = true;	// ugh. avoid recursion
 	    daddy_perf_l_->creation_processing();
 	    init_b_ = false;
 	}
-	
-	*/
+#endif	
 	do_creation_processing();
 	init_b_ = true;
     }
 }
+
 void
 Performer::do_creation_processing()
 {
diff -urN ../lilypond-0.1.2/lily/score-elem.cc ./lily/score-elem.cc
--- ../lilypond-0.1.2/lily/score-elem.cc	Thu Aug  7 02:27:45 1997
+++ ./lily/score-elem.cc	Fri Aug  8 13:10:08 1997
@@ -144,7 +144,7 @@
 Interval
 Score_elem::extent(Axis a)const
 {
-    Interval r(0,0);
+    Interval r;
     if ( !empty_b_ ) {
 	
 	r = a == X_AXIS? do_width(): do_height();
@@ -382,7 +382,9 @@
 {
 }
 
-
+void
+Score_elem::do_unlink()
+{}
 
 IMPLEMENT_IS_TYPE_B(Score_elem);
 
@@ -409,8 +411,10 @@
 }
 
 /*
+  
   DEPENDENCIES
- */
+
+  */
 
 void
 Score_elem::remove_dependency(Score_elem*e)
@@ -493,31 +497,31 @@
 void
 Score_elem::handle_prebroken_dependencies()
 {
-    Link_array<Score_elem> remove_us_arr;
+    Link_array<Score_elem> old_arr, new_arr;
+    
     for (int i=0; i < dependency_size(); i++) {
 	Score_elem * elt = dependency(i);
 	Item *it_l = elt->item();
-	if (it_l && it_l->pcol_l_->breakable_b())
+	if (it_l && it_l->breakable_b_)
 	    if (item()) {
 		Score_elem *new_l = it_l->find_prebroken_piece(item()->pcol_l_);
 		if (new_l != elt ) {
-		    do_substitute_dependency( elt, new_l);
-		    remove_us_arr.push(elt);
-		    
-		    add_dependency(new_l);
+		    new_arr.push (new_l);
+		    old_arr.push(elt);
 		} 
 	    }else {
-		add_dependency(it_l->broken_to_a_[0]);
-		add_dependency(it_l->broken_to_a_[1]);		
+		new_arr.push(it_l->broken_to_a_[0]);
+		old_arr.push(0);
+		old_arr.push(0);		
+		new_arr.push(it_l->broken_to_a_[1]);		
 	    }
-
     }
     
-    remove_us_arr.default_sort();
-    remove_us_arr.uniq();
-    for (int i=0;  i <remove_us_arr.size(); i++)
-	remove_dependency(remove_us_arr[i]);
-
+    for (int i=0;  i < old_arr.size(); i++)
+	if (old_arr[i])
+	    substitute_dependency( old_arr[i], new_arr[i] );
+	
+	
     status_ = PREBROKEN;
 }
 
@@ -528,6 +532,10 @@
 {
     for (int i=0; i < dependency_size(); i++) 
 	dependency(i)->unlink_all();
+    Link_array<Score_elem> extra(get_extra_dependencies());
+    for (int i=0; i < extra.size(); i++)
+	extra[i]->unlink_all();
+    
     junk_links();
     axis_group_l_a_[0] = axis_group_l_a_[1] =0;
 }
@@ -535,6 +543,7 @@
 void
 Score_elem::unlink()
 {
+    do_unlink();
     while ( dependency_size()) {
 	do_substitute_dependency(dependency(0),0);
 	remove_edge_out_idx(0);
diff -urN ../lilypond-0.1.2/lily/score-grav.cc ./lily/score-grav.cc
--- ../lilypond-0.1.2/lily/score-grav.cc	Wed Aug  6 22:10:59 1997
+++ ./lily/score-grav.cc	Fri Aug  8 09:39:07 1997
@@ -135,7 +135,7 @@
 Score_engraver::typeset_all()
 {
     PCol * c= get_staff_info().command_pcol_l();
-    PScore *ps_l = score_l_->pscore_p_;
+    Paper_score *ps_l = score_l_->pscore_p_;
 
     for  (int i =0; i < nobreak_item_p_arr_.size(); i++) {
 	ps_l->typeset_item(nobreak_item_p_arr_[i], c, 0);
diff -urN ../lilypond-0.1.2/lily/score-performer.cc ./lily/score-performer.cc
--- ../lilypond-0.1.2/lily/score-performer.cc	Thu Aug  7 13:45:06 1997
+++ ./lily/score-performer.cc	Fri Aug  8 13:52:56 1997
@@ -6,18 +6,15 @@
   (c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
  */
 
-#include <time.h>
 #include "score-performer.hh"
 #include "input-translator.hh"
 #include "midi-def.hh"
-#include "audio-item.hh"
 #include "audio-column.hh"
+#include "audio-item.hh"
 #include "audio-score.hh"
-#include "midi-item.hh"
 #include "midi-stream.hh"
 #include "string-convert.hh"
 #include "debug.hh"
-#include "main.hh"
 #include "score.hh"
 #include "source-file.hh"
 #include "source.hh"
@@ -27,7 +24,6 @@
 
 Score_performer::Score_performer()
 {
-    midi_l_ = 0;
 }
 
 Score_performer::~Score_performer()
@@ -50,22 +46,6 @@
 Score_performer::finish()
 {
     Performer_group_performer::do_removal_processing();
-
-
-    Midi_stream output_stream( midi_l_->outfile_str_, midi_item_l_arr_.size() + 1, 384 );    
-    *mlog << "MIDI output to " << midi_l_->outfile_str_ << " ..." << endl;    
-
-    header( output_stream);
-//    int track_i = 1;
-    for (int i=0; i<  midi_item_l_arr_.size(); i++) {
-	Midi_item * it_p = midi_item_l_arr_[i];
-	
-//	if ( it_p->is_type_b( Midi_track::static_name()))
-//	    ((Midi_track*)it_p )->number_i_ = track_i ++;
-	output_stream<< *it_p;
-    }
-    *output_stream.os_p_ << flush;
-    *mlog << endl;
 }
 
 void
@@ -76,51 +56,9 @@
 }
 
 void
-Score_performer::play( Midi_item* l )
-{
-    midi_item_l_arr_.push( l );
-}
-
-Moment
-Score_performer::get_mom() const
+Score_performer::play( Audio_staff* p )
 {
-    return now_mom_;
-}
-
-void
-Score_performer::header(Midi_stream &output_stream)
-{
-    Midi_track midi_track;
-    
-    time_t t = time( 0 );
-
-    // perhaps multiple text events?
-    String str = String( "Creator: " ) + get_version_str() + "\n";
-
-    Midi_text creator( Midi_text::TEXT, str );
-    midi_track.add( Moment( 0 ), &creator );
-
-    str = "Automatically generated at ";
-    str += ctime( &t );
-    str = str.left_str( str.length_i() - 1 );
-    str += "\n";
-    Midi_text generate( Midi_text::TEXT, str );
-    midi_track.add( Moment( 0 ), &generate );
-
-    str = "from musical definition: ";
-
-    str += score_l_->location_str();
-    Midi_text from( Midi_text::TEXT, str );
-    midi_track.add( Moment( 0 ), &from );
-
-    Midi_text track_name( Midi_text::TRACK_NAME, "Track " 
-			  + String_convert::i2dec_str( 0, 0, '0' ) );
-    midi_track.add( Moment( 0 ), &track_name );
-
-    Midi_tempo tempo ( get_tempo_i() );
-    midi_track.add( Moment(0), &tempo);
-
-    output_stream  << midi_track;
+    score_l_->audio_score_p_->play( p );
 }
 
 void 
@@ -136,31 +74,21 @@
 Score_performer::process()
 {
     process_requests();
-    prev_mom_ = now_mom_;
 }
 
 void
 Score_performer::set_score(Score* score_l )
 {
     Global_translator::set_score( score_l );
-    midi_l_ = score_l->midi_p_;
 }
 
 void
 Score_performer::start()
 {
-    //<ugh>
-    int track_i = 1;
-    Performer_group_performer::set_track( track_i );
-    //</ugh>
-
-    if ( midi_l_->outfile_str_ == "" )
-	midi_l_->outfile_str_ = default_out_fn + ".midi";
 }
 
-
 int
 Score_performer::get_tempo_i()const
 {
-    return midi_l_->get_tempo_i(Moment( 1, 4 ));
+    return score_l_->midi_p_->get_tempo_i(Moment( 1, 4 ));
 }
diff -urN ../lilypond-0.1.2/lily/score.cc ./lily/score.cc
--- ../lilypond-0.1.2/lily/score.cc	Thu Aug  7 13:45:06 1997
+++ ./lily/score.cc	Fri Aug  8 13:52:56 1997
@@ -15,8 +15,8 @@
 #include "main.hh"
 #include "source.hh"
 #include "source-file.hh"
-#include "midi-output.hh"
 #include "midi-def.hh"
+#include "midi-stream.hh"
 #include "audio-score.hh"
 #include "p-col.hh"
 #include "music-iterator.hh"
@@ -92,7 +92,7 @@
 	return;
     
     *mlog << "\nCreating MIDI elements ..." << flush;
-    audio_score_p_ = new Audio_score( midi_p_ );
+    audio_score_p_ = new Audio_score( this );
     
     Global_translator* score_trans=  midi_p_->get_global_translator_p();
     run_translator( score_trans );
@@ -104,6 +104,8 @@
 //	return;
     }
     *mlog << endl;
+
+    midi_output();
 }
     
 void
@@ -113,7 +115,7 @@
 	return;
     
     *mlog << "\nCreating elements ..." << flush;
-    pscore_p_ = new PScore(paper_p_);
+    pscore_p_ = new Paper_score(paper_p_);
     
     Global_translator * score_trans=  paper_p_->get_global_translator_p();
     run_translator( score_trans );
@@ -133,34 +135,17 @@
     paper_output();
 }
 
-
 void
-Score::set(Paper_def *pap_p)
+Score::midi_output()
 {
-    delete paper_p_;
-    paper_p_ = pap_p;
-}
-
-void
-Score::set(Midi_def* midi_p)
-{    
-    delete midi_p_;
-    midi_p_ = midi_p;
-}
-
+    if ( midi_p_->outfile_str_ == "" )
+	midi_p_->outfile_str_ = default_out_fn + ".midi";
 
+    Midi_stream midi_stream( midi_p_->outfile_str_ );    
+    *mlog << "MIDI output to " << midi_p_->outfile_str_ << " ..." << endl;    
 
-void
-Score::print() const
-{
-#ifndef NPRINT
-    mtor << "score {\n"; 
-    music_p_->print();
-    if (midi_p_)
-	midi_p_->print();
-    
-    mtor << "}\n";
-#endif
+    audio_score_p_->output( midi_stream );
+    *mlog << endl;
 }
 
 void
@@ -182,21 +167,32 @@
     the_output << "% outputting Score, defined at: " <<
 	location_str() << "\n";
     pscore_p_->output(the_output);
-    
 }
 
 void
-Score::midi_output()
+Score::print() const
 {
-#if 0
-    if (!midi_p_)
-	return;
-
-    if (midi_p_->outfile_str_ == "")
-	midi_p_->outfile_str_ = default_out_fn + ".midi";
+#ifndef NPRINT
+    mtor << "score {\n"; 
+    music_p_->print();
+    if (midi_p_)
+	midi_p_->print();
     
-    *mlog << "midi output to " << midi_p_->outfile_str_ << " ...\n";    
-    Midi_output(this, midi_p_);
+    mtor << "}\n";
 #endif
+}
+
+void
+Score::set(Paper_def *pap_p)
+{
+    delete paper_p_;
+    paper_p_ = pap_p;
+}
+
+void
+Score::set(Midi_def* midi_p)
+{    
+    delete midi_p_;
+    midi_p_ = midi_p;
 }
 
diff -urN ../lilypond-0.1.2/lily/scoreline.cc ./lily/scoreline.cc
--- ../lilypond-0.1.2/lily/scoreline.cc	Wed Aug  6 22:11:10 1997
+++ ./lily/scoreline.cc	Fri Aug  8 10:43:26 1997
@@ -74,7 +74,8 @@
 void
 Line_of_score::add(Score_elem*e)
 {
-    if( !e->dependent_size())	// avoid excess dependencies.
+    // avoid excess dependencies.
+    if(!( e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
 	add_dependency(e);
 }
 
diff -urN ../lilypond-0.1.2/lily/script-column.cc ./lily/script-column.cc
--- ../lilypond-0.1.2/lily/script-column.cc	Mon Jul 28 23:56:53 1997
+++ ./lily/script-column.cc	Thu Aug  7 22:47:41 1997
@@ -20,6 +20,7 @@
 Script_column::add(Script*s_l)
 {
     script_l_arr_.push(s_l);
+    add_dependency(s_l);
     add_element(s_l);
 }
 
@@ -89,13 +90,13 @@
 Script_column::add_support(Item*i_l)
 {
     support_l_arr_.push(i_l);
+    add_dependency( i_l);
     add_element(i_l);
 }
 
 void
 Script_column::do_substitute_dependency(Score_elem*o,Score_elem*n)
 {
-    Horizontal_vertical_group::do_substitute_dependency(o,n);
     if (o->item()) {
 	script_l_arr_.substitute((Script*)o->item(),(Script*) (n?n->item():0));
 	support_l_arr_.substitute(o->item(), (n?n->item():0));
diff -urN ../lilypond-0.1.2/lily/span-bar-grav.cc ./lily/span-bar-grav.cc
--- ../lilypond-0.1.2/lily/span-bar-grav.cc	Tue Aug  5 21:22:18 1997
+++ ./lily/span-bar-grav.cc	Fri Aug  8 09:38:48 1997
@@ -25,8 +25,10 @@
 void
 Span_bar_engraver::acknowledge_element(Score_elem_info i)
 {
-    if ( i.origin_grav_l_arr_.size() > 1 && 
-	 i.elem_l_->is_type_b( Bar::static_name() ) ) {
+    int depth = i.origin_grav_l_arr_.size();
+    if ( depth > 1
+	 && i.elem_l_->is_type_b( Bar::static_name() ) ) 
+    {
 	bar_l_arr_.push( (Bar*)i.elem_l_->item() );
 	
 	if (bar_l_arr_.size() >= 2 && !spanbar_p_) {
diff -urN ../lilypond-0.1.2/lily/span-bar.cc ./lily/span-bar.cc
--- ../lilypond-0.1.2/lily/span-bar.cc	Wed Aug  6 17:20:57 1997
+++ ./lily/span-bar.cc	Fri Aug  8 02:19:46 1997
@@ -43,9 +43,8 @@
     spanning_l_arr_.substitute( bold , b);
 }
 
-/*
-  A no-op if not yet output: the span_bar slavish follows what it spans
- */
+/** Translate a Span_bar.  A no-op if not yet output: the span_bar
+  slavish follows what it spans */
 void
 Span_bar::translate_y(Real y)
 {
@@ -106,3 +105,8 @@
 
 
 IMPLEMENT_IS_TYPE_B1(Span_bar,Bar);
+
+Span_bar::Span_bar()
+{
+    type_str_ = "";
+}
diff -urN ../lilypond-0.1.2/lily/span-score-bar-grav.cc ./lily/span-score-bar-grav.cc
--- ../lilypond-0.1.2/lily/span-score-bar-grav.cc	Mon Jul 28 23:56:52 1997
+++ ./lily/span-score-bar-grav.cc	Fri Aug  8 02:34:00 1997
@@ -17,7 +17,6 @@
 
 
 IMPLEMENT_IS_TYPE_B1(Span_score_bar_engraver, Span_bar_engraver);
-
 IMPLEMENT_IS_TYPE_B1(Piano_bar_engraver, Span_score_bar_engraver);
 
 Span_bar*
diff -urN ../lilypond-0.1.2/lily/spanner-elem-group.cc ./lily/spanner-elem-group.cc
--- ../lilypond-0.1.2/lily/spanner-elem-group.cc	Sun Aug  3 16:53:40 1997
+++ ./lily/spanner-elem-group.cc	Fri Aug  8 09:56:47 1997
@@ -11,7 +11,7 @@
 
 
 
-IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group);
+IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group_element);
 
 Interval
 Spanner_elem_group::do_width() const
@@ -24,7 +24,7 @@
 {
 #ifndef NPRINT
     Spanner::do_print();
-    Horizontal_vertical_group::do_print();
+    Horizontal_vertical_group_element::do_print();
 #endif
 }
 
diff -urN ../lilypond-0.1.2/lily/staff-info.cc ./lily/staff-info.cc
--- ../lilypond-0.1.2/lily/staff-info.cc	Thu Jul 24 23:00:25 1997
+++ ./lily/staff-info.cc	Fri Aug  8 10:17:13 1997
@@ -16,6 +16,7 @@
 {
     return score_l_;
 }
+
 Staff_info::Staff_info()
 {
     score_l_ =0;
diff -urN ../lilypond-0.1.2/lily/staff-performer.cc ./lily/staff-performer.cc
--- ../lilypond-0.1.2/lily/staff-performer.cc	Thu Aug  7 13:45:06 1997
+++ ./lily/staff-performer.cc	Fri Aug  8 13:52:56 1997
@@ -6,79 +6,50 @@
   (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
  */
 
-
 #include "staff-performer.hh"
 #include "translator.hh"
 #include "input-translator.hh"
 #include "debug.hh"
-#include "midi-def.hh"
 #include "audio-column.hh"
 #include "audio-item.hh"
-#include "midi-item.hh"
-#include "midi-stream.hh"
-#include "string.hh"
-#include "string-convert.hh"
-
+#include "audio-staff.hh"
 
 IMPLEMENT_IS_TYPE_B1(Staff_performer,Performer_group_performer);
 ADD_THIS_PERFORMER(Staff_performer);
 
 Staff_performer::Staff_performer()
 {
-    midi_track_p_ = new Midi_track;
+    audio_staff_p_ = 0;
 }
 
 Staff_performer::~Staff_performer()
 {
-    delete midi_track_p_;
+    delete audio_staff_p_;
 }
 
 void
 Staff_performer::do_creation_processing()
 {
-}
+    audio_staff_p_ = new Audio_staff;
 
-void
-Staff_performer::do_removal_processing()
-{
-    header();
+    // staff name
+    play( new Audio_text( Audio_text::TRACK_NAME, instrument_str() ) );
 
-    Moment midi_mom = 0;
-    for ( PCursor<Audio_item*> i( audio_item_p_list_ ); i.ok(); i++ ) {
-	Audio_item* l = *i;
-	Moment mom = l->audio_column_l_->at_mom();
-	Moment delta_t = mom - midi_mom_ ;
-	midi_mom_ += delta_t;
-	Midi_item* p = l->midi_item_p();
-	p->channel_i_ = track_i_;
-	midi_track_p_->add( delta_t, p );
-	delete p;
-    }
+    // instrument description
+    play( new Audio_text( Audio_text::INSTRUMENT_NAME, instrument_str() ) );
 
-    Performer::play( midi_track_p_ );
+    // tempo
+    play( new Audio_tempo( get_tempo_i() ) );
+
+    // instrument
+    play( new Audio_instrument( instrument_str() ) );
 }
 
 void
-Staff_performer::header()
+Staff_performer::do_removal_processing()
 {
-    // set track name
-    Midi_text track_name( Midi_text::TRACK_NAME, instrument_str() );
-    midi_track_p_->add( Moment( 0 ), &track_name );
-
-    // set instrument description
-    Midi_text instrument_name( Midi_text::INSTRUMENT_NAME, instrument_str() );
-    midi_track_p_->add( Moment( 0 ), &instrument_name );
-
-    // set instrument :-)
-    // lieve wendy, nu heb je mijn track_i_ / get_staff_i weggehaald...
-    // zie ook note-performer: ugh
-    // ugh, need to know channel (===track===staff) too
-    int channel_i = track_i_;
-    Midi_instrument instrument( channel_i, instrument_str() );
-    midi_track_p_->add( Moment( 0 ), &instrument );
-
-    Midi_tempo midi_tempo( get_tempo_i() );
-    midi_track_p_->add( Moment( 0 ), &midi_tempo );
+    Performer::play( audio_staff_p_ );
+    audio_staff_p_ = 0;
 }
 
 String 
@@ -90,29 +61,7 @@
 void 
 Staff_performer::play( Audio_item* p )
 {
-    audio_item_p_list_.bottom().add( p );
-    Performer::play( p );
-}
-
-// huh?
-void 
-Staff_performer::play( Midi_item* p )
-{
+    audio_staff_p_->add( p );
     Performer::play( p );
 }
-
-
-//<ugh>
-int
-Staff_performer::get_track_i() const
-{
-    return track_i_;
-}
-
-void
-Staff_performer::set_track( int& track_i_r )
-{
-    track_i_ = track_i_r++;
-}
-//</ugh>
 
diff -urN ../lilypond-0.1.2/lily/staff-side.cc ./lily/staff-side.cc
--- ../lilypond-0.1.2/lily/staff-side.cc	Mon Jul 28 23:56:52 1997
+++ ./lily/staff-side.cc	Fri Aug  8 00:47:14 1997
@@ -106,13 +106,7 @@
 void
 Staff_side::do_substitute_dependency(Score_elem*o, Score_elem*n)
 { 
-    int i;
-    while ((i=support_l_arr_.find_i(o) ) >=0)
-	if (n) 
-	    support_l_arr_[i] = n;
-	else
-	    support_l_arr_.del(i);
-
+    support_l_arr_.unordered_substitute(o,n);
     if (staff_sym_l_ == o)
 	staff_sym_l_ = n ? (Staff_symbol*) n->spanner():0;
 }
diff -urN ../lilypond-0.1.2/lily/template8.cc ./lily/template8.cc
--- ../lilypond-0.1.2/lily/template8.cc	Thu Aug  7 13:45:07 1997
+++ ./lily/template8.cc	Fri Aug  8 13:52:56 1997
@@ -10,12 +10,12 @@
 #include "plist.hh"
 #include "audio-column.hh"
 #include "audio-item.hh"
-#include "cursor.tcc"
-#include "list.tcc"
+#include "audio-staff.hh"
 #include "pcursor.tcc"
 #include "plist.tcc"
 
 
 IPL_instantiate(Audio_item);
 IPL_instantiate(Audio_column);
+IPL_instantiate(Audio_staff);
 
diff -urN ../lilypond-0.1.2/lily/vertical-align-grav.cc ./lily/vertical-align-grav.cc
--- ../lilypond-0.1.2/lily/vertical-align-grav.cc	Wed Aug  6 18:50:54 1997
+++ ./lily/vertical-align-grav.cc	Fri Aug  8 09:54:56 1997
@@ -35,7 +35,7 @@
 Vertical_align_engraver::acknowledge_element(Score_elem_info i)
 {
     if ( i.origin_grav_l_arr_.size() == 2 && 
-	 i.elem_l_->is_type_b(Vertical_group::static_name()) &&
+	 i.elem_l_->is_type_b(Vertical_group_element::static_name()) &&
 	 !i.elem_l_->axis_group_l_a_[Y_AXIS]   ) {
 	assert( !valign_p_->contains_b(  i.elem_l_) );
 
diff -urN ../lilypond-0.1.2/lily/vertical-group-spanner.cc ./lily/vertical-group-spanner.cc
--- ../lilypond-0.1.2/lily/vertical-group-spanner.cc	Thu Aug  7 14:08:36 1997
+++ ./lily/vertical-group-spanner.cc	Fri Aug  8 09:54:56 1997
@@ -10,4 +10,4 @@
 #include "item.hh"
 #include "p-col.hh"
 
-IMPLEMENT_IS_TYPE_B2(Vertical_group_spanner, Axis_group_spanner, Vertical_group);
+IMPLEMENT_IS_TYPE_B2(Vertical_group_spanner, Axis_group_spanner, Vertical_group_element);
diff -urN ../lilypond-0.1.2/make/Targets.make ./make/Targets.make
--- ../lilypond-0.1.2/make/Targets.make	Wed Aug  6 22:01:16 1997
+++ ./make/Targets.make	Fri Aug  8 14:14:27 1997
@@ -8,7 +8,7 @@
 #	Han-Wen Nienhuys <hanwen@stack.nl>
 
 .PHONY : all clean config default dist doc doc++ dummy exe help lib TAGS html\
-	check-flower-deps check-lily-deps check-doc-deps
+	check-flower-deps check-lib-deps check-doc-deps
 
 # target all:
 #
@@ -224,7 +224,7 @@
 check-flower-deps:
 	$(MAKE)  -C $(depth)/flower/ default
 
-check-lily-deps: check-flower-deps
+check-lib-deps: check-flower-deps
 	$(MAKE)  -C $(depth)/lib
 
 check-doc-deps:
diff -urN ../lilypond-0.1.2/mi2mu/Makefile ./mi2mu/Makefile
--- ../lilypond-0.1.2/mi2mu/Makefile	Wed Aug  6 15:06:41 1997
+++ ./mi2mu/Makefile	Fri Aug  8 14:14:27 1997
@@ -46,7 +46,7 @@
 
 # list of custom libraries:
 #
-MODULE_LIBDEPS=check-flower-deps check-lily-deps
+MODULE_LIBDEPS=check-flower-deps check-lib-deps
 MODULE_LIBES=-llily -lflower
 #
 
