]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge with master
authorJoe Neeman <joeneeman@gmail.com>
Sun, 28 Jan 2007 09:06:42 +0000 (11:06 +0200)
committerJoe Neeman <joeneeman@gmail.com>
Sun, 28 Jan 2007 09:06:42 +0000 (11:06 +0200)
136 files changed:
Documentation/index.html.in
Documentation/topdocs/NEWS.tely
Documentation/user/basic-notation.itely
Documentation/user/instrument-notation.itely
Documentation/user/introduction.itely
Documentation/user/lilypond.tely
Documentation/user/macros.itexi
Documentation/user/music-glossary.tely
Documentation/user/non-music.itely
Documentation/user/putting.itely
Documentation/user/running.itely
Documentation/user/spacing.itely
Documentation/user/templates.itely
Documentation/user/tutorial.itely
Documentation/user/working.itely
VERSION
buildscripts/build-coverage.sh
buildscripts/build-profile.sh
buildscripts/coverage.py
buildscripts/makelsr.py [new file with mode: 0755]
buildscripts/output-distance.py
flower/include/interval.hh
flower/include/offset.hh
flower/offset.cc
input/GNUmakefile
input/lsr/GNUmakefile [new file with mode: 0644]
input/lsr/LSR.ly [new file with mode: 0644]
input/lsr/SConscript [new file with mode: 0644]
input/lsr/advanced/AAA-intro-advanced.ly [new file with mode: 0644]
input/lsr/advanced/Alternating-beam-directions.ly [new file with mode: 0644]
input/lsr/advanced/GNUmakefile [new file with mode: 0644]
input/lsr/advanced/SConscript [new file with mode: 0644]
input/lsr/trick/AAA-intro-trick.ly [new file with mode: 0644]
input/lsr/trick/Caesura-railtracks-with-fermata.ly [new file with mode: 0644]
input/lsr/trick/GNUmakefile [new file with mode: 0644]
input/lsr/trick/SConscript [new file with mode: 0644]
input/lsr/trick/Tramlines-and-Feta-font-caesurae.ly [new file with mode: 0644]
input/regression/+.ly [deleted file]
input/regression/AAA-intro-regression.ly [new file with mode: 0644]
input/regression/auto-beam-beaming-override.ly [new file with mode: 0644]
input/regression/backend-excercise.ly
input/regression/display-lily-tests.ly
input/regression/glissando-broken.ly [new file with mode: 0644]
input/regression/hairpin-to-barline-mark.ly [new file with mode: 0644]
input/regression/line-style.ly [new file with mode: 0644]
input/regression/skiptypesetting-show-last.ly [new file with mode: 0644]
input/regression/spacing-horizontal-skyline-grace.ly [new file with mode: 0644]
input/regression/tablature-slide.ly [new file with mode: 0644]
input/test/+.ly [deleted file]
input/test/AAA-intro-test.ly [new file with mode: 0644]
lily/accidental-placement.cc
lily/accidental.cc
lily/ambitus-engraver.cc
lily/audio-staff.cc
lily/auto-beam-engraver.cc
lily/beam-engraver.cc
lily/beaming-pattern.cc
lily/constrained-breaking.cc
lily/context.cc
lily/dynamic-engraver.cc
lily/dynamic-text-spanner.cc [deleted file]
lily/freetype-error.cc [new file with mode: 0644]
lily/general-scheme.cc
lily/glissando-engraver.cc
lily/grob-property.cc
lily/grob.cc
lily/includable-lexer.cc
lily/include/beaming-pattern.hh
lily/include/context.hh
lily/include/freetype.hh
lily/include/grob.hh
lily/include/item.hh
lily/include/lily-guile-macros.hh
lily/include/lily-guile.hh
lily/include/lily-proto.hh
lily/include/line-interface.hh
lily/include/midi-chunk.hh [new file with mode: 0644]
lily/include/midi-item.hh
lily/include/midi-stream.hh
lily/include/midi-walker.hh
lily/include/prob.hh
lily/include/source.hh
lily/include/sources.hh [new file with mode: 0644]
lily/include/spanner.hh
lily/include/stencil.hh
lily/include/tie-formatting-problem.hh
lily/input.cc
lily/item.cc
lily/key-engraver.cc
lily/least-squares.cc
lily/lily-guile.cc
lily/lily-parser-scheme.cc
lily/lily-parser.cc
lily/line-interface.cc
lily/line-spanner.cc
lily/midi-chunk.cc [new file with mode: 0644]
lily/midi-item.cc
lily/midi-stream.cc
lily/midi-walker.cc
lily/new-line-spanner.cc [new file with mode: 0644]
lily/open-type-font.cc
lily/page-breaking.cc
lily/pango-font.cc
lily/pango-select.cc
lily/parse-scm.cc
lily/parser.yy
lily/performance.cc
lily/prob.cc
lily/separating-group-spanner.cc
lily/source.cc
lily/sources.cc [new file with mode: 0644]
lily/spanner.cc
lily/stencil.cc
lily/system-scheme.cc [new file with mode: 0644]
lily/template5.cc
lily/tie-formatting-problem.cc
lily/ttf.cc
ly/engraver-init.ly
ly/music-functions-init.ly
python/convertrules.py
scm/coverage.scm [new file with mode: 0644]
scm/define-grob-interfaces.scm
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/define-music-display-methods.scm
scm/display-lily.scm
scm/framework-ps.scm
scm/lily.scm
scm/markup.scm
scm/memory-trace.scm
scm/music-functions.scm
scm/output-ps.scm
scm/output-tex.scm
scm/ps-to-png.scm
scm/stencil.scm
scm/to-xml.scm

index 11c99de0565a20f421b80a593cb943b1351ac990..e457d98a6d1a8dfa940c2f9aa0831d30604a64dd 100644 (file)
@@ -82,6 +82,10 @@ in <a class="title" href="user/lilypond.pdf">PDF</a>)
 (~ 2 Mb, in  <a class="title" href="../input/test/collated-files.pdf">PDF</a>)
 
      <br>(for advanced users)
+
+<li><a class="title" href="../input/lsr/collated-files.html">Snippets</a>
+     <br>(current in development)
+
  <li><a class="title" href="user/music-glossary/index.html">Glossary</a>
 (in <a class="title" href="user/music-glossary.html">one big page</a> ~ 1 Mb,
 in <a class="title" href="user/music-glossary.pdf">PDF</a>)
index 4769d08c7adabf9dfe1c8f741112a7ad4fe64912..e7b58fc71fc819d53308b8d610700ff3e77da124 100644 (file)
@@ -20,7 +20,6 @@ See user manual, \NAME\
 @end macro
 @end ifnothtml
 
-
 @macro textanchor{NAME}
 @html
 <a name="\NAME\"></a>
@@ -65,12 +64,13 @@ which scares away people.
 * only show user-visible changes. 
 
 @end ignore
+
 @item
 Notes or rests, such as a typical end note, that fill an entire
 measure are preceded by some more space.
 
-@lilypond[ragged-right,relative=1]
-{
+@lilypond[ragged-right]
+\relative c' {
   \time 4/4
   s1
   c2. c4
index b4e36e8655209fe1d54b68178c1e446dee4d4447..da60b0e06cc876bc33edbfe50d74a0d53935c4be 100644 (file)
@@ -20,7 +20,7 @@ This chapter explains how to use basic notation features.
 @menu
 * Pitches::                     
 * Rhythms::                     
-* Multiple notes at once::      
+* Polyphony::                   
 * Staff notation::              
 * Connecting notes::            
 * Expressive marks::            
@@ -39,7 +39,7 @@ This section discusses how to specify the pitch of notes.
 * Accidentals::                 
 * Cautionary accidentals::      
 * Micro tones::                 
-* Notes names in other languages::  
+* Note names in other languages::  
 * Relative octaves::            
 * Octave check::                
 * Transpose::                   
@@ -128,7 +128,7 @@ The input @code{d e f} is interpreted as @q{print a D-natural,
 E-natural, and an F-natural,} regardless of the key
 signature.  For more information about the distinction between
 musical content and the presentation of that content, see
-@ref{More about pitches}.
+@ref{Accidentals and key signatures}.
 
 @lilypond[fragment,quote,ragged-right,verbatim,relative]
 \key d \major
@@ -212,8 +212,8 @@ three-quarter flats, so LilyPond's symbol does not conform to any
 standard.
 
 
-@node Notes names in other languages
-@subsection Notes names in other languages
+@node Note names in other languages
+@subsection Note names in other languages
 
 There are predefined sets of note names for various other languages.
 To use them, include the language specific init file.  For
@@ -884,8 +884,8 @@ Examples: @inputfileref{input/@/regression,completion@/-heads@/.ly}.
 Program reference: @internalsref{Completion_heads_engraver}.
 
 
-@node Multiple notes at once
-@section Multiple notes at once
+@node Polyphony
+@section Polyphony
 
 Polyphony in music refers to having more than one voice occurring in
 a piece of music.  Polyphony in LilyPond refers to having more than
@@ -1394,7 +1394,7 @@ can be specified by setting this property directly.
 
 Accidentals and key signatures often confuse new users, because
 unaltered notes get natural signs depending on the key signature.  For
-more information, see @ref{Accidentals} or @ref{More about pitches}.
+more information, see @ref{Accidentals} or @ref{Accidentals and key signatures}.
 
 @lilypond[quote,ragged-right,verbatim,relative=2,fragment]
 \key g \major
index fdd4d5ca41399ca49c3971f611ae2c82eb398ff6..abff76eef1014176f56582b988a3ec7f7db529a9 100644 (file)
@@ -680,7 +680,7 @@ way is to use the @code{\addlyrics} function.
 @menu
 * Setting simple songs::        
 * Entering lyrics::             
-* Hyphens and extenders::
+* Hyphens and extenders::       
 * The Lyrics context::          
 * Melismata::                   
 * Another way of entering lyrics::  
@@ -808,7 +808,7 @@ between syllables, or use tilde  symbol (@code{~}) to get a lyric tie.
 \relative { c2 e4 g2 e4 }
 \addlyrics { gran- de_a- mi- go }
 \addlyrics { pu- "ro y ho-" nes- to }
-\addlyrics { pu- ro~yho- nes- to }
+\addlyrics { pu- ro~y~ho- nes- to }
 @end lilypond
 
 The lyric ties is implemented with the Unicode character U+203F, so be
@@ -1119,7 +1119,9 @@ There is one tricky aspect: the setting for @code{ignoreMelismata}
 must be set one syllable @emph{before} the non-melismatic syllable
 in the text, as shown here,
 
+@c  FIXME: breaks compile
 @lilypond[verbatim,ragged-right,quote]
+%{
 <<
   \relative \new Voice = "lahlah" {
     \set Staff.autoBeaming = ##f
@@ -1138,6 +1140,7 @@ in the text, as shown here,
     still
   }
 >>
+%}
 @end lilypond
 
 
@@ -1381,12 +1384,11 @@ layout.
 @node More about stanzas
 @subsection More about stanzas
 
+@c what's this doing here?
 @cindex phrasing, in lyrics
 
-
 @cindex stanza number
-@cindex singer's names
-@cindex name of singer
+@subsubsection Adding stanza numbers 
 
 Stanza numbers can be added by setting @code{stanza}, e.g.,
 
@@ -1402,7 +1404,57 @@ Stanza numbers can be added by setting @code{stanza}, e.g.,
 }
 @end lilypond
 
-These numbers are put just before the start of first syllable.
+@noindent
+These numbers are put just before the start of the first syllable.
+
+
+@subsubsection Adding dynamics marks
+
+Stanzas differing in loudness may be indicated by putting a
+dynamics mark before each stanza.  In Lilypond, everthing coming in
+front of a stanza goes into the @code{StanzaNumber} object; dynamics marks
+are no different.  For technical reasons, you have to set the stanza
+outside @code{\lyricmode}:
+
+@lilypond[quote,ragged-right,verbatim]
+text = {
+  \set stanza = \markup { \dynamic "ff" "1. " }
+  \lyricmode {
+    Big bang
+  }
+}
+
+<<
+  \new Voice = "tune" {
+    \time 3/4
+    g'4 c'2
+  }
+\new Lyrics \lyricsto "tune" \text
+>>
+@end lilypond
+
+@cindex singer name
+@cindex name of singer
+@subsubsection Adding singer names
+
+Names of singers can also be added.  They are printed at the start of
+the line, just like instrument names.  They are created by setting
+@code{vocalName}.  A short version may be entered as @code{shortVocalName}.
+
+@lilypond[fragment,ragged-right,quote,verbatim,relative=2]
+\new Voice {
+  \time 3/4 g2 e4 a2 f4 g2.
+} \addlyrics {
+  \set vocalName = "Bert "
+  Hi, my name is Bert.
+} \addlyrics {
+  \set vocalName = "Ernie "
+  Oh, che -- ri, je t'aime
+}
+@end lilypond
+
+
+@subsubsection Printing stanzas at the end 
 
 Sometimes it is appropriate to have one stanza set
 to the music, and the rest added in verse form at
@@ -1448,23 +1500,7 @@ its fleece was white as snow.
 @end lilypond
 
 
-Names of singers can also be added.  They are printed at the start of
-the line, just like instrument names.  They are created by setting
-@code{vocalName}.  A short version may be entered as @code{shortVocalName}.
-
-
-@lilypond[fragment,ragged-right,quote,verbatim,relative=2]
-\new Voice {
-  \time 3/4 g2 e4 a2 f4 g2.
-} \addlyrics {
-  \set vocalName = "Bert "
-  Hi, my name is Bert.
-} \addlyrics {
-  \set vocalName = "Ernie "
-  Oh, che -- ri, je t'aime
-}
-@end lilypond
-
+@subsubsection Printing stanzas at the end in multiple columns 
 
 When a piece of music has many verses, they are often printed in
 multiple columns across the page. An outdented verse number often
index 33a62a44b8d15f7b6b921a150ee76821116cba7b..101772c95d26e26fb6bd44e299f2b3df01a73517 100644 (file)
@@ -787,8 +787,8 @@ are a set of tables showing the chord names, MIDI instruments,
 a list of color names, and the Feta font.
 
 @item
-@emph{@ref{Example templates}}
-provides templates of LilyPond pieces.  Just cut and paste a
+@emph{@ref{Templates}}
+of LilyPond pieces.  Just cut and paste a
 template into a file, add notes, and you're done!
 
 @item
index 3bd4ca5623de61e964933a32c1d4e141207978cb..7e5f04918588b0ece6e36d7d8edad6288f3684a3 100644 (file)
@@ -184,7 +184,7 @@ Appendices
 * Literature list::                Reference works about music notation.
 * Scheme tutorial::                Programming inside LilyPond.
 * Notation manual tables::         Tables and charts.
-* Example templates::              Ready-made templates.
+* Templates::                      Ready-made templates.
 * Cheat sheet::                    Summary of LilyPond syntax.
 * GNU Free Documentation License:: License of this document.
 * LilyPond command index::
index 0a85e749dce08303ba67f09e8b9f8b61e94eed9d..0274641da2e0b1e0f1d2244653c7f27ef3ae4632 100644 (file)
@@ -217,6 +217,11 @@ user manual, @internalsref{\NAME\}
 
 @end macro
 
+@macro moreinfo
+@subheading More information
+
+@end macro
+
 @macro seealso
 @noindent
 @subsubheading See also
index 840ac2ccb9ceef47551b63ea317c8c1f776e4ccf..97d118294baaa59718433ca99bff9bd22ffeb3bb 100644 (file)
@@ -150,10 +150,12 @@ Languages in this order.
 * alto::                        
 * alto clef::                   
 * ambit::                       
+* anacrusis::                   
 * ancient minor scale::         
 * andante::                     
 * appoggiatura::                
 * arpeggio::                    
+* articulation::                
 * ascending interval::          
 * augmented interval::          
 * autograph::                   
@@ -576,6 +578,15 @@ The term ambit (from latin: ambitus, plural: ambitus) denotes a range
 of pitches for a given voice in a part of music.  It may also denote
 the pitch range that a musical instrument is capable of playing.
 
+@node anacrusis
+@section anacrusis
+
+@c  TODO: add more languages for anacrusis
+F: anacrouse
+
+An anacrusis (also known as pickup or upbeat) is an incomplete measure
+of music before a section of music.
+
 @node ancient minor scale
 @section ancient minor scale
 
@@ -701,6 +712,15 @@ FI: arpeggio, murtosointu.
 >>
 @end lilypond
 
+@node articulation
+@section articulation
+
+@c TODO: add languages for articulation.
+Articulation refers to notation which indicates how a note or notes should
+be played.  Slurs, accents, staccato, and legato are all examples of
+articulartion.
+
+
 @node ascending interval
 @section ascending interval
 
index 365cfa9c2d19301b7da03f6ab68acc4354aeac35..f167c6cb2248b80d291d730529a0442d51d3dc28 100644 (file)
@@ -844,7 +844,6 @@ in the @code{\midi@{@}} section.
   \context @{
     \Voice
     \remove "Dynamic_performer"
-    \remove "Span_dynamic_performer"
   @}
 @}
 @end example
index af557788fc89bced9da052e525d55b4955d98325..1dd8222330d718ae29cb41d2a95ca9a61d8fdc43 100644 (file)
@@ -18,6 +18,7 @@ create @code{\score} blocks.
 * Extending the templates::     
 * How LilyPond files work::     
 * Score is a single musical expression::  
+* An orchestral part::          
 @end menu
 
 
@@ -458,3 +459,136 @@ layer starts on the same horizontal position in your
 text editor!
 
 
+
+
+
+
+@node An orchestral part
+@section An orchestral part
+
+In orchestral music, all notes are printed twice.  Once in a part for
+the musicians, and once in a full score for the conductor.  Identifiers can
+be used to avoid double work.  The music is entered once, and stored in
+a variable.  The contents of that variable is then used to generate
+both the part and the full score.
+
+It is convenient to define the notes in a special file.  For example,
+suppose that the file @file{horn-music.ly} contains the following part
+of a horn/@/bassoon duo
+
+@example
+hornNotes = \relative c @{
+  \time 2/4
+  r4 f8 a cis4 f e d
+@}
+@end example
+
+@noindent
+Then, an individual part is made by putting the following in a file
+
+@example
+\include "horn-music.ly"
+\header @{
+  instrument = "Horn in F"
+@}
+
+@{
+ \transpose f c' \hornNotes
+@}
+@end example
+
+The line
+
+@example
+\include "horn-music.ly"
+@end example
+
+@noindent
+substitutes the contents of @file{horn-music.ly} at this position in
+the file, so @code{hornNotes} is defined afterwards.  The command
+@code{\transpose f@tie{}c'} indicates that the argument, being
+@code{\hornNotes}, should be transposed by a fifth upwards.  Sounding
+@samp{f} is denoted by notated @code{c'}, which corresponds with the
+tuning of a normal French Horn in@tie{}F.  The transposition can be seen
+in the following output
+
+@lilypond[quote,ragged-right]
+\transpose f c' \relative c {
+  \time 2/4
+  r4 f8 a cis4 f e d
+}
+@end lilypond
+
+In ensemble pieces, one of the voices often does not play for many
+measures.  This is denoted by a special rest, the multi-measure
+rest.  It is entered with a capital @samp{R} followed by a duration
+(@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
+etc.).  By multiplying the
+duration, longer rests can be constructed.  For example, this rest
+takes 3@tie{}measures in 2/4 time
+
+@example
+R2*3
+@end example
+
+When printing the part, multi-rests
+must be condensed.  This is done by setting a run-time variable
+
+@example
+\set Score.skipBars = ##t
+@end example
+
+@noindent
+This command sets the property @code{skipBars} in the
+@code{Score} context to true (@code{##t}).  Prepending the rest and
+this option to the music above, leads to the following result
+
+@lilypond[quote,ragged-right]
+\transpose f c' \relative c {
+  \time 2/4
+  \set Score.skipBars = ##t
+  R2*3
+  r4 f8 a cis4 f e d
+}
+@end lilypond
+
+
+The score is made by combining all of the music together.  Assuming
+that the other voice is in @code{bassoonNotes} in the file
+@file{bassoon-music.ly}, a score is made with
+
+@example
+\include "bassoon-music.ly"
+\include "horn-music.ly"
+
+<<
+  \new Staff \hornNotes
+  \new Staff \bassoonNotes
+>>
+@end example
+
+@noindent
+leading to
+
+@lilypond[quote,ragged-right]
+\relative c <<
+  \new Staff {
+    \time 2/4 R2*3
+    r4 f8 a cis4 f e d
+  }
+  \new Staff {
+    \clef bass
+    r4 d,8 f | gis4 c | b bes |
+    a8 e f4 | g d | gis f
+  }
+>>
+@end lilypond
+
+More in-depth information on preparing parts and scores can be found
+in the notation manual; see @ref{Orchestral music}.
+
+Setting run-time variables (@q{properties}) is discussed in
+@ref{Changing context properties on the fly}.
+
+
+
index ff4af0cf17153f077c7cf1110e8985767336a29f..5670f9e28b15e641a053f98fbbb5188ef6077ba9 100644 (file)
@@ -378,7 +378,7 @@ cd ~/bin
 Create a file called @code{lilypond} which contains
 
 @example
-exec @var{path/to}/LilyPond.app/Contents/Resources/bin/lilypond "$@"
+exec @var{path/to}/LilyPond.app/Contents/Resources/bin/lilypond "$@@"
 @end example
 
 Create similar files @code{lilypond-book}, @code{convert-ly}, and
@@ -577,6 +577,9 @@ bug by following the directions on
 
 @uref{http://lilypond.org/web/devel/participating/bugs}
 
+Please construct submit @ref{Minimal examples} of bug reports.  We do not
+have the resources to investigate reports which are not as small as possible.
+
 
 @node Error messages
 @section Error messages
@@ -692,12 +695,14 @@ installation instructions.
 @end ifnothtml
 
 
-@item JEdit
+@item LilyPondTool
 
-The @uref{http://@/www@/.jedit@/.org@/,jEdit} editor has a LilyPond plugin.
-This plugin includes a DVI viewer, integrated help and viewing via
-GhostScript.  It can be installed by doing @key{Plugins > Plugin
-Manager}, and selecting @code{LilyTool} from the @key{Install} tab.
+Created as a plugin for the @uref{http://@/www@/.jedit@/.org@/,jEdit} text
+editor, LilyPondTool is the most feature-rich text-based tool for editing
+LilyPond scores.  Its features include a Document Wizard with lyrics
+support to set up documents easier, and embedded PDF viewer with advanced
+point-and-click support.  For screenshots, demos and installation
+instructions, visit @uref{http://lilypondtool@/.organum@/.hu}
 
 @end table
 
index a15df5904575ec5cccfe755ca847f45d73489974..377a74ea1392fb6d13a8cf68799b679ed76f08d5 100644 (file)
@@ -484,7 +484,6 @@ staves inside a system.
 
 @menu
 * Vertical spacing inside a system::  
-* Vertical spacing of piano staves::  
 * Vertical spacing between systems::  
 * Controlling spacing of individual systems::  
 * Two-pass vertical spacing::
@@ -538,53 +537,6 @@ Example files: @inputfileref{input/regression/,page-spacing.ly},
 @inputfileref{input/regression/,alignment-vertical-spacing.ly}.
 
 
-@node Vertical spacing of piano staves
-@subsection Vertical spacing of piano staves
-
-The distance between staves of a @internalsref{PianoStaff} cannot be
-computed during formatting.  Rather, to make cross-staff beaming work
-correctly, that distance has to be fixed beforehand.
-
-The distance of staves in a @code{PianoStaff} is set with the
-@code{forced-distance} property of the
-@internalsref{VerticalAlignment} object, created in
-@internalsref{PianoStaff}.
-
-It can be adjusted as follows
-@example
-\new PianoStaff \with @{
-  \override VerticalAlignment #'forced-distance = #7
-@} @{
-  ...
-@}
-@end example
-
-@noindent
-This would bring the staves together at a distance of 7 staff spaces,
-measured from the center line of each staff.
-
-The difference is demonstrated in the following example,
-@lilypond[quote,verbatim]
-\relative c'' <<
-  \new PianoStaff \with {
-    \override VerticalAlignment #'forced-distance = #7
-  } <<
-    \new Staff { c1 }
-    \new Staff { c }
-  >>
-  \new PianoStaff <<
-    \new Staff { c }
-    \new Staff { c }
-  >>
->>
-@end lilypond
-
-
-@seealso
-
-Example files: @inputfileref{input/regression/,alignment-vertical-spacing.ly}.
-
-
 @node Vertical spacing between systems
 @subsection Vertical spacing between systems
 
index fca2900d655f1b1cc9d53a332f37c7e448032f58..51c27f4f573c702492c11ef2d807cd6f39324ffd 100644 (file)
@@ -7,8 +7,8 @@
     version that you are working on.  See TRANSLATION for details.
 @end ignore
 
-@node Example templates
-@appendix Example templates
+@node Templates
+@appendix Templates
 
 This section of the manual contains templates with the LilyPond score
 already set up for you.  Just add notes, run LilyPond, and enjoy
@@ -366,7 +366,6 @@ pedal = {
     \context {
       \PianoStaff
       \accepts Dynamics
-      \override VerticalAlignment #'forced-distance = #7
     }
   }
 }
index ee0ee87abe533fe4a032da4def61b059b6bfe5e3..d1b5eb467ce88abdbc56e770421370dd92925f59 100644 (file)
@@ -7,6 +7,23 @@
     version that you are working on.  See TRANSLATION for details.
 @end ignore
 
+@ignore
+Tutorial guidelines:
+- unless you have a really good reason, use either
+    @l ilypond[quote,ragged-right,verbatim]
+  or
+    @l ilypond[quote,ragged-right,verbatim,fragment,relative=2]
+  (without spaces)
+  Don't use any other relative=X commands (make it a non-fragment
+  example), and don't use fragment without relative=2.
+- use "aes" and "ees" instead of "as" and "aes".  I know it's not
+  correct Dutch naming, but let's not confuse people with this until
+  we get to the Basic notation chapter.
+@end ignore
+
+
+
+@c   old info that will probably be removed.
 @c TODO:
 @c   * more details about running lilypond; error messages,
 @c     compiling/viewing (emacs?)
@@ -31,97 +48,97 @@ picture in the HTML version of this manual, you will see the exact
 LilyPond input that was used to generate that image.
 Try it on this image
 
-@lilypond[fragment,quote,ragged-right,relative=2]
-c-\markup { \bold \huge { Click here.  } }
+@c no verbatim here
+@lilypond[quote,ragged-right]
+\relative c'' {
+  c-\markup { \bold \huge { Click here.  } }
+}
 @end lilypond
-@end ifhtml
 
-By cutting and pasting the full input into a test file, you have a
+By cutting and pasting everything in the @qq{ly snippet} section, you have a
 starting template for experiments.  If you like learning in this way,
-you will probably want to print out or bookmark
-@ifhtml
-the
-@end ifhtml
+you will probably want to print out or bookmark the
 @ref{Cheat sheet}, which is a table listing of the most common
 commands for quick reference.
+@end ifhtml
 
 @menu
 * First steps::                 
-* Second steps::                
-* More about pitches::          
-* Entering ties::               
-* Automatic and manual beams::  
-* Octave entry::                
-* Music expressions explained::  
-* More staves::                 
-* Adding articulation marks to notes::  
-* Combining notes into chords::  
-* Advanced rhythmic commands::  
-* Commenting input files::      
-* Printing lyrics::             
-* A lead sheet::                
-* Adding titles::               
-* Single staff polyphony::      
-* Piano staves::                
-* Organizing larger pieces::    
-* An orchestral part::          
-* After the tutorial::          
+* Single staff notation::       
+* Multiple notes at once::      
+* Songs::                       
+* Final touches::               
 @end menu
 
 
 @node First steps
 @section First steps
 
-The first example demonstrates how to enter the most elementary piece
-of music, a @rglos{scale}.  A @rglos{note} can be entered by typing
-its name, from @samp{a} through @samp{g}.  So, if you enter
+This section gives a basic introduction to working with LilyPond.
+
+@menu
+* Compiling a file::            
+* Simple notation::             
+* Working on text files::       
+* How to read the tutorial::    
+@end menu
+
+
+@node Compiling a file
+@subsection Compiling a file
+
+The first example demonstrates how to start working with LilyPond.  To
+create sheet music, we write a text file that specifies the
+notation.  For example, if we write
 
 @example
 @{
-c' d' e' f' g' a' b' c''
+  c' e' g' e'
 @}
 @end example
 
 @noindent
 the result looks like this
 
-@lilypond[quote]
+@c  in this case we don't want verbatim
+@lilypond[quote,ragged-right]
 {
-c' d' e' f' g' a' b' c''
+  c' e' g' e'
 }
 @end lilypond
 
-@emph{Warning:} Every piece of LilyPond input needs to have @{curly
-braces@} placed around the input.  The braces should be also be
+@strong{Warning:} Every piece of LilyPond input needs to have @strong{@{ curly
+braces @}} placed around the input.  The braces should also be
 surrounded by a space unless they are at the beginning or end of a
-line to avoid ambiguities.  These may be omitted in examples in this
+line to avoid ambiguities.  These may be omitted in some examples in this
 manual, but don't forget them in your own music!
 
 @cindex Case sensitive
-In addition, LilyPond input is case sensitive.  @code{ @{ c d e @} } is
-valid input; @code{ @{ C D E @} } will produce an error message.
-
+In addition, LilyPond input is @strong{case sensitive}.  @code{ @{ c d e @} }
+is valid input; @code{ @{ C D E @} } will produce an error message.
 
+@sp 1
 
-@unnumberedsubsec Entering music and viewing output
+@subheading Entering music and viewing output
 
 In this section we will explain what commands to run
 and how to view or print the output.
 
-@unnumberedsubsubsec MacOS X
+@subsubheading MacOS X
 
 If you double click LilyPond.app, it will open with an example
 file. Save it, for example, to @file{test.ly} on your Desktop, and
 then process it with the menu command @samp{Compile > Typeset File}.
 The resulting PDF file will be displayed on your screen.
 
-Be warned that the first time you ever run lilypond will take a minute
-or two, because all of the system fonts have to be analyzed first.
+Be warned that the first time you ever run LilyPond, it will take a minute
+or two because all of the system fonts have to be analyzed first.
 
 For future use of LilyPond, you should begin by selecting "New"
-or "Open".
+or "Open".  You must save your file before typesetting it.  If any errors
+occur in processing, please see the log window.
 
-@unnumberedsubsubsec Windows
+@subsubheading Windows
 
 On Windows, start up a text-editor@footnote{Any simple or
 programmer-oriented editor with UTF-8 support will do, for example
@@ -129,26 +146,45 @@ Notepad.  Do not use a word processor, since these insert formatting
 codes that will confuse LilyPond.} and enter
 
 @verbatim
-{ c' e' g' c'' }
+{
+  c' e' g' e'
+}
 @end verbatim
 
 Save it on the desktop as @file{test.ly} and make sure that it is not
 called @file{test.ly.TXT}.  Double clicking @file{test.ly} will process
-the file and show the resulting PDF file.
+the file and show the resulting PDF file.  To edit an existing
+@file{.ly} file, right-click on it and select @qq{Edit source}.
 
+If you double-click in the LilyPond icon on the Desktop, it will open
+a simple text editor with an example file. Save it, for example, to
+@file{test.ly} on your Desktop, and then double-click on the file to
+process it.  After some seconds, you will get a file @file{test.pdf}
+on your desktop.  Double-click on this PDF file to view the typeset
+score.  An alternative method to process the @file{test.ly} file
+is to drag and drop it onto the LilyPond icon using your mouse pointer.
 
-@unnumberedsubsubsec Unix
+Double-clicking the file does not only result in a PDF file, but also
+produces a @file{.log} file that contains some information on what LilyPond
+has done to the file.  If any errors occur, please examine this file.
+
+
+@subsubheading Unix
 
 Begin by opening a terminal window and starting a text editor.  For
 example, you could open an xterm and execute
 @code{joe}@footnote{There are macro files for VIM addicts, and there
 is a @code{LilyPond-mode} for Emacs addicts.  If they have not been
-installed already, refer to the file @file{INSTALL.txt}.}.  In your
+installed already, refer to the file @file{INSTALL.txt}.  The
+easiest editing environment is @file{LilyPondTool}.  See
+@ref{Editor support} for more information.}.  In your
 text editor, enter the following input and save the file as
 @file{test.ly}
 
 @verbatim
-{ c' e' g' c'' }
+{
+  c' e' g' e'
+}
 @end verbatim
 
 @noindent
@@ -179,198 +215,381 @@ Converting to `test.pdf'...
 @noindent
 The result is the file @file{test.pdf} which you can print or view
 with the standard facilities of your operating system.@footnote{If
-your system does not have any tools installed, you can try
+your system does not have any such tools installed, you can try
 @uref{http://@/www@/.cs@/.wisc@/.edu/@/~ghost/,Ghostscript}, a freely
 available package for viewing and printing PDF and PostScript files.}
 
 
-@node Second steps
-@section Second steps
+@node Simple notation
+@subsection Simple notation
 
-@emph{Remember:} Every piece of LilyPond input needs to have @{curly
-braces@} placed around the input.  The braces should be surrounded by
-a space unless they are at the beginning or end of a line to avoid
-ambiguities.  For the rest of this manual, most examples will omit
-these braces, but don't forget them in your own music!
+LilyPond will add some notation elements automatically.  In the next
+example, we have only specified four pitches, but LilyPond has
+added a clef, time signature, and rhythms.
 
-@c will be removed once the tutorial either explains \relative or
-@c examples are fixed so they don't use it.  -gp
-In addition, many examples use @code{relative} mode.  This is explained
-in @ref{Octave entry}; for now simply be aware that some examples
-should be placed inside @code{\relative @{ @emph{...music...} @}}.
-Many example have also been compressed horizontally to save
-space, using @code{\paper @{ ragged-right = ##t @}}.
+@lilypond[quote,ragged-right,verbatim]
+{
+  c' e' g' e'
+}
+@end lilypond
 
-@cindex Case sensitive
-Finally, LilyPond input is case sensitive.  @code{ @{ c d e @} } is
-valid input; @code{ @{ C D E @} } will produce an error message.
+@noindent
+This behavior may be altered, but in most cases these automatic values
+are useful.
 
-@c  End of latest re-write.  Since I have no life, I may do more
-@c  work on this, but I'd really like to have a Doc Helper take
-@c  over this task.  -gp
 
+@subheading Pitches
 
-The @rglos{duration} of a note is specified by a number after the note
-name.  @samp{1} for a @rglos{whole note}, @samp{2} for a @rglos{half note},
-@samp{4} for a @rglos{quarter note} and so on
+The easiest way to enter notes is by using @code{\relative} mode.  In
+this mode, the @rglos{interval} between the previous note and the
+current note is assumed to be within a @rglos{fourth}.  We begin by
+entering the most elementary piece of music, a @rglos{scale}.
 
-@example
-a1 a2 a4 a16 a32
-@end example
+@lilypond[quote,ragged-right,verbatim]
+\relative c' {
+  c d e f
+  g a b c
+}
+@end lilypond
+
+The initial note is @rglos{middle C}.  Each successive note
+is within a fourth of the previous note -- in other words, the first
+@samp{c} is the closest C to middle C.  This is followed by the closest
+D to the previous note.  We can create melodies which have larger intervals:
 
-@lilypond[fragment,quote,notime,relative=2]
-\set Staff.autoBeaming = ##f
-{ a1 a2 a4 a16 a32 s16_" " }
+@lilypond[quote,ragged-right,verbatim]
+\relative c' {
+  d f a g
+  c b f d
+}
 @end lilypond
 
-If you do not specify a duration, the duration last entered is used
-for the next notes.  The duration of the first note in input defaults
-to a quarter
+@noindent
+As you may notice, this example does not start on middle C.  The first
+note -- the @samp{d} -- is the closest D to middle C.
 
-@example
-a a8 a a2 a
-@end example
+To add intervals that are larger than a fourth, we can raise the octave
+by adding a single quote @code{'} (or apostrophe) to the note name.  We can
+lower the octave by adding a comma @code{,} to the note name.
 
-@lilypond[fragment,quote,notime,relative=2]
-{ a a8 a a2 a s16_" " }
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  a a, c' f,
+  g g'' a,, f'
+}
 @end lilypond
 
+@noindent
+To change a note by two (or more!) octaves, we use multiple @code{''} or
+@code{,,} -- but be careful that you use two single quotes @code{''} and
+not one double quote @code{"}@tie{}!  The initial value in
+@code{\relative c'} may also be modified like this.
 
-A @rglos{rest} is entered just like a note, but with the name @samp{r}
 
-@example
-r2 r4 r8 r16
-@end example
+@subheading Durations (rhythms)
+
+The @rglos{duration} of a note is specified by a number after the note
+name.  @samp{1} for a @rglos{whole note}, @samp{2} for a @rglos{half note},
+@samp{4} for a @rglos{quarter note} and so on.  Beams are added
+automatically.
 
-@lilypond[fragment,quote,notime]
-r2 r4 r8 r16 s16_" "
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  a1
+  a2 a4 a8 a
+  a16 a a a a32 a a a a64 a a a a a a a a2
+}
 @end lilypond
 
-Add a dot @samp{.} after the duration to get a @rglos{dotted note}
+@noindent
+If you do not specify a duration, the previous duration is used
+for the next note.  The duration of the first note defaults to a quarter.
 
-@example
-a2. a4 a8. a16
-@end example
+To create @rglos{dotted notes}, add a dot @samp{.} to the duration number.
 
-@lilypond[fragment,quote,notime,relative=1]
-{ a2. a4 a8. a16 s16_" " }
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  a a a4. a8
+  a8. a16 a a8. a8 a4.
+}
 @end lilypond
 
-The (or @rglos{time signature}) can be set with the @code{\time}
-command
 
-@example
-\time 3/4
-\time 6/8
-\time 4/4
-@end example
+@subheading Rests
+
+A @rglos{rest} is entered just like a note with the name @samp{r}:
 
-@c A clef here may lead to confusion, remove it.
-@lilypond[fragment,quote]
-\override Staff.Clef #'transparent = ##t
-\time 3/4
-s4_" "
-\time 6/8
-s4_" "
-\time 4/4
-s16_" "
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  a r r2
+  r8 a r4 r4. r8
+}
 @end lilypond
 
-The @rglos{clef} can be set using the @code{\clef} command
 
-@example
-\clef treble
-\clef bass
-\clef alto
-\clef tenor
-@end example
+@subheading Time signature
+
+The @rglos{time signature}) can be set with the @code{\time} command:
 
-@lilypond[fragment,quote,notime]
-\clef treble
-s4_" "
-\clef bass
-s4_" "
-\clef alto
-s4_" "
-\clef tenor
-s16_" "
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  \time 3/4
+  a4 a a
+  \time 6/8
+  a4. a
+  \time 4/4
+  a4 a a a
+}
 @end lilypond
 
-Remember to enclose the notes and commands in curly braces
-@code{@{@tie{}@dots{}@tie{}@}} to convert it to printable output.
 
-@lilypond[fragment,quote,noindent,verbatim]
-\time 3/4
-\clef bass
-c2 e4 g2.
-f4 e d c2 r4
+@subheading Clef
+
+The @rglos{clef} can be set using the @code{\clef} command:
+
+@lilypond[quote,ragged-right,verbatim]
+\relative c' {
+  \clef treble
+  c1
+  \clef alto
+       c1
+  \clef tenor
+  c1
+  \clef bass
+  c1
+}
 @end lilypond
 
-For more information on
 
+@subheading All together
+
+Here is a small example showing all these elements together:
+
+@lilypond[quote,ragged-right,verbatim]
+\relative c, {
+  \time 3/4
+  \clef bass
+  c2 e8 c' g'2.
+  f4 e d c4 c, r4
+}
+@end lilypond
+
+@moreinfo
 @quotation
 @table @asis
 @item Entering pitches and durations
-see
-@ref{Pitches}, and @ref{Durations}.
-@item Clefs
-see @ref{Clef}.
+see @ref{Pitches} and @ref{Durations}.
 @item Rests
 see @ref{Rests}.
 @item Time signatures and other timing commands
 see @ref{Time signature}.
+@item Clefs
+see @ref{Clef}.
+@end table
+@end quotation
+
+
+@node Working on text files
+@subsection Working on text files
+
+LilyPond input files are treated like files in most programming languages:
+they are case sensitive, white-space insensitive, expressions are
+formed with curly braces @{ @}, and comments are denoted with @code{%} or
+@code{%@{ .. %@}}.
+
+If the previous sentence sounds like nonsense, don't worry!  We'll explain
+what all these terms mean:
+
+@itemize
+
+@cindex Case sensitive
+@item @strong{Case sensitive}:
+it matters whether you enter a letter
+in lower case (i.e. @code{a, b, s, t}) or upper case (i.e.
+@code{A, B, S, T}).  Notes are lower case: @code{ @{ c d e @} }
+is valid input; @code{ @{ C D E @} } will produce an error message.
+
+@item @strong{Whitespace insensitive}:
+it does not matter how many
+spaces (or new lines) you add.  @code{ @{ c d e @}} means the same thing
+as @code{ @{ c @ @ @ @ @  d e @} } and
+@example
+          @{
+c                        d
+  e @}
+@end example
+
+@noindent
+Of course, the previous example is hard to read.  A good rule of thumb
+is to indent code blocks with either a tab or two spaces:
+@example
+@{
+  c d e
+@}
+@end example
+
+@item @strong{Expressions:}
+Every piece of LilyPond input needs to have
+@strong{@{ curly braces @}} placed around the input.  These braces tell
+LilyPond that the input is a single music expression, just like
+parenthesis @samp{()} in mathematics.  The braces should
+be surrounded by a space unless they are at the beginning or end of a
+line to avoid ambiguities.
+
+A function (such as @code{\relative @{ @}} ) also counts as a single
+music expression.
+
+@cindex comments
+@cindex line comment
+@cindex block comment
+@item @strong{Comments}:
+A comment is a remark for the human reader of the music input; it is
+ignored while parsing, so it has no effect on the printed output.
+There are two types of comments.  The percent symbol @samp{%}
+introduces a line comment; anything after @samp{%} on that line is
+ignored.  A block comment marks a whole section of music
+input as a comment.  Anything that is enclosed in @code{%@{} and @code{%@}} is
+ignored.  The following fragment shows possible uses for comments
+
+@example
+% notes for twinkle twinkle follow
+  c4 c g' g a a g2
+
+%@{
+    This line, and the notes below
+    are ignored, since they are in a
+    block comment.
+
+    g g f f e e d d c2
+%@}
+@end example
+
+@end itemize
+
+There are more tips for constructing input files in
+@ref{Suggestions for writing LilyPond files}.
+
+
+@node How to read the tutorial
+@subsection How to read the tutorial
+
+As we saw in @ref{Working on text files}, LilyPond input must be
+surrounded by @{ @} marks or a @code{\relative c'' @{ ... @}}.  For the
+rest of this manual, most examples will omit this.
+
+If you are reading the HTML documentation and wish to see the exact
+exact LilyPond code that was used to create the example, simply click
+on the picture.  If you are not reading the HTML version, you could
+copy and paste the displayed input, but you @strong{must} add the
+@code{\relative c'' @{ @}} like this:
+
+@example
+\relative c'' @{
+  ... example goes here...
+@}
+@end example
+
+Why omit the braces?  Most examples
+in this manual can be inserted into the middle of a longer piece of
+music.  For these examples, it does not make sense to add
+@code{\relative c'' @{ @}} -- you should not place a @code{\relative}
+inside another @code{\relative}, so you would not be able to copy
+a small documentation example and paste it inside a longer piece
+of your own.
+
+
+@node Single staff notation
+@section Single staff notation
+
+This section introduces common notation that is used for one voice
+on one staff.
+
+@menu
+* Relative note names::         
+* Accidentals and key signatures::  
+* Ties and slurs::              
+* Articulation and dynamics::   
+* Automatic and manual beams::  
+* Advanced rhythmic commands::  
+@end menu
+
+
+@node Relative note names
+@subsection Relative note names
+
+As we saw in @ref{Simple notation}, LilyPond calculates the pitch of
+each note relative to the previous one@footnote{There is another mode of
+entering pitches, @ref{Absolute note names}, but in practice relative
+mode is much easier and safer to use.}.  If no extra octave marks
+(@code{'} and @code{,}) are added, it assumes that each pitch is within
+a fourth of the previous note.
+
+LilyPond examines pitches based on the note names -- in other words,
+an augmented fourth is @emph{not} the same as a diminished fifth.  If we
+begin at a C, then an F-sharp will be placed a higher than the C, while
+a G-flat will be placed lower than the C.
+
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+c2 fis
+c2 ges
+@end lilypond
+
+@moreinfo
+@quotation
+@table @asis
+@item Relative octaves
+see @ref{Relative octaves}.
+@item Octave check
+see @ref{Octave check}.
 @end table
 @end quotation
 
 
-@node More about pitches
-@section More about pitches
+
+@node Accidentals and key signatures
+@subsection Accidentals and key signatures
+
+@subheading Accidentals
 
 A @rglos{sharp} pitch is made by adding @samp{is} to
-the name, a @rglos{flat} pitch by adding @samp{es}.  As
+the name, and a @rglos{flat} pitch by adding @samp{es}.  As
 you might expect, a @rglos{double sharp} or @rglos{double flat} is
 made by adding @samp{isis} or @samp{eses}@footnote{This syntax
 derived from note naming conventions in Nordic and Germanic languages,
-like German and Dutch.}
-
-@example
-cis1 ees fisis aeses
-@end example
+like German and Dutch.  To use other names for accidentals, see
+@ref{Note names in other languages}.}
 
-@lilypond[fragment,quote,notime]
-\set Score.timing = ##f
-\transpose c c' { cis1 ees fisis aeses s16_" " }
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+cis1 ees fisis, aeses
 @end lilypond
 
 @cindex key signature, setting
-The key signature is set with the command @code{\key}, followed by
-a pitch and @code{\major} or @code{\minor}
+@subheading Key signatures
 
-@example
-\key d \major
-g1
-\key c \minor
-g
-@end example
+The key signature is set with the command @code{\key} followed by
+a pitch and @code{\major} or @code{\minor}.
 
-@lilypond[fragment,quote,notime,fragment]
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
 \key d \major
-g'1
+a1
 \key c \minor
-g'
+a
 @end lilypond
 
-@noindent
-Key signatures together with the pitches (including alterations) are
-used to determine when to print accidentals.  This is a
+@sp 1
+
+@subheading Warning: key signatures and pitches
+
+To determine whether to print an accidental, LilyPond examines the
+pitches and the key signature.  The key signature only effects
+the @emph{printed} accidentals, not the actual pitches!  This is a
 feature that often causes confusion to newcomers, so let us explain it
 in more detail.
 
-
 LilyPond makes a sharp distinction between musical content and
 layout.  The alteration (flat, natural or sharp) of a note is part of
 the pitch, and is therefore musical content.  Whether an accidental (a
-flat, natural or sharp @emph{sign}) is printed in front of the
+@emph{printed} flat, natural or sharp sign) is printed in front of the
 corresponding note is a question of layout.  Layout is something that
 follows rules, so accidentals are printed automatically according to
 those rules.  The pitches in your music are works of art, so they will
@@ -378,246 +597,359 @@ not be added automatically, and you must enter what you want to hear.
 
 In this example
 
-@lilypond[quote,notime,fragment]
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
 \key d \major
-d' cis' fis'
+d cis fis
 @end lilypond
 
 @noindent
-no note has an explicit accidental, but you still must enter
-
-@example
-\key d \major
-d cis fis
-@end example
+No note has a printed accidental, but you must still add the @samp{is} to
+@code{cis} and @code{fis}.
 
-@noindent
-The code @samp{d} does not mean @qq{print a black dot just below the
-staff.}  Rather, it means: @qq{a note with pitch D-natural.}  In the key
-of A-flat major, it does get an accidental
+The code @samp{e} does not mean @qq{print a black dot just below the
+first line of the staff.}  Rather, it means: @qq{there is a note with
+pitch E-natural.}  In the key of A-flat major, it @emph{does} get an
+accidental:
 
-@lilypond[quote,notime,fragment,relative=1,verbatim]
-\key as \major
-d
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+\key aes \major
+e
 @end lilypond
 
 Adding all alterations explicitly might require a little more effort
 when typing, but the advantage is that transposing is easier, and
 accidentals can be printed according to different conventions.  See
-@ref{Automatic accidentals}, for some examples how accidentals can be printed
+@ref{Automatic accidentals} for some examples how accidentals can be printed
 according to different rules.
 
-
-For more information on
-
+@moreinfo
 @quotation
 @table @asis
 @item Accidentals
-see @ref{Automatic accidentals}.
-
+see @ref{Accidentals} and @ref{Automatic accidentals}.
 @item Key signature
 see @ref{Key signature}.
 @end table
 @end quotation
 
-@node Entering ties
-@section Entering ties
 
-@cindex tie
+@node Ties and slurs
+@subsection Ties and slurs
+
+@cindex ties
+@subheading Ties
 A @rglos{tie} is created by appending a tilde @samp{~} to the first
 note being tied
 
-@lilypond[quote,notime,fragment,verbatim,relative=3]
-g4~ g a2~ a4
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+g4~ g c2~
+c4 ~ c8 a8 ~ a2
 @end lilypond
 
-For more information on Ties see @ref{Ties}.
-
+@cindex slurs
+@subheading Slurs
 
+A @rglos{slur} is a curve drawn across many notes.  The starting note
+and ending note are marked with @samp{(} and @samp{)} respectively.
 
-@node Automatic and manual beams
-@section Automatic and manual beams
-
-@cindex beams, by hand
-All @rglos{beam}s are drawn automatically
-
-@lilypond[quote,fragment,relative=2,verbatim]
-a8 ais d es r d
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+d4( c16) cis( d e c cis d) e( d4)
 @end lilypond
 
-@noindent
-If you do not like where beams are put, they can be entered by
-hand.  Mark the first note to be beamed with @samp{[} and the last one
-with @samp{]}.
+@cindex slurs, phrasing
+@cindex phrasing slurs
+@subheading Phrasing slurs
 
-@lilypond[quote,fragment,relative=2,verbatim]
-a8[ ais] d[ es r d]
+@cindex phrasing slurs
+Slurs to indicate longer phrasing can be entered with @code{\(} and
+@code{\)}.  You can have both legato slurs and phrasing slurs at the
+same time, but you cannot have simultaneous slurs or simultaneous
+phrasing slurs.
+
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+a8(\( ais b c) cis2 b'2 a4 cis,\)
 @end lilypond
 
-For more information on beams, see @ref{Manual beams}.
+@sp 1
 
+@cindex slurs versus ties
+@subheading Warnings: slurs vs. ties
 
-Here are key signatures, accidentals and ties in action
+A slur looks like a @rglos{tie}, but it has a different meaning.  A
+tie simply makes the first note longer, and can only be used on
+pairs of notes with the same pitch.  Slurs indicate the articulations
+of notes, and can be used on larger groups of notes.  Slurs and ties
+can be nested.
 
-@lilypond[fragment,quote,noindent,line-width=50\staff-space,verbatim]
-\relative c'' {
-  \time 4/4
-  \key g \minor
-  \clef treble
-  r4 r8 a8 gis4 b
-  a8 d4.~ d e,8
-  fis4 fis8 fis8 eis4 a8 gis~
-  gis2 r2
-}
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+c2~( c8 fis fis4 ~ fis2 g2)
 @end lilypond
 
-@cindex accidentals
-
-
-@noindent
-There are some interesting points to note in this example.  Bar lines
-and beams are drawn automatically.  Line breaks are calculated
-automatically; it does not matter where the line breaks are in the
-source file.  Finally, the order in which time, key, and clef changes
-are entered is not relevant: in the printout, these are ordered
-according to standard notation conventions.
+@moreinfo
+@quotation
+@table @asis
+@item Ties
+see @ref{Ties}.
+@item Slurs
+see @ref{Slurs}.
+@item Phrasing slurs
+see @ref{Phrasing slurs}.
+@end table
+@end quotation
 
 
+@node Articulation and dynamics
+@subsection Articulation and dynamics
 
-@node Octave entry
-@section Octave entry
+@cindex articulation
+@cindex accents
+@cindex staccato
+@subheading Articulations
 
+Common @rglos{articulations} can be added to a note using a dash @samp{-}
+and a single character:
 
-@c Tim wants to move this quotes example just before the: quotes-do not-work
-@c score, but we'd need to remove quotes from the other two (key and
-@c tie) examples...
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+c-. c-- c-> c-^ c-+ c-_
+@end lilypond
 
-@c better to have this just before the `octaves are bad' snipped
-@c but we'd need to remove the ', from \key and tie
-To raise a note by an octave, add a high quote @samp{'} (apostrophe) to
-the note name, to lower a note one octave, add a @q{low quote} @samp{,}
-(comma).  Middle C is @code{c'}
+@cindex fingering
+@subheading Fingerings
+Similarly, fingering indications can be added to a note using a dash
+(@samp{-}) and the digit to be printed:
 
-@lilypond[quote,notime,fragment,verbatim]
-c'4 c'' c''' \clef bass c c,
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+c-3 e-5 b-2 a-1
 @end lilypond
 
-An example of the use of quotes is in the following Mozart fragment
+Articulations and fingerings are usually placed automatically, but you
+can specify a direction using @samp{^} (up) or @samp{_} (down).  You can
+also use multiple articulations on the same note.  However, in most cases
+it is best to let LilyPond determine the articulation directions.
 
-@lilypond[quote,ragged-right,fragment,verbatim]
-\key a \major
-\time 6/8
-cis''8. d''16 cis''8 e''4 e''8
-b'8. cis''16 b'8 d''4 d''8
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+c_-^1 d^. f^4_2-> e^-_+
 @end lilypond
 
-@noindent
-This example shows that music in a high register needs lots of quotes.
-This makes the input less readable, and it is a source of errors.  The
-solution is to use @q{relative octave} mode.   This is the
-most convenient way to copy existing music.
-
-In relative mode, a note without octavation quotes (i.e., the @samp{'}
-or @samp{,} after a note) is chosen so that it is closest to the
-previous one.  For example, @samp{c f} goes up while @samp{c g} goes
-down.
+@subheading Dynamics
+Dynamic signs are made by adding the markings (with a backslash) to
+the note
 
-To use relative mode, add @code{\relative} before the piece of
-music.  The first note is taken relative to the middle C
-@c no , for this sentence
-(i.e., @code{c'})
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+c\ff c\mf c\p c\pp
+@end lilypond
 
+@cindex dynamics
+@cindex decrescendo
+@cindex crescendo
 
+Crescendi and decrescendi are started with the commands @code{\<} and
+@code{\>}.  An ending dynamic, for example @code{\f}, will finish the
+(de)crescendo, or the command @code{\!} can be used
 
-@lilypond[quote,notime,fragment,verbatim]
-\relative {
-  c' f c g c
-}
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+c2\< c2\ff\> c2 c2\!
 @end lilypond
 
-
-Since most music has small intervals, pieces can be written almost
-without octavation quotes in relative mode.  The previous example is
-entered as
-
-@lilypond[quote,ragged-right,verbatim]
-\relative {
-  \key a \major
-  \time 6/8
-  cis'8. d16 cis8 e4 e8
-  b8. cis16 b8 d4 d8
-}
+@moreinfo
+@quotation
+@table @asis
+@item Articulations
+see @ref{Articulations}.
+@item Fingering
+see @ref{Fingering instructions}.
+@item Dynamics
+see @ref{Dynamics}.
+@end table
+@end quotation
+
+
+@node Automatic and manual beams
+@subsection Automatic and manual beams
+
+@cindex beams, by hand
+All @rglos{beam}s are drawn automatically:
+
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+a8 ais d ees r d c16 b a8
 @end lilypond
 
-@c needed better, maybe even redundant explanation
-@c   added another example below.
-@c grappig: Pa vond het heel logies, en slim toen-i eenmaal begreep.
-@c in eerste instantie drong het `relative' niet door zonder extra uitleg.
-Larger intervals are made by adding octavation quotes.
+@noindent
+If you do not like the automatic beams, they may be overridden
+manually.  Mark the first note to be beamed with @samp{[} and the last one
+with @samp{]}.
 
-@lilypond[quote,notime,verbatim,fragment]
-\relative c {
-  c'' f, f c' c g' c,
-}
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+a8[ ais] d[ ees r d] a b
 @end lilypond
 
-In summary, quotes or commas no longer determine the absolute height
-of a note in @code{\relative} mode.  Rather, the height of a note is
-relative to the previous one, and changing the octave of a single note
-shifts all following notes an octave up or down.
+@moreinfo
+@quotation
+@table @asis
+@item Automatic beams
+see @ref{Automatic beams}.
+@item Manual beams
+see @ref{Manual beams}.
+@end table
+@end quotation
+
+
+@node Advanced rhythmic commands
+@subsection Advanced rhythmic commands
 
-For more information on relative octaves see @ref{Relative octaves},
-and @ref{Octave check}.
+@cindex pickup
+@cindex anacruse
+@cindex partial measure
+@subheading Partial measure
 
+A pickup (or @rglos{anacrusis}) is entered with the keyword
+@code{\partial}.  It is followed by a duration: @code{\partial 4} is
+a quarter note pickup and @code{\partial 8} an eighth note.
 
-@node Music expressions explained
-@section Music expressions explained
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+\partial 8
+f8 c2 d
+@end lilypond
+
+@cindex tuplets
+@cindex triplets
+@subheading Tuplets
+
+Tuplets are made with the @code{\times} keyword.  It takes two
+arguments: a fraction and a piece of music.  The duration of the piece
+of music is multiplied by the fraction.  Triplets make notes occupy
+2/3 of their notated duration, so a triplet has 2/3 as its fraction
+
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+\times 2/3 { f8 g a }
+\times 2/3 { c r c }
+\times 2/3 { f,8 g16 a g a }
+\times 2/3 { d4 a8 }
+@end lilypond
+
+@cindex grace notes
+@cindex acciaccatura
+@cindex appoggiatura
+@subheading Grace notes
+
+Grace notes are created with the @code{\grace} command, although they
+can also be created by prefixing a music expression with the
+keyword @code{\appoggiatura} or @code{\acciaccatura}
+
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+c2 \grace { a32 b} c2
+c2 \appoggiatura b16 c2
+c2 \acciaccatura b16 c2
+@end lilypond
+
+@moreinfo
+@quotation
+@table @asis
+@item Grace notes
+see @ref{Grace notes},
+@item Tuplets
+see @ref{Tuplets},
+@item Pickups
+see @ref{Partial measures}.
+@end table
+@end quotation
+
+
+@node Multiple notes at once
+@section Multiple notes at once
+
+This section introduces having more than one note at the same time:
+multiple instruments, multiple staves for a single instrument (i.e. piano),
+and chords.
+
+Polyphony in music refers to having more than one voice occurring in
+a piece of music.  Polyphony in LilyPond refers to having more than
+one voice on the same staff.
+
+@menu
+* Music expressions explained::  
+* Multiple staves::             
+* Piano staves::                
+* Single staff polyphony::      
+* Combining notes into chords::  
+@end menu
 
 
-In input files, music is represent by so-called @emph{music
-expression}s.  We have already seen some in the previous examples;
-a single note is a music expression
+@node Music expressions explained
+@subsection Music expressions explained
+
+In LilyPond input files, music is represented by @emph{music
+expressions}.  A single note is a music expression, although it is not
+valid input all on its own.
 
-@lilypond[fragment,quote,verbatim,relative=3]
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
 a4
 @end lilypond
 
-Enclosing a group of notes in braces creates a new music
-expression
+Enclosing a group of notes in braces creates a new music expression:
 
-@lilypond[fragment,quote,verbatim,relative=3]
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
 { a4 g4 }
 @end lilypond
 
-Putting a bunch of music expressions (e.g., notes) in braces, means that
-they should be played in sequence.  The result again is a music
-expression, which can be grouped with other expressions sequentially.
-Here, the expression from the previous example is combined with two
-notes
+Putting a group of music expressions (e.g. notes) in braces means that
+they are in sequence (i.e. each one follows the previous one).  The result
+is another music expression:
 
-@lilypond[fragment,quote,verbatim,relative=3]
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
 { { a4 g } f g }
 @end lilypond
 
-This technique is useful for non-monophonic music.  To enter music
-with more voices or more staves, we also combine expressions in
-parallel.  Two voices that should play at the same time, are entered
-as a simultaneous combination of two sequences.  A @q{simultaneous}
-music expression is formed by enclosing expressions in @code{<<} and
-@code{>>}.  In the following example, three sequences (all containing
-two separate notes) are combined simultaneously
+@subheading Simultaneous music expressions: multiple staves
 
-@lilypond[fragment,quote,verbatim,relative=3]
-<<
-  { a4 g }
-  { f e }
-  { d b }
->>
+This technique is useful for polyphonic music.  To enter music
+with more voices or more staves, we combine expressions in
+parallel.  To indicate that two voices should play at the same time,
+simply enter a simultaneous combination of music expressions.  A
+@q{simultaneous} music expression is formed by enclosing expressions inside
+@code{<<} and @code{>>}.  In the following example, three sequences (all
+containing two separate notes) are combined simultaneously:
+
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  <<
+    { a4 g }
+    { f e }
+    { d b }
+  >>
+}
+@end lilypond
+
+Note that we have indented each level of the input with a different
+amount of space.  LilyPond does not care how much (or little) space there
+is at the beginning of a line, but indenting LilyPond code like this makes
+it much easier for humans to read.
+
+@strong{Warning}: each note is relative to the
+previous note in the input, not relative to the @code{c''} in the
+initial @code{\relative} command.
+
+
+@subheading Simultaneous music expressions: single staff
+
+To determine the number of staves in a piece, LilyPond looks at the first
+expression.  If it is a single note, there is one staff; if there is a
+simultaneous expression, there is more than one staff.
+
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  c2 <<c e>>
+  << { e f } { c <<b d>> } >>
+}
 @end lilypond
 
+@cindex expression
+@cindex music expression
+@subheading Analogy: mathematical expressions
+
 This mechanism is similar to mathematical
 formulas: a big formula is created by composing small formulas.  Such
-formulas are called expressions, and their definition is recursive, so
+formulas are called expressions, and their definition is recursive so
 you can make arbitrarily complex and large expressions.  For example,
 
 @example
@@ -630,8 +962,6 @@ you can make arbitrarily complex and large expressions.  For example,
 ((1 + 2) * 3) / (4 * 5)
 @end example
 
-@cindex expression
-@cindex music expression
 This is a sequence of expressions, where each expression is contained
 in the next (larger) one.  The simplest expressions are numbers, and larger
 ones are made by combining expressions with operators (like @samp{+},
@@ -639,66 +969,37 @@ ones are made by combining expressions with operators (like @samp{+},
 music expressions can be nested arbitrarily deep, which is necessary
 for complex music like polyphonic scores.
 
-Note that this example only has one staff, whereas
-the previous example had three separate staves.  That is because this
-example begins with a single note.  To determine the number of staves,
-LilyPond looks at the first element.  If it is a single note, there is one
-staff; if there is a simultaneous expression, there is more than one staff.
-
-@lilypond[fragment,quote,verbatim,relative=2]
-{
-  c <<c e>>
-  << { e f } { c <<b d>> } >>
-}
-@end lilypond
-
-Music files with deep nesting can be confusing to enter and
-maintain.  One convention that helps against this confusion is
-indenting.  When entering a file with deep nesting of braces and
-angles, it is customary to use an indent that indicates the nesting
-level.  Formatting music like this eases reading and helps you insert
-the right number of closing braces at the end of an expression.  For
-example,
-
-@example
-<<
-  @{
-    @dots{}
-  @}
-  @{
-    @dots{}
-  @}
->>
-@end example
 
-Some editors have special support for entering LilyPond, and can help
-indenting source files.  See @ref{Editor support} for more information.
+@node Multiple staves
+@subsection Multiple staves
 
-@node More staves
-@section More staves
+As we saw in @ref{Music expressions explained}, LilyPond input files
+are constructed out of music expressions.  If the score begins with
+simultaneous music expressions, LilyPond creates multiples staves.  However,
+it is easier to see what happens if we create each staff explicitly.
 
 To print more than one staff, each piece of music that makes up a
 staff is marked by adding @code{\new Staff} before it.  These
 @code{Staff} elements are then combined in parallel with @code{<<} and
-@code{>>}, as demonstrated here
+@code{>>}:
 
-@lilypond[quote,fragment,verbatim]
-<<
-  \new Staff { \clef treble c'' }
-  \new Staff { \clef bass c }
->>
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  <<
+    \new Staff { \clef treble c }
+    \new Staff { \clef bass c,, }
+  >>
+}
 @end lilypond
 
-
 The command @code{\new} introduces a @q{notation context.}  A notation
 context is an environment in which musical events (like notes or
 @code{\clef} commands) are interpreted.  For simple pieces, such
 notation contexts are created automatically.  For more complex pieces, it
-is best to mark contexts explicitly.  This ensures that each fragment
-gets its own stave.
+is best to mark contexts explicitly.
 
-There are several types of contexts.  @code{Staff}, @code{Voice} and
-@code{Score} handle melodic notation, while @code{Lyrics} sets lyric
+There are several types of contexts.  @code{Score}, @code{Staff},
+and @code{Voice} handle melodic notation, while @code{Lyrics} sets lyric
 texts and @code{ChordNames} prints chord names.
 
 In terms of syntax, prepending @code{\new} to a music expression
@@ -706,358 +1007,226 @@ creates a bigger music expression.  In this way it resembles the minus
 sign in mathematics.  The formula @math{(4+5)} is an expression, so
 @math{-(4+5)} is a bigger expression.
 
-We can now typeset a melody with two staves
-
-@c TODO: (c) status of this Paul McCartney (?) song (let's all stand together)
+Time signatures entered in one staff affects all other staves, but
+the key signature of one staff does @emph{not} affect other
+staves@footnote{This behavior may be changed if desired; see
+@ref{Changing defaults} for details.}.
 
-@lilypond[fragment,quote,verbatim,ragged-right]
-\relative <<
-  \new Staff {
-    \time 3/4
-    \clef treble
-
-    e'2 d4 c2 b4 a8[ a]
-    b[ b] g[ g] a2.
-  }
-  \new Staff {
-     \clef bass
-     c,,2 e4 g2.
-     f4 e d c2.
-  }
->>
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  <<
+    \new Staff { \clef treble \time 3/4 c }
+    \new Staff { \clef bass \key d \major c,, }
+  >>
+}
 @end lilypond
 
-For more information on contexts see the description in
-@ref{Interpretation contexts}.
 
 
 
-@node Adding articulation marks to notes
-@section Adding articulation marks to notes
-
-@cindex articulation
-@cindex accents
-@cindex staccato
-
-Common accents can be added to a note using a dash (@samp{-}) and a
-single character
-
-@lilypond[fragment,quote,verbatim,relative=2]
-c-.  c-- c-> c-^ c-+ c-_
-@end lilypond
-
-@cindex fingering
-Similarly, fingering indications can be added to a note using a dash
-(@samp{-}) and the digit to be printed
-
-@lilypond[fragment,quote,verbatim,relative=2]
-c-3 e-5 b-2 a-1
-@end lilypond
+@node Piano staves
+@subsection Piano staves
 
-Articulations and fingerings are usually placed automatically, but you
-can specify a direction using @samp{^} (up) or @samp{_} (down).  You can
-also use multiple articulations on the same note.  In most cases, however,
-it is best to let LilyPond determine the articulation directions.
+@cindex staff switch, manual
+@cindex cross staff voice, manual
+Piano music is typeset in two staves connected by a brace.  Printing
+such a staff is similar to the polyphonic example in @ref{Multiple staves},
+but now this entire expression is inserted inside a @code{PianoStaff}:
 
-@lilypond[fragment,quote,verbatim,relative=2]
-c_-^1 d^. f^4_2-> e^-_+
-@end lilypond
+@example
+\new PianoStaff <<
+  \new Staff @dots{}
+  \new Staff @dots{}
+>>
+@end example
 
-Dynamic signs are made by adding the markings (with a backslash) to
-the note
+Here is a small example
 
-@lilypond[fragment,quote,verbatim,relative=2]
-c\ff c\mf
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  \new PianoStaff <<
+    \new Staff { \time 2/4 c4 e g g, }
+    \new Staff { \clef bass c,, c' e c }
+  >>
+}
 @end lilypond
 
-@cindex dynamics
-@cindex decrescendo
-@cindex crescendo
-
-Crescendi and decrescendi are started with the commands @code{\<} and
-@code{\>}.  An ending dynamic, for example @code{\f}, will finish the
-(de)crescendo, or the command @code{\!} can be used
-
-@lilypond[fragment,quote,verbatim,relative=2]
-c2\< c2\ff\> c2 c2\!
-@end lilypond
+@moreinfo
+@quotation
+See @ref{Piano music}.
+@end quotation
 
 
+@node Single staff polyphony
+@subsection Single staff polyphony
 
-@cindex slur
+@cindex polyphony
+@cindex multiple voices
+@cindex voices, more -- on a staff
+When different melodic lines are combined on a single staff they are
+printed as polyphonic voices; each voice has its own stems, slurs and
+beams, and the top voice has the stems up, while the bottom voice has
+them down.
 
-A @rglos{slur} is a curve drawn across many notes, and indicates
-legato articulation.  The starting note and ending note are marked
-with @samp{(} and @samp{)}, respectively
+Entering such parts is done by entering each voice as a sequence (with
+@code{@{...@}}) and combining these simultaneously, separating the
+voices with @code{\\}
 
-@lilypond[fragment,quote,fragment,relative=2,verbatim]
-d4( c16) cis( d e c cis d) e( d4)
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+<<
+  { a4 g2 f4~ f4 } \\
+  { r4 g4 f2 f4 }
+>>
 @end lilypond
 
-@cindex slurs versus ties
-A slur looks like a @rglos{tie}, but it has a different meaning.  A
-tie simply makes the first note sound longer, and can only be used on
-pairs of notes with the same pitch.  Slurs indicate the articulations
-of notes, and can be used on larger groups of notes.  Slurs and ties
-can be nested
+For polyphonic music typesetting, spacer rests can also be convenient;
+these are rests that do not print.  They are useful for filling up
+voices that temporarily do not play.  Here is the same example with a
+spacer rest (@samp{s}) instead of a normal rest (@samp{r}),
 
-@lilypond[quote,fragment,relative=2]
-c2~( c8 fis fis4 ~ fis2 g2)
+@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
+<<
+  { a4 g2 f4~ f4 } \\
+  { s4 g4 f2 f4 }
+>>
 @end lilypond
 
-@cindex phrasing slurs
-Slurs to indicate phrasing can be entered with @code{\(} and
-@code{\)}, so you can have both legato slurs and phrasing slurs at the
-same time.  You cannot have simultaneous slurs or simultaneous
-phrasing slurs.
+@noindent
+Again, these expressions can be nested arbitrarily.
 
-@lilypond[quote,fragment,relative=2,verbatim]
-a8(\( ais b c) cis2 b'2 a4 cis, c\)
+@lilypond[quote,fragment,verbatim,relative=2,fragment]
+<<
+  \new Staff <<
+    { a4 g2 f4~ f4 } \\
+    { s4 g4 f2 f4 }
+  >>
+  \new Staff <<
+    \clef bass
+    { <c g>1 ~ <c g>4 } \\
+    { e,,4 d e2 ~ e4}
+  >>
+>>
 @end lilypond
 
-
-For more information on
-
+@moreinfo
 @quotation
-@table @asis
-@item Fingering
-see @ref{Fingering instructions}.
-@item Articulations
-see @ref{Articulations}.
-@item Slurs
-see @ref{Slurs}.
-@item Phrasing slurs
-see @ref{Phrasing slurs}.
-@item Dynamics
-see @ref{Dynamics}.
-@end table
+See @ref{Basic polyphony}.
 @end quotation
 
 
 @node Combining notes into chords
-@section Combining notes into chords
+@subsection Combining notes into chords
 
 @cindex chords
-Chords can be made by surrounding pitches with angle brackets.
-Angle brackets are the symbols @samp{<} and @samp{>}.
+Chords can be made by surrounding pitches with single angle brackets.  Angle
+brackets are the symbols @samp{<} and @samp{>}.
 
-@lilypond[quote,relative=1,fragment,verbatim]
-r4 <c e g>4 <c f a>8
+@lilypond[quote,fragment,verbatim,relative=2,fragment]
+r4 <c e g>4 <c f a>2
 @end lilypond
 
-
 You can combine markings like beams and ties with chords.  They must
-be placed outside the angled brackets
-
-@lilypond[quote,relative=1,fragment,verbatim]
-r4 <c e g>8[ <c f a>]~ <c f a>
-@end lilypond
-
-@example
-r4 <c e g>8\>( <c e g> <c e g> <c f a>\!)
-@end example
-
-@lilypond[quote,relative=1,fragment]
-\slurUp
-r4 <c e g>8\>( <c e g> <c e g> <c f a>\!)
-@end lilypond
-
-
-@node Advanced rhythmic commands
-@section Advanced rhythmic commands
-
-@cindex pickup
-@cindex anacruse
-@cindex partial measure
-A pickup is entered with the keyword @code{\partial}.  It
-is followed by a duration: @code{\partial 4} is a quarter note upstep
-and @code{\partial 8} an eighth note
-
-@lilypond[quote,relative=2,verbatim,fragment]
-\partial 8
-f8 c2 d e
-@end lilypond
-
-@cindex tuplets
-@cindex triplets
-Tuplets are made with the @code{\times} keyword.  It takes two
-arguments: a fraction and a piece of music.  The duration of the piece
-of music is multiplied by the fraction.  Triplets make notes occupy
-2/3 of their notated duration, so a triplet has 2/3 as its fraction
+be placed outside the angle brackets
 
-@lilypond[quote,relative=1,verbatim,fragment]
-\times 2/3 { f8 g a }
-\times 2/3 { c r c }
+@lilypond[quote,fragment,verbatim,relative=2,fragment]
+r4 <c e g>8[ <c f a>]~ <c f a>2
 @end lilypond
 
-@cindex grace notes
-@cindex acciaccatura
-Grace notes are also made by prefixing a music expression with the
-keyword @code{\appoggiatura} or @code{\acciaccatura}
-@cindex appoggiatura
-@cindex acciaccatura
-
-@lilypond[quote,relative=2,verbatim,fragment]
-c4 \appoggiatura b16 c4
-c4 \acciaccatura b16 c4
+@lilypond[quote,fragment,verbatim,relative=2,fragment]
+r4 <c e g>8\>( <c e g> <c e g>4 <c f a>\!)
 @end lilypond
 
-@noindent
-
-For more information on
-
-@quotation
-@table @asis
-@item Grace notes
-see @ref{Grace notes},
-@item Tuplets
-see @ref{Tuplets},
-@item Pickups
-see @ref{Partial measures}.
-@end table
-@end quotation
-
-
-@node Commenting input files
-@section Commenting input files
-
-@cindex comments
-@cindex line comment
-@cindex block comment
-A comment is a remark for the human reader of the music input; it is
-ignored while parsing, so it has no effect on the printed output.
-There are two types of comments.  The percent symbol @samp{%}
-introduces a line comment; after @samp{%} the rest of the line is
-ignored.  A block comment marks a whole section of music
-input.  Anything that is enclosed in @code{%@{} and @code{%@}} is
-ignored.  The following fragment shows possible uses for comments
-
-@example
-% notes for twinkle twinkle follow
-  c4 c g' g a a g2
-
-%@{
-    This line, and the notes below
-    are ignored, since they are in a
-    block comment.
-
-    g g f f e e d d c2
-%@}
-@end example
-
-@c  TODO   post-2.6 reorg
-@c   This is good info, but I wouldn't call it a comment.  IMO it should
-@c   be moved somewhere else.
 
-@cindex versioning
-
-There is a special statement that is a kind of comment.  The @code{\version}
-statement marks for which version of LilyPond the file was written.
-To mark a file for version 2.10.1, use
+@node Songs
+@section Songs
 
-@example
-\version "2.10.1"
-@end example
+This section introduces vocal music and simple song sheets.
 
-@noindent
-These annotations make future upgrades of LilyPond go more
-smoothly.  Changes in the syntax are handled with a special program,
-@file{convert-ly} (see @ref{Updating files with convert-ly}), and it uses
-@code{\version} to determine what rules to apply.
+@menu
+* Printing lyrics::             
+* A lead sheet::                
+@end menu
 
 
 @node Printing lyrics
-@section Printing lyrics
-@cindex lyrics
-
-@c TODO: (c) status of the Queen fragment.
+@subsection Printing lyrics
 
 @cindex Lyrics
 @cindex Songs
-Lyrics are entered by separating each syllable with a space
-
-@example
-I want to break free
-@end example
+Consider a simple melody:
 
-Consider the melody
-
-@lilypond[quote,verbatim,fragment,ragged-right]
-\relative {
-  r4 c \times 2/3 { f g g }
-  \times 2/3 { g4( a2) }
+@lilypond[quote,ragged-right,verbatim]
+\relative c'' {
+  a4 e c8 e r4
+       b2 c4( d)
 }
 @end lilypond
 
 The lyrics can be set to these notes, combining both with the
-@code{\addlyrics} keyword
+@code{\addlyrics} keyword.  Lyrics are entered by separating each
+syllable with a space.
 
-@lilypond[quote,verbatim,fragment,ragged-right]
+@lilypond[quote,ragged-right,verbatim]
 <<
-  \relative {
-    r4 c \times 2/3 { f g g }
-    \times 2/3 { g4( a2) }
+  \relative c'' {
+    a4 e c8 e r4
+         b2 c4( d)
   }
-  \addlyrics { I want to break free }
+  \addlyrics { One day this shall be free }
 >>
 @end lilypond
 
 @cindex melisma
 @cindex extender line
-@c synonyms?
 This melody ends on a @rglos{melisma}, a single syllable (@q{free})
 sung to more than one note.  This is indicated with an @emph{extender
-line}.  It is entered as two underscores, i.e.,
+line}.  It is entered as two underscores @code{__}:
 
-@example
-@{ I want to break free __ @}
-@end example
-
-@lilypond[fragment,quote,ragged-right]
+@lilypond[quote,ragged-right,verbatim]
 <<
-  \relative {
-    r4 c \times 2/3 { f g g }
-    \times 2/3 { g4( a2) }
+  \relative c'' {
+    a4 e c8 e r4
+         b2 c4( d)
   }
-  \addlyrics { I want to break free __ }
+  \addlyrics { One day this shall be free __ }
 >>
 @end lilypond
 
 Similarly, hyphens between words can be entered as two dashes,
 resulting in a centered hyphen between two syllables
 
-@example
-A -- le gri -- a
-@end example
-
-@c no ragged-right here, because otherwise the hypens get lost.
-@lilypond[fragment,quote]
+@c no ragged-right here because otherwise the hypens get lost.
+@lilypond[quote,verbatim]
 <<
-  \relative {
+  \relative c' {
     \time 2/4
-    f4 f c' c
+    f4 f c c
   }
-  \addlyrics { A -- le gri -- a }
+  \addlyrics { A -- le -- gri -- a }
 >>
 @end lilypond
 
-More options, like putting multiple lines of lyrics below a melody are
+@moreinfo
+@quotation
+More options, such as putting multiple stanzas below a melody, are
 discussed in @ref{Vocal music}.
+@end quotation
 
 
 @node A lead sheet
-@section A lead sheet
+@subsection A lead sheet
 
 @cindex Lead sheets
 @cindex chords
 @cindex chord names
 
 @c TODO: revise this, \chords { } is shorter and more intuitive.
+@c  I need help for this.  -gp
 
-In popular music, it is common to denote accompaniment with chord names.
+In popular music it is common to denote accompaniment with chord names.
 Such chords can be entered like notes,
 
-@lilypond[quote,verbatim,ragged-right]
+@lilypond[quote,ragged-right,verbatim]
 \chordmode { c2 f4. g8 }
 @end lilypond
 
@@ -1086,16 +1255,8 @@ following result.
 When put together, chord names, lyrics and a melody form
 a lead sheet, for example,
 
-@example
-<<
-  \chords @{ @emph{chords} @}
-  @emph{the melody}
-  \addlyrics @{ @emph{the text} @}
->>
-@}
-@end example
-
-@lilypond[quote,ragged-right]
+@lilypond[quote,verbatim,ragged-right]
+% FIXME: this melody needs to be changed.  See my new example in 2.4.1. -gp
 <<
   \chords { r2 c:sus4 f }
   \relative {
@@ -1110,145 +1271,179 @@ A complete list of modifiers and other options for layout can be found
 in @ref{Chords}.
 
 
+@node Final touches
+@section Final touches
+
+This is the final section of the tutorial; it demonstrates how to add the
+final touches to simple pieces, and provides an introduction to the rest
+of the manual.
+
+@menu
+* Version number::              
+* Adding titles::               
+* Absolute note names::         
+* Organizing pieces with identifiers::  
+* After the tutorial::          
+* How to read the manual::      
+@end menu
+
+
+@node Version number
+@subsection Version number
+
+@cindex versioning
+The @code{\version} statement marks for which version of LilyPond the file
+was written.  To mark a file for version 2.10.1, place
+
+@example
+\version "2.10.1"
+@end example
+
+@noindent
+at the top of your LilyPond file.
+
+These annotations make future upgrades of LilyPond go more
+smoothly.  Changes in the syntax are handled with a special program,
+@file{convert-ly} (see @ref{Updating files with convert-ly}), and it uses
+@code{\version} to determine what rules to apply.
+
+
 @node Adding titles
-@section Adding titles
+@subsection Adding titles
 
-Bibliographic information is entered in a separate block, the
-@code{\header} block.  The name of the piece, its composer, etc., are
-entered as an assignment, within @code{\header
-@{@tie{}@dots{}@tie{}@}}.  The @code{\header} block is usually put at
-the top of the file.  For example,
+The title, composer, opus number, and similar information are entered
+in the @code{\header} block.  This exists outside of the main
+music expression; the @code{\header} block is usually placed underneath
+the @ref{Version number}.
 
 @example
+\version "2.10.1"
 \header @{
-  title = "Miniature"
-  composer = "Igor Stravinsky"
+  title = "Symphony"
+  composer = "Me"
+  opus = "Op. 9"
 @}
 
-@{ @dots{} @}
+@{
+  @dots{} music @dots{}
+@}
 @end example
 
-
 When the file is processed, the title and composer are printed above
 the music.  More information on titling can be found in @ref{Creating
 titles}.
 
 
-@node Single staff polyphony
-@section Single staff polyphony
+@node Absolute note names
+@subsection Absolute note names
 
-@cindex polyphony
-@cindex multiple voices
-@cindex voices, more -- on a staff
-When different melodic lines are combined on a single staff they are
-printed as polyphonic voices; each voice has its own stems, slurs and
-beams, and the top voice has the stems up, while the bottom voice has
-them down.
+So far we have always used @code{\relative} to define pitches.  This is
+the easiest way to enter most music, but another way of defining pitches
+exists: absolute mode.
 
-Entering such parts is done by entering each voice as a sequence (with
-@code{@{...@}}), and combining these simultaneously, separating the
-voices with @code{\\}
+If you omit the @code{\relative}, LilyPond treats all pitches as
+absolute values.  A @code{c'} will always mean middle C, a @code{b} will
+always mean the note one step below middle C, and a @code{g,} will
+always mean the note on the bottom staff of the bass clef.
 
-@lilypond[quote,verbatim,relative=2,fragment]
-<< { a4 g2 f4~ f4 } \\
-   { r4 g4 f2 f4 } >>
+@lilypond[quote,verbatim,ragged-right]
+{
+  \clef bass
+  c' b g, g,
+  g, f, f c'
+}
 @end lilypond
 
-For polyphonic music typesetting, spacer rests can also be convenient;
-these are rests that do not print.  They are useful for filling up
-voices that temporarily do not play.  Here is the same example with a
-spacer rest (@samp{s}) instead of a normal rest (@samp{r}),
+Here is a four-octave scale:
 
-@lilypond[quote,verbatim,relative=2,fragment]
-<< { a4 g2 f4~ f4 } \\
-   { s4 g4 f2 f4 } >>
+@lilypond[quote,verbatim,ragged-right]
+{
+  \clef bass
+  c, d, e, f,
+  g, a, b, c
+  d e f g
+  a b c' d'
+  \clef treble
+  e' f' g' a'
+  b' c'' d'' e''
+  f'' g'' a'' b''
+  c'''1
+}
 @end lilypond
 
-@noindent
-Again, these expressions can be nested arbitrarily
+As you can see, writing a melody in the treble clef involves a lot of
+quote ' marks.  Consider this fragment from Mozart:
 
-@lilypond[quote,fragment,verbatim,relative=2,fragment]
-<<
-  \new Staff <<
-    { a4 g2 f4~ f4 } \\
-    { s4 g4 f2 f4 }
-  >>
-  \new Staff <<
-    \clef bass
-    { <c g>1 ~ <c g>4 } \\
-    { e,,4 d e2 ~ e4}
-  >>
->>
+@lilypond[quote,verbatim,ragged-right]
+{
+  \key a \major
+  \time 6/8
+  cis''8. d''16 cis''8 e''4 e''8
+  b'8. cis''16 b'8 d''4 d''8
+}
 @end lilypond
 
-More features of polyphonic typesetting are described in this manual
-in section @ref{Basic polyphony}.
-
-
-@node Piano staves
-@section Piano staves
-
-@cindex staff switch, manual
-@cindex cross staff voice, manual
-Piano music is typeset in two staves connected by a brace.  Printing
-such a staff is similar to the polyphonic example in @ref{More staves},
-
-@example
-<< \new Staff @{ @dots{} @}
-   \new Staff @{ @dots{} @} >>
-@end example
-
-@noindent
-but now this entire expression must be interpreted as a
-@code{PianoStaff}
-
-@example
-\new PianoStaff << \new Staff @dots{} >>
-@end example
+All these quotes makes the input less readable and it is a source of
+errors.  With @code{\relative}, the previous example is much easier
+to read:
 
-Here is a small example
-
-@lilypond[quote,verbatim,relative=1,fragment]
-\new PianoStaff <<
-  \new Staff { \time 2/4 c4 c g' g }
-  \new Staff { \clef bass c,, c' e c }
->>
+@lilypond[quote,verbatim,ragged-right]
+\relative c'' {
+  \key a \major
+  \time 6/8
+  cis8. d16 cis8 e4 e8
+  b8. cis16 b8 d4 d8
+}
 @end lilypond
 
-More information on formatting piano music is given in @ref{Piano music}.
+If you make a mistake with an octave mark (@code{'} or @code{,}) while
+working in @code{\relative} mode, it is very obvious -- many notes will
+be in the wrong octave.  When working in absolute mode, a single mistake
+will not be as visible, and will not be as easy to find.
 
+However, absolute mode is useful for music which has large intervals, and
+is extremely useful for computer-generated LilyPond files.
 
-@node Organizing larger pieces
-@section Organizing larger pieces
+
+@node Organizing pieces with identifiers
+@subsection Organizing pieces with identifiers
 
 When all of the elements discussed earlier are combined to produce
-larger files, the @code{\score} blocks get a lot bigger because the
-music expressions are longer, and, in the case of polyphonic music,
-more deeply nested.  Such large expressions can become unwieldy.
+larger files, the music expressions get a lot bigger.  In polyphonic
+music with many staves, the input files can become very confusing.  We can
+reduce this confusion by using @emph{identifiers}.
 
-By using variables, also known as identifiers, it is possible to break
-up complex music expressions.  An identifier is assigned as follows
+With identifiers (also known as variables or macros), we can break up
+complex music expressions.  An identifier is assigned as follows
 
 @example
 namedMusic = @{ @dots{} @}
 @end example
 
-@noindent
-The contents of the music expression @code{namedMusic}, can be used
-later by preceding the name with a backslash, i.e., @code{\namedMusic}.
-In the next example, a two-note motive is repeated two times by using
-variable substitution
-
-@lilypond[quote,ragged-right,verbatim,nofragment]
-seufzer = {
-  e'4( dis'4)
+The contents of the music expression @code{namedMusic} can be used
+later by placing a backslash in front of the name
+(@code{\namedMusic}, just like a normal LilyPond command).  Identifiers
+must be defined @emph{before} the main music expression.
+
+@lilypond[quote,verbatim,ragged-right]
+violin = \new Staff { \relative c'' {
+  a4 b c b
+}}
+cello = \new Staff { \relative c {
+  \clef bass
+  e2 d
+}}
+{
+  <<
+    \violin
+    \cello
+  >>
 }
-{ \seufzer \seufzer }
 @end lilypond
 
-The name of an identifier should have alphabetic characters only: no
-numbers, underscores, or dashes.  The assignment should be outside of
-running music.
+@noindent
+The name of an identifier must have alphabetic characters only: no
+numbers, underscores, or dashes.
 
 It is possible to use variables for many other types of objects in the
 input.  For example,
@@ -1260,7 +1455,7 @@ aFivePaper = \paper @{ paperheight = 21.0 \cm @}
 @end example
 
 Depending on its contents, the identifier can be used in different
-places.  The following example uses the above variables
+places.  The following example uses the above variables:
 
 @example
 \paper @{
@@ -1270,148 +1465,16 @@ places.  The following example uses the above variables
 @{ c4^\name @}
 @end example
 
-More information on the possible uses of identifiers is given in the
-technical manual, in @ref{Input variables and Scheme}.
-@c fixme: the ref is too technical.
-
-
-@node An orchestral part
-@section An orchestral part
-
-In orchestral music, all notes are printed twice.  Once in a part for
-the musicians, and once in a full score for the conductor.  Identifiers can
-be used to avoid double work.  The music is entered once, and stored in
-a variable.  The contents of that variable is then used to generate
-both the part and the full score.
-
-It is convenient to define the notes in a special file.  For example,
-suppose that the file @file{horn-music.ly} contains the following part
-of a horn/@/bassoon duo
-
-@example
-hornNotes = \relative c @{
-  \time 2/4
-  r4 f8 a cis4 f e d
-@}
-@end example
-
-@noindent
-Then, an individual part is made by putting the following in a file
-
-@example
-\include "horn-music.ly"
-\header @{
-  instrument = "Horn in F"
-@}
-
-@{
- \transpose f c' \hornNotes
-@}
-@end example
-
-The line
-
-@example
-\include "horn-music.ly"
-@end example
-
-@noindent
-substitutes the contents of @file{horn-music.ly} at this position in
-the file, so @code{hornNotes} is defined afterwards.  The command
-@code{\transpose f@tie{}c'} indicates that the argument, being
-@code{\hornNotes}, should be transposed by a fifth upwards.  Sounding
-@samp{f} is denoted by notated @code{c'}, which corresponds with the
-tuning of a normal French Horn in@tie{}F.  The transposition can be seen
-in the following output
-
-@lilypond[quote,ragged-right]
-\transpose f c' \relative c {
-  \time 2/4
-  r4 f8 a cis4 f e d
-}
-@end lilypond
-
-In ensemble pieces, one of the voices often does not play for many
-measures.  This is denoted by a special rest, the multi-measure
-rest.  It is entered with a capital @samp{R} followed by a duration
-(@code{1}@tie{}for a whole note, @code{2}@tie{}for a half note,
-etc.).  By multiplying the
-duration, longer rests can be constructed.  For example, this rest
-takes 3@tie{}measures in 2/4 time
-
-@example
-R2*3
-@end example
-
-When printing the part, multi-rests
-must be condensed.  This is done by setting a run-time variable
-
-@example
-\set Score.skipBars = ##t
-@end example
-
-@noindent
-This command sets the property @code{skipBars} in the
-@code{Score} context to true (@code{##t}).  Prepending the rest and
-this option to the music above, leads to the following result
-
-@lilypond[quote,ragged-right]
-\transpose f c' \relative c {
-  \time 2/4
-  \set Score.skipBars = ##t
-  R2*3
-  r4 f8 a cis4 f e d
-}
-@end lilypond
-
-
-The score is made by combining all of the music together.  Assuming
-that the other voice is in @code{bassoonNotes} in the file
-@file{bassoon-music.ly}, a score is made with
-
-@example
-\include "bassoon-music.ly"
-\include "horn-music.ly"
-
-<<
-  \new Staff \hornNotes
-  \new Staff \bassoonNotes
->>
-@end example
-
-@noindent
-leading to
-
-@lilypond[quote,ragged-right]
-\relative c <<
-  \new Staff {
-    \time 2/4 R2*3
-    r4 f8 a cis4 f e d
-  }
-  \new Staff {
-    \clef bass
-    r4 d,8 f | gis4 c | b bes |
-    a8 e f4 | g d | gis f
-  }
->>
-@end lilypond
-
-More in-depth information on preparing parts and scores can be found
-in the notation manual; see @ref{Orchestral music}.
-
-Setting run-time variables (@q{properties}) is discussed in
-@ref{Changing context properties on the fly}.
-
 
 @node After the tutorial
-@section After the tutorial
+@subsection After the tutorial
 
 After finishing the tutorial, you should probably try writing a
-piece or two.  Start with one of the @ref{Example templates} and
+piece or two.  Start with one of the @ref{Templates} and
 add notes.  If you need any notation that was not covered in the
 tutorial, look at the Notation Reference, starting with
 @ref{Basic notation}.  If you want to write for an instrument
-ensemble which is not covered in the @ref{Example templates},
+ensemble which is not covered in the templates,
 take a look at @ref{Extending the templates}.
 
 Once you have written a few short pieces, read the rest of
@@ -1422,3 +1485,24 @@ LilyPond input.  You may wish to skim these chapters right
 now, and come back to them after you have more experience.
 
 
+@node How to read the manual
+@subsection How to read the manual
+
+As we saw in @ref{How to read the tutorial}, many examples in the
+tutorial omitted a @code{\relative c'' @{ ... @}} around the printed
+example.
+
+In the rest of the manual, we are much more lax about the
+printed examples: sometimes they may have omitted a
+@code{\relative c'' @{ ... @}}, but in other times a different initial
+pitch may be used (such as @code{c'} or @code{c,,}), and in some cases
+the whole example is in absolute note mode!  However, ambiguities like
+this only exist where the pitches are not important.  In any example
+where the pitch matters, we have explicitly stated our @code{\relative}
+our our absolute-mode @code{@{ @}}.
+
+If you are still confused about the exact LilyPond input that was
+used in an example, read the HTML version (if you are not already doing
+so) and click on the picture of the music.  This will display the exact
+input that LilyPond used to generate this manual.
+
index 97edb206c335eeee8dae48d4659090583a15e535..22659409a21078460f3998a970f91a3e87a4ee15 100644 (file)
@@ -22,6 +22,7 @@ this chapter.
 * Style sheets::                
 * Updating old files::          
 * Troubleshooting (taking it all apart)::  
+* Minimal examples::            
 @end menu
 
 
@@ -624,4 +625,46 @@ bass = \relative c' @{
 Now start slowly uncommenting more and more of the
 @code{bass} part until you find the problem line.
 
+Another very useful debugging technique is constructing
+@ref{Minimal examples}.
+
+
+@node Minimal examples
+@section Minimal examples
+
+A minimal example is an example which is small as possible.  These
+examples are much easier to understand than long examples.  Minimal
+examples are used for
+
+@itemize
+@item Bug reports
+@item Sending a help request to mailists
+@item Adding an example to the @uref{http://lsr@/.dsi@/.unimi/2.it/,LilyPond
+Snippet Repository}
+@end itemize
+
+To construct an example which is as small as possible, the rule is
+quite simple: remove anything which is not necessary.  When trying to
+remove unnecessary parts of a file, it is a very good idea to comment
+out lines instead of deleting them.  That way, if you discover that you
+actually @emph{do} need some lines, you can un-comment them, instead of
+typing them in from scratch.
+
+There are two exceptions to the @qq{as small as possible} rule:
+
+@itemize
+@item Include the @code{\version} number.
+@item If possible, use @code{\paper@{ ragged-right=##t @}} at the
+top of your example. 
+@end itemize
+
+The whole point of a minimal example is to make it easy to read:
+
+@itemize
+@item Avoid using complicated notes, keys, or time signatures, unless you
+wish to demonstrate something is about the behavior of those items. 
+@item Do not use \override commands unless that is the point of the
+example.
+@end itemize
+
 
diff --git a/VERSION b/VERSION
index 0b8b4feb65dd346078857f31b7f04bdb0d6cc046..1380565e9e23ad59c3090aec2eca325eec525959 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=11
-PATCH_LEVEL=12
+PATCH_LEVEL=13
 MY_PATCH_LEVEL=
 
index 6e543860a3fc7ee0faa095c6aa08f6801d6520df..b86ebaaf521ba5a8cc6af1ca0b1c347b389b99ed 100755 (executable)
@@ -19,10 +19,10 @@ else
 fi
 
 mkdir -p scripts/out-cov/
-touch  scripts/out-cov/midi2ly.1
+touch scripts/out-cov/midi2ly scripts/out-cov/midi2ly.1
 make conf=cov -j2 &&  \
   make conf=cov test-clean OUT_TEST=testcov LILYPOND_JOBS= && \
-  make conf=cov test OUT_TEST=testcov LILYPOND_JOBS= 
+  make conf=cov test OUT_TEST=testcov LILYPOND_JOBS='-dtrace-scheme-coverage '
 
 if test "$?" != "0"; then
   tail -100 out-cov/test-run.log
@@ -37,6 +37,9 @@ mkdir $resultdir
 cd $resultdir
 
 ln $depth/lily/* .
+ln $depth/scm/*.scm .
+mv $depth/input/regression/out-testcov/*.scm.cov .
+ln $depth/ly/*.ly .
 ln $depth/lily/out-cov/*[ch] .
 mkdir include
 ln $depth/lily/include/* include/
@@ -49,6 +52,7 @@ done
 python $depth/buildscripts/coverage.py --uncovered *.cc > uncovered.txt
 python $depth/buildscripts/coverage.py --hotspots *.cc > hotspots.txt
 python $depth/buildscripts/coverage.py --summary *.cc > summary.txt
+python $depth/buildscripts/coverage.py --uncovered *.scm > uncovered-scheme.txt
 
 head -20 summary.txt
 
@@ -57,6 +61,7 @@ results in
 
   out/coverage-results/summary.txt
   out/coverage-results/uncovered.txt
+  out/coverage-results/uncovered-scheme.txt
   out/coverage-results/hotspots.txt
 
 EOF
index 4c53c644e49437cbc956bc36c10aa53484c92369..072cf64520c2fab1640a4e10502f833651bd370e 100755 (executable)
@@ -32,11 +32,15 @@ cd $resultdir
 cat > long-score.ly << EOF
 \version "2.10.0"
 foo = \new Staff \new Voice \repeat unfold 50 \relative { c4 d8[ d16( e]~ e16[ e e) f] g8  }
-\new ChoirStaff << 
-  \foo \foo \foo \foo 
-  \foo \foo \foo \foo 
-
->>
+\score { 
+  \new ChoirStaff << 
+    \foo \foo \foo \foo 
+    \foo \foo \foo \foo 
+
+  >>
+  \midi {}
+  \layout {}
+}
 EOF
 
 rm gmon.sum
index 380e9e30755a17bfa3d67a45afd4483fbd1d2521..0b3b2b7aafa1f431ed8112dccfa95936c35cd728 100644 (file)
@@ -69,11 +69,27 @@ class Chunk:
                 cov = ''
             sys.stdout.write ('%8s:%8d:%s' % (cov, n, l))
             
+    def uncovered_score (self):
+        return self.length ()
+    
+class SchemeChunk (Chunk):
+    def uncovered_score (self):
+        text = self.text ()
+        if (text.startswith  ('(define ')
+            and not text.startswith ('(define (')):
+            return 0
+
+        if (text.startswith  ('(define-public ')
+            and not text.startswith ('(define-public (')):
+            return 0
+
+        return len ([l for (c,n,l) in self.lines() if (c == 0)]) 
+
 def read_gcov (f):
     ls = []
 
     in_lines = [l for l in open (f).readlines ()]
-    (count_len, line_num_len) = tuple (map (len, in_lines[0].split':')[:2]))
+    (count_len, line_num_len) = tuple (map (len, in_lines[0].split (':')[:2]))
     
     for l in in_lines:
         c = l[:count_len].strip ()
@@ -96,7 +112,7 @@ def read_gcov (f):
         
     return ls
 
-def get_chunks (ls, file):
+def get_c_chunks (ls, file):
     chunks = []
     chunk = []
 
@@ -115,6 +131,29 @@ def get_chunks (ls, file):
             
     return chunks
 
+def get_scm_chunks (ls, file):
+    chunks = []
+    chunk = []
+
+    def new_chunk ():
+        if chunk:
+            nums = [n-1 for (n, l) in chunk]
+            chunks.append (SchemeChunk ((min (nums), max (nums)+1),
+                                        max (last_c, 0), ls, file))
+            chunk[:] = []
+        
+    last_c = -1
+    for (cov_count, line_number, line) in ls:
+        if line.startswith ('('):
+            new_chunk ()
+            last_c = -1
+        
+        chunk.append ((line_number, line))
+        if cov_count >= 0:
+            last_c = cov_count
+
+    return chunks
+
 def widen_chunk (ch, ls):
     a -= 1
     b += 1
@@ -129,7 +168,13 @@ def extract_chunks (file):
         print s
         return []
         
-    return get_chunks (ls, file)
+    cs = []
+    if 'scm' in file:
+        cs = get_scm_chunks (ls, file)
+    else:
+        cs = get_c_chunks (ls, file)
+    return cs
+
 
 def filter_uncovered (chunks):
     def interesting (c):
@@ -173,11 +218,17 @@ def main ():
     if options.uncovered or options.hotspots:
         chunks = []
         for a in args:
-            chunks += extract_chunks  ('%s.gcov' % a)
+            name = a
+            if name.endswith ('scm'):
+                name += '.cov'
+            else:
+                name += '.gcov'
+            
+            chunks += extract_chunks  (name)
 
         if options.uncovered:
             chunks = filter_uncovered (chunks)
-            chunks = [(c.length (), c) for c in chunks]
+            chunks = [(c.uncovered_score (), c) for c in chunks]
         elif options.hotspots:
             chunks = [((c.coverage_count, -c.length()), c) for c in chunks]
             
diff --git a/buildscripts/makelsr.py b/buildscripts/makelsr.py
new file mode 100755 (executable)
index 0000000..3f70827
--- /dev/null
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+import sys
+import os
+import os.path
+import shutil
+
+dirs = ['advanced','trick']
+
+try:
+       in_dir = sys.argv[1]
+except:
+       print "Please specify input_file."
+       sys.exit()
+
+for dir in dirs:
+       srcdir = os.path.join (in_dir, dir)
+       destdir = os.path.join ('input', 'lsr', dir)
+       if not(os.path.isdir(destdir)):
+               print "Please run this script from the head of the source tree,"
+               print "  and/or check that you have the right categories."
+               sys.exit()
+
+       file_names = os.listdir (destdir)
+       for file in file_names:
+               if (file.endswith ('.ly')):
+                       if (file[:3] != 'AAA'):
+                               os.remove( os.path.join(destdir,file) )
+
+       file_names = os.listdir (in_dir + dir)
+       for file in file_names:
+               src = os.path.join (srcdir, file)
+               dest = os.path.join (destdir, file)
+               shutil.copyfile (src, dest)
+
index d066ff7af7f3afbabcf354ee03e150e83df938c5..a3c4df5cbaf9ca52ee255e0a386e4d0bf6bdd512 100644 (file)
@@ -508,12 +508,13 @@ class ProfileFileLink (FileCompareLink):
                     note_info, self.contents[oldnew])
 
         dist = 0.0
-        factor = {'time': 3.0 ,
-                  'cells': 5.0,
-                  }
+        factor = {
+            'time': 1.0 ,
+            'cells': 5.0,
+            }
         
         for k in ('time', 'cells'):
-            real_val = math.tan (self.get_ratio (k) * 0.5* math.pi)
+            real_val = math.tan (self.get_ratio (k) * 0.5 * math.pi)
             dist += math.exp (math.fabs (real_val) * factor[k])  - 1
 
         dist = min (dist, 100)
index ba28b1c76c2031062a7526d7776ceeed98311066..33e7c016304bef0903f2af10c719436faec2c166 100644 (file)
@@ -103,11 +103,7 @@ struct Interval_t : public Drul_array<T>
     return *this;
   }
 
-  Real linear_combination (Real x) const
-  {
-    Drul_array<Real> da (at (LEFT), at (RIGHT));
-    return ::linear_combination (da, x);
-  }
+  Real linear_combination (Real x) const;
   string to_string () const;
 
   bool contains (T r) const;
index 1995dd2554eed232bf9279396ac044a18c4c44ce..a3093c98ef2548f2157b328c44d510415352ee27 100644 (file)
 #include "std-string.hh"
 #include "real.hh"
 
-class Offset;
-Offset complex_multiply (Offset, Offset);
-Offset complex_divide (Offset, Offset);
-Offset complex_exp (Offset);
 
 /*
   This is a mixture a 2D vector. Sometimes it can
@@ -100,15 +96,13 @@ public:
     coordinate_a_[a] = -coordinate_a_[a];
     return *this;
   }
-
+  Offset direction () const;
+  
   Real arg () const;
+  Real angle_degrees () const;
   Real length () const;
   bool is_sane () const;
-  Offset operator *= (Offset z2)
-  {
-    *this = complex_multiply (*this, z2);
-    return *this;
-  }
+  Offset operator *= (Offset z2);
 };
 
 #include "arithmetic-operator.hh"
@@ -116,6 +110,19 @@ IMPLEMENT_ARITHMETIC_OPERATOR (Offset, +);
 IMPLEMENT_ARITHMETIC_OPERATOR (Offset, -);
 IMPLEMENT_ARITHMETIC_OPERATOR (Offset, *);
 
+
+
+Offset complex_multiply (Offset, Offset);
+Offset complex_divide (Offset, Offset);
+Offset complex_exp (Offset);
+
+inline Offset
+Offset::operator *= (Offset z2)
+{
+  *this = complex_multiply (*this, z2);
+  return *this;
+}
+
 inline Offset
 operator * (Real o1, Offset o2)
 {
index f578b191f9a4c8b93f4f694a8b8f06beefb522c8..086147188253c81e5e35e8a30f219e3307e3a7ff 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "offset.hh"
 
-
 #ifndef STANDALONE
 string
 Offset::to_string () const
@@ -75,6 +74,11 @@ Offset::arg () const
   return atan2 (coordinate_a_[Y_AXIS], coordinate_a_[X_AXIS]);
 }
 
+Real
+Offset::angle_degrees () const
+{
+  return arg () * 180 / M_PI;
+}
 /**
    euclidian vector length / complex modulus
 */
@@ -93,3 +97,11 @@ Offset::is_sane () const
     && !isinf (coordinate_a_[X_AXIS]) 
     && !isnan (coordinate_a_[Y_AXIS]);
 }
+
+Offset
+Offset::direction () const
+{
+  Offset d = *this;
+  d /= length (); 
+  return d;
+}
index 022f9c3f12a1407957ff54ed6c2b42f9fda6d8d4..a8c4d4a26ba4b43290d499e44e8482eb44c47202 100644 (file)
@@ -1,6 +1,6 @@
 depth = ..
 
-SUBDIRS = test regression tutorial mutopia manual
+SUBDIRS = test regression tutorial mutopia manual lsr
 
 examples = typography-demo les-nereides wilhelmus proportional bach-schenker cary
 
diff --git a/input/lsr/GNUmakefile b/input/lsr/GNUmakefile
new file mode 100644 (file)
index 0000000..36b2eec
--- /dev/null
@@ -0,0 +1,12 @@
+depth = ../../
+
+SUBDIRS = advanced trick
+
+STEPMAKE_TEMPLATES=documentation texinfo tex
+LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc
+
+include $(depth)/make/stepmake.make
+
+
+TITLE=LilyPond Examples
+
diff --git a/input/lsr/LSR.ly b/input/lsr/LSR.ly
new file mode 100644 (file)
index 0000000..b2fe188
--- /dev/null
@@ -0,0 +1,21 @@
+\version "2.10.0"
+\header{
+texidoc = "@unnumbered LilyPond Examples
+
+These pages show LilyPond examples (snippets) from the
+@uref{http://lsr@/.dsi@/.unimi@/.it,LilyPond Snippet Repository}.
+
+@c @h eading @uref{../trick/collated-files.html,Trick}:
+@strong{@uref{trick/collated-files.html,Trick}}:
+These snippets are blah blah.
+
+@c @h eading @uref{../advanced/collated-files.html,Advanced}:
+@strong{@uref{advanced/collated-files.html,Advanced}}:
+These snippets are fazzle snap.
+
+"
+}
+
+% make sure .png  is generated.
+\lyrics {  " " }
+% \lyrics {  "(left blank intentionally)" }
diff --git a/input/lsr/SConscript b/input/lsr/SConscript
new file mode 100644 (file)
index 0000000..c534e35
--- /dev/null
@@ -0,0 +1,4 @@
+# -*-python-*-
+
+Import ('env', 'collate')
+collate (title = 'LilyPond Examples')
diff --git a/input/lsr/advanced/AAA-intro-advanced.ly b/input/lsr/advanced/AAA-intro-advanced.ly
new file mode 100644 (file)
index 0000000..ce1540c
--- /dev/null
@@ -0,0 +1,21 @@
+\version "2.10.0"
+%% +.ly: Be the first .ly file for lys-to-tely.py.
+%% Better to make lys-to-tely.py include "introduction.texi" or
+%% other .texi documents too?
+
+\header{
+texidoc = #(string-append "
+@unnumbered Introduction
+
+This document shows all kinds of advanced snippets from the
+@uref{http://lsr@/.dsi@/.unimi@/.it,LilyPond Snippet Repository}.
+
+In the web version of this document, you can click on the file name
+or figure for each example to see the corresponding input file.
+
+This document is for LilyPond version 
+" (lilypond-version) "." )
+}
+
+% make sure .png  is generated.
+\lyrics {  " " }
diff --git a/input/lsr/advanced/Alternating-beam-directions.ly b/input/lsr/advanced/Alternating-beam-directions.ly
new file mode 100644 (file)
index 0000000..1298e8f
--- /dev/null
@@ -0,0 +1,31 @@
+\version "2.10.12"
+
+\header { texidoc = "
+<p>The eighth notes may be seemingly attached to different
+    beams, and the corresponding notes connected by ties. 
+    Such a situation may occur, for example, in the cello suites.
+" }
+
+wipeNote = {
+    \once \override NoteHead #'transparent = ##t
+    \once \override Stem #'transparent = ##t 
+}
+\layout { raggedright = ##t }
+
+
+\relative c''<< {
+    c8[~
+       \wipeNote
+       c8
+       c8~
+       \wipeNote
+       c
+       c]~
+    \wipeNote
+    c\noBeam
+}\\
+   { s8 c8 [ s c s c] }
+
+   
+>>
+
diff --git a/input/lsr/advanced/GNUmakefile b/input/lsr/advanced/GNUmakefile
new file mode 100644 (file)
index 0000000..43325ab
--- /dev/null
@@ -0,0 +1,16 @@
+
+depth = ../../../
+
+STEPMAKE_TEMPLATES=documentation texinfo tex
+LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc
+
+## Hmm, would this work?  No -- if we really want examples, move
+## to other dir (input/) comes to mind.
+## examples = font20 ancient-font
+## LOCALSTEPMAKE_TEMPLATES += ly mutopia
+
+EXTRA_DIST_FILES= 
+
+include $(depth)/make/stepmake.make
+
+TITLE=Advanced snippets
diff --git a/input/lsr/advanced/SConscript b/input/lsr/advanced/SConscript
new file mode 100644 (file)
index 0000000..f72bfff
--- /dev/null
@@ -0,0 +1,4 @@
+# -*-python-*-
+
+Import ('env', 'collate')
+collate (title = 'Advanced snippets')
diff --git a/input/lsr/trick/AAA-intro-trick.ly b/input/lsr/trick/AAA-intro-trick.ly
new file mode 100644 (file)
index 0000000..ae4b6b0
--- /dev/null
@@ -0,0 +1,21 @@
+\version "2.10.0"
+%% +.ly: Be the first .ly file for lys-to-tely.py.
+%% Better to make lys-to-tely.py include "introduction.texi" or
+%% other .texi documents too?
+
+\header{
+texidoc = #(string-append "
+@unnumbered Introduction
+
+This document shows all kinds of tricks from the
+@uref{http://lsr@/.dsi@/.unimi@/.it,LilyPond Snippet Repository}.
+
+In the web version of this document, you can click on the file name
+or figure for each example to see the corresponding input file.
+
+This document is for LilyPond version 
+" (lilypond-version) "." )
+}
+
+% make sure .png  is generated.
+\lyrics {  " " }
diff --git a/input/lsr/trick/Caesura-railtracks-with-fermata.ly b/input/lsr/trick/Caesura-railtracks-with-fermata.ly
new file mode 100644 (file)
index 0000000..d466fac
--- /dev/null
@@ -0,0 +1,25 @@
+\version "2.10.12"
+
+\header { texidoc = "
+A caesura is sometimes denoted with a double \"railtracks\" breath mark with a fermata sign positioned over the top of the railtracks. This snippet should present an optically pleasing combination of railtracks and a fermata.
+
+It works for lilypond 2.5 and above.
+" }
+
+{
+  \context Voice {
+    c''2.
+    % use some scheme code to construct the symbol
+    \override BreathingSign #'text = #(markup #:line 
+                                  (#:musicglyph "scripts.caesura"
+                                   #:translate (cons -1.75 1.6) 
+                                   #:musicglyph "scripts.ufermata"
+                                  ))
+    \breathe c''4
+    % set the breathe mark back to normal
+    \revert BreathingSign #'text
+    c''2. \breathe c''4
+    \bar "|."
+  }
+}
+
diff --git a/input/lsr/trick/GNUmakefile b/input/lsr/trick/GNUmakefile
new file mode 100644 (file)
index 0000000..a8293cb
--- /dev/null
@@ -0,0 +1,16 @@
+
+depth = ../../../
+
+STEPMAKE_TEMPLATES=documentation texinfo tex
+LOCALSTEPMAKE_TEMPLATES=lilypond ly lysdoc
+
+## Hmm, would this work?  No -- if we really want examples, move
+## to other dir (input/) comes to mind.
+## examples = font20 ancient-font
+## LOCALSTEPMAKE_TEMPLATES += ly mutopia
+
+EXTRA_DIST_FILES= 
+
+include $(depth)/make/stepmake.make
+
+TITLE=Trick snippets
diff --git a/input/lsr/trick/SConscript b/input/lsr/trick/SConscript
new file mode 100644 (file)
index 0000000..3845b7b
--- /dev/null
@@ -0,0 +1,4 @@
+# -*-python-*-
+
+Import ('env', 'collate')
+collate (title = 'Trick snippets')
diff --git a/input/lsr/trick/Tramlines-and-Feta-font-caesurae.ly b/input/lsr/trick/Tramlines-and-Feta-font-caesurae.ly
new file mode 100644 (file)
index 0000000..6d8fb0a
--- /dev/null
@@ -0,0 +1,66 @@
+\version "2.10.12"
+
+\header { texidoc = "
+This snippet shows a way to insert available Feta font symbols as caesurae and ways to create tramlines.  Normally a caesura is indicated by a pair of oblique lines lying through the top line of the staff, also called a fetura, tramlines, railroad tracks, or a cut-off.  LilyPond provides several alternatives.  A stylized version of tramlines is called caesura.  The normal tramline form, here called fetura, is not in the Feta font set, but can be constructed using the / character.
+" }
+
+\version "2.8.4"
+%{ This snippet shows a way to insert available Feta font symbols as caesurae
+ and ways to create tramlines.  Normally a caesura is indicated by a pair of
+ oblique lines lying through the top line of the staff, also called a fetura,
+ tramlines, railroad tracks, or a cut-off.  LilyPond provides several
+ alternatives.  A stylized version of tramlines is called caesura.  The normal
+ tramline form, here called fetura, is not in the Feta font set, but can be
+ constructed using the / character.%}
+                                               \relative c'' {
+\time 3/4
+e4 d e
+                                       % default
+e_\markup { "default - breathe" }
+       \breathe d e |
+                                       % rcomma
+       % by default, \breathe uses the rcomma, just as if saying:
+               \override BreathingSign   #'text =
+               #(make-musicglyph-markup "scripts.rcomma")
+e_\markup rcomma \breathe d e |
+                                       % lcomma
+               \override BreathingSign   #'text =
+               #(make-musicglyph-markup "scripts.lcomma")
+e_\markup lcomma \breathe d e |
+                                       % rvarcomma
+               \override BreathingSign   #'text =
+               #(make-musicglyph-markup "scripts.rvarcomma")
+e_\markup rvarcomma \breathe d e | \break
+                                       % lvarcomma
+               \override BreathingSign   #'text =
+               #(make-musicglyph-markup "scripts.lvarcomma")
+e_\markup lvarcomma \breathe d e |
+                                       % upbow or wedge
+               \override BreathingSign   #'text =
+                #(make-musicglyph-markup "scripts.upbow")
+e_\markup upbow \breathe d e |
+                                       % caesura
+               \override BreathingSign   #'text =
+                #(make-musicglyph-markup "scripts.caesura")
+e_\markup caesura \breathe d e |
+                                       % fetura, tramlines, or railroad tracks
+<<{
+\hideNotes a16 a a a a4 a \unHideNotes
+}\\{
+       \once\override TextScript   #'extra-offset = #'(4.0 . -2.7)
+e^\markup {\fontsize #2 {\bold "/" \hspace #-1.4 \bold "/"}}
+d_\markup { \hspace #-10 "fetura" } e |
+}>>
+       \once\override TextScript   #'font-name = #"cmb10"
+       \once\override TextScript   #'extra-offset = #'(4.0 . -2.2)
+e^\markup {\magnify #1.3 { "/" \hspace #-1.5 "/"}}
+       \once \override Score.SeparationItem #'padding = #4
+d_\markup { \hspace #-10 "fetura" } e |
+
+e d e \bar "||"
+                                               }%end relative
+                                       \layout{
+indent = 0.00\in
+                                       }%end layout
+
+
diff --git a/input/regression/+.ly b/input/regression/+.ly
deleted file mode 100644 (file)
index d19595b..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-\version "2.10.0"
-%% +.ly: Be the first .ly file for lys-to-tely.py.
-%% Better to make lys-to-tely.py include "introduction.texi" or
-%% other .texi documents too?
-
-
-\header{
-texidoc =
-
-#(string-append "@unnumbered Introduction
-
-This document presents proofs for
-LilyPond " (lilypond-version) ".  When the
-text corresponds with the shown notation, we consider LilyPond Officially
-BugFree (tm).  This document is intended for finding bugs and for
-documenting bugfixes.
-
-In the web version of this document, you can click on the file name 
-or figure for each example to see the corresponding input file.
-
-TODO: order of tests (file names!), test only one feature per test.
-Smaller and neater tests.
-")
-
-}
-
-%
-% make sure the .png is generated.
-%
-\lyrics { "(left blank intentionally)" }
-
diff --git a/input/regression/AAA-intro-regression.ly b/input/regression/AAA-intro-regression.ly
new file mode 100644 (file)
index 0000000..d19595b
--- /dev/null
@@ -0,0 +1,31 @@
+\version "2.10.0"
+%% +.ly: Be the first .ly file for lys-to-tely.py.
+%% Better to make lys-to-tely.py include "introduction.texi" or
+%% other .texi documents too?
+
+
+\header{
+texidoc =
+
+#(string-append "@unnumbered Introduction
+
+This document presents proofs for
+LilyPond " (lilypond-version) ".  When the
+text corresponds with the shown notation, we consider LilyPond Officially
+BugFree (tm).  This document is intended for finding bugs and for
+documenting bugfixes.
+
+In the web version of this document, you can click on the file name 
+or figure for each example to see the corresponding input file.
+
+TODO: order of tests (file names!), test only one feature per test.
+Smaller and neater tests.
+")
+
+}
+
+%
+% make sure the .png is generated.
+%
+\lyrics { "(left blank intentionally)" }
+
diff --git a/input/regression/auto-beam-beaming-override.ly b/input/regression/auto-beam-beaming-override.ly
new file mode 100644 (file)
index 0000000..2eb529a
--- /dev/null
@@ -0,0 +1,21 @@
+
+\header {
+
+
+  texidoc = "Autobeamer remembers @code{subdivideBeams} and other
+beaming pattern related functions at the start of an autobeam."
+
+}
+
+
+\version "2.11.12"
+\paper { ragged-right = ##t }
+{
+  \time 2/4
+  b16 b b b
+  b16 b b b
+  \set subdivideBeams = ##t
+  \set Score.beatLength = #(ly:make-moment 1 8)
+  b16 b b b
+  b16 b b b
+}
index 5c623f978ba6fd7da3efdbff64f281f74fcd7ee0..f709dabb7bdf899dda3d2f62511b7ad93bc85e7c 100644 (file)
@@ -23,7 +23,8 @@
       \makeClusters { <g a>8 <e a> <g a>4 }
       
       \override Glissando #'style = #'zigzag
-      f2 \glissando f'
+      \slurDashed
+      f2( \glissando f')
       \setEasyHeads
       f e 
     }
index 516fbb4acbfa469b6c0438d7948c70b245e6b71a..5b2b4f198c0bdf6689966d489ddd69fa2dc459ba 100644 (file)
@@ -5,7 +5,8 @@
 %%%
 %%% Testing utilities
 %%%
-
+#(use-modules (scm display-lily))
+#(memoize-clef-names supported-clefs)
 #(define (parse-lily-and-compute-lily-string chr port)
   (let ((lily-string (call-with-output-string
                       (lambda (out)
          (if result-info
              result-info "BUG")
           input output))
-
-
-     (make-music 'SequentialMusic 'void #t)
-    
-   ))))
+     (make-music 'SequentialMusic 'void #t)))))
          
 test = 
 #(define-music-function (parser location result-info strings) (string? pair?)
@@ -57,7 +54,6 @@ test =
 stderr of this run." 
 }
 
-
 %% Sequential music
 \test "" ##[ { { a b } { c d } } #]            % SequentialMusic
 \test "" ##[ << { a b } { c d } >> #]          % SimultaneousMusic
diff --git a/input/regression/glissando-broken.ly b/input/regression/glissando-broken.ly
new file mode 100644 (file)
index 0000000..b72e1c7
--- /dev/null
@@ -0,0 +1,14 @@
+\header {
+  texidoc = "If broken, Glissandi anticipate on the pitch of the next line."
+  
+}
+\version "2.11.13"
+\paper {
+  ragged-right = ##T }
+
+\relative c'' {
+  \override Glissando #'breakable = ##t 
+  d1 \glissando |
+  \break
+  c,1
+}
diff --git a/input/regression/hairpin-to-barline-mark.ly b/input/regression/hairpin-to-barline-mark.ly
new file mode 100644 (file)
index 0000000..488ae8b
--- /dev/null
@@ -0,0 +1,13 @@
+\version "2.11.12"
+\paper { ragged-right = ##t }
+\header {
+
+  texidoc = "hairpinToBarline is not confused by very long marks."
+
+}
+
+\new Staff \relative c' {
+  c1\< |
+  \mark "Very long mark"
+  c4\> c c c\! |
+}
diff --git a/input/regression/line-style.ly b/input/regression/line-style.ly
new file mode 100644 (file)
index 0000000..4d33f49
--- /dev/null
@@ -0,0 +1,24 @@
+\header {
+  texidoc = "Cover all line styles available"
+  
+}
+\version "2.11.13"
+\paper {
+  ragged-right = ##T
+}
+
+\relative c'' {
+  \override Glissando #'breakable = ##t
+
+  s2
+  d2 \glissando d'2
+  \once \override Glissando #'dash-fraction = #0.5
+  d,2 \glissando d'2
+  \override Glissando #'style = #'dotted-line
+  d,2 \glissando d'2
+
+  \override Glissando #'style = #'zigzag
+  d,2 \glissando d'2
+  \override Glissando #'style = #'trill
+  d,2 \glissando d'2
+}
diff --git a/input/regression/skiptypesetting-show-last.ly b/input/regression/skiptypesetting-show-last.ly
new file mode 100644 (file)
index 0000000..b0ebfda
--- /dev/null
@@ -0,0 +1,18 @@
+\header {
+
+  texidoc = "@code{showLastLength} will only show the last bit of a score"
+
+  }
+
+\version "2.10.12"
+
+showLastLength = R1*3
+\paper {
+  ragged-right = ##T
+}
+
+{
+  c1 c1
+  c1 c1
+  c1 c1
+}
diff --git a/input/regression/spacing-horizontal-skyline-grace.ly b/input/regression/spacing-horizontal-skyline-grace.ly
new file mode 100644 (file)
index 0000000..391d516
--- /dev/null
@@ -0,0 +1,32 @@
+\header{
+
+  texidoc = "Skyline horizontal spacing may fold non-adjacent columns
+together, but they still do not collide. In this case, the arpeggio
+and the barline do not collide."
+
+}
+
+\version "2.11.13"
+
+\paper
+{
+  ragged-right = ##t
+}
+
+\new Staff
+\relative c
+{
+  \override Score.NonMusicalPaperColumn #'stencil = #ly:paper-column::print 
+  \time 6/8
+  \clef bass
+  s2. |
+  \relative c <<
+    {
+      <des ges b des>4\arpeggio
+    }
+    \\
+    {
+      \acciaccatura ges,8 \voiceTwo ges4
+    }
+  >>
+}
diff --git a/input/regression/tablature-slide.ly b/input/regression/tablature-slide.ly
new file mode 100644 (file)
index 0000000..204c4c3
--- /dev/null
@@ -0,0 +1,16 @@
+\header
+{
+
+  texidoc = "Tab supports slides."
+}
+
+\version "2.11.10"
+\paper {
+  ragged-right = ##T
+}
+
+
+\relative \new TabVoice
+{
+  <c g'\harmonic> d\2\glissando e\2
+}
diff --git a/input/test/+.ly b/input/test/+.ly
deleted file mode 100644 (file)
index f19247d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-\version "2.10.0"
-%% +.ly: Be the first .ly file for lys-to-tely.py.
-%% Better to make lys-to-tely.py include "introduction.texi" or
-%% other .texi documents too?
-
-\header{
-texidoc = #(string-append "
-@section Introduction
-
-This document shows all kinds of tips and tricks, from simple to
-advanced.  You may also find dirty tricks, or the very very
-latest features that have not been documented or fully implemented
-yet. 
-
-In the web version of this document, you can click on the file name
-or figure for each example to see the corresponding input file.
-
-This document is for LilyPond version 
-" (lilypond-version) ".")
-}
-
-% make sure .png  is generated.
-\lyrics {  "(left blank intentionally)" }
diff --git a/input/test/AAA-intro-test.ly b/input/test/AAA-intro-test.ly
new file mode 100644 (file)
index 0000000..b0abda4
--- /dev/null
@@ -0,0 +1,23 @@
+\version "2.10.0"
+%% +.ly: Be the first .ly file for lys-to-tely.py.
+%% Better to make lys-to-tely.py include "introduction.texi" or
+%% other .texi documents too?
+
+\header{
+texidoc = #(string-append "
+@unnumbered Introduction
+
+This document shows all kinds of tips and tricks, from simple to
+advanced.  You may also find dirty tricks, or the very very
+latest features that have not been documented or fully implemented
+yet. 
+
+In the web version of this document, you can click on the file name
+or figure for each example to see the corresponding input file.
+
+This document is for LilyPond version 
+" (lilypond-version) ".")
+}
+
+% make sure .png  is generated.
+\lyrics {  "(left blank intentionally)" }
index 323fa7d6f3d23764d361df92707fbe7f97772eee..cbc1478608fba2bc42ddf31c34ae5a5b59157da4 100644 (file)
@@ -397,8 +397,8 @@ Accidental_placement::calc_positioning_done (SCM smob)
   Real padding = robust_scm2double (me->get_property ("padding"), 0.2);
 
   Skyline left_skyline = head_ape->left_skyline_;
-  left_skyline.raise (-robust_scm2double (me->get_property ("right-padding"), 0))
-;
+  left_skyline.raise (-robust_scm2double (me->get_property ("right-padding"), 0));
+  
   /*
     Add accs entries right-to-left.
   */
@@ -442,9 +442,10 @@ Accidental_placement::calc_positioning_done (SCM smob)
   me->flush_extent_cache (X_AXIS);
   me->set_property ("X-extent", scm_width);
 
-  for (vsize i = apes.size (); i--;)
-    delete apes[i];
+  junk_pointers (apes);
 
+  delete head_ape;
+  
   return SCM_BOOL_T;
 }
 
index 46db4f4f2f0bf51af1694c30dfc0fe3827d014e2..3bfd1b816d1e91f15f7257979381efde7df3c53d 100644 (file)
@@ -66,13 +66,16 @@ Accidental_interface::accurate_boxes (Grob *me, Grob **common)
   vector<Box> boxes;
 
   bool parens = to_boolean (me->get_property ("parenthesized"));
+  if (!me->is_live ())
+    return boxes;
 
   SCM scm_style = me->get_property ("style");
   if (!scm_is_symbol (scm_style)
       && !to_boolean (me->get_property ("restore-first"))
       && !parens)
     {
-      Rational alteration = ly_scm2rational (me->get_property ("alteration"));
+      Rational alteration
+       = robust_scm2rational (me->get_property ("alteration"), 0);
       if (alteration == FLAT_ALTERATION)
        {
          Box stem = b;
@@ -151,7 +154,7 @@ Accidental_interface::print (SCM smob)
   if (!scm_is_string (glyph_name))
     {
       me->warning (_f ("Could not find glyph-name for alteration %s",
-                      ly_scm2rational (alt).to_string ().c_str ()));
+                      ly_scm_write_string (alt).c_str ()));
       return SCM_EOL;
     }
   
index 0e4e2d949b8006bfb899909b10837a1d9176e0f5..e2fdcc9595cb38dcf50aa7b46155b29efe3ab705 100644 (file)
@@ -149,7 +149,7 @@ Ambitus_engraver::finalize ()
                                start_key_sig_);
 
          Rational sig_alter = (handle != SCM_BOOL_F)
-           ? ly_scm2rational (scm_cdr (handle)) : Rational (0);
+           ? robust_scm2rational (scm_cdr (handle), Rational (0)) : Rational (0);
 
          if (sig_alter == p.get_alteration ())
            {
index 120313ef6455c2505e7af243992a8960590eb1df..353a26f270e272a2afc8c57389687b2686db941b 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "audio-staff.hh"
 
-#include "midi-item.hh"
+#include "midi-chunk.hh"
 #include "midi-stream.hh"
 #include "midi-walker.hh"
 
@@ -32,6 +32,8 @@ Audio_staff::output (Midi_stream &midi_stream, int channel)
   Midi_walker i (this, &midi_track, channel);
   for (; i.ok (); i++)
     i.process ();
+
+  i.finalize ();
   
   midi_stream.write (midi_track);
 }
index 4ff8d9d2b7c88e7632907e0651f02483ac90c55e..d2cef6ae1693ecb2bd9bf8a928958b9978a7fb4a 100644 (file)
@@ -68,15 +68,17 @@ private:
   Moment beam_start_moment_;
   Moment beam_start_location_;
 
-  bool subdivide_beams_;
-  Moment beat_length_;
-
   // We act as if beam were created, and start a grouping anyway.
   Beaming_pattern *grouping_;
   SCM beam_settings_;
 
   Beaming_pattern *finished_grouping_;
 
+
+  Beaming_options beaming_options_;
+  Beaming_options finished_beaming_options_;
+  
+  
   void check_bar_property ();
 };
 
@@ -207,6 +209,7 @@ Auto_beam_engraver::begin_beam ()
 
   stems_ = new vector<Item*>;
   grouping_ = new Beaming_pattern ();
+  beaming_options_.from_context (context ());
   beam_settings_ = updated_grob_properties (context (), ly_symbol2scm ("Beam"));
 
   beam_start_moment_ = now_mom ();
@@ -242,6 +245,7 @@ Auto_beam_engraver::end_beam ()
        {
          announce_end_grob (finished_beam_, SCM_EOL);
          finished_grouping_ = grouping_;
+         finished_beaming_options_ = beaming_options_;
        }
       delete stems_;
       stems_ = 0;
@@ -260,7 +264,7 @@ Auto_beam_engraver::typeset_beam ()
       if (!finished_beam_->get_bound (RIGHT))
        finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
       
-      finished_grouping_->beamify (context ());
+      finished_grouping_->beamify (finished_beaming_options_);
       Beam::set_beaming (finished_beam_, finished_grouping_);
       finished_beam_ = 0;
 
index 288a47494149b9077187d17902b224a791905be3..51569b0e270b6582366f4e3cf0b7bb3412a97d9f 100644 (file)
@@ -46,9 +46,9 @@ protected:
   /// moment (global time) where beam started.
   Moment beam_start_mom_;
 
-  bool subdivide_beams_;
-  Moment beat_length_;
-
+  Beaming_options beaming_options_;
+  Beaming_options finished_beaming_options_;
+  
   void typeset_beam ();
   void set_melisma (bool);
 
@@ -135,13 +135,17 @@ Beam_engraver::process_music ()
       beam_start_location_ = mp;
       beam_start_mom_ = now_mom ();
 
+      beaming_options_.from_context (context ());
       beam_info_ = new Beaming_pattern;
       /* urg, must copy to Auto_beam_engraver too */
     }
 
   typeset_beam ();
   if (stop_ev_ && beam_)
-    announce_end_grob (beam_, stop_ev_->self_scm ());
+    {
+      announce_end_grob (beam_, stop_ev_->self_scm ());
+      
+    }
 }
 
 void
@@ -151,8 +155,8 @@ Beam_engraver::typeset_beam ()
     {
       if (!finished_beam_->get_bound (RIGHT))
        finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
-         
-      finished_beam_info_->beamify (context ());
+      
+      finished_beam_info_->beamify (finished_beaming_options_);
       Beam::set_beaming (finished_beam_, finished_beam_info_);
 
       delete finished_beam_info_;
@@ -179,7 +183,8 @@ Beam_engraver::stop_translation_timestep ()
     {
       finished_beam_ = beam_;
       finished_beam_info_ = beam_info_;
-
+      finished_beaming_options_ = beaming_options_;
+      
       stop_ev_ = 0;
       beam_ = 0;
       beam_info_ = 0;
index 542ce8e455c61f6191a48c7a4d040948abd61285..ba5b8a4a72dee519ba9e1f254c61523e698cc6f7 100644 (file)
@@ -116,28 +116,24 @@ Beaming_pattern::de_grace ()
 }
 
 void
-Beaming_pattern::beamify (Context *context)
+Beaming_pattern::beamify (Beaming_options const &options)
 {
   if (infos_.size () <= 1)
     return;
 
   if (infos_[0].start_moment_.grace_part_)
     de_grace ();
-  
-  bool subdivide_beams = to_boolean (context->get_property ("subdivideBeams"));
-  Moment beat_length = robust_scm2moment (context->get_property ("beatLength"), Moment (1, 4));
-  Moment measure_length = robust_scm2moment (context->get_property ("measureLength"), Moment (1, 4));
 
   if (infos_[0].start_moment_ < Moment (0))
     for (vsize i = 0; i < infos_.size(); i++)
-      infos_[i].start_moment_ += measure_length;
+      infos_[i].start_moment_ += options.measure_length_;
   
-  SCM grouping = context->get_property ("beatGrouping");
   Moment measure_pos (0);
   
   vector<Moment> group_starts;
   vector<Moment> beat_starts;
-  
+
+  SCM grouping = options.grouping_;
   while (measure_pos <= infos_.back().start_moment_)
     {
       int count = 2;
@@ -150,9 +146,9 @@ Beaming_pattern::beamify (Context *context)
       group_starts.push_back (measure_pos);
       for (int i = 0; i < count; i++)
        {
-         beat_starts.push_back (measure_pos + beat_length * i);
+         beat_starts.push_back (measure_pos + options.beat_length_ * i);
        }
-      measure_pos += beat_length * count;
+      measure_pos += options.beat_length_ * count;
     }
    
   vsize j = 0;
@@ -163,16 +159,19 @@ Beaming_pattern::beamify (Context *context)
             && group_starts[j+1] <= infos_[i].start_moment_)
        j++;
 
-      infos_[i].group_start_ = group_starts[j];
-      infos_[i].beat_length_ = beat_length;  
+      if (j < group_starts.size ())
+       infos_[i].group_start_ = group_starts[j];
+      
+      infos_[i].beat_length_ = options.beat_length_;  
       while (k + 1 < beat_starts.size() 
             && beat_starts[k+1] <= infos_[i].start_moment_)
        k++;
 
-      infos_[i].beat_start_ = beat_starts[k];
+      if (k < beat_starts.size())
+       infos_[i].beat_start_ = beat_starts[k];
     }
   
-  beamify (subdivide_beams);
+  beamify (options.subdivide_beams_);
 }
 
 
@@ -234,3 +233,18 @@ Beaming_pattern::beamlet_count (int i, Direction d) const
 {
   return infos_.at (i).beam_count_drul_[d];
 }
+
+void
+Beaming_options::from_context (Context *context)
+{
+  grouping_ = context->get_property ("beatGrouping");
+  subdivide_beams_ = to_boolean (context->get_property ("subdivideBeams"));
+  beat_length_ = robust_scm2moment (context->get_property ("beatLength"), Moment (1, 4));
+  measure_length_ = robust_scm2moment (context->get_property ("measureLength"), Moment (1, 4));
+}
+
+Beaming_options::Beaming_options ()
+{
+  grouping_ = SCM_EOL;
+  subdivide_beams_ = false;
+}
index 9eaa3d6c6e39868f1952ee223884a45a6282f640..33426c0b3f3b0ca5bcd24bd5f38263431b9013fe 100644 (file)
@@ -264,7 +264,7 @@ Constrained_breaking::min_system_count (vsize start, vsize end)
 int
 Constrained_breaking::max_system_count (vsize start, vsize end)
 {
-  vsize brk = (end >= start_.size ()) ? breaks_.size () - 1 : starting_breakpoints_[end];
+  vsize brk = (end >= start_.size ()) ? breaks_.size () : starting_breakpoints_[end];
   return brk - starting_breakpoints_[start];
 }
 
index 15bd3c5fb84a0a8c03deae29d0a9119fe8bf3a05..7e5ea8ae2ac0c83ee84e30de36f38f8d10590e34 100644 (file)
@@ -461,18 +461,8 @@ Context::add_alias (SCM sym)
 }
 
 void
-Context::internal_set_property (SCM sym, SCM val
-#ifndef NDEBUG
-                               , char const *file, int line, char const *fun
-#endif
-                               )
+Context::internal_set_property (SCM sym, SCM val)
 {
-#ifndef NDEBUG
-  (void) file;
-  (void) line;
-  (void) fun;
-#endif
-
   if (do_internal_type_checking_global)
     assert (type_check_assignment (sym, val, ly_symbol2scm ("translation-type?")));
 
index 2104235387883f64c54380d22a63c7d9b1a797eb..caef2ce4c4231a8fb0d22893be4160a5504f44a5 100644 (file)
@@ -24,6 +24,7 @@
 #include "stream-event.hh"
 #include "warn.hh"
 #include "spanner.hh"
+#include "text-interface.hh"
 
 #include "translator.icc"
 
@@ -252,13 +253,9 @@ Dynamic_engraver::process_music ()
              context ()->set_property ((start_type
                                         + "Spanner").c_str (), SCM_EOL);
              s = get_property ((start_type + "Text").c_str ());
-             /*
-               FIXME: use get_markup () to check type.
-             */
-             if (scm_is_string (s) || scm_is_pair (s))
+             if (Text_interface::is_markup (s))
                {
-                 cresc_->set_property ("edge-text",
-                                       scm_cons (s, scm_from_locale_string ("")));
+                 cresc_->set_property ("text", s);
                  context ()->set_property ((start_type + "Text").c_str (),
                                            SCM_EOL);
                }
@@ -336,10 +333,18 @@ Dynamic_engraver::typeset_all ()
       if (!finished_cresc_->get_bound (RIGHT)
          || use_bar)
        {
-         Grob *column_bound = unsmob_grob (use_bar
-                                           ? get_property ("currentCommandColumn")
-                                           : get_property ("currentMusicalColumn"));
-           
+                 
+         Grob *column_bound = 0;
+         if (use_bar)
+           {
+             column_bound = unsmob_grob (get_property ("breakableSeparationItem"));
+           }
+         
+         if (!column_bound)
+           column_bound = unsmob_grob (use_bar
+                                       ? get_property ("currentCommandColumn")
+                                       : get_property ("currentMusicalColumn"));
+         
          finished_cresc_->set_bound (RIGHT, script_
                                      ? script_
                                      : column_bound);
diff --git a/lily/dynamic-text-spanner.cc b/lily/dynamic-text-spanner.cc
deleted file mode 100644 (file)
index e6a9f33..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-  dynamic-text-spanner.cc -- implement Text_spanner
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 2000--2007 Jan Nieuwenhuizen <janneke@gnu.org>
-
-  Revised over good by Han-Wen.
-*/
-
-#include "text-interface.hh"
-#include "text-spanner.hh"
-#include "line-spanner.hh"
-#include "spanner.hh"
-#include "font-interface.hh"
-#include "dimensions.hh"
-#include "output-def.hh"
-#include "warn.hh"
-#include "paper-column.hh"
-
-class Dynamic_text_spanner
-{
-public:
-  DECLARE_SCHEME_CALLBACK (print, (SCM));
-  DECLARE_GROB_INTERFACE();
-};
-
-/*
-  This is a partial C&P from text-spanner.cc
-
-  Dynamic_text_spanner is similar, but
-
-  * does not require bracket functionality.
-
-  * should make room for spanning points (mf/f/mp texts).
-
-  * In the future, we should  support
-
-  cresc - - - - poco - - - a - - - - poco - - -
-
-  as well
-
-
-  The cut & paste is rather inelegant, but text-spanner was a failed
-  and buggy attempt at being generic.
-*/
-MAKE_SCHEME_CALLBACK (Dynamic_text_spanner, print, 1);
-SCM
-Dynamic_text_spanner::print (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-  Spanner *spanner = dynamic_cast<Spanner *> (me);
-
-  Grob *common = spanner->get_bound (LEFT)
-    ->common_refpoint (spanner->get_bound (RIGHT), X_AXIS);
-  Output_def *layout = me->layout ();
-
-  Interval span_points;
-  Drul_array<bool> broken;
-  Direction d = LEFT;
-  do
-    {
-      Item *b = spanner->get_bound (d);
-      broken[d] = b->break_status_dir () != CENTER;
-
-      if (broken[d])
-       {
-         if (d == LEFT)
-           span_points[d] = spanner->get_broken_left_end_align ();
-         else
-           span_points[d] = b->relative_coordinate (common, X_AXIS);
-       }
-      else
-       {
-         Real pad = 0.0;
-         Real encl = d;
-         if (b->internal_has_interface (ly_symbol2scm ("dynamic-interface")))
-           {
-             pad = robust_scm2double (me->get_property ("bound-padding"), 0.0);
-             encl = -d;
-           }
-
-         /*
-           ugh - a special case.
-
-           FIXME: this fixed an issue, but need to have this issue in
-           the issue tracker.
-
-           This fix doesn't quite work: it should only do this if the
-           right bound has a trill too.
-          */
-#if 0
-         if (d == RIGHT && me->get_property ("style") == ly_symbol2scm ("trill"))
-           {
-             pad = 2.0;
-             encl = LEFT;
-           }
-#endif
-         
-         Interval ext = b->extent (common, X_AXIS);
-         span_points[d] = -d * pad
-           + robust_relative_extent (b, common, X_AXIS)
-           .linear_combination (encl);
-       }
-    }
-  while (flip (&d) != LEFT);
-
-  SCM properties = Font_interface::text_font_alist_chain (me);
-  SCM edge_text = me->get_property ("edge-text");
-  Drul_array<Stencil> edge;
-  if (scm_is_pair (edge_text))
-    {
-      Direction d = LEFT;
-      do
-       {
-         if (broken[d])
-           continue;
-
-         SCM text = index_get_cell (edge_text, d);
-
-         if (Text_interface::is_markup (text))
-           edge[d] = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (), properties, text));
-
-         if (!edge[d].is_empty ())
-           edge[d].align_to (Y_AXIS, CENTER);
-       }
-      while (flip (&d) != LEFT);
-    }
-
-  Stencil m;
-  do
-    {
-      Interval ext = edge[d].extent (X_AXIS);
-      Real pad = robust_scm2double (me->get_property ("bound-padding"), 0.0);
-      if (!ext.is_empty ())
-       {
-         edge[d].translate_axis (span_points[d], X_AXIS);
-         m.add_stencil (edge[d]);
-         span_points[d] += -d * (ext[-d] + pad);
-       }
-    }
-  while (flip (&d) != LEFT);
-
-  if (!span_points.is_empty ()
-      && span_points.length () > robust_scm2double (me->get_property ("dash-period"), 0.0))
-    {
-      Stencil l = Line_spanner::line_stencil (me,
-                                             Offset (span_points[LEFT], 0),
-                                             Offset (span_points[RIGHT], 0));
-      m.add_stencil (l);
-    }
-  m.translate_axis (- me->relative_coordinate (common, X_AXIS), X_AXIS);
-  return m.smobbed_copy ();
-}
-
-ADD_INTERFACE (Dynamic_text_spanner,
-              "A text spanner for crescendo texts",
-              
-              "bound-padding "
-              "dash-period "
-              "dash-fraction "
-              "edge-text "
-              "style "
-              "thickness");
-
diff --git a/lily/freetype-error.cc b/lily/freetype-error.cc
new file mode 100644 (file)
index 0000000..6836711
--- /dev/null
@@ -0,0 +1,42 @@
+/* 
+  freetype-error.cc -- implement freetype error messages
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2007 Han-Wen Nienhuys <hanwen@lilypond.org>
+  
+*/
+
+#include "freetype.hh"
+
+#undef __FTERRORS_H__                                           
+#define FT_ERRORDEF( e, v, s )  { e, s },                       
+#define FT_ERROR_START_LIST     {                               
+#define FT_ERROR_END_LIST       { 0, 0 } };                     
+                                                                         
+const struct Freetype_error_message
+{                                                               
+  int          err_code;                                        
+  const char*  err_msg;
+} ft_errors[] =                                                 
+                                                                         
+#include <freetype/fterrors.h>
+
+  ;
+
+
+#include <string>
+
+string
+freetype_error_string (int code)
+{
+  for (Freetype_error_message const *p = ft_errors;
+       p->err_msg; p ++)
+    {
+      if (p->err_code == code)
+       return p->err_msg;
+    }
+
+  return "<unknown error>"; 
+}
+  
index c52bc54ece2a7b7e9391d2357809a3fff536083c..cbc3b605ed13c9be41229f04db1119f952b772f4 100644 (file)
@@ -10,6 +10,7 @@
 #include "config.hh"
 
 #include <cstdio>
+#include <ctype.h>
 #include <cstring>  /* memset */
 using namespace std;
 
@@ -24,6 +25,7 @@ using namespace std;
 #include "file-path.hh"
 #include "relocate.hh"
 #include "file-name.hh"
+#include "string-convert.hh"
 
 LY_DEFINE (ly_find_file, "ly:find-file",
           1, 0, 0, (SCM name),
@@ -393,3 +395,122 @@ LY_DEFINE (ly_truncate_list_x, "ly:truncate-list!",
   return lst;
 }
 
+string
+format_single_argument (SCM arg, int precision)
+{
+  if (scm_is_integer (arg) && scm_exact_p (arg) == SCM_BOOL_T)
+    return (String_convert::int_string (scm_to_int (arg)));
+  else if (scm_is_number (arg))
+    {
+      Real val = scm_to_double (arg);
+
+      if (isnan (val) || isinf (val))
+       {
+         warning (_ ("Found infinity or nan in output. Substituting 0.0"));
+         return ("0.0");
+         if (strict_infinity_checking)
+           abort();
+       }
+      else
+       return (String_convert::form_string ("%.*lf", precision, val));
+    }
+  else if (scm_is_string (arg))
+    return (ly_scm2string (arg));
+  else if (scm_is_symbol (arg))
+    return (ly_symbol2string (arg));
+  else
+    {
+      ly_progress (scm_from_locale_string ("Unsupported SCM value for format: ~a"),
+                  scm_list_1 (arg));
+    }
+  
+    
+  return "";    
+}
+
+LY_DEFINE (ly_format, "ly:format",
+          1, 0, 1, (SCM str, SCM rest),
+          "LilyPond specific format, supporting ~a ~[0-9]f.")
+{
+  SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
+
+  string format = ly_scm2string (str);
+  vector<string> results;
+
+  vsize i = 0;
+  while (i < format.size())
+    {
+      vsize tilde = format.find ('~', i);
+
+      results.push_back (format.substr (i, (tilde-i)));
+
+      if (tilde == NPOS)
+       break ;
+      
+      tilde ++;
+
+      char spec = format.at (tilde ++);
+      if (spec == '~')
+       results.push_back ("~");
+      else
+       {
+         if (!scm_is_pair (rest))
+           {
+             programming_error (string (__FUNCTION__) 
+                                + ": not enough arguments for format.");
+             return ly_string2scm ("");
+           }
+         
+         SCM arg = scm_car (rest);
+         rest = scm_cdr (rest);
+
+         int precision = 8;
+         
+         if (spec == '$')
+           precision = '2';
+         else if (isdigit (spec))
+           {
+             precision = spec - '0';
+             spec = format.at (tilde ++);
+           }
+                  
+         if (spec == 'a' || spec == 'f')
+           results.push_back (format_single_argument (arg, precision));
+         else if (spec == 'l')
+           {
+             SCM s = arg;
+             for (; scm_is_pair (s); s = scm_cdr (s))
+               {
+                 results.push_back (format_single_argument (scm_car (s), precision));
+                 if (scm_cdr (s) != SCM_EOL)
+                   results.push_back (" ");
+               }
+
+             if (s != SCM_EOL)
+               results.push_back (format_single_argument (s, precision));
+               
+           }
+       }
+
+      i = tilde;
+    }
+
+  if (scm_is_pair (rest))
+    programming_error (string (__FUNCTION__)
+                      + ": too many  arguments");
+
+  vsize len = 0;
+  for (vsize i = 0; i < results.size(); i++)
+    len += results[i].size();
+  
+  char *result = (char*) scm_malloc (len + 1);
+  char *ptr = result;
+  for (vsize i = 0; i < results.size(); i++)
+    {
+      strncpy (ptr, results[i].c_str (), results[i].size());
+      ptr += results[i].size();
+    }
+  *ptr = '\0';
+    
+  return scm_take_locale_stringn (result, len);
+}
index ff918886770bc2547fbaa16c6c83cee9e9c4cb59..3a88ef888cda5a8d30c3bd782e7f3fb0701f582b 100644 (file)
 
 #include "translator.icc"
 
-/**
-   Create line-spanner grobs for glissandi lines that connect note
-   heads.
-*/
 class Glissando_engraver : public Engraver
 {
 public:
@@ -109,7 +105,11 @@ Glissando_engraver::finalize ()
 
 ADD_ACKNOWLEDGER (Glissando_engraver, rhythmic_head);
 ADD_TRANSLATOR (Glissando_engraver,
-               /* doc */ "Engrave a glissandi",
-               /* create */ "Glissando",
-               /* read */ "followVoice",
+               /* doc */ "",
+               /* create */
+               "Glissando",
+
+               /* read */
+               "",
+
                /* write */ "");
index 5e49d8e8ec4747e765c567d9629073bc68bd8c17..b62a6bb9f9f94f815221f2c1f7819d0276e24ec0 100644 (file)
@@ -53,7 +53,13 @@ Grob::get_property_alist_chain (SCM def) const
 
 extern void check_interfaces_for_property (Grob const *me, SCM sym);
 
-#ifndef NDEBUG
+#if 0
+
+/*
+  We can't change signatures depending on NDEBUG, since NDEBUG comes
+  over the command line and may be different per .cc file.  This
+  should be done through the macro expansion of get_property().
+ */
 void
 Grob::internal_set_property (SCM sym, SCM v, char const *file, int line, char const *fun)
 {
@@ -82,6 +88,8 @@ Grob::internal_set_property (SCM sym, SCM v, char const *file, int line, char co
                             sym, v, SCM_UNDEFINED));
 }
 #else
+
+
 void
 Grob::internal_set_property (SCM sym, SCM v)
 {
index c5f04d052fbe5e101faaf9b28a68c5d57fe653f0..d1318ba95481fac4d743fe164dba7c5341b41de8 100644 (file)
@@ -128,7 +128,7 @@ Grob::get_print_stencil () const
          Real x = scm_to_double (scm_cadr (rot));
          Real y = scm_to_double (scm_caddr (rot));
 
-         retval.rotate (angle, Offset (x, y));
+         retval.rotate_degrees (angle, Offset (x, y));
        }
 
       /* color support... see interpret_stencil_expression () for more... */
@@ -446,7 +446,7 @@ Grob::maybe_pure_extent (Grob *refp, Axis a, bool pure, int start, int end)
 }
 
 Interval_t<int>
-Grob::spanned_rank_iv ()
+Grob::spanned_rank_iv () const
 {
   return Interval_t<int> (-1, 0);
 }
index ee971d7cad75f523ffd901f3fc24c4a38b5b91dc..617b1ace32ad706392b45bf797048eafd57ef7a8 100644 (file)
@@ -17,7 +17,7 @@ using namespace std;
 #include "international.hh"
 #include "main.hh"
 #include "source-file.hh"
-#include "source.hh"
+#include "sources.hh"
 #include "warn.hh"
 
 #ifndef YY_BUF_SIZE
index 134c4488d5e4a986c0cb3ef317fe2e57d330b19d..4a9eae6198c7eb8ab61b0a8cbea846e6953641e0 100644 (file)
 #include "moment.hh"
 #include "lily-proto.hh"
 
+struct Beaming_options
+{
+  SCM grouping_;
+  bool subdivide_beams_;
+  Moment beat_length_;
+  Moment measure_length_;
+
+  Beaming_options ();
+  void from_context (Context*);  
+};
+
 struct Beam_rhythmic_element
 {
   Moment start_moment_;
@@ -38,7 +49,7 @@ class Beaming_pattern
 public:
   Beaming_pattern ();
   
-  void beamify (Context*);
+  void beamify (Beaming_options const&);
   void de_grace ();
   void add_stem (Moment d, int beams);
   int beamlet_count (int idx, Direction d) const;
index 2cb0280ea128cb59076f7ce1d07463358fd007c2..39babf7b669751f9c2204b0701ace74159c621bf 100644 (file)
@@ -85,11 +85,7 @@ public:
   Context *where_defined (SCM name_sym, SCM *value) const;
   void unset_property (SCM var_sym);
 
-#ifndef NDEBUG
-  void internal_set_property (SCM var_sym, SCM value, char const *file, int line, char const *fun);
-#else
   void internal_set_property (SCM var_sym, SCM value);
-#endif
 
   Context *create_context (Context_def *, string, SCM);
   DECLARE_LISTENER (create_context_from_event);
index 2297d6c1d8bf716f046371715215613d6fd33980..1b6dad26e8962ff795b4b47758a7da701a11fe35 100644 (file)
@@ -19,5 +19,7 @@ extern FT_Library freetype2_library;
 
 FT_Face open_ft_face (string str);
 
+string freetype_error_string (int code);
+
 #endif /* FREETYPE_HH */
 
index 5876d4497d8c0d582f2af98ed5bede9527b00570..3b5f19d97e77f8db8af88a799d801f4623450e71 100644 (file)
@@ -84,12 +84,7 @@ public:
   SCM internal_get_object (SCM symbol) const;
   void internal_set_object (SCM sym, SCM val);
   void internal_del_property (SCM symbol);
-
-#ifndef NDEBUG
-  void internal_set_property (SCM sym, SCM val, char const *file, int line, char const *fun);
-#else
   void internal_set_property (SCM sym, SCM val);
-#endif
 
   /* messages */  
   void warning (string) const;
@@ -131,7 +126,7 @@ public:
   Grob *get_parent (Axis a) const;
   void fixup_refpoint ();
 
-  virtual Interval_t<int> spanned_rank_iv ();
+  virtual Interval_t<int> spanned_rank_iv () const;
 };
 
 /* smob utilities */
index d00541a8bf26fe35a19e90f43f03515de50eaadd..fa5092e27ad38e60e805312bd97d292fe93859dd 100644 (file)
@@ -38,7 +38,7 @@ public:
   virtual System *get_system () const;
   virtual Paper_column *get_column () const;
   virtual void handle_prebroken_dependencies ();
-  virtual Interval_t<int> spanned_rank_iv ();
+  virtual Interval_t<int> spanned_rank_iv () const;
   DECLARE_GROB_INTERFACE();
 protected:
   virtual void discretionary_processing ();
@@ -46,4 +46,6 @@ protected:
   virtual void derived_mark () const;
 };
 
+Interval_t<Moment> spanned_time_interval (Item *l, Item *r);
+
 #endif
index dec12d19bdf1942476c2f810d8159e342c3be082..555d65bfd3a6aa116923ec46456796184f582f37 100644 (file)
@@ -169,7 +169,11 @@ ly_add_function_documentation (SCM proc, char const *fname,
 #define del_property(x) internal_del_property (ly_symbol2scm (x))
 
 #ifndef NDEBUG
-#define set_property(x, y) internal_set_property (ly_symbol2scm (x), y, __FILE__, __LINE__, __FUNCTION__)
+/*
+  TODO: include modification callback support here, perhaps
+  through intermediate Grob::instrumented_set_property( .. __LINE__ ).
+ */
+#define set_property(x, y) internal_set_property (ly_symbol2scm (x), y)  
 #else
 #define set_property(x, y) internal_set_property (ly_symbol2scm (x), y)
 #endif
index 6eef555bf599cef61ca47dc41299d06e31cf4551..6f21a29b03c172e53c7c720a9628027a556a7e06 100644 (file)
@@ -32,7 +32,7 @@
     A ly_B2A (B b);  */
 
 SCM ly_last (SCM list);
-SCM ly_write2scm (SCM s);
+string ly_scm_write_string (SCM s);
 SCM ly_deep_copy (SCM);
 SCM ly_truncate_list (int k, SCM lst);
 
@@ -65,6 +65,7 @@ Drul_array<bool> robust_scm2booldrul (SCM, Drul_array<bool>);
 Interval robust_scm2interval (SCM, Drul_array<Real>);
 Offset robust_scm2offset (SCM, Offset);
 string robust_scm2string (SCM, string);
+Rational robust_scm2rational (SCM, Rational);
 
   
 SCM ly_quote_scm (SCM s);
@@ -81,6 +82,8 @@ SCM ly_hash2alist (SCM tab);
 SCM ly_hash_table_keys (SCM tab);
 
 SCM ly_assoc_prepend_x (SCM alist, SCM key, SCM val);
+inline bool ly_is_fraction (SCM x) { return SCM_FRACTIONP(x) || scm_is_integer (x); }
+    
 inline bool ly_is_list (SCM x) { return SCM_NFALSEP (scm_list_p (x)); }
 inline bool ly_is_procedure (SCM x) { return SCM_NFALSEP (scm_procedure_p (x)); }
 inline bool ly_is_port (SCM x) { return SCM_NFALSEP (scm_port_p (x)); }
index 56c80f56654ec7fb67b4dbf25d278b8308084d39..fca8aa372f9a553e1c8541ad83d0fce18caadf65 100644 (file)
@@ -90,6 +90,7 @@ class Mensural_ligature_engraver;
 class Midi_chunk;
 class Midi_duration;
 class Midi_dynamic;
+class Midi_event;
 class Midi_header;
 class Midi_instrument;
 class Midi_item;
index 7746a735e8ed9c0c8a297ff393bb200149f1345a..fa94b9f71185fc5813bce3229b8f0e09e64ede18 100644 (file)
@@ -16,6 +16,12 @@ struct Line_interface
 {
   static Stencil line (Grob *me, Offset from, Offset to);
   DECLARE_GROB_INTERFACE();
+  static Stencil make_zigzag_line (Grob *me,
+                                  Offset from,
+                                  Offset to);
+  static Stencil make_trill_line (Grob *me,
+                                Offset from,
+                                Offset to);
   static Stencil make_dashed_line (Real th, Offset from, Offset to, Real, Real);
   static Stencil make_line (Real th, Offset from, Offset to);
   static Stencil make_arrow (Offset beg, Offset end, Real thick,
diff --git a/lily/include/midi-chunk.hh b/lily/include/midi-chunk.hh
new file mode 100644 (file)
index 0000000..fc41a54
--- /dev/null
@@ -0,0 +1,75 @@
+/* 
+  midi-chunk.hh -- declare  Midi_chunk
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2007 Han-Wen Nienhuys <hanwen@lilypond.org>
+  
+*/
+
+#ifndef MIDI_CHUNK_HH
+#define MIDI_CHUNK_HH
+
+#include "lily-proto.hh"
+#include "virtual-methods.hh"
+#include "std-vector.hh"
+
+
+/**
+   timed MIDI event
+*/
+class Midi_event
+{
+public:
+  Midi_event (int delta, Midi_item *midi);
+
+  int delta_ticks_;
+  Midi_item *midi_;
+  string to_string () const;
+};
+
+
+
+
+/**
+   variable sized MIDI data
+*/
+class Midi_chunk
+{
+public:
+  void set (string header_string, string data_string, string footer_string);
+  virtual string to_string () const;
+  virtual string data_string () const;
+  DECLARE_CLASSNAME(Midi_chunk);
+  virtual ~Midi_chunk ();
+private:
+  string data_string_;
+  string footer_string_;
+  string header_string_;
+};
+
+class Midi_header : public Midi_chunk
+{
+public:
+  DECLARE_CLASSNAME(Midi_header);
+
+  Midi_header (int format_i, int tracks_i, int clocks_per_4_i);
+};
+
+class Midi_track : public Midi_chunk
+{
+public:
+  int number_;
+  DECLARE_CLASSNAME(Midi_track);
+
+  vector<Midi_event*> events_;
+
+  Midi_track ();
+  ~Midi_track ();
+
+  void add (int, Midi_item *midi);
+  virtual string data_string () const;
+};
+
+#endif /* MIDI_CHUNK_HH */
+
index f7ea0e0585c07cce1551692ef714b1b78660bb7d..a3cea87e619c7f2c591e7e73ed8d25428cfbe930 100644 (file)
@@ -10,6 +10,8 @@
 #include "audio-item.hh"
 #include "std-vector.hh"
 
+string int2midi_varint_string (int i);
+  
 /**
    Any piece of midi information.
 
@@ -23,10 +25,8 @@ public:
   virtual ~Midi_item ();
   virtual char const *name () const;
 
-  /// factory
   static Midi_item *get_midi (Audio_item *a);
 
-  static string i2varint_string (int i);
 
   virtual string to_string () const = 0;
 };
@@ -39,36 +39,6 @@ public:
   Midi_channel_item ();
 };
 
-/**
-   timed MIDI event
-*/
-class Midi_event
-{
-public:
-  Midi_event (int delta, Midi_item *midi);
-
-  int delta_ticks_;
-  Midi_item *midi_;
-  string to_string () const;
-};
-
-/**
-   variable sized MIDI data
-*/
-class Midi_chunk : public Midi_item
-{
-public:
-  void set (string header_string, string data_string, string footer_string);
-  virtual string to_string () const;
-  virtual string data_string () const;
-  DECLARE_CLASSNAME(Midi_chunk);
-
-private:
-  string data_string_;
-  string footer_string_;
-  string header_string_;
-};
-
 class Midi_duration : public Midi_item
 {
 public:
@@ -78,13 +48,6 @@ public:
   Real seconds_;
 };
 
-class Midi_header : public Midi_chunk
-{
-public:
-    DECLARE_CLASSNAME(Midi_header);
-
-  Midi_header (int format_i, int tracks_i, int clocks_per_4_i);
-};
 
 /**
    Change instrument event
@@ -202,19 +165,6 @@ public:
   Audio_tempo *audio_;
 };
 
-class Midi_track : public Midi_chunk
-{
-public:
-  int number_;
-  DECLARE_CLASSNAME(Midi_track);
-
-  vector<Midi_event*> events_;
-
-  Midi_track ();
-  ~Midi_track ();
 
-  void add (int, Midi_item *midi);
-  virtual string data_string () const;
-};
 
 #endif // MIDI_ITEM_HH
index 1d9066e8654b5de80e9ee713689fbf21924ace52..fe31d6590fb03a461ce5160616726169996cb745 100644 (file)
 using namespace std;
 
 #include "std-string.hh"
+#include "lily-proto.hh"
 
-class Midi_item;
-
-/// Midi outputfile
 struct Midi_stream
 {
   Midi_stream (string file_name_string);
   ~Midi_stream ();
 
   void write (string);
-  void write (Midi_item const &);
-  void write (int);
-
+  void write (Midi_chunk const &);
   void open ();
 
   FILE *out_file_;
index 69bf4c8a9b939589e41caf9fa62cc2390cd174a3..8ea8b27b6442b73829c9b68f9e4d2b8a862e11f5 100644 (file)
@@ -33,12 +33,12 @@ public:
   void process ();
   void operator ++ (int);
   bool ok () const;
-
+  void finalize ();
 private:
   void do_start_note (Midi_note *note);
   void do_stop_notes (int);
   void output_event (int, Midi_item *l);
-  
+  Midi_item *get_midi (Audio_item*); 
   int channel_;
   Midi_track *track_;
   Audio_staff *staff_;
@@ -47,6 +47,7 @@ private:
   PQueue<Midi_note_event> stop_note_queue;
   int last_tick_;
 
+  vector<Midi_item*> midi_events_;
 };
 
 #endif // MIDI_WALKER_HH
index 136dd3c9d6610833d03cb8353f42a3ef8a20f788..839edd4abacdff4c1be17a8cabd93267d66ef271 100644 (file)
@@ -42,12 +42,7 @@ public:
   SCM type () const { return type_; }
   SCM get_property_alist (bool mutble) const;
   SCM internal_get_property (SCM sym) const;
-
-#ifndef NDEBUG
-  void internal_set_property (SCM sym, SCM val, const char *file, int line, char const *fun);
-#else
   void internal_set_property (SCM sym, SCM val);
-#endif
 };
 DECLARE_UNSMOB(Prob,prob);
 SCM ly_prob_set_property_x (SCM system, SCM sym, SCM value);
index 9cc52192c6b79a5e1dcb14e22b77c4e1786adffa..09c7cfafd0cb2ee13152e399db7d99198272b2fd 100644 (file)
@@ -1,31 +1 @@
-/*
-  source.hh -- part of LilyPond
-
-  (c) 1997--2007 Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-
-#ifndef SOURCE_HH
-#define SOURCE_HH
-
-#include "flower-proto.hh"
-#include "std-vector.hh"
-
-/*   A set of sourcefiles.  */
-class Sources
-{
-  Sources (Sources const &);
-  vector<Source_file*> sourcefiles_;
-
-public:
-  Sources ();
-  ~Sources ();
-
-  Source_file *get_file (string *file_name);
-  Source_file *get_sourcefile (char const *);
-  void add (Source_file *sourcefile);
-  void set_path (File_path *);
-
-  const File_path *path_;
-};
-
-#endif /* SOURCE_HH */
+#error
diff --git a/lily/include/sources.hh b/lily/include/sources.hh
new file mode 100644 (file)
index 0000000..13776f3
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+  sources.hh -- part of LilyPond
+
+  (c) 1997--2007 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef SOURCES_HH
+#define SOURCES_HH
+
+#include "flower-proto.hh"
+#include "std-vector.hh"
+
+class Sources
+{
+  Sources (Sources const &);
+  vector<Source_file*> sourcefiles_;
+
+public:
+  Sources ();
+  ~Sources ();
+
+  Source_file *get_file (string *file_name);
+  Source_file *get_sourcefile (char const *);
+  void add (Source_file *sourcefile);
+  void set_path (File_path *);
+
+  const File_path *path_;
+};
+
+#endif /* SOURCE_HH */
index e4a09cc0cf8395e6dc0ec5da6a2c3926230a43d6..23455d73b1b65ae82fd8243cef509fe4ed4fd0af 100644 (file)
@@ -47,7 +47,8 @@ public:
   void substitute_one_mutable_property (SCM sym, SCM val);
   bool fast_substitute_grob_array (SCM sym, Grob_array *);
 
-  virtual Interval_t<int> spanned_rank_iv ();
+  Interval_t<Moment> spanned_time () const;
+  virtual Interval_t<int> spanned_rank_iv () const;
   void set_bound (Direction d, Grob *);
   Item *get_bound (Direction d) const;
 
@@ -64,6 +65,7 @@ public:
   DECLARE_GROB_INTERFACE();
   virtual System *get_system () const;
 
+  
 protected:
   void set_my_columns ();
   virtual Grob *clone () const;
index 445e461380b61550241da5920d200926b324561e..820771ef7fe4d772ac072410b50d3bbe4f8e807e 100644 (file)
@@ -64,6 +64,7 @@ public:
   void translate (Offset);
   Stencil translated (Offset) const;
   void rotate (Real, Offset);
+  void rotate_degrees (Real, Offset);
   void align_to (Axis a, Real x);
   void translate_axis (Real, Axis);
 
index ebee98877fd69b4c9f03686ff008fbb250028149..50f1746b86ba374abb138d9e1a2372051fb16fff 100644 (file)
@@ -31,6 +31,7 @@ struct Tie_configuration_variation
 typedef map < Tuple<int, 2>, Skyline> Chord_outline_map;
 typedef map < Tuple<int, 2>, Box> Column_extent_map;
 typedef map <int, Slice> Position_extent_map;
+
 class Tie_formatting_problem
 {
   Chord_outline_map chord_outlines_;
index 3d998b384e6d806761ce122ede378e69cf200c8e..09028d0858ea4a00fbaf39c24055c370c1e74dad 100644 (file)
@@ -13,7 +13,7 @@ using namespace std;
 
 #include "international.hh"
 #include "source-file.hh"
-#include "source.hh"
+#include "sources.hh"
 #include "warn.hh"
 
 Input::Input (Input const &i)
index c6ca1b2c6939778a77f096ba2671bac0ad0ecdd0..521b285d52d86aa89d7c4ed014a39ac2ace40fd9 100644 (file)
@@ -16,6 +16,9 @@
 #include "system.hh"
 #include "pointer-group-interface.hh"
 
+#include "moment.hh"
+
+
 Grob *
 Item::clone () const
 {
@@ -174,12 +177,39 @@ Item::pure_is_visible (int start, int end) const
 }
 
 Interval_t<int>
-Item::spanned_rank_iv ()
+Item::spanned_rank_iv () const
 {
   int c = get_column ()->get_rank ();
   return Interval_t<int> (c, c);
 }
 
+Interval_t<Moment>
+spanned_time_interval (Item *l, Item *r) 
+{
+  Drul_array<Item*> bounds (l, r);
+  Interval_t<Moment> iv;
+
+  Direction d = LEFT;
+  do
+    {
+      if (bounds[d] && bounds[d]->get_column ())
+       iv[d] = robust_scm2moment (bounds[d]->get_column ()->get_property ("when"),
+                                 iv[d]);
+    }
+  while (flip (&d) != LEFT);
+
+  do
+    {
+      if (!bounds[d] || !bounds[d]->get_column ())
+       iv[d] = iv[-d];
+    }
+  while (flip (&d) != LEFT);
+  
+  
+  return iv;
+}
+
+
 void
 Item::derived_mark () const
 {
index c086f3d250198c6ce37431a81e70952825e8e5a3..36199d704146b7b9b1609a5c971ee1929526a296 100644 (file)
@@ -77,7 +77,7 @@ Key_engraver::create_key (bool is_default)
          for (SCM s = last; scm_is_pair (s); s = scm_cdr (s))
            {
              SCM new_alter_pair = scm_assoc (scm_caar (s), key);
-             Rational old_alter = ly_scm2rational (scm_cdar (s));
+             Rational old_alter = robust_scm2rational (scm_cdar (s), 0);
              if (new_alter_pair == SCM_BOOL_F
                  || extranatural
                  && (ly_scm2rational (scm_cdr (new_alter_pair)) - old_alter)*old_alter < Rational (0))
index d95279a54e0d801420b28b6348f3b0f76f2583d1..582e5b0dcb2bb655832512338f0fe57489f77cd8 100644 (file)
@@ -37,7 +37,9 @@ minimise_least_squares (Real *coef, Real *offset,
   Real den = (count * sqx - sqr (sx));
   if (!count || !den)
     {
-      programming_error ("minimise_least_squares ():  Nothing to minimise");
+      programming_error ("minimise_least_squares ():  Nothing to minimise\n"
+                        "This means that vertical spacing is triggered\n"
+                        "before line breaking\n");
       *coef = 0.0;
       *offset = count ? sy / count : 0.0;
     }
index a1a635961c02cc9e46bc4587ce32e1cc3ef76241..976b19e47c0819a32111fea6f28d5261d24ee2ae 100644 (file)
@@ -34,8 +34,8 @@ using namespace std;
 /*
   symbols/strings.
  */
-SCM
-ly_write2scm (SCM s)
+string
+ly_scm_write_string (SCM s)
 {
   SCM port = scm_mkstrport (SCM_INUM0,
                            scm_make_string (SCM_INUM0, SCM_UNDEFINED),
@@ -46,7 +46,7 @@ ly_write2scm (SCM s)
 
   // scm_apply (write, port, SCM_EOL);
   scm_call_2 (write, s, port);
-  return scm_strport_to_string (port);
+  return ly_scm2string (scm_strport_to_string (port));
 }
 
 SCM
@@ -394,7 +394,7 @@ ly_deep_copy (SCM src)
 string
 print_scm_val (SCM val)
 {
-  string realval = ly_scm2string (ly_write2scm (val));
+  string realval = ly_scm_write_string (val);
   if (realval.length () > 200)
     realval = realval.substr (0, 100)
       + "\n :\n :\n"
@@ -582,6 +582,14 @@ ly_scm2rational (SCM r)
                   scm_to_int (scm_denominator (r)));
 }
 
+Rational
+robust_scm2rational (SCM n, Rational rat)
+{
+  if (ly_is_fraction (n))
+    return ly_scm2rational (n);
+  else
+    return rat;
+}
 
 SCM
 alist_to_hashq (SCM alist)
@@ -653,13 +661,7 @@ parse_symbol_list (char const *symbols)
   return ly_string_array_to_scm (string_split (s, ' '));
 }
 
-
-bool
-ly_is_fraction (SCM x)
-{
-  return SCM_FRACTIONP(x);
-}
-
+/* GDB debugging. */
 struct ly_t_double_cell
 {
   SCM a;
index c3ac4afa3c9a98e53a1ca1441e7fb6b2777567c5..ca1d224bd6ac7703f7d8f54b64434fe4102965ee 100644 (file)
@@ -18,7 +18,7 @@
 #include "ly-module.hh"
 #include "main.hh"
 #include "program-option.hh"
-#include "source.hh"
+#include "sources.hh"
 #include "warn.hh"
 
 /* Do not append `!' suffix, since 1st argument is not modified. */
index 356615adc3cbf3d2ea93a42ed9d40964eabf3987..456acd1a9e023109c88139e1a66b270a4f3f3323 100644 (file)
@@ -20,7 +20,7 @@
 #include "paper-book.hh"
 #include "parser.hh"
 #include "score.hh"
-#include "source.hh"
+#include "sources.hh"
 #include "text-metrics.hh"
 #include "warn.hh"
 
index 894d1089cfa6a545cad8835a7ca96c88b0a49b16..8c54fa7ed1d35a31aa9ca34405fd2a3e64bf7ec7 100644 (file)
@@ -12,6 +12,7 @@
 #include "lookup.hh"
 #include "output-def.hh"
 #include "grob.hh"
+#include "font-interface.hh"
 
 Stencil
 Line_interface::make_arrow (Offset begin, Offset end,
@@ -31,6 +32,95 @@ Line_interface::make_arrow (Offset begin, Offset end,
   return Lookup::round_filled_polygon (points, thick);
 }
 
+Stencil
+Line_interface::make_trill_line (Grob *me,
+                                Offset from,
+                                Offset to)
+{
+  Offset dz = (to-from);
+  SCM alist_chain = Font_interface::text_font_alist_chain (me);
+  SCM style_alist = scm_list_n (scm_cons (ly_symbol2scm ("font-encoding"),
+                                         ly_symbol2scm ("fetaMusic")),
+                               SCM_UNDEFINED);
+
+  Font_metric *fm = select_font (me->layout (),
+                                scm_cons (style_alist,
+                                          alist_chain));
+
+  Stencil elt = fm->find_by_name ("scripts.trill_element");
+
+  Real elt_len = elt.extent (X_AXIS).length ();
+  if (elt_len <= 0.0)
+    {
+      programming_error ("can't find scripts.trill_element");
+      return Stencil ();
+    }
+      
+  Stencil line;
+  Real len = 0.0;
+  do
+    {
+      line.add_at_edge (X_AXIS, RIGHT, elt, 0);
+      len = line.extent (X_AXIS).length ();
+    }
+  while (len + elt_len < dz.length ());
+
+  line.rotate (dz.arg (), Offset (0,0));
+  line.translate (from);
+
+  return line; 
+}
+
+
+Stencil
+Line_interface::make_zigzag_line (Grob *me,
+                                 Offset from,
+                                 Offset to)
+{
+  Offset dz = to -from;
+
+  Real thick = Staff_symbol_referencer::line_thickness (me);
+  thick *= robust_scm2double (me->get_property ("thickness"), 1.0); // todo: staff sym referencer? 
+
+  Real staff_space = Staff_symbol_referencer::staff_space (me);
+
+  Real w = robust_scm2double (me->get_property ("zigzag-width"), 1) * staff_space;
+  int count = (int) ceil (dz.length () / w);
+  w = dz.length () / count;
+
+  Real l = robust_scm2double (me->get_property ("zigzag-length"), 1) * w;
+  Real h = l > w / 2 ? sqrt (l * l - w * w / 4) : 0;
+
+  Offset rotation_factor = complex_exp (Offset (0, dz.arg ()));
+
+  Offset points[3];
+  points[0] = Offset (0, -h / 2);
+  points[1] = Offset (w / 2, h / 2);
+  points[2] = Offset (w, -h / 2);
+  for (int i = 0; i < 3; i++)
+    points[i] = complex_multiply (points[i], rotation_factor);
+
+  Stencil squiggle (Line_interface::make_line (thick, points[0], points[1]));
+  squiggle.add_stencil (Line_interface::make_line (thick, points[1], points[2]));
+
+  Stencil total;
+  for (int i = 0; i < count; i++)
+    {
+      Stencil moved_squiggle (squiggle);
+      moved_squiggle.translate (from + Offset (i * w, 0) * rotation_factor);
+      total.add_stencil (moved_squiggle);
+    }
+
+  Box b;
+  b.add_point (Offset (0, 0));
+  b.add_point (dz);
+  b[X_AXIS].widen (thick / 2);
+  b[Y_AXIS].widen (thick / 2);
+
+  return Stencil (b, total.expr ());
+}
+
+
 Stencil
 Line_interface::make_dashed_line (Real thick, Offset from, Offset to,
                                  Real dash_period, Real dash_fraction)
@@ -113,7 +203,13 @@ Line_interface::line (Grob *me, Offset from, Offset to)
     * robust_scm2double (me->get_property ("thickness"), 1);
 
   SCM type = me->get_property ("style");
-
+  if (type == ly_symbol2scm ("zigzag"))
+    {
+      return make_zigzag_line (me, from, to);
+    }
+  else if (type == ly_symbol2scm ("trill"))
+    return make_trill_line (me, from, to);
+  
   Stencil stil;
 
   SCM dash_fraction = me->get_property ("dash-fraction");
@@ -153,6 +249,8 @@ ADD_INTERFACE (Line_interface,
               "dash-fraction "
               "thickness "
               "style "
+              "zigzag-length "
+              "zigzag-width "
               "arrow-length "
               "arrow-width ")
 
index f6809cda266d7f69ffb33487cbe018f2d90129b3..7a8870aee5d8c4ac4f0ab0ac682e5e56d225198e 100644 (file)
 #include "lookup.hh"
 #include "line-interface.hh"
 
-Stencil
-zigzag_stencil (Grob *me,
-               Offset from,
-               Offset to)
-{
-  Offset dz = to -from;
-
-  Real thick = Staff_symbol_referencer::line_thickness (me);
-  thick *= robust_scm2double (me->get_property ("thickness"), 1.0); // todo: staff sym referencer? 
-
-  Real staff_space = Staff_symbol_referencer::staff_space (me);
-
-  Real w = robust_scm2double (me->get_property ("zigzag-width"), 1) * staff_space;
-  int count = (int) ceil (dz.length () / w);
-  w = dz.length () / count;
-
-  Real l = robust_scm2double (me->get_property ("zigzag-length"), 1) * w;
-  Real h = l > w / 2 ? sqrt (l * l - w * w / 4) : 0;
-
-  Offset rotation_factor = complex_exp (Offset (0, dz.arg ()));
-
-  Offset points[3];
-  points[0] = Offset (0, -h / 2);
-  points[1] = Offset (w / 2, h / 2);
-  points[2] = Offset (w, -h / 2);
-  for (int i = 0; i < 3; i++)
-    points[i] = complex_multiply (points[i], rotation_factor);
-
-  Stencil squiggle (Line_interface::make_line (thick, points[0], points[1]));
-  squiggle.add_stencil (Line_interface::make_line (thick, points[1], points[2]));
-
-  Stencil total;
-  for (int i = 0; i < count; i++)
-    {
-      Stencil moved_squiggle (squiggle);
-      moved_squiggle.translate (from + Offset (i * w, 0) * rotation_factor);
-      total.add_stencil (moved_squiggle);
-    }
-
-  Box b;
-  b.add_point (Offset (0, 0));
-  b.add_point (dz);
-  b[X_AXIS].widen (thick / 2);
-  b[Y_AXIS].widen (thick / 2);
-
-  return Stencil (b, total.expr ());
-}
-
 MAKE_SCHEME_CALLBACK (Line_spanner, after_line_breaking, 1);
 SCM
 Line_spanner::after_line_breaking (SCM g)
@@ -105,53 +57,7 @@ Line_spanner::line_stencil (Grob *me,
                            Offset from,
                            Offset to)
 {
-  Offset dz = to -from;
-  SCM type = me->get_property ("style");
-
-  Stencil line;
-
-  if (scm_is_symbol (type)
-      && (type == ly_symbol2scm ("line")
-         || type == ly_symbol2scm ("dashed-line")
-         || type == ly_symbol2scm ("dotted-line")
-         || type == ly_symbol2scm ("zigzag")
-         || (type == ly_symbol2scm ("trill") && dz[Y_AXIS] != 0)))
-    {
-      line = (type == ly_symbol2scm ("zigzag"))
-       ? zigzag_stencil (me, from, to)
-       : Line_interface::line (me, from, to);
-    }
-  else if (scm_is_symbol (type)
-          && type == ly_symbol2scm ("trill"))
-    {
-      SCM alist_chain = Font_interface::text_font_alist_chain (me);
-      SCM style_alist = scm_list_n (scm_cons (ly_symbol2scm ("font-encoding"),
-                                             ly_symbol2scm ("fetaMusic")),
-                                   SCM_UNDEFINED);
-
-      Font_metric *fm = select_font (me->layout (),
-                                    scm_cons (style_alist,
-                                              alist_chain));
-      Stencil m = fm->find_by_name ("scripts.trill_element");
-      Stencil mol;
-
-      do
-       mol.add_at_edge (X_AXIS, RIGHT, m, 0);
-      while (m.extent (X_AXIS).length ()
-            && mol.extent (X_AXIS).length ()
-            + m.extent (X_AXIS).length () < dz[X_AXIS])
-       ;
-
-      /*
-       FIXME: should center element on x/y
-      */
-      mol.translate_axis (m.extent (X_AXIS).length () / 2, X_AXIS);
-      mol.translate_axis (- (mol.extent (Y_AXIS)[DOWN]
-                            + mol.extent (Y_AXIS).length ()) / 2, Y_AXIS);
-
-      mol.translate (from);
-      line = mol;
-    }
+  Stencil line = Line_interface::line (me, from, to);
 
   if (to_boolean (me->get_property ("arrow")))
     line.add_stencil (Line_interface::arrows (me, from, to, false, true));
@@ -315,7 +221,5 @@ ADD_INTERFACE (Line_spanner,
               "arrow "
               "gap "
               "thickness "
-              "zigzag-length "
-              "zigzag-width "
               );
 
diff --git a/lily/midi-chunk.cc b/lily/midi-chunk.cc
new file mode 100644 (file)
index 0000000..5aaf5bd
--- /dev/null
@@ -0,0 +1,157 @@
+/* 
+  midi-chunk.cc -- implement Midi_chunk
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2007 Han-Wen Nienhuys <hanwen@lilypond.org>
+  
+*/
+
+#include "midi-chunk.hh"
+
+#include "midi-item.hh"
+#include "std-string.hh"
+#include "string-convert.hh"
+
+Midi_track::Midi_track ()
+{
+  //                4D 54 72 6B     MTrk
+  //                00 00 00 3B     chunk length (59)
+  //        00      FF 58 04 04 02 18 08    time signature
+  //        00      FF 51 03 07 A1 20       tempo
+
+  // FF 59 02 sf mi  Key Signature
+  //         sf = -7:  7 flats
+  //         sf = -1:  1 flat
+  //         sf = 0:  key of C
+  //         sf = 1:  1 sharp
+  //         sf = 7: 7 sharps
+  //         mi = 0:  major key
+  //         mi = 1:  minor key
+
+  number_ = 0;
+
+  char const *data_str0 = ""
+    //        "00" "ff58" "0404" "0218" "08"
+    // "00" "ff51" "0307" "a120"
+    // why a key at all, in midi?
+    // key: C
+    // "00" "ff59" "02" "00" "00"
+    // key: F (scsii-menuetto)
+    //                           "00" "ff59" "02" "ff" "00"
+    ;
+
+  string data_string;
+  // only for format 0 (currently using format 1)?
+  data_string += String_convert::hex2bin (data_str0);
+
+  char const *footer_str0 = "00" "ff2f" "00";
+  string footer_string = String_convert::hex2bin (footer_str0);
+
+  set ("MTrk", data_string, footer_string);
+}
+
+void
+Midi_track::add (int delta_ticks, Midi_item *midi)
+{
+  assert (delta_ticks >= 0);
+
+  Midi_event *e = new Midi_event (delta_ticks, midi);
+  events_.push_back (e);
+}
+
+string
+Midi_track::data_string () const
+{
+  string str = Midi_chunk::data_string ();
+
+  for (vector<Midi_event*>::const_iterator i (events_.begin());
+       i != events_.end(); i ++)
+    {
+      str += (*i)->to_string ();
+    }
+  return str;
+}
+
+
+Midi_track::~Midi_track ()
+{
+  junk_pointers (events_); 
+}
+
+/****************************************************************
+  event
+*/
+Midi_event::Midi_event (int delta_ticks, Midi_item *midi)
+{
+  delta_ticks_ = delta_ticks;
+  midi_ = midi;
+}
+
+string
+Midi_event::to_string () const
+{
+  string delta_string = int2midi_varint_string (delta_ticks_);
+  string midi_string = midi_->to_string ();
+  assert (midi_string.length ());
+  return delta_string + midi_string;
+}
+/****************************************************************
+ header
+*/ 
+
+Midi_header::Midi_header (int format, int tracks, int clocks_per_4)
+{
+  string str;
+
+  string format_string = String_convert::int2hex (format, 4, '0');
+  str += String_convert::hex2bin (format_string);
+
+  string tracks_string = String_convert::int2hex (tracks, 4, '0');
+  str += String_convert::hex2bin (tracks_string);
+
+  string tempo_string = String_convert::int2hex (clocks_per_4, 4, '0');
+  str += String_convert::hex2bin (tempo_string);
+
+  set ("MThd", str, "");
+}
+
+
+/****************************************************************
+   chunk
+ */
+Midi_chunk::~Midi_chunk ()
+{
+  
+}
+
+void
+Midi_chunk::set (string header_string, string data_string, string footer_string)
+{
+  data_string_ = data_string;
+  footer_string_ = footer_string;
+  header_string_ = header_string;
+}
+
+string
+Midi_chunk::data_string () const
+{
+  return data_string_;
+}
+
+string
+Midi_chunk::to_string () const
+{
+  string str = header_string_;
+  string dat = data_string ();
+  string length_string = String_convert::int2hex (dat.length ()
+                                                 + footer_string_.length (), 8, '0');
+  length_string = String_convert::hex2bin (length_string);
+
+  str += length_string;
+  str += dat;
+  str += footer_string_;
+
+  return str;
+}
+
index 88f9aeb86f0525a8788ce7490f1d0799bf3dc96d..3d2d67a38e6b56319516a4322d78ee35842ffb4f 100644 (file)
@@ -47,35 +47,7 @@ Midi_item::get_midi (Audio_item *a)
   return 0;
 }
 
-void
-Midi_chunk::set (string header_string, string data_string, string footer_string)
-{
-  data_string_ = data_string;
-  footer_string_ = footer_string;
-  header_string_ = header_string;
-}
-
-string
-Midi_chunk::data_string () const
-{
-  return data_string_;
-}
 
-string
-Midi_chunk::to_string () const
-{
-  string str = header_string_;
-  string dat = data_string ();
-  string length_string = String_convert::int2hex (dat.length ()
-                                                 + footer_string_.length (), 8, '0');
-  length_string = String_convert::hex2bin (length_string);
-
-  str += length_string;
-  str += dat;
-  str += footer_string_;
-
-  return str;
-}
 
 Midi_duration::Midi_duration (Real seconds_f)
 {
@@ -88,37 +60,6 @@ Midi_duration::to_string () const
   return string ("<duration: ") + ::to_string (seconds_) + ">";
 }
 
-Midi_event::Midi_event (int delta_ticks, Midi_item *midi)
-{
-  delta_ticks_ = delta_ticks;
-  midi_ = midi;
-}
-
-string
-Midi_event::to_string () const
-{
-  string delta_string = Midi_item::i2varint_string (delta_ticks_);
-  string midi_string = midi_->to_string ();
-  assert (midi_string.length ());
-  return delta_string + midi_string;
-}
-
-Midi_header::Midi_header (int format, int tracks, int clocks_per_4)
-{
-  string str;
-
-  string format_string = String_convert::int2hex (format, 4, '0');
-  str += String_convert::hex2bin (format_string);
-
-  string tracks_string = String_convert::int2hex (tracks, 4, '0');
-  str += String_convert::hex2bin (tracks_string);
-
-  string tempo_string = String_convert::int2hex (clocks_per_4, 4, '0');
-  str += String_convert::hex2bin (tempo_string);
-
-  set ("MThd", str, "");
-}
-
 Midi_instrument::Midi_instrument (Audio_instrument *a)
 {
   audio_ = a;
@@ -158,7 +99,7 @@ Midi_item::~Midi_item ()
 }
 
 string
-Midi_item::i2varint_string (int i)
+int2midi_varint_string (int i)
 {
   int buffer = i & 0x7f;
   while ((i >>= 7) > 0)
@@ -391,80 +332,13 @@ Midi_text::to_string () const
 {
   string str = "ff" + String_convert::int2hex (audio_->type_, 2, '0');
   str = String_convert::hex2bin (str);
-  str += i2varint_string (audio_->text_string_.length ());
+  str += int2midi_varint_string (audio_->text_string_.length ());
   str += audio_->text_string_;
   return str;
 }
 
-Midi_track::Midi_track ()
-  : Midi_chunk ()
-{
-  //                4D 54 72 6B     MTrk
-  //                00 00 00 3B     chunk length (59)
-  //        00      FF 58 04 04 02 18 08    time signature
-  //        00      FF 51 03 07 A1 20       tempo
-
-  // FF 59 02 sf mi  Key Signature
-  //         sf = -7:  7 flats
-  //         sf = -1:  1 flat
-  //         sf = 0:  key of C
-  //         sf = 1:  1 sharp
-  //         sf = 7: 7 sharps
-  //         mi = 0:  major key
-  //         mi = 1:  minor key
-
-  number_ = 0;
-
-  char const *data_str0 = ""
-    //        "00" "ff58" "0404" "0218" "08"
-    // "00" "ff51" "0307" "a120"
-    // why a key at all, in midi?
-    // key: C
-    // "00" "ff59" "02" "00" "00"
-    // key: F (scsii-menuetto)
-    //                           "00" "ff59" "02" "ff" "00"
-    ;
-
-  string data_string;
-  // only for format 0 (currently using format 1)?
-  data_string += String_convert::hex2bin (data_str0);
-
-  char const *footer_str0 = "00" "ff2f" "00";
-  string footer_string = String_convert::hex2bin (footer_str0);
-
-  set ("MTrk", data_string, footer_string);
-}
-
-void
-Midi_track::add (int delta_ticks, Midi_item *midi)
-{
-  assert (delta_ticks >= 0);
-
-  Midi_event *e = new Midi_event (delta_ticks, midi);
-  events_.push_back (e);
-}
-
-string
-Midi_track::data_string () const
-{
-  string str = Midi_chunk::data_string ();
-
-  for (vector<Midi_event*>::const_iterator i (events_.begin());
-       i != events_.end(); i ++)
-    {
-      str += (*i)->to_string ();
-    }
-  return str;
-}
-
-
 char const *
 Midi_item::name () const
 {
    return this->class_name ();
 }
-
-Midi_track::~Midi_track ()
-{
-  junk_pointers (events_);
-}
index 11afe02cf46b13e0dcc53f9a681348fdcbd558b3..bcaefe7c181fc461fde48f8a6b9b744c865321cf 100644 (file)
@@ -13,7 +13,7 @@ using namespace std;
 
 #include "international.hh"
 #include "main.hh"
-#include "midi-item.hh"
+#include "midi-chunk.hh"
 #include "misc.hh"
 #include "program-option.hh"
 #include "stream.hh"
@@ -45,16 +45,10 @@ Midi_stream::write (string str)
 }
 
 void
-Midi_stream::write (Midi_item const &midi)
+Midi_stream::write (Midi_chunk const &midi)
 {
   string str = midi.to_string ();
 
   return write (str);
 }
 
-void
-Midi_stream::write (int i)
-{
-  write (Midi_item::i2varint_string (i));
-}
-
index 941e64c282932e753a97c1aa494327d339929ef8..cef858c92768ebacf1374fb6d8f9bddb418a6536 100644 (file)
@@ -12,6 +12,7 @@
 #include "audio-column.hh"
 #include "audio-staff.hh"
 #include "midi-item.hh"
+#include "midi-chunk.hh"
 #include "midi-stream.hh"
 #include "warn.hh"
 
@@ -53,9 +54,14 @@ Midi_walker::Midi_walker (Audio_staff *audio_staff, Midi_track *track,
 
 Midi_walker::~Midi_walker ()
 {
-  do_stop_notes (INT_MAX);
+  junk_pointers (midi_events_);
 }
 
+void
+Midi_walker::finalize ()
+{
+  do_stop_notes (INT_MAX);
+}
 
 /**
    Find out if start_note event is needed, and do it if needed.
@@ -88,7 +94,6 @@ Midi_walker::do_start_note (Midi_note *note)
            {
              /* skip this stopnote,
                 don't play the start note */
-             delete note;
              note = 0;
              break;
            }
@@ -99,6 +104,8 @@ Midi_walker::do_start_note (Midi_note *note)
     {
       Midi_note_event e;
       e.val = new Midi_note_off (note);
+
+      midi_events_.push_back (e.val);
       e.key = int (stop_ticks);
       stop_note_queue.insert (e);
 
@@ -118,7 +125,6 @@ Midi_walker::do_stop_notes (int max_ticks)
       Midi_note_event e = stop_note_queue.get ();
       if (e.ignore_)
        {
-         delete e.val;
          continue;
        }
 
@@ -154,7 +160,7 @@ Midi_walker::process ()
   Audio_item *audio = items_[index_];
   do_stop_notes (audio->audio_column_->ticks ());
 
-  if (Midi_item *midi = Midi_item::get_midi (audio))
+  if (Midi_item *midi = get_midi (audio))
     {
       if (Midi_channel_item *mci = dynamic_cast<Midi_channel_item*> (midi))
        mci->channel_ = channel_;
@@ -169,6 +175,14 @@ Midi_walker::process ()
     }
 }
 
+Midi_item*
+Midi_walker::get_midi (Audio_item *i)
+{
+  Midi_item *mi = Midi_item::get_midi (i);
+  midi_events_.push_back (mi);
+  return mi;
+}
+
 bool
 Midi_walker::ok () const
 {
diff --git a/lily/new-line-spanner.cc b/lily/new-line-spanner.cc
new file mode 100644 (file)
index 0000000..3842cb2
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+  line-spanner.cc -- implement New_line_spanner
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2000--2007 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "spanner.hh"
+#include "output-def.hh"
+#include "paper-column.hh"
+#include "staff-symbol-referencer.hh"
+#include "font-interface.hh"
+#include "warn.hh"
+#include "align-interface.hh"
+#include "lookup.hh"
+#include "line-interface.hh"
+#include "moment.hh"
+
+#include "lily-proto.hh"
+#include "grob-interface.hh"
+#include "text-interface.hh"
+
+class New_line_spanner
+{
+public:
+  DECLARE_SCHEME_CALLBACK (print, (SCM));
+  DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+
+  DECLARE_SCHEME_CALLBACK (calc_left_bound_info, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_left_bound_info_and_text, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_right_bound_info, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_bound_info, (SCM, Direction));
+  DECLARE_GROB_INTERFACE();
+
+  static Grob *common_y (Grob*); 
+};
+
+Grob*
+New_line_spanner::common_y (Grob*me_grob) 
+{
+  Spanner *me = dynamic_cast<Spanner*> (me_grob);
+  
+  Grob *commony = me;
+  Direction d = LEFT;
+  do
+    if (me->get_bound (d)->break_status_dir () == CENTER)
+      commony = me->get_bound (d)->common_refpoint (commony, Y_AXIS);
+  while (flip (&d) != LEFT);
+
+  return commony;
+}
+
+static Grob *
+line_spanner_common_parent (Grob *me)
+{
+  Grob *common = find_fixed_alignment_parent (me);
+  if (!common)
+    {
+      common = Staff_symbol_referencer::get_staff_symbol (me);
+      if (common)
+       common = common->get_parent (Y_AXIS);
+      else
+       common = me->get_parent (Y_AXIS);
+    }
+
+  return common;
+}
+
+SCM
+New_line_spanner::calc_bound_info (SCM smob, Direction dir)
+{
+  Spanner *me = unsmob_spanner (smob);
+
+  Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
+  commonx = me->common_refpoint (commonx, X_AXIS);
+
+  SCM bound_details = me->get_property ("bound-details");
+
+  SCM details = SCM_BOOL_F;
+  if (details == SCM_BOOL_F)
+    details = ly_assoc_get ((dir == LEFT)
+                           ? ly_symbol2scm ("left")
+                           : ly_symbol2scm ("right"), bound_details, SCM_BOOL_F);
+
+  if (me->get_bound (dir)->break_status_dir ())
+    {
+      SCM extra = ly_assoc_get ((dir == LEFT)
+                               ? ly_symbol2scm ("left-broken")
+                               : ly_symbol2scm ("right-broken"), bound_details, SCM_EOL);
+
+      for (SCM s = extra; scm_is_pair (s); s = scm_cdr (s))
+       details = scm_cons (scm_car (s), details);
+    }
+  
+  if (details == SCM_BOOL_F)
+    details = ly_assoc_get (ly_symbol2scm ("default"), bound_details, SCM_EOL);
+
+  SCM text = ly_assoc_get (ly_symbol2scm ("text"), details, SCM_BOOL_F);
+  if (Text_interface::is_markup (text))
+    {
+      Output_def *layout = me->layout ();
+      SCM properties = Font_interface::text_font_alist_chain (me);
+      details = scm_acons (ly_symbol2scm ("stencil"),
+                          Text_interface::interpret_markup (layout->self_scm (),
+                                                            properties, text),
+                          details);
+    }
+  
+  if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("X"), details, SCM_BOOL_F)))
+    {
+      Direction attach = (Direction)
+       robust_scm2int (ly_assoc_get (ly_symbol2scm ("attach-dir"),
+                                                    details, SCM_BOOL_F),
+                       CENTER);
+
+      details = scm_acons (ly_symbol2scm ("X"),
+                          scm_from_double (me->get_bound (dir)->extent (commonx, X_AXIS)
+                                           .linear_combination (attach)),
+                          details);
+    }
+  
+
+  if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("Y"), details, SCM_BOOL_F)))
+    {
+      Real y = 0.0;
+
+      Real extra_dy = robust_scm2double (me->get_property ("extra-dy"),
+                                        0.0);
+         
+      if (me->get_bound (dir)->break_status_dir ())
+       {
+         /*
+           This is hairy. For the normal case, we simply find common
+           parents, and draw a line between the bounds. When two note
+           heads are on different systems, there is no common parent
+           anymore. We have to find the piano-staff object.
+         */
+
+         Spanner *next_sp = me->broken_neighbor (dir);
+         Item *next_bound = next_sp->get_bound (dir);
+
+         if (next_bound->break_status_dir ())
+           {
+             programming_error ("no note heads for the line spanner on neighbor line?"
+                                " Confused.");
+             me->suicide ();
+             return SCM_EOL;
+           }
+
+         Grob *next_common_y = line_spanner_common_parent (next_bound);
+         Interval next_ext = next_bound->extent (next_common_y, Y_AXIS);
+
+         y = next_ext.center ();
+       }
+      else
+       {
+         Grob *commony = common_y (me);
+         y = me->get_bound (dir)->extent (commony, Y_AXIS).center();
+       }
+
+      y += dir * extra_dy / 2; 
+      details = scm_acons (ly_symbol2scm ("Y"), scm_from_double (y), details);
+    }
+
+  return details;
+}
+
+MAKE_SCHEME_CALLBACK (New_line_spanner, calc_right_bound_info, 1);
+SCM
+New_line_spanner::calc_right_bound_info (SCM smob)
+{
+  return New_line_spanner::calc_bound_info (smob, RIGHT);
+}
+
+MAKE_SCHEME_CALLBACK (New_line_spanner, calc_left_bound_info, 1);
+SCM
+New_line_spanner::calc_left_bound_info (SCM smob)
+{
+  return New_line_spanner::calc_bound_info (smob, LEFT);
+}
+
+MAKE_SCHEME_CALLBACK (New_line_spanner, calc_left_bound_info_and_text, 1);
+SCM
+New_line_spanner::calc_left_bound_info_and_text (SCM smob)
+{
+  SCM alist = New_line_spanner::calc_bound_info (smob, LEFT);
+  Spanner *me = unsmob_spanner (smob);
+
+  SCM text = me->get_property ("text");
+  if (Text_interface::is_markup (text)
+      && me->get_bound (LEFT)->break_status_dir () == CENTER
+      && ly_assoc_get (ly_symbol2scm ("stencil"), alist, SCM_BOOL_F) == SCM_BOOL_F)
+    {
+      Output_def *layout = me->layout ();
+      SCM properties = Font_interface::text_font_alist_chain (me);
+      alist = scm_acons (ly_symbol2scm ("stencil"),
+                        Text_interface::interpret_markup (layout->self_scm (),
+                                                          properties, text),
+                        alist);
+    }
+  
+  return alist;
+}
+
+MAKE_SCHEME_CALLBACK (New_line_spanner, print, 1);
+SCM
+New_line_spanner::print (SCM smob)
+{
+  Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
+
+  Interval_t<Moment> moments = me->spanned_time ();
+  /*
+    We remove the line at the start of the line.  For piano voice
+    indicators, it makes no sense to have them at the start of the
+    line.
+
+    I'm not sure what the official rules for glissandi are, but
+    usually the 2nd note of the glissando is "exact", so when playing
+    from the start of the line, there is no need to glide.
+
+    From a typographical p.o.v. this makes sense, since the amount of
+    space left of a note at the start of a line is very small.
+
+    --hwn.
+
+  */
+  if (moments.length () == Moment (0,0))
+    return SCM_EOL;
+  
+  Drul_array<SCM> bounds (me->get_property ("left-bound-info"),
+                         me->get_property ("right-bound-info"));
+
+  
+  Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
+  commonx = me->common_refpoint (commonx, X_AXIS);
+
+  Drul_array<Offset> span_points;
+
+  Direction d =  LEFT;
+  do
+    {
+      Offset z (robust_scm2double (ly_assoc_get (ly_symbol2scm ("X"),
+                                                bounds[d], SCM_BOOL_F), 0.0)
+               + commonx->relative_coordinate (commonx, X_AXIS),
+               robust_scm2double (ly_assoc_get (ly_symbol2scm ("Y"),
+                                                bounds[d], SCM_BOOL_F), 0.0));
+      
+      span_points[d] = z;
+    }
+  while (flip (&d) != LEFT);
+
+  Offset dz = (span_points[RIGHT] - span_points[LEFT]);
+  Offset dz_dir = dz.direction ();
+  Drul_array<Real> gaps (0, 0);
+  Drul_array<bool> arrows (0, 0);
+  Drul_array<Stencil*> stencils (0,0);
+  do
+    {
+      gaps[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("padding"),
+                                                bounds[d], SCM_BOOL_F), 0.0);
+      arrows[d] = to_boolean (ly_assoc_get (ly_symbol2scm ("arrow"),
+                                           bounds[d], SCM_BOOL_F));
+      stencils[d] = unsmob_stencil (ly_assoc_get (ly_symbol2scm ("stencil"),
+                                                 bounds[d], SCM_BOOL_F));
+     
+    }
+  while (flip (&d) != LEFT);
+
+  if (gaps[LEFT] + gaps[RIGHT] > dz.length ())
+    {
+      return SCM_EOL;
+    }
+
+  Stencil line;
+  do
+    {
+      if (stencils[d])
+       {
+        Stencil s = stencils[d]->translated (span_points[d]);
+        SCM align = ly_assoc_get (ly_symbol2scm ("stencil-align-dir-y"),
+                                  bounds[d], SCM_BOOL_F);
+        SCM off = ly_assoc_get (ly_symbol2scm ("stencil-offset"),
+                                  bounds[d], SCM_BOOL_F);
+
+        if (scm_is_number (align)) 
+          s.align_to (Y_AXIS, scm_to_double (align));
+
+        /*
+          todo: should use font-size.
+         */
+        if (is_number_pair (off))
+          s.translate (ly_scm2offset (off));
+        
+        line.add_stencil (s);
+       }
+    }
+  while (flip (&d) != LEFT);
+
+  do
+    {
+      if (stencils[d])
+       span_points[d] += dz_dir *
+         (stencils[d]->extent (X_AXIS)[-d] / dz_dir[X_AXIS]);
+
+      
+      span_points[d] += -d * gaps[d] *  dz.direction ();
+    }
+  while (flip (&d) != LEFT);
+
+  line.add_stencil (Line_interface::line (me, 
+                                         span_points[LEFT],
+                                         span_points[RIGHT]));
+
+  line.add_stencil (Line_interface::arrows (me,
+                                           span_points[LEFT],
+                                           span_points[RIGHT],
+                                           arrows[LEFT],
+                                           arrows[RIGHT]));
+  Grob *commony = common_y (me);
+
+  line.translate (Offset (-me->relative_coordinate (commonx, X_AXIS),
+                         -me->relative_coordinate (commony, Y_AXIS)));
+                         
+    
+  return line.smobbed_copy ();
+}
+
+ADD_INTERFACE (New_line_spanner,
+              "Generic line drawn between two objects, e.g. for use with glissandi.\n"
+              "The property @code{style} can be @code{line}, "
+              "@code{dashed-line}, @code{trill}, \n"
+              "@code{dotted-line} or @code{zigzag}.\n"
+              "\n",
+
+              "extra-dy "
+              "gap "
+              "thickness "
+              "bound-details " 
+              "left-bound-info " 
+              "right-bound-info " 
+              );
+
index 8b1229fe90917bc3f508fb6f20ad1b8372f16b67..2e72d57af35ada1833d95f5c60807358b9ef606c 100644 (file)
@@ -39,7 +39,9 @@ load_table (char const *tag_str, FT_Face face, FT_ULong *length)
       return buffer;
     }
   else
-    programming_error ("Cannot find OpenType table.");
+    programming_error (_f ("Free type error: %s",
+                          freetype_error_string (error_code).c_str ()
+                          ));
 
   return 0;
 }
@@ -97,8 +99,10 @@ open_ft_face (string str)
   if (error_code == FT_Err_Unknown_File_Format)
     error (_f ("unsupported font format: %s", str.c_str ()));
   else if (error_code)
-    error (_f ("unknown error: %d reading font file: %s", error_code,
-              str.c_str ()));
+    error (_f ("error reading font file %s: %s", 
+              str.c_str (),
+              freetype_error_string (error_code).c_str ()
+              ));
   return face;
 }
 
@@ -170,7 +174,8 @@ Open_type_font::get_indexed_char (size_t signed_idx) const
       char name[len];
       size_t code = FT_Get_Glyph_Name (face_, signed_idx, name, len);
       if (code)
-       warning (_f ("FT_Get_Glyph_Name() returned error: %u", unsigned (code)));
+       warning (_f ("FT_Get_Glyph_Name() Freetype error: %s",
+                    freetype_error_string (code)));
 
       SCM sym = ly_symbol2scm (name);
       SCM alist = scm_hashq_ref (lily_character_table_, sym, SCM_BOOL_F);
@@ -294,7 +299,8 @@ Open_type_font::glyph_list () const
       char name[len];
       size_t code = FT_Get_Glyph_Name (face_, i, name, len);
       if (code)
-       warning (_f ("FT_Get_Glyph_Name() returned error: %u", unsigned (code)));
+       warning (_f ("FT_Get_Glyph_Name() error: %s",
+                    freetype_error_string (code).c_str ()));
 
       *tail = scm_cons (scm_from_locale_string (name), SCM_EOL);
       tail = SCM_CDRLOC (*tail);
index b5c38293e5fdeacb180605b9ea8b20bebf04b623..83add92ae0ba59492d98539914834d02318e7a19 100644 (file)
@@ -75,7 +75,13 @@ void
 Page_breaking::break_into_pieces (vsize start_break, vsize end_break, Line_division const &div)
 {
   vector<Break_position> chunks = chunk_list (start_break, end_break);
-  assert (chunks.size () == div.size () + 1);
+  bool ignore_div = false;
+  if (chunks.size () != div.size () + 1)
+    {
+      programming_error ("did not find a valid page breaking configuration");
+      ignore_div = true;
+      assert (0);
+    }
 
   for (vsize i = 0; i + 1 < chunks.size (); i++)
     {
@@ -86,7 +92,9 @@ Page_breaking::break_into_pieces (vsize start_break, vsize end_break, Line_divis
          vsize end;
          line_breaker_args (sys, chunks[i], chunks[i+1], &start, &end);
 
-         vector<Column_x_positions> pos = line_breaking_[sys].solve (start, end, div[i]);
+         vector<Column_x_positions> pos = ignore_div
+           ? line_breaking_[sys].best_solution (start, end)
+           : line_breaking_[sys].solve (start, end, div[i]);
          all_[sys].pscore_->root_system ()->break_into_pieces (pos);
        }
     }
index f91eafb9844743dd1a6ae89904e5c48ebb0f81b8..10cca5bfaf7734cec57c6f039043ee4f853a6f8f 100644 (file)
@@ -163,7 +163,9 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str,
        {
          int errorcode = FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN);
          if (errorcode)
-           programming_error ("FT_Get_Glyph_Name returns error");
+           programming_error (_f ("FT_Get_Glyph_Name() error: %s",
+                                  freetype_error_string (errorcode).c_str()
+                                  ));
        }
 
       SCM char_id = SCM_EOL;
index ed4b7579d4da6fc21f2c4a413ab7d55867d0d65e..bc97f787514a1b98b2d361f0ba597abe388dc158 100644 (file)
@@ -58,7 +58,8 @@ select_pango_font (Output_def *layout, SCM chain)
   char *str = pango_font_description_to_string (pfd);
   SCM scm_str = scm_from_locale_string (str);
   g_free (str);
-
+  pango_font_description_free (pfd);
+  
   return find_pango_font (layout, scm_str, 1.0);
 }
 
index fabc5c2e891d943161c56f765c25fae3558c1967..c4d535d85dbe94b3be7833b40997bc16d06c7479 100644 (file)
@@ -31,6 +31,9 @@ internal_ly_parse_scm (Parse_start *ps)
   scm_seek (port, scm_long2num (off), scm_long2num (SEEK_SET));
   SCM from = scm_ftell (port);
 
+  scm_set_port_line_x (port,  scm_from_int (ps->start_location_.line_number () -1));
+  scm_set_port_column_x (port,  scm_from_int (ps->start_location_.column_number () -1));
+  
   SCM answer = SCM_UNSPECIFIED;
   SCM form = scm_read (port);
 
index 02f03dea92fd941e8a4646e24f94be083b360b72..4bf3c9d191e98d5585404c45d16b2aa3858fb2ed 100644 (file)
@@ -410,6 +410,7 @@ If we give names, Bison complains.
 %type <scm> pitch_also_in_chords
 %type <scm> post_events
 %type <scm> property_operation
+%type <scm> property_path
 %type <scm> scalar
 %type <scm> script_abbreviation
 %type <scm> simple_chord_elements
@@ -1122,6 +1123,16 @@ context_change:
        }
        ;
 
+
+property_path:
+       embedded_scm {
+               $$ = scm_cons ($1, SCM_EOL);
+       }
+       | property_path embedded_scm {
+               $$ = scm_cons ($2, $1);
+       }
+       ;
+
 property_operation:
        STRING '=' scalar {
                $$ = scm_list_3 (ly_symbol2scm ("assign"),
@@ -1131,13 +1142,10 @@ property_operation:
                $$ = scm_list_2 (ly_symbol2scm ("unset"),
                        scm_string_to_symbol ($2));
        }
-       | OVERRIDE simple_string embedded_scm '=' embedded_scm {
-               $$ = scm_list_4 (ly_symbol2scm ("push"),
-                       scm_string_to_symbol ($2), $5, $3);
-       }
-       | OVERRIDE simple_string embedded_scm embedded_scm '=' embedded_scm {
-               $$ = scm_list_5 (ly_symbol2scm ("push"),
-                               scm_string_to_symbol ($2), $6, $4, $3);
+       | OVERRIDE simple_string property_path '=' embedded_scm {
+               $$ = scm_append (scm_list_2 (scm_list_3 (ly_symbol2scm ("push"),
+                                                       scm_string_to_symbol ($2), $5),
+                                            $3));
        }
        | REVERT simple_string embedded_scm {
                $$ = scm_list_3 (ly_symbol2scm ("pop"),
@@ -1183,17 +1191,12 @@ context_prop_spec:
        ;
 
 simple_music_property_def:
-       OVERRIDE context_prop_spec embedded_scm '=' scalar {
-               $$ = scm_list_5 (scm_car ($2),
-                       ly_symbol2scm ("OverrideProperty"),
-                       scm_cadr ($2),
-                       $5, $3);
-       }
-       | OVERRIDE context_prop_spec embedded_scm  embedded_scm '=' scalar {
-               $$ = scm_list_n (scm_car ($2),                  
-                       ly_symbol2scm ("OverrideProperty"),
-                       scm_cadr ($2),
-                       $6, $4, $3, SCM_UNDEFINED);
+       OVERRIDE context_prop_spec property_path '=' scalar {
+               $$ = scm_append (scm_list_2 (scm_list_n (scm_car ($2),                  
+                               ly_symbol2scm ("OverrideProperty"),
+                               scm_cadr ($2),
+                               $5, SCM_UNDEFINED),
+                               $3));
        }
        | REVERT context_prop_spec embedded_scm {
                $$ = scm_list_4 (scm_car ($2),
index 439d9489f175727bc3ad0624179acaa49b8145d2..e536622f06f550336876ea29f4e3b421df787bce 100644 (file)
@@ -17,7 +17,7 @@ using namespace std;
 #include "international.hh"
 #include "lily-version.hh"
 #include "main.hh"
-#include "midi-item.hh"
+#include "midi-chunk.hh"
 #include "midi-stream.hh"
 #include "score.hh"
 #include "string-convert.hh"
index 7438de3dcb05fa6a1500db02cf3f672a07c8014e..e6facbddc5808f521d47bbfe4516d9d6159ddcc5 100644 (file)
@@ -158,18 +158,8 @@ Prob::internal_get_property (SCM sym) const
 }
 
 void
-Prob::internal_set_property (SCM sym, SCM val
-#ifndef NDEBUG
-                            , char const *file, int line, char const *fun
-#endif
-                            ) 
+Prob::internal_set_property (SCM sym, SCM val) 
 {
-#ifndef NDEBUG
-  (void) file;
-  (void) line;
-  (void) fun;
-#endif
-
   if (do_internal_type_checking_global)
     type_check_assignment (sym, val);
   
index f8975cd5158e5eb62be38f642899c8d3972cc220..7de9341e397868b8f24c812910a37dfef0f60b12 100644 (file)
@@ -13,6 +13,7 @@
 #include "output-def.hh"
 #include "dimensions.hh"
 #include "pointer-group-interface.hh"
+#include "moment.hh"
 
 void
 Separating_group_spanner::find_rods (Item *r,
@@ -37,7 +38,13 @@ Separating_group_spanner::find_rods (Item *r,
          Separation_item::set_distance (Drul_array<Item*> (lb, r), padding);
        }
 
-      if (Separation_item::set_distance (Drul_array<Item *> (l, r), padding))
+      if (Separation_item::set_distance (Drul_array<Item *> (l, r), padding)
+         /*
+           This check is because grace notes are set very tight, and
+           the accidentals of main note may stick out so far to cover
+           a barline preceding the grace note.
+          */
+         && spanned_time_interval (l, r).length ().main_part_ > Rational (0))
        break;
 
       /*
index 068baed379405c532d1b144eac81dd228322d365..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,66 +0,0 @@
-/*
-  source.cc -- implement Sources
-
-  source file of the LilyPond music typesetter
-
-  (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
-*/
-
-#include "source.hh"
-
-#include "source-file.hh"
-#include "file-path.hh"
-
-Sources::Sources ()
-{
-  path_ = 0;
-}
-
-
-Sources::Sources (Sources const &)
-{
-  assert (false);
-}
-
-
-void
-Sources::set_path (File_path *f)
-{
-  path_ = f;
-}
-
-/**
-   open a file
-
-   File_string the file to be opened, name might be changed if it is
-   found in a search path.
-*/
-Source_file *
-Sources::get_file (string *file_string) //UGH
-{
-  if (*file_string != "-" && path_)
-    {
-      string file_string_o = path_->find (*file_string);
-      if ((file_string_o == "") && (*file_string != ""))
-       return 0;
-      *file_string = file_string_o;
-    }
-  Source_file *f = new Source_file (*file_string);
-  add (f);
-  return f;
-}
-
-void
-Sources::add (Source_file *sourcefile)
-{
-  sourcefiles_.push_back (sourcefile);
-}
-
-Sources::~Sources ()
-{
-  for (vsize i = 0; i < sourcefiles_.size (); i++)
-    {
-      sourcefiles_[i]->unprotect ();
-    }
-}
-
diff --git a/lily/sources.cc b/lily/sources.cc
new file mode 100644 (file)
index 0000000..bfd3e0d
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+  source.cc -- implement Sources
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+*/
+
+#include "sources.hh"
+
+#include "source-file.hh"
+#include "file-path.hh"
+
+Sources::Sources ()
+{
+  path_ = 0;
+}
+
+
+Sources::Sources (Sources const &)
+{
+  assert (false);
+}
+
+
+void
+Sources::set_path (File_path *f)
+{
+  path_ = f;
+}
+
+/**
+   open a file
+
+   File_string the file to be opened, name might be changed if it is
+   found in a search path.
+*/
+Source_file *
+Sources::get_file (string *file_string) //UGH
+{
+  if (*file_string != "-" && path_)
+    {
+      string file_string_o = path_->find (*file_string);
+      if ((file_string_o == "") && (*file_string != ""))
+       return 0;
+      *file_string = file_string_o;
+    }
+  Source_file *f = new Source_file (*file_string);
+  add (f);
+  return f;
+}
+
+void
+Sources::add (Source_file *sourcefile)
+{
+  sourcefiles_.push_back (sourcefile);
+}
+
+Sources::~Sources ()
+{
+  for (vsize i = 0; i < sourcefiles_.size (); i++)
+    {
+      sourcefiles_[i]->unprotect ();
+    }
+}
+
index e1fe55efe1d04d6ee65ea6e0ce80ad5f9b94bbbd..14ab378668eba48b12546c2febb4a4a29ffae231 100644 (file)
@@ -14,6 +14,7 @@
 #include "stencil.hh"
 #include "system.hh"
 #include "warn.hh"
+#include "moment.hh"
 
 Grob *
 Spanner::clone () const
@@ -145,7 +146,7 @@ Spanner::set_my_columns ()
 }
 
 Interval_t<int>
-Spanner::spanned_rank_iv ()
+Spanner::spanned_rank_iv () const
 {
   Interval_t<int> iv (0, 0);
 
@@ -156,6 +157,14 @@ Spanner::spanned_rank_iv ()
   return iv;
 }
 
+Interval_t<Moment>
+Spanner::spanned_time () const
+{
+  return spanned_time_interval (spanned_drul_[LEFT],
+                               spanned_drul_[RIGHT]);
+}
+
+
 Item *
 Spanner::get_bound (Direction d) const
 {
index b88b0c8bdebb50581e275babe0a9fdb819e17f23..12bbf4ea128f0f573a41ae1e9b7d1f6cabd5fbe4 100644 (file)
@@ -73,11 +73,17 @@ Stencil::extent_box () const
   return dim_;
 }
 
+void
+Stencil::rotate (Real a, Offset off)
+{
+  rotate_degrees (a *180/M_PI, off); 
+}
+
 /*
* Rotate this stencil around the point [x, y]
+  Rotate this stencil around the point [x, y]
  */
 void
-Stencil::rotate (Real a, Offset off)
+Stencil::rotate_degrees (Real a, Offset off)
 {
   const Real x_cen = extent (X_AXIS).center ();
   const Real y_cen = extent (Y_AXIS).center ();
diff --git a/lily/system-scheme.cc b/lily/system-scheme.cc
new file mode 100644 (file)
index 0000000..d0b7cfc
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+  system-scheme.cc -- implement scheme bindings to System
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2007 Joe Neeman <joeneeman@gmail.com>
+*/
+
+#include "align-interface.hh"
+#include "pointer-group-interface.hh"
+#include "system.hh"
+
+
+LY_DEFINE (ly_system_print, "ly:system-print",
+          1, 0, 0, (SCM system),
+          "Draw the system and return the prob containing its "
+          "stencil.")
+{
+  Grob *me = unsmob_grob (system);
+  System *me_system = dynamic_cast<System*> (me);
+  SCM_ASSERT_TYPE (me, system, SCM_ARG1, __FUNCTION__, "grob");
+
+  return me_system->get_paper_system ();
+}
+
+LY_DEFINE (ly_system_stretch, "ly:system-stretch",
+          2, 0, 0, (SCM system, SCM amount_scm),
+          "Stretch the system vertically by the given amount. "
+          "This must be called before the system is drawn (for example "
+          "with ly:system-print).")
+{
+  Grob *me = unsmob_grob (system);
+  Real amount = robust_scm2double (amount_scm, 0.0);
+  
+  extract_grob_set (me, "elements", elts);
+  for (vsize i = 0; i < elts.size (); i++)
+    if (Align_interface::has_interface (elts[i]))
+      {
+       Align_interface::stretch (elts[i], amount, Y_AXIS);
+       break;
+      }
+  return SCM_UNDEFINED;
+}
index cbf4f3bfa7b489aba187fb1b3f5777f413b05979..b669abb8994ef59bdbc51216cff3752c293233cb 100644 (file)
@@ -7,6 +7,8 @@
 */
 
 #include "moment.hh"
+#include "real.hh"
+#include "interval.hh"
 
 #include "interval.tcc"
 
@@ -19,6 +21,7 @@ Interval_t<Rational>::infinity ()
   return infty;
 }
 
+
 template<>
 string
 Interval_t<Rational>::T_to_string (Rational a)
@@ -27,3 +30,32 @@ Interval_t<Rational>::T_to_string (Rational a)
 }
 
 template INTERVAL__INSTANTIATE (Rational);
+
+
+template<>
+Moment
+Interval_t<Moment>::infinity ()
+{
+  Moment infty;
+  
+  infty.main_part_.set_infinite (1);
+  return infty;
+}
+
+
+template<>
+string
+Interval_t<Moment>::T_to_string (Moment a)
+{
+  return a.to_string ();
+}
+
+template INTERVAL__INSTANTIATE (Moment);
+
+template<>
+Real
+Interval_t<Real>::linear_combination (Real x) const
+{
+  Drul_array<Real> da (at (LEFT), at (RIGHT));
+  return ::linear_combination (da, x);
+}
index 6c7e2a024f091d0f5af9adae860c0a790b1cb80c..38510ae5f07d6a7c93296c4bb81fe147d37bb1bd 100644 (file)
@@ -128,7 +128,12 @@ Tie_formatting_problem::set_column_chord_outline (vector<Item*> bounds,
          x.add_point (stem->relative_coordinate (x_refpoint_, X_AXIS));
          x.widen (staff_space / 20); // ugh.
          Interval y;
-         y.add_point (Stem::stem_end_position (stem) * staff_space * .5);
+         Real stem_end_position =
+           Stem::is_cross_staff (stem)
+           ? get_grob_direction (stem) * infinity_f
+           : Stem::stem_end_position (stem) * staff_space * .5;
+
+         y.add_point (stem_end_position);
 
          Direction stemdir = get_grob_direction (stem);
          y.add_point (Stem::head_positions (stem)[-stemdir]
index e8e86007a3d1b27ab6ac482748fc2909450d622d..26deb0841b9db4696abd4ac8a8960aae5d9d2155 100644 (file)
@@ -168,7 +168,7 @@ print_trailer (void *out,
                                              GLYPH_NAME_LEN);
          if (error)
            {
-             programming_error ("print_trailer(): FT_Get_Glyph_Name() returned error");
+             programming_error ("FT_Get_Glyph_Name(): error.");
              glyph_name[0] = 0;
            }
        }
index 9ac5a25294aad06309a42c9a700acd2ea7d4b810..ddcced5c46f0d30df301fc06141b6e51fa75eb23 100644 (file)
@@ -57,7 +57,6 @@
   \consists "Figured_bass_position_engraver"
   \consists "Script_row_engraver"
 
-  \override VerticalAxisGroup #'minimum-Y-extent = #'(-3.5 . 3.5)
   localKeySignature = #'()
   createSpacing = ##t
   ignoreFiguredBassRest = ##t 
@@ -308,6 +307,7 @@ contained staves are not connected vertically."
   "Just like @code{GrandStaff} but with a forced distance between
     the staves, so cross staff beaming and slurring can be used."
 
+  \override VerticalAxisGroup #'minimum-Y-extent = #'(-4 . 4)
   \consists "Instrument_name_engraver"
   
   instrumentName = #'()
@@ -678,6 +678,11 @@ AncientRemoveEmptyStaffContext = \context {
   %% No accidental in tablature !
   \remove Accidental_engraver
 
+  \override Glissando #'extra-dy = #0.75
+  \override Glissando #'bound-details #'right = #`((attach-dir . ,LEFT)
+                                                  (padding . 0.3))
+  \override Glissando #'bound-details #'left = #`((attach-dir . ,RIGHT)
+                                                  (padding . 0.3))
   \override Glissando #'extra-dy = #0.75
   \override Glissando #'gap = #0.2
 }
index e914b70326435296f9968343badc6d16fa7f3b78..2a8af551e98aaacd049907d738126b74c238958e 100644 (file)
@@ -175,9 +175,6 @@ cueDuring =
              'quoted-voice-direction dir
              'origin location))
 
-%% The following causes an error with guile 1.6.8 (guile 1.6.7 and 1.8.x are fine)
-#(use-modules (scm display-lily))
-
 displayLilyMusic =
 #(define-music-function (parser location music) (ly:music?)
    (newline)
index a4d47978915c0915f0b14f07694f7f5040990f9c..06f572e2048c4514c5be02271245e7f87f09b474 100644 (file)
@@ -604,24 +604,25 @@ def conv (str):
     return str
 
 conversions.append (((1,3,113), conv, 'LyricVoice -> LyricsVoice'))
+def regularize_id (str):
+    s = ''
+    lastx = ''
+    for x in str:
+        if x == '_':
+            lastx = x
+            continue
+        elif x in string.digits:
+            x = chr(ord (x) - ord ('0')  +ord ('A'))
+        elif x not in string.letters:
+            x = 'x'
+        elif x in string.lowercase and lastx == '_':
+            x = string.upper (x)
+        s = s + x
+        lastx = x
+    return s
 
 def conv (str):
-    def regularize_id (str):
-       s = ''
-       lastx = ''
-       for x in str:
-           if x == '_':
-               lastx = x
-               continue
-           elif x in string.digits:
-               x = chr(ord (x) - ord ('0')  +ord ('A'))
-           elif x not in string.letters:
-               x = 'x'
-           elif x in string.lowercase and lastx == '_':
-               x = string.upper (x)
-           s = s + x
-           lastx = x
-       return s
+
 
     def regularize_dollar_reference (match):
        return regularize_id (match.group (1))
diff --git a/scm/coverage.scm b/scm/coverage.scm
new file mode 100644 (file)
index 0000000..7b1dfc8
--- /dev/null
@@ -0,0 +1,96 @@
+(define-module (scm coverage))
+
+(use-modules (lily)
+            (ice-9 rdelim)
+            (ice-9 regex)
+            (ice-9 format))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-public (coverage:show-all filter?)
+  (let*
+      ((keys
+       (filter filter?
+               (sort (map car (hash-table->alist coverage-table)) string<? ))))
+    
+  (newline)
+  (for-each
+   (lambda (k)
+
+     (format #t "Coverage for file: ~a\n" k)
+     (display-coverage
+      k (hash-ref coverage-table k)
+      (format #f "~a.cov" (basename k))))
+   keys)))
+
+
+(define-public (coverage:enable)
+  (trap-set! memoize-symbol-handler record-coverage)
+  (trap-enable 'memoize-symbol)
+  (trap-enable 'traps))
+
+     
+(define-public (coverage:disable)
+  (trap-set! memoize-symbol-handler #f)
+  (trap-disable 'memoize-symbol))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define coverage-table (make-hash-table 57))
+
+(define (read-lines port)
+  (string-split (read-delimited "" port) #\newline))
+
+(define (display-coverage file vec out-file)
+  (let*
+      ((lines (read-lines (open-file file "r")))
+       (format-str "~8@a: ~5@a:~a\n")
+       (out (if out-file (open-output-file out-file)
+               (current-output-port))))
+
+    (format out format-str "-" 0 (format #f "Source:~a" file))
+    (do
+       ((i 0 (1+ i))
+        (l lines (cdr l)))
+       ((or (null? l) ))
+
+      (format out format-str
+                      (cond
+                       ((and (< i (vector-length vec)) (vector-ref vec i)) "1")
+                       ((and (string-contains file ".ly") (string-match "^[ \t]*%.*$" (car l)))
+                        "-")
+                       ((string-match  "^[ \t]*[()'`,]*$" (car l))
+                        "-")
+                       ((string-match  "^[ \t]*;.*$" (car l))
+
+                        "-")
+                       (else "0"))
+                      (1+ i)
+                      (car l)))))
+
+(define (record-coverage key cont exp env)
+  (let*
+      ((name (source-property exp 'filename))
+       (line (source-property exp 'line))
+       (vec (and name (hash-ref coverage-table name #f)))
+       (veclen (and vec (vector-length vec)))
+       (veccopy (lambda (src dst)
+                 (vector-move-left! src 0 (vector-length src)
+                                    dst 0)
+                 dst)))
+    (if (and line name)
+       (begin
+         (if (or (not vec) (>= line (vector-length vec)))
+             (set! vec
+                   (hash-set! coverage-table name
+                               (if vec
+                                   (veccopy vec (make-vector (1+ line) #f))
+                                   (make-vector (1+ line) #f)))))
+
+         (vector-set! vec line #t))
+    )))
+
+
+
+
+
index e141103e05b05d0aadfe0d5098e56912d76405a1..2f8c1413d31a7bc473094da67436539bcb311175 100644 (file)
    "Dynamic line spanner"
    '(avoid-slur))
 
+(ly:add-interface
+ 'dynamic-text-spanner-interface
+   "Dynamic text spanner"
+   '(text))
+
 (ly:add-interface
  'finger-interface
  "A fingering instruction"
index 41e74c2078ece5848f5448b1208c87be404a4166..68e92a4fbb1274a0040f6f4fc020107290be6b79 100644 (file)
@@ -65,6 +65,7 @@ beaming patterns from stem to stem inside a beam.")
      (before-line-breaking ,boolean? "Dummy property, used to trigger a callback function.")
      (between-cols ,pair? "Where to attach a loose column to")
      (bound-padding ,number? "The amount of padding to insert around spanner bounds.")
+     (bound-details ,list? "alist of properties for determining attachments of spanners to edges.")
      (bracket-flare ,number-pair? "A pair of numbers specifying how
 much edges of brackets should slant outward.  Value 0.0 means straight
 edges")
@@ -225,6 +226,7 @@ objects in higher layers.")
                            "The thickness of ledger lines: it is the
 sum of 2 numbers.  The first is the factor for line thickness, and the
 second for staff space. Both contributions are added.")
+     (left-bound-info ,list? "alist of properties for determining attachments of spanners to edges.")
      (left-padding ,ly:dimension? "The amount of space that is put
 left to an object (eg. a group of accidentals).")
      (length ,ly:dimension? "User override for the stem length of
@@ -266,7 +268,8 @@ dimension, measured in staff space.")
      (minimum-Y-extent ,number-pair? "See @code{minimum-X-extent}.")
      (minimum-length ,ly:dimension? "Try to make a spanner at least
 this long. This requires an appropriate callback for the
-@code{springs-and-rods} property.")
+@code{springs-and-rods} property.  If added to a Tie, this sets the
+minimum distance between noteheads.")
      (minimum-space ,ly:dimension? "Minimum distance that the victim
 should move (after padding).")
      (neutral-direction ,ly:dir? "Which direction to take in the
@@ -324,6 +327,7 @@ quicker the slur attains it @code{height-limit}.")
      (remove-first ,boolean? "Remove the first staff of a orchestral score?")
      (restore-first ,boolean? "Print a natural before the accidental.")
      (rhythmic-location ,rhythmic-location? "Where (bar number, measure position) in the score.")
+     (right-bound-info ,list? "alist of properties for determining attachments of spanners to edges.")
      (right-padding ,ly:dimension? "Space to insert on the right side  of an object (eg. between note and its accidentals.)")
      (rotation ,list? "Number of degrees to rotate this object, and what point
 to rotate around. #'(45 0 0) means rotate 45 degrees around the center of this object.")
index 645202e28ab5c113e39c1c78e2bc939213413513..5acb4fc1c6bd3972ce69681f0d43abb0d52720c1 100644 (file)
 
     (DynamicTextSpanner
      . (
-       (stencil . ,ly:dynamic-text-spanner::print)
-
        ;; rather ugh with NCSB
        ;; (font-series . bold)
        (font-shape . italic)
        (style . dashed-line)
 
+       (bound-details . ((right . ((attach-dir .  ,LEFT)
+                                   (Y . 0)
+                                   (padding . 0.75)
+                                   ))
+                         (right-broken . ((attach-dir .  ,RIGHT)
+                                   (padding . 0.0)
+                                   ))
+                         
+                         (left . ((attach-dir .  ,LEFT)
+                                  (Y . 0)
+                                  (stencil-offset . (0 . -0.5))
+                                  (padding . 0.5)
+                                  ))
+                         (left-broken . ((attach-dir .  ,RIGHT)
+                                         
+                                         ;; make sure the - - - stays at reasonable
+                                         ;; distance from staff.
+                                         (text . " ")
+                                  ))
+                         ))
+       (stencil . ,ly:new-line-spanner::print)
+       (left-bound-info . ,ly:new-line-spanner::calc-left-bound-info-and-text)
+       (right-bound-info . ,ly:new-line-spanner::calc-right-bound-info)
+
        ;; need to blend with dynamic texts.
        (font-size . 1)
-       (bound-padding . 0.75)
        (dash-fraction . 0.2)
        (dash-period . 3.0)
        (meta . ((class . Spanner)
                 (interfaces . (font-interface
                                text-interface
-                               line-spanner-interface
+                               new-line-spanner-interface
+                               line-interface
                                dynamic-interface
                                dynamic-text-spanner-interface
                                spanner-interface))))))
        (zigzag-width . 0.75)
        (X-extent . #f)
        (Y-extent . #f)
-       (stencil . ,ly:line-spanner::print)
-       (after-line-breaking . ,ly:line-spanner::after-line-breaking)
+       (bound-details . ((right . ((attach-dir .  ,CENTER)
+                                   (padding . 1.5)
+                                     ))
+                         (left . ((attach-dir .  ,CENTER)
+                                  (padding . 1.5)
+                                     ))
+                         ))
+       (stencil . ,ly:new-line-spanner::print)
+       (left-bound-info . ,ly:new-line-spanner::calc-left-bound-info)
+       (right-bound-info . ,ly:new-line-spanner::calc-right-bound-info)
        (meta . ((class . Spanner)
                 (interfaces . (line-interface
                                unbreakable-spanner-interface
-                               line-spanner-interface))))))
+                               new-line-spanner-interface))))))
 
     (GraceSpacing
      . (
 
     (TrillSpanner
      . (
-       (stencil . ,ly:dynamic-text-spanner::print)
-       (edge-text . ,(cons (make-musicglyph-markup "scripts.trill")
-                           ""))
+       (left-bound-info . ,ly:new-line-spanner::calc-left-bound-info)
+       (right-bound-info . ,ly:new-line-spanner::calc-right-bound-info)
+
+       (bound-details . ((left . ((text . ,(make-translate-scaled-markup
+                                            '(0.5 . -0.6)
+                                            (make-musicglyph-markup "scripts.trill")))
+                                  (Y . 0)
+                                  (padding . 0.25)
+                                  (attach-dir . ,LEFT)
+                                  ))
+                         (right . ((Y . 0)))
+                         ))
+       
+       (stencil . ,ly:new-line-spanner::print)
+
        (style . trill)
        (staff-padding . 1.0)
        (padding . 0.5)
        (outside-staff-priority . 50)
        (meta . ((class . Spanner)
                 (interfaces . (text-spanner-interface
-                               line-spanner-interface
+                               new-line-spanner-interface
                                side-position-interface
                                font-interface))))))
 
        (non-musical . #t)
        (X-extent . #f)
        (Y-extent . #f)
-       (stencil . ,ly:line-spanner::print)
-       (after-line-breaking . ,ly:line-spanner::after-line-breaking)
+       (bound-details . ((right . ((attach-dir .  ,CENTER)
+                                   (padding . 1.5)
+                                     ))
+                         (left . ((attach-dir .  ,CENTER)
+                                  (padding . 1.5)
+                                     ))
+                         ))
+       (stencil . ,ly:new-line-spanner::print)
+       (left-bound-info . ,ly:new-line-spanner::calc-left-bound-info)
+       (right-bound-info . ,ly:new-line-spanner::calc-right-bound-info)
        (meta . ((class . Spanner)
-                (interfaces . (line-spanner-interface
+                (interfaces . (new-line-spanner-interface
                                line-interface))))
        ))
 
index ea72b1147646fcbd6c81e4b720ac99dfe2467893..91be3e28b38bfc0892a5cea2261dbb2523c33f13 100644 (file)
@@ -900,10 +900,15 @@ Otherwise, return #f."
            ?unit-count)))
 
 ;;; \clef 
-(define clef-name-alist (map (lambda (name+vals)
-                              (cons (cdr name+vals)
-                                    (car name+vals)))
-                            supported-clefs))
+(define clef-name-alist #f)
+(define-public (memoize-clef-names clefs)
+  "Initialize `clef-name-alist', if not already set."
+  (if (not clef-name-alist)
+      (set! clef-name-alist
+            (map (lambda (name+vals)
+                   (cons (cdr name+vals)
+                         (car name+vals)))
+                 clefs))))
 
 (define-extra-display-method ContextSpeccedMusic (expr parser)
   "If `expr' is a clef change, return \"\\clef ...\"
index df0d04df7d97f8204e115178e22664c702e625bf..b7e253566aa54414529d9b099bacf6da21be42e9 100644 (file)
 ;;; Display methods are stored in the `display-methods' property of each music
 ;;; type.
 ;;;
-;;; - `display-lily-music' can be called to display a music expression using
-;;; LilyPond notation. `music->lily-string' return a string describing a music
-;;; expression using LilyPond notation.
+;;; - `music->lily-string' return a string describing a music expression using
+;;; LilyPond notation. The special variables *indent*, *previous-duration*,
+;;; and *force-duration* influence the indentation level and the display of
+;;; music durations.
 ;;;
 ;;; - `with-music-match' can be used to destructure a music expression, extracting
 ;;; some interesting music properties.
@@ -98,13 +99,6 @@ display method will be called."
                    music-type)))
       (format #f "%{ expecting a music expression: ~a %}" expr)))
 
-(define*-public (display-lily-music expr parser #:key force-duration)
-  (parameterize ((*indent* 0)
-                (*previous-duration* (ly:make-duration 2))
-                (*force-duration* force-duration))
-    (display (music->lily-string expr parser))
-    (newline)))
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; Music pattern matching
@@ -267,13 +261,13 @@ inside body."
 ;;;
 
 ;;; indentation
-(define *indent* (make-parameter 0))
+(define-public *indent* (make-parameter 0))
 
 ;;; set to #t to force duration printing
-(define *force-duration* (make-parameter #f))
+(define-public *force-duration* (make-parameter #f))
 
 ;;; last duration found
-(define *previous-duration* (make-parameter (ly:make-duration 2)))
+(define-public *previous-duration* (make-parameter (ly:make-duration 2)))
 
 ;;; Set to #t to force a line break with some kinds of expressions (eg sequential music)
 (define *force-line-break* (make-parameter #t))
index 670e28e538d35cb053aee265af64a41c8124ce41..213d995c2c463a3eb7dd3897190ba192643693ca 100644 (file)
     (string-append
       "/" command " { /" fontname " " (ly:number->string scaling) " output-scale div selectfont } bind def\n"))
 
-  (define (standard-tex-font? x)
-    (or (equal? (substring x 0 2) "ms")
-       (equal? (substring x 0 2) "cm")))
-
   (define (font-load-command font)
     (let* ((specced-font-name (ly:font-name font))
           (fontname (if specced-font-name
           (ops (ly:output-def-lookup paper 'output-scale))
           (scaling (* ops magnification designsize)))
 
-      ;; Bluesky pfbs have UPCASE names (sigh.)
-      ;; FIXME - don't support Bluesky?
-      (if (standard-tex-font? fontname)
-         (set! fontname (string-upcase fontname)))
       (if (equal? fontname "unknown")
          (display (list font fontname)))
       (define-font plain fontname scaling)))
index e98897fca850ecb62ae1d66f9757de634c61843b..bc4a48f7a9c0bd9a2e55219fe9396370d8da012f 100644 (file)
@@ -71,6 +71,7 @@ on errors, and print a stack trace.")
              (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN.")
              (separate-log-files #f "Output to FILE.log per file.")
              (trace-memory-frequency #f "Record Scheme cell usage this many times per second, and dump to file.")
+             (trace-scheme-coverage #f "Record coverage of Scheme files") 
              (ttf-verbosity 0
                             "how much verbosity for TTF font embedding?")
              (show-available-fonts #f
@@ -108,6 +109,7 @@ on errors, and print a stack trace.")
             (srfi srfi-14)
             (scm clip-region)
             (scm memory-trace)
+            (scm coverage)
             )
 
 ;; my display
@@ -122,13 +124,20 @@ on errors, and print a stack trace.")
 ;;; debugging evaluator is slower.  This should
 ;;; have a more sensible default.
 
-(if (ly:get-option 'verbose)
+(if (or (ly:get-option 'verbose)
+       (ly:get-option 'trace-memory-frequencency)
+       (ly:get-option 'trace-scheme-coverage)
+       )
     (begin
       (ly:set-option 'protected-scheme-parsing #f)
       (debug-enable 'debug)
       (debug-enable 'backtrace)
       (read-enable 'positions)))
 
+
+(if (ly:get-option 'trace-scheme-coverage)
+    (coverage:enable))
+
 (define-public tex-backend?
   (member (ly:output-backend) '("texstr" "tex")))
 
@@ -617,6 +626,12 @@ The syntax is the same as `define*-public'."
 
   
   (let ((failed (lilypond-all files)))
+    (if (ly:get-option 'trace-scheme-coverage)
+       (begin
+         (coverage:show-all (lambda (f) (string-contains f "lilypond"))
+                            )))
+         
+    
     (if (pair? failed)
        (begin
          (ly:error (_ "failed files: ~S") (string-join failed))
index c786c16890f1b64bbf7c80d3d9d7a131165a31b5..5efe02732a9b6a7fa59aece302cc7e41c7cdbf55 100644 (file)
@@ -350,9 +350,14 @@ eg: ((italic) (raise 4) (bold)), maps the commands on each markup argument, eg:
                                   (cdr arg)))))
 
 ;; 
-;; typecheck, and throw an error when something amiss.
+;; 
+;;
 ;; 
 (define (markup-thrower-typecheck arg)
+  "typecheck, and throw an error when something amiss.
+
+Uncovered - cheap-markup? is used."
+
   (cond ((string? arg) #t)
         ((not (pair? arg))
          (throw 'markup-format "Not a pair" arg))
index dd86c491078a2f90e40cff2268062deb8f7627c6..0b636377cceb580f793aa39d68e4141bf12a6963 100644 (file)
@@ -1,6 +1,7 @@
 (define-module (scm memory-trace))
+(use-modules (lily)
+            (ice-9 format))
 
-(use-modules (ice-9 format))
 (define-public (mtrace:start-trace freq)
   (set! usecond-interval (inexact->exact (/ 1000000 freq)))
   (call-with-new-thread start-install-tracepoint))
@@ -16,6 +17,8 @@
 (define continue-tracing #t)
 (define busy-tracing #f)
 (define trace-thread #f)
+(define start-time 0)
+(define start-memory 0)
 
 (define trace-count 0)
 (define usecond-interval 100000)
           (pair? (cdr args))
           (pair? (cadr args)))
       (caadr args) #f))
-
+(define last-count 0)
 (define (record-stack key continuation . args)
   (if (eq? (current-thread) trace-thread)
       #t ;; do nothing.
-      (begin
+      (let*
+         ((cells (cdr (assoc 'total-cells-allocated (gc-stats))))
+          (proc (arg-procedure args))
+          (time (tms:utime (times)))
+          (stack (extract-trace continuation)))
+       
        (set! busy-tracing #t)
        (trap-disable 'traps)
        (trap-disable 'enter-frame)
+
        (set! trace-count (1+ trace-count))
+       (ly:progress "<~a: ~a/~a>\n"
+                    trace-count
+                    (- time start-time)
+                    (- cells last-count))
 
+       (set! last-count cells)
        (set! trace-points
              (cons (list
-                    (assoc 'total-cells-allocated (gc-stats))
-                    (cons 'stack (extract-trace continuation))
-                    (cons 'proc (arg-procedure args))
+                    (cons 'cells cells)
+                    (cons 'proc proc)
+                    (cons 'stack stack)
+                    (cons 'time time)
                     )
                    
                    trace-points))
 
 (define (start-install-tracepoint)
   (set! trace-thread (current-thread))
+  (set! trace-points '())
+  (set! continue-tracing #t)
+  (set! trace-count 0)
+  (set! start-memory (cdr (assoc 'total-cells-allocated (gc-stats))))
+  (set! start-time (tms:utime (times)))
+  
   (install-tracepoint))
 
 (define (install-tracepoint)
       (install-tracepoint)))
 
 (define-public (mtrace:dump-results base)
-  (define out (open-output-file (format #f "~a.graph" base)))
-  (define stacks-out (open-output-file (format #f "~a.stacks" base)))
-  (define i 0)
-  (define last-mem 0) 
-  (format out "# memory trace with ~a points\n" (length trace-points))
-  
-  (for-each
-   (lambda (r)
-     (let*
-        ((mem (cdr (assoc 'total-cells-allocated r)))
-         (proc (cdr (assoc 'proc r)))
-         (stack (cdr (assoc 'stack r))))
-       
-       (format out "~a ~a\n" i mem)
-       (if stack
-          (begin
-            (format stacks-out "~15a - delta-mem: ~15a - ~a \n" i
-                    (- mem last-mem) proc)
-            (do
-                ((j 0 (1+ j))
-                 (stack (cdr (assoc 'stack r)) stack))
-                ((>= j (vector-length stack)))
-              
-              (format stacks-out "\t~a\n"
-                      (vector-ref stack j)))))
-       
-       (set! i (1+ i))
-       (set! last-mem mem)
-       ))
-   (reverse trace-points)))
-
+  (let*
+      ((stacks-name (format #f "~a.stacks" base))
+       (graph-name (format #f "~a.graph" base))
+       (graph-out (open-output-file graph-name))
+       (stacks-out (open-output-file stacks-name))
+       (i 0)
+       (last-mem 0)
+       )
+
+    (ly:progress "Memory statistics to ~a and ~a..."
+                stacks-name graph-name)
+    (format graph-out "# memory trace with ~a points\n" (length trace-points))
+    (for-each
+     (lambda (r)
+       (let*
+          ((mem (- (cdr (assoc 'cells r)) start-memory))
+           (proc (cdr (assoc 'proc r)))
+           (stack (cdr (assoc 'stack r)))
+           (time (- (cdr (assoc 'time r)) start-time)))
+        
+        (format graph-out "~a ~a\n" time mem)
+        (if stack
+            (begin
+              (format stacks-out "~5a t = ~5a - delta-mem: ~15a - ~a \n" i
+                      time
+                      (- mem last-mem) proc)
+              (do
+                  ((j 0 (1+ j))
+                   (stack (cdr (assoc 'stack r)) stack))
+                  ((>= j (vector-length stack)))
+                
+                (format stacks-out "\t~a\n"
+                        (vector-ref stack j)))))
+        
+        (set! i (1+ i))
+        (set! last-mem mem)
+        ))
+     (reverse trace-points))))
 
 
 (define (test-graph . rest)
     trace))
 
 
-
-
-
-
        
        
index 21617676ad71f64fef61530ba42116bb9c63e3d0..049f27ea3ae63cf69e77267c9c4227a9a7b8652f 100644 (file)
@@ -186,6 +186,21 @@ Returns `obj'.
   (newline)
   obj)
 
+;;;
+;;; Scheme music expression --> Lily-syntax-using string translator
+;;;
+(use-modules (srfi srfi-39)
+             (scm display-lily))
+
+(define*-public (display-lily-music expr parser #:key force-duration)
+  "Display the music expression using LilyPond syntax"
+  (memoize-clef-names supported-clefs)
+  (parameterize ((*indent* 0)
+                (*previous-duration* (ly:make-duration 2))
+                (*force-duration* force-duration))
+    (display (music->lily-string expr parser))
+    (newline)))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define-public (shift-one-duration-log music shift dot)
@@ -613,11 +628,6 @@ SkipEvent. Useful for extracting parts from crowded scores"
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; warn for bare chords at start.
 
-(define (has-request-chord elts)
-  (reduce (lambda (x y) (or x y)) #f
-         (map (lambda (x)
-                (equal? (ly:music-property x 'name) 'RequestChord))
-              elts)))
 
 (define-public (ly:music-message music msg)
   (let ((ip (ly:music-property music 'origin)))
@@ -625,25 +635,6 @@ SkipEvent. Useful for extracting parts from crowded scores"
        (ly:input-message ip msg)
        (ly:warning msg))))
 
-(define (check-start-chords music)
-  "Check music expression for a Simultaneous_music containing notes\n(ie. Request_chords),
-without context specification. Called  from parser."
-  (let ((es (ly:music-property music 'elements))
-       (e (ly:music-property music 'element))
-       (name (ly:music-property music 'name)))
-    (cond ((equal? name "Context_specced_music") #t)
-         ((equal? name "Simultaneous_music")
-          (if (has-request-chord es)
-              (ly:music-message music "Starting score with a chord.\nInsert an explicit \\context before chord")
-              (map check-start-chords es)))
-         ((equal? name "SequentialMusic")
-          (if (pair? es)
-              (check-start-chords (car es))))
-         (else (if (ly:music? e) (check-start-chords e)))))
-  music)
-
-
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; setting stuff for grace context.
index 8af5b3fa3dd47d1164f2148fd51e90236a7ffcdd..b82c185e02caa7638dc0acd9a6628e4dc179cd65 100644 (file)
@@ -38,7 +38,7 @@
            setcolor
            setrotation
            text
-           zigzag-line))
+           ))
 
 
 (use-modules (guile)
 
 ;; ice-9 format uses a lot of memory
 ;; using simple-format almost halves lilypond cell usage
-(define format simple-format)
-
-(define (escape-parentheses s)
-  (regexp-substitute/global #f "(^|[^\\])([\\(\\)])" s 'pre 1 "\\" 2 'post))
 
 (define (str4 num)
   (if (or (nan? num) (inf? num))
       (ly:number->string num)))
 
 (define (number-pair->string4 numpair)
-  (string-append (str4 (car numpair))
-                " "
-                (str4 (cdr numpair))))
+  (ly:format "~4l" numpair)) 
 
 (define (numbers->string4 numlist)
   (string-join (map str4 numlist) " "))
 
-;; FIXME: lily-def
-(define-public (ps-string-def prefix key val)
-  (format #f "/ ~a~a (~a) def\n"
-         prefix
-         (symbol->string key)
-         (escape-parentheses val)))
-
-(define (ps-number-def prefix key val)
-  (let ((s (if (integer? val)
-              (ly:number->string val)
-              (ly:number->string (exact->inexact val)))))
-    (format #f "/~a~a ~a def\n"
-           prefix
-           (symbol->string key) s)))
-
-
 ;;;
 ;;; Lily output interface, PostScript implementation --- cleanup and docme
 ;;;
 
 ;; two beziers
 (define (bezier-sandwich lst thick)
-  (format #f "~a ~a draw_bezier_sandwich" 
-         (string-join (map number-pair->string4 lst) " ")
-         (str4 thick)))
+  (ly:format "~l ~4f draw_bezier_sandwich" 
+            (map number-pair->string4 lst)
+         thick))
 
 (define (char font i)
-  (format #f "~a (\\~a) show"
+  (ly:format "~a (\\~a) show"
    (ps-font-command font)
    (ly:inexact->string i 8)))
 
 (define (circle radius thick fill)
-  (format #f
-   "~a ~a ~a draw_circle"
+  (ly:format
+   "~a ~4f ~4f draw_circle"
    (if fill
      "true"
      "false")
-   (str4 radius) (str4 thick)))
+   radius thick))
 
 (define (dashed-line thick on off dx dy phase)
-  (format #f "~a ~a ~a [ ~a ~a ] ~a draw_dashed_line"
-   (str4 dx)
-   (str4 dy)
-   (str4 thick)
-   (str4 on)
-   (str4 off)
-   (str4 phase)
-   
-   ))
+  (ly:format "~4f ~4f ~4f [ ~4f ~4f ] ~4f draw_dashed_line"
+   dx
+   dy
+   thick
+   on
+   off
+   phase))
 
 ;; what the heck is this interface ?
 (define (dashed-slur thick on off l)
-  (format #f "~a ~a [ ~a ~a ] 0 draw_dashed_slur"
+  (ly:format "~l ~4f [ ~4f ~4f ] 0 draw_dashed_slur"
          (let ((control-points (append (cddr l) (list (car l) (cadr l)))))
-           (string-join (map number-pair->string4 control-points) " "))
-         (str4 thick)
-         (str4 on)
-         (str4 off)))
+           (map number-pair->string4 control-points))
+         thick
+         on
+         off))
 
 (define (dot x y radius)
-  (format #f " ~a draw_dot"
-   (numbers->string4 (list radius x y))))
+  (ly:format " ~4l draw_dot" (list radius x y)))
 
 (define (draw-line thick x1 y1 x2 y2)
-  (format #f "~a ~a ~a ~a ~a draw_line"
-         (str4 (- x2 x1))
-         (str4 (- y2 y1))
-         (str4 x1)
-         (str4 y1)
-         (str4 thick)))
+  (ly:format "~4f ~4f ~4f ~4f ~4f draw_line"
+         (- x2 x1) (- y2 y1)
+         x1 y1 thick))
 
 (define (embedded-ps string)
   string)
 
   (define (glyph-spec w x y g)
     (let ((prefix (if (string? g) "/" "")))
-      (format #f "~a ~a ~a~a"
-             (str4 (+ w x))
-             (str4 y)
-             prefix g)))
+      (ly:format "~4f ~4f ~a~a"
+                (+ w x)  y
+                prefix g)))
   
-  (format #f
-         (if cid?
+  (ly:format 
+   (if cid?
 "/~a /CIDFont findresource ~a output-scale div scalefont setfont
 ~a
 ~a print_glyphs"
 
          (if (and (< 0 (interval-length x-ext))
                   (< 0 (interval-length y-ext)))
-             (format #f "~a ~a ~a ~a (textedit://~a:~a:~a:~a) mark_URI\n"
-                     (str4 (+ (car offset) (car x-ext)))
-                     (str4 (+ (cdr offset) (car y-ext)))
-                     (str4 (+ (car offset) (cdr x-ext)))
-                     (str4 (+ (cdr offset) (cdr y-ext)))
-
-                     ;; TODO
-                     ;;full escaping.
-
-                     ;; backslash is interpreted by GS.
-                     (ly:string-substitute "\\" "/" 
-                                           (ly:string-substitute " " "%20" file))
-                     (cadr location)
-                     (caddr location)
-                     (cadddr location))
+             (ly:format "~4f ~4f ~4f ~4f (textedit://~a:~a:~a:~a) mark_URI\n"
+                        (+ (car offset) (car x-ext))
+                        (+ (cdr offset) (car y-ext))
+                        (+ (car offset) (cdr x-ext))
+                        (+ (cdr offset) (cdr y-ext))
+
+                        ;; TODO
+                        ;;full escaping.
+
+                        ;; backslash is interpreted by GS.
+                        (ly:string-substitute "\\" "/" 
+                                              (ly:string-substitute " " "%20" file))
+                        (cadr location)
+                        (caddr location)
+                        (cadddr location))
              "")))))
 
-(define (lily-def key val)
-  (let ((prefix "lilypondlayout"))
-    (if (string=?
-         (substring key 0 (min (string-length prefix) (string-length key)))
-         prefix)
-      (format "/~a { ~a } bind def\n" key val)
-      (format "/~a (~a) def\n" key val))))
 
 (define (named-glyph font glyph)
-  (format #f "~a /~a glyphshow " ;;Why is there a space at the end?
-         (ps-font-command font)
-         glyph))
+  (ly:format "~a /~a glyphshow " ;;Why is there a space at the end?
+            (ps-font-command font)
+            glyph))
 
 (define (no-origin)
   "")
 
 (define (placebox x y s) 
-  (format #f
-"~a ~a moveto
-~a\n"
-  (str4 x)
-  (str4 y)
-  s))
+  (ly:format
+"~4f ~4f moveto
+~a\n" x y s))
 
 (define (polygon points blot-diameter filled?)
-  (format #f "~a ~a ~a ~a draw_polygon"
-         (if filled? "true" "false")
-         (numbers->string4 points)
-         (number->string (- (/ (length points) 2) 1))
-         (str4 blot-diameter)))
+  (ly:format "~a ~4l ~a ~4f draw_polygon"
+            (if filled? "true" "false")
+            points
+            (- (/ (length points) 2) 1)
+            blot-diameter))
 
 (define (repeat-slash width slope beam-thickness)
   (define (euclidean-length x y)
 
   (let ((x-width (euclidean-length beam-thickness (/ beam-thickness slope)))
        (height (* width slope)))
-    (format #f "~a draw_repeat_slash"
-           (numbers->string4 (list x-width width height)))))
+    (ly:format "~4l draw_repeat_slash"
+            (list x-width width height))))
 
 
 (define (round-filled-box left right bottom top blotdiam)
         (width (- right (+ halfblot x)))
         (y (- halfblot bottom))
         (height (- top (+ halfblot y))))
-    (format #f "~a draw_round_box"
-           (numbers->string4
-             (list width height x y blotdiam)))))
+    (ly:format  "~4l draw_round_box"
+               (list width height x y blotdiam))))
 
 ;; save current color on stack and set new color
 (define (setcolor r g b)
-  (format #f "gsave ~a setrgbcolor\n"
-         (numbers->string4 (list r g b))))
+  (ly:format "gsave ~4l setrgbcolor\n"
+             (list r g b)))
 
 ;; restore color from stack
 (define (resetcolor) "grestore \n")
 
 ;; rotation around given point
 (define (setrotation ang x y)
-  (format #f "gsave ~a translate ~a rotate ~a translate\n"
-    (numbers->string4 (list x y))
-    (number->string ang)
-    (numbers->string4 (list (* -1 x) (* -1 y)))))
+  (ly:format "gsave ~4l translate ~a rotate ~4l translate\n"
+            (list x y)
+            ang
+            (list (* -1 x) (* -1 y))))
 
 (define (resetrotation ang x y)
   "grestore  ")
   "\n unknown\n")
 
 (define (url-link url x y)
-  (format #f "~a ~a ~a ~a (~a) mark_URI"
-         (car x)
-         (car y)
-         (cdr x)
-         (cdr y)
-         url))
+  (ly:format "~a ~a ~a ~a (~a) mark_URI"
+            (car x)
+            (car y)
+            (cdr x)
+            (cdr y)
+            url))
 
 (define (utf-8-string pango-font-description string)
   (ly:warning (_ "utf-8-string encountered in PS backend")))
 
-
-(define (zigzag-line centre? zzw zzh thick dx dy)
-  (format #f "~a ~a ~a ~a 0 0 ~a ~a draw_zigzag_line"
-   (if centre? "true" "false")
-   (str4 zzw)
-   (str4 zzh)
-   (str4 thick)
-   (str4 dx)
-   (str4 dy)))
-
-
 (define (path thickness exps)
   (define (convert-path-exps exps)
     (if (pair? exps)
             )
 
          ;; WARNING: this is a vulnerability: a user can output arbitrary PS code here.
-         (cons (format #f
-                       "~a ~a "
-                       (string-join (map (lambda (x) (format #f "~a " x)) args) " ")
+         (cons (ly:format
+                       "~l ~a "
+                       args 
                        head)
                (convert-path-exps (drop rest arity))))
        '()))
     
     
-  (format #f
-   "1 setlinecap ~a setlinewidth\n~a stroke"
+  (ly:format
+   "1 setlinecap ~a setlinewidth\n~l stroke"
    thickness
-   (string-join (convert-path-exps exps) " ")))
+   (convert-path-exps exps) ))
   
index d9a97b90934139f5316153473e957dcdc799923d..4be327839707c5e8a68ecd6f58d2f62433988ce6 100644 (file)
@@ -27,7 +27,6 @@
            dashed-slur
            named-glyph
            dashed-line
-           zigzag-line
            comment
            repeat-slash
            placebox
 (define (dashed-line thick on off dx dy phase)
   (embedded-ps (list 'dashed-line  thick on off dx dy phase)))
 
-(define (zigzag-line centre? zzw zzh thick dx dy)
-  (embedded-ps (list 'zigzag-line centre? zzw zzh thick dx dy)))
-
 (define (embedded-ps expr)
   (let ((ps-string
         (with-output-to-string
            (string-append "\\special{src:"
                           (line-column-location location) "}")
            ""))
-      ""))
\ No newline at end of file
+      ""))
index 9959afdbfe6f48b24da675dfbdc713c7dc61f23a..fe17642c43d99f732641a28da1bbd137412ab759 100644 (file)
 (define-public (gulp-file file-name . max-size)
   (ly:gulp-file file-name (if (pair? max-size) (car max-size))))
 
-(define BOUNDING-BOX-RE
-  "^%%BoundingBox: (-?[0-9]+) (-?[0-9]+) (-?[0-9]+) (-?[0-9]+)")
-
-(define (unused-found-broken-get-bbox file-name)
-  (let* ((bbox (string-append file-name ".bbox"))
-        ;; -sOutputFile does not work with bbox?
-        (cmd (format #t "gs\
- -sDEVICE=bbox\
- -q\
- -dNOPAUSE\
- ~S\
- -c showpage\
- -c quit 2>~S"
-                     file-name bbox))
-        (status (system cmd))
-        (s (gulp-file bbox 10240))
-        (m (string-match BOUNDING_BOX_RE s)))
-
-    (if m
-       (list->vector
-        (map (lambda (x) (string->number (car x))) (vector->list m)))
-       #f)))
-
-
 ;; copy of ly:system. ly:* not available via lilypond-ps2png.scm
 (define (my-system be-verbose exit-on-error cmd)
   (define status 0)
index 463a082fd337e63e25230fc4fe89f70c3091206f..283f04fe2d6665055ab605b3eb564a0b63e8f874 100644 (file)
@@ -382,6 +382,7 @@ grestore
         (input (if (ly:stream-event? cause) (ly:event-property cause 'origin) #f))
         (location (if (ly:input-location? input) (ly:input-file-line-char-column input) '()))
 
+        ;; todo: use stencil extent if available.
         (x-ext (ly:grob-extent grob system-grob X))
         (y-ext (ly:grob-extent grob system-grob Y))
         )
index 409247d0a554963bb2c52cdd379a22bd12739f43..437cc03b4af6becca1f2574b31430d67f0a99c7f 100644 (file)
@@ -89,19 +89,6 @@ is then separated.
                   (numer . ,(car (ly:duration-factor d)))
                   (denom . ,(cdr (ly:duration-factor d))))))
 
-(define (musicxml-pitch->xml-node p)
-  (make <xml-node>
-    #:name 'pitch
-    #:children
-    (list
-     (make <xml-node>
-       #:name 'step
-       #:value (list-ref  '("C" "D" "E" "F" "G" "A" "B")
-                         (ly:pitch-notename p)))
-     (make <xml-node>
-       #:name 'octave
-       #:value (number->string (ly:pitch-octave p))))))
-
 (define (pitch->xml-node p)
   (make <xml-node>
     #:name 'pitch
@@ -250,7 +237,6 @@ is then separated.
   ;;
   ;;  (display (dtd-header) port)
 
-  (define pitch->xml-node musicxml-pitch->xml-node)
   (define duration->xml-node musicxml-duration->xml-node)
   
   (display (open-tag 'music '((type . score)) '()) port)