]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.28
authorfred <fred>
Tue, 26 Mar 2002 21:46:47 +0000 (21:46 +0000)
committerfred <fred>
Tue, 26 Mar 2002 21:46:47 +0000 (21:46 +0000)
195 files changed:
Documentation/tex/lilypond-overview.doc
Documentation/tex/refman.yo
Documentation/tex/tutorial.yo
configure.in
flower/include/array.hh
flower/include/array.icc
flower/include/link.icc
flower/include/parray.hh
input/bugs/time-grouping.ly [new file with mode: 0644]
input/just-friends.ly [new file with mode: 0644]
input/opus-130.ly
input/star-spangled-banner.ly
input/test/auto-beam-override.ly [new file with mode: 0644]
input/test/auto-beam.ly
input/test/chord-inversion.ly
input/test/chord-table.ly
input/test/coda-kludge.ly [new file with mode: 0644]
input/test/ly2dvi-testpage.ly [new file with mode: 0644]
input/test/rep.ly
input/test/span-bars.ly [new file with mode: 0644]
lib/duration-convert.cc
lib/duration.cc
lib/include/duration.hh
lily/GNUmakefile
lily/abbrev.cc
lily/abbreviation-beam.cc
lily/atom.cc
lily/auto-beam-engraver.cc
lily/bar-engraver.cc
lily/bar-number-engraver.cc
lily/bar-script-engraver.cc
lily/bar.cc
lily/base-span-bar-engraver.cc [new file with mode: 0644]
lily/beam-engraver.cc
lily/beam.cc
lily/bow.cc
lily/boxes.cc
lily/break.cc
lily/change-iterator.cc
lily/chord-name-engraver.cc
lily/chord.cc
lily/clef-item.cc
lily/collision.cc
lily/command-request.cc
lily/crescendo.cc
lily/dimension-cache.cc
lily/dots.cc
lily/dynamic-engraver.cc
lily/engraver-group.cc
lily/engraver.cc
lily/extender-spanner.cc
lily/g-text-item.cc
lily/general-script-def.cc
lily/global-ctor.cc [new file with mode: 0644]
lily/global-translator.cc
lily/graphical-element.cc
lily/heads-engraver.cc
lily/include/atom.hh
lily/include/bar.hh
lily/include/base-span-bar-engraver.hh [new file with mode: 0644]
lily/include/beam-engraver.hh
lily/include/box.hh
lily/include/change-iterator.hh
lily/include/chord-name-engraver.hh
lily/include/chord.hh
lily/include/colhpos.hh
lily/include/command-request.hh
lily/include/cons.cc [new file with mode: 0644]
lily/include/cons.hh [new file with mode: 0644]
lily/include/crescendo.hh
lily/include/general-script-def.hh
lily/include/global-ctor.hh [new file with mode: 0644]
lily/include/global-translator.hh
lily/include/includable-lexer.hh
lily/include/killing-cons.tcc [new file with mode: 0644]
lily/include/lily-proto.hh
lily/include/line-of-score.hh
lily/include/lookup.hh
lily/include/lyric-performer.hh
lily/include/midi-def.hh
lily/include/midi-item.hh
lily/include/misc.hh
lily/include/molecule.hh
lily/include/music-list.hh
lily/include/music-wrapper-iterator.hh
lily/include/music-wrapper.hh
lily/include/music.hh
lily/include/musical-request.hh
lily/include/my-lily-lexer.hh
lily/include/my-lily-parser.hh
lily/include/paper-def.hh
lily/include/paper-outputter.hh
lily/include/protected-scm.hh
lily/include/repeat-engraver.hh
lily/include/repeated-music-iterator.hh
lily/include/repeated-music.hh
lily/include/request-iterator.hh
lily/include/rhythmic-grouping.hh [new file with mode: 0644]
lily/include/score-element-info.hh
lily/include/script-def.hh
lily/include/script-engraver.hh
lily/include/script.hh
lily/include/slur-engraver.hh
lily/include/span-bar.hh
lily/include/span-score-bar-engraver.hh
lily/include/staff-side.hh
lily/include/stem.hh
lily/include/text-def.hh
lily/include/time-signature-engraver.hh
lily/include/timing-translator.hh
lily/include/translator.hh
lily/item.cc
lily/lexer.ll
lily/line-of-score.cc
lily/lookup.cc
lily/main.cc
lily/midi-def.cc
lily/midi-item.cc
lily/midi-walker.cc
lily/molecule.cc
lily/multi-measure-rest-engraver.cc
lily/multi-measure-rest.cc
lily/music-list.cc
lily/music-wrapper-iterator.cc
lily/music-wrapper.cc
lily/music.cc
lily/musical-request.cc
lily/my-lily-parser.cc
lily/note-column.cc
lily/note-head.cc
lily/p-col.cc
lily/p-score.cc
lily/paper-def.cc
lily/paper-outputter.cc
lily/parser.yy
lily/protected-scm.cc
lily/repeat-engraver.cc
lily/repeated-music-iterator.cc
lily/repeated-music.cc
lily/request-iterator.cc
lily/rest.cc
lily/rhythmic-column-engraver.cc
lily/rhythmic-grouping.cc [new file with mode: 0644]
lily/score-element.cc
lily/score-engraver.cc
lily/score-performer.cc
lily/score.cc
lily/script-def.cc
lily/script-engraver.cc
lily/script.cc
lily/sequential-music-iterator.cc
lily/slur.cc
lily/span-bar-engraver.cc
lily/span-bar.cc
lily/span-score-bar-engraver.cc
lily/spring-spacer.cc
lily/staff-margin-engraver.cc
lily/staff-performer.cc
lily/staff-side.cc
lily/staff-sym.cc
lily/stem-info.cc
lily/stem.cc
lily/template4.cc
lily/text-def.cc
lily/text-engraver.cc
lily/text-spanner.cc
lily/tie-engraver.cc
lily/time-description.cc
lily/time-signature.cc
lily/timing-translator.cc
lily/translator-ctors.cc
lily/translator-group.cc
lily/translator.cc
lily/tuplet-engraver.cc
lily/tuplet-spanner.cc
lily/volta-spanner.cc
ly/auto-beam-settings.ly [new file with mode: 0644]
ly/declarations.ly
ly/dynamic.ly
ly/params.ly
ly/property.ly
mf/GNUmakefile
mf/feta-accordion.mf
mf/feta-bolletjes.mf
mutopia/E.Satie/petite-ouverture-a-danser.ly
mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly
mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly
mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly
mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly
mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly
mutopia/J.S.Bach/Solo-Cello-Suites/scs-paper.ly
mutopia/J.S.Bach/wtk1-fugue2.ly
ps/lily.ps
scm/lily.scm
tex/lilyponddefs.tex

index 885faa672783e9fc42aeebad024e6c0e539c014d..eae2c17b7c20efc56fca77484c35d81f688f534e 100644 (file)
@@ -12,6 +12,8 @@
 \begin{document}
 \maketitle
 
+[THIS IS WORK IN PROGRESS.  THIS PAPER IS NOT FINISHED]
+
 % -*-LaTeX-*-
 \section{Introduction}
 
index f84468dc122471ece430ddd36654562ee6b83b54..6cad45cc87ed347f40e31edb0730287d4b364e8f 100644 (file)
@@ -7,11 +7,11 @@ redef(var)(1)(whenlatex(latexcommand({\normalfont\scshape )ARG1+latexcommand(}))
 
 redef(code)(1)(tt(ARG1))
 
+
 COMMENT(
 
 TODO:
    the use of semicolons needs to be documented once it settles down
-   \times needs documentation with examples somewhere once it works (?)
    paper size?
    the explanation of how lyrics mode parses words seems ridiculous.  
      Is there a simple way to explain this, or is the behavior
@@ -22,15 +22,39 @@ TODO:
    accordion symbols
    extender*  (see extender.ly)
    \repeat & \alternative  -> probably should have an example
+   properties:
+      unfoldRepeats
+      voltaVisibility
+   property: stemLeftBeamCount stemRightBeamCount
+   interstaff beams (beam-interstaff.ly)
+   interstaff slurs (see preludes-1.ly)
+   boolean property barAuto
+   property: noteheadStyle
+   harmonics: test/harmonics.fly
+   autobeamer
+   properties: beamAutoEndx ??? rational string "1/2"
+        beamAutoBegin
+        beamAutoEnd
+        beamAuto
+        ScriptPadding
+        Direction
+        chordNameStyle (banter)
+        chordInversionPreserve
+        createInitdefaultClef  
+        dynamicStyle   
+        singleStaffBracket
+        numberOfStaffLines
+
+
+       {Mark,BarNumber,Margin}{Direction,ScriptPadding}
+               
+       
 )
 
 
-COMMENT( This document contains Mudela fragments.  You need at least
+COMMENT( 
+This document contains Mudela fragments.  You need at least
 Yodl-1.30.18 to convert this to tex or html.
-
-TODO
-
-in stead <-> instead
 )
 
 htmlbodyopt(bgcolor)(white)
@@ -47,7 +71,7 @@ latexlayoutcmds(
 
 whentexinfo(notableofcontents())
 
-article(Mudela 1.0.7 / LilyPond 1.1.8 Reference Manual)
+article(Mudela 1.0.14 / LilyPond 1.1.27 Reference Manual)
       (Adrian Mariano, Han-Wen Nienhuys and Jan Nieuwenhuizen)
       (nop()PIPETHROUGH(date "+%B %d, %Y")()()nop())
 
@@ -225,16 +249,16 @@ will only be able to refer to identifiers whose names begin with a
 letter and are entirely alphanumeric.  It is also impossible to refer
 to an identifier whose name is the same as the name of a keyword.  The
 following words are keywords:
-verb(absdynamic    grouping       mm              relative     
-accepts       header         musicalpitch    remove       
-alternative   in             name            repeat       tempo
-bar           include        notenames       scm          time
-cadenza       key            notes           scmfile      times
-clef          keysignature   paper           score        translator
-cm            lyrics         partial         script       transpose
-consists      maininput      penalty         shape        type
-duration      mark           property        skip         version
-font          midi           pt              spandynamic)
+verb(absdynamic     duration        mark           property   skip       
+accepts        font            midi           pt         spandynamic
+alternative    grouping        mm             relative   tempo      
+bar            header          musicalpitch   remove     time       
+cadenza        in              name           repeat     times      
+chordmodifier  include         notenames      scm        translator 
+chords         key             notes          scmfile    transpose  
+clef           keysignature    paper          score      type       
+cm             lyrics          partial        script     version    
+consists       maininput       penalty        shape)
 
 The right hand side of an identifier assignment is parsed completely
 when the assignment is made.  It therefore must have any context
@@ -318,6 +342,10 @@ notename of code(word).  If no notename is found, then code(word) is
 treated as a string.  If you mistype a notename, the parser will most
 likely complain that you should be in code(\lyrics) mode to do lyrics. 
 
+dit(Chord mode) Chord mode is instroduced by the keyword code(\chords).
+Very similar to Note mode.  
+COMMENT(I'm not sure how it differs)
+
 dit(Lyric mode) Lyrics mode is introduced by the keyword
 code(\lyrics).  This mode is has rules that make it easy to include
 punctuation and diacritical marks in words.  A word in Lyrics mode
@@ -437,42 +465,66 @@ mudela(fragment,verbatim,center)(
 a'4. b'4.
 )
 
-In addition, the duration can be followed by a multiplier which is
-introduced with the asterisk code(*) and can be an integer or a
-fraction.  The multiplier changes the duration that LilyPond uses
-internally for the note, but for notes it 
-does not change the symbol that is printed.  
+Extra long notes can be obtained using the code(\breve) and
+code(longa) durations:
 mudela(fragment,verbatim,center)(
-c'4*2 c'4*2 d'8*2/3 d'8*2/3
+c'\breve gis'\longa
+)
+
+In order to get triplets and other tuplets, you must use the
+code(\times) keyword which multiplies the duration by a fraction.  The
+syntax is code(\times) var(fraction) var(music).  The length of all of
+the specified music will be multiplied by the fraction and the
+fraction's denominator will be printed over the notes.  The most
+common tuplet is the triplet in which 3 notes have the length of 2, so
+the notes are 2/3 their written length:
+mudela(fragment,verbatim,center)( b'4 \times 2/3 {c'4 c' c'} d'4 d'4 )
+If you try to use code(\times) as the first thing in your music, you
+may encounter the warning ``No one to print a tuplet start bracket''.
+This happens because the Tuplet-engraver is in Voice and no Voice has
+been created yet.  You must explicitly specify the Voice context in
+this situation 
+mudela(fragment,verbatim,center)( 
+\type Voice { \times 2/3 {c'4 d' e'}} 
 )
+
+A shorthand for code(\times) is to write code(*)var(fraction) after a
+duration.  This shorthand will not label triplets correctly, but
+it is convenient for long rests.  
 For long rests with durations equal to an integer number of whole notes,
 LilyPond produces output that indicates the duration of the rest.  If you use
 code(r) then one rest symbol will be printed and several measures left blank.
 If you use code(R) then all of the measure will be filled with whole rests.
+mudela(fragment,verbatim,center)(
+r1 r1*3 R1*3
+)
 If you set the code(Score.SkipBars) property, then only one measure will be
 printed; with code(R), a number indicating the length of the rest will be
 displayed.  
 mudela(fragment,verbatim,center)(
-r1*3 R1*3
 \property Score.SkipBars=1
-r1*3 R1*3)
-
-Extra long notes can be obtained using the code(\breve) and
-code(longa) durations:
+r1 r1*3 R1*3
+)
+Even though the code(\times) command is not explicit, it is still
+necessary to specify a code(Voice) context if the music begins with
+rests lengthened using code(*).  
+Otherwise, the following will result:
 mudela(fragment,verbatim,center)(
-c'\breve gis'\longa
+R1*3 c'1 d'
 )
 
-
-subsect(Note Spanners: Beams, Tuplets, Slurs and Ties)
+subsect(Note Spanners: Beams, Slurs and Ties)
 
 A beam is specified by surrounding the beamed notes with brackets
 code([) and code(]).  
 mudela(fragment,verbatim,center)(
-[a'8 a'] [a'16 a' a' a']
+[a'8 a'] [a'16 a' a' a'] 
+)
+Some more elaborate constructions:
+mudela(fragment,verbatim,center)(
+[a'16 <a' c''> c'' <a' c''>] 
+\times 2/3 { [e'8 f' g'] }
 )
-
-[EXPLAIN TUPLETS HERE]
 
 Another type of spanner is the slur.  Slurs connects chords and try to
 avoid crossing stems.  A slur is started with code(CHAR(40)) and stopped with
@@ -492,6 +544,22 @@ mudela(fragment,verbatim,center)(
 e' ~ e' <c' e' g'> ~ <c' e' g'>
 )
 
+It is possible to create beams and slurs that cross staffs by switching the
+context:
+mudela(fragment,verbatim,center)(
+<
+\type Staff=one \notes\relative c'{
+  \stemup
+  [c8 c \translator Staff=two \stemup c c]
+  \translator Staff=one
+  d4( \translator Staff=two )a4
+  }
+\type Staff=two \notes{ \clef bass;}
+>
+)
+
+
+COMMENT(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
 
 subsect(Note Ornaments)
 
@@ -515,17 +583,17 @@ mudela()(
           c''-\open  c''-\flageolet  c''-\reverseturn 
           c''-\trill
           c''-\prall c''-\mordent c''-\prallprall  c''-\prallmordent
-          c''-\upprall c''-\downprall c''-\thumb}
+          c''-\upprall c''-\downprall c''-\thumb }
   \type Lyrics \lyrics{  
         accent      marcato      staccatissimo fermata stopped
            staccato tenuto upbow downbow lheel rheel ltoe rtoe  turn
            open  flageolet reverseturn 
              trill  prall
-           mordent prallprall prallmordent uprall  downprall thumb}>
-  \paper{linewidth  = 5.875\in;
-         indent = 0.0;
-        }
-}
+           mordent prallprall prallmordent uprall  downprall thumb } 
+  >
+  \paper{ linewidth = 5.875\in;          
+          indent = 0.0;        }
+ }
 )
 
 COMMENT( The following are defined in script.ly but do not work:
@@ -572,6 +640,9 @@ mudela(fragment,verbatim,center)(
 c'' \< \! c''   d'' \decr e'' \rced 
 < f''1 {s4 \< \! s4 \> \! s2 } >)
 
+
+COMMENT(Broken!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
+
 Tremolo marks can be printed by a note by adding code(:)[var(length)]
 after the note.  The length must be at least 8.  A var(length) value
 of 8 gives one line across the note stem.  
@@ -683,6 +754,101 @@ code(\transpose) first.  Any code(\relative) keywords that are outside the
 code(\transpose) have no effect on notes that appear inside the
 code(\transpose).  
 
+sect(Chords)
+
+Chords can be entered either by name or by listing the notes in angle brackets.
+Chords can be displayed either as notes or by name.  To enter chords by name,
+either place them inside the code(\chords) keyword, or use
+code(\notes) and surround them with
+code(@) characters. 
+Chord names have the form
+var(tonic)[var(duration)][code(-)var(modifier)][code(^)var(subtractions)][code(/)var(inversion)]
+The var(tonic) should be the tonic note of the chord, and the var(duration) is
+the chord duration in the usual notation.  There are two kinds of modifiers.
+One type is chord additions, which are obtained by listing intervals separated
+by dots.  An interval is written by its number with an optional code(+) or
+code(-) to indicate raising or lowering by half a step.  A chord additions has
+two effects:  it adds the specified interval and all lower odd numbered
+intervals to the chord, and it may lower or raise the specified interval.
+Intervals can be separated by a dot (code(.)) if you need to list
+several unmodified intervals.
+Repeating a code(-) character will remove a half step from the preceeding
+interval.  
+mudela(fragment,verbatim,center)(
+\transpose c''{ 
+\chords{
+  c1 c-3- c-7 c-8 c-9  
+  c-9-5+7+ c-3-5- c-4.6.8
+}}) 
+The second type of modifier that may appear after the code(-) is 
+a named modifier. 
+Named modifiers are listed in the file file(chord-modifiers.ly).  The
+available modifiers are code(m) and code(min) which lower
+the 3rd half a step, code(aug) which raises the 5th, code(dim) which lowers
+the 5th, code(maj) which adds a raised 7th, and code(sus) which replaces the
+5th with a 4th.  
+mudela(fragment,verbatim,center)(
+\transpose c''{ 
+\chords{
+  c1-m c-min c-maj c-aug c-dim c-sus
+}}) 
+
+Chord subtractions are used to eliminate notes from a chord.  The notes to be
+subtracted are listed after a code(^) character, separated by dots.  
+mudela(fragment,verbatim,center)(
+\transpose c''{ 
+\chords{
+  c1^3 c-7^5.3 c-8^7
+}}) 
+
+Chord inversions can be specified by appending code(/) and the name of a
+single note to a chord.  This has the effect of lowering the specified note by
+an octave so it becomes the lowest note in the chord.  If the
+specified note is not in the chord then a warning will be printed.  
+mudela(fragment,verbatim,center)(
+\transpose c'''{ 
+ @c1@ @c/e@ @c/g@ @c-7/e@
+}) 
+Throughout these examples, chords have been shifted around the staff
+using code(\transpose).  The code(\relative) keyword has odd effects
+when combined with named chords.  
+
+For displaying printed chord names, use the code(ChordNames) context.  
+The chords may be entered either using the notation described above,
+or directly using angle brackets. 
+mudela(fragment,verbatim)(
+<
+  \type ChordNames { \chords{ a b c} \notes{ < d f g >  < e g b > } }
+  \type Staff \notes{ a b c' d' e' }
+>
+)
+Lilypond examines chords specified as lists of notes to determine a
+name to give the chord.  By default, LilyPond will not try to identify
+chord inversions:
+mudela(fragment,verbatim,center)(
+<
+  \type ChordNames { 
+     \notes{ < e' g' c'' > } }
+  \type Staff \notes{ c' } 
+>)
+If you want inversions to be recognized, you must set the property
+code(Score.chordInversion): 
+mudela(fragment,verbatim,center)(
+<
+  \property Score.chordInversion = 1
+  \type ChordNames { 
+       \notes{ < e' g' c'' > } }
+  \type Staff \notes{ c' } 
+>)
+
+COMMENT(
+  Two other properties
+     chordInversionPreserve
+ and chordNameStyle = Banter
+ exist.  What do these do?
+)
+
+
 sect(Lyrics)
 
 Lyrics are entered like notes, with pitches replaced
@@ -714,39 +880,29 @@ URG
 Why does this warrant an URG?
 )
 
+When one word is attached to many notes, you may 
+want a  continuous line after the lyric to show  this.   To achieve
+this effect, add a code(__) lyric after the lyric to be extended.  
+This will create
+an extender, a line  that extends over the entire duration of 
+the lyric.   There must be a lyric after the code(__), so if you want
+to extend the final lyric, you will have to end with a blank lyric. 
+mudela(verbatim,center)(
+\score{
+< \notes \relative c''{ 
+     a4()b()c()d c()d()b()a }
+   \type Lyrics \lyrics {
+     foo1 __  bar2. __ _ }
+> })
+     
 
-COMMENT(
-
-sect(Chords and Voices)
-
-Here's a simple chord
-mudela(fragment,verbatim,center)(
-<c e g>
-)
-
-here are a few
-mudela(fragment,verbatim,center)(
-<
-        { c'()d'()c' }
-        { e'()f'()e' }
-        { g'()a'()g' }
->
-)
-
-and similarly voices
-mudela(fragment,verbatim)(
-<
-        { \voiceone c'4 g' c' g' }
-        { \voicetwo c2 g2 }
->
-)
+COMMENT(Broken!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
 
-)
 
 sect(Time)  
 
 LilyPond aligns all musical objects according to the amount of time
-they occupy.  All of these objects have a duration.  When music is
+they occupy.  All musical objects have a duration.  When music is
 written sequentially using braces the duration is the sum of the 
 durations of the elements.  When music is stacked into simultaneous music 
 using angle
@@ -843,6 +999,30 @@ verb(
 )
 
 
+sect(Repeats)
+
+In order to specify repeats, use the code(\repeat) keyword.  By
+default, repeats are printed with repeat symbols.  
+mudela(fragment,verbatim,center)(
+c'1
+\repeat 2 { c'4 d' e' f' }
+\repeat 2 { f' e' d' c' })
+In order to specify alternate endings, use the code(\alternative)
+keyword.  
+mudela(fragment,verbatim,center)(
+c'1
+\repeat 2 {c'4 d' e' f'} 
+\alternative { {d'2 d'} {f' f} })
+When the repeats involve partial measures, it will be necessary to use
+code(\partial) keywords to indicate which measures are short.  
+mudela(fragment,verbatim)(
+\type Staff { \relative c'{
+  \repeat 2 { \partial 4; e | c2 d2 | e2 f2 | }
+  \alternative { { g4 g g } {\partial 2.; a a a a | b1 } }
+}})
+Repeats can be unfolded by setting the unfoldRepeats 
+
+
 sect(Keywords)
 
 Keywords sometimes appear alone, but usually they require arguments.
@@ -907,7 +1087,7 @@ mudela(center)(
 mudela(center)(
 \score{
   \notes{\cadenza 1; \clef alto;    c'4_"\kern -10mm alto"
-           \clef scarlatti;    c'4_"\kern -4mm scarlatti"
+      %     \clef scarlatti;    c'4_"\kern -4mm scarlatti"
            \clef mezzosoprano; c'4^"\kern -10mm mezzosoprano"
            \clef soprano;  c'4_"\kern -10mm soprano"
            \clef treble;  c'4^"\kern -6mm treble"
@@ -973,7 +1153,7 @@ dit(code(\lyrics) var(lyriclist)) Parse var(lyriclist) in lyrics mode.
 
 dit(code(\maininput)) Internal command.  This command is used for creating init
 files like file(init.fly) that read the user file into the middle of another
-file.  Using it in a user file will lead to an infinite loop.
+file.  It is illegal to use this command in a user file.  
         
 dit(code(\mark) var(unsigned)code(;) or code(\mark) var(string)code(;)) 
 Allowed in music only.  Prints a mark over or under (depending on the
@@ -1007,8 +1187,6 @@ code(\musicalpitch) keyword.
 dit(code(\notes) var(music)) Enter note mode and process the
 specified music. 
 
-dit(code(\)code(output) var(string)code(;)) Generate a parse error.
-
 dit(code(\paper) var(statmentlist)) 
 Appears in a score block to indicate that the music should be printed
 or to set output parameters.  Can also appear at the top level to set
@@ -1163,6 +1341,12 @@ dit(code(Voice)) Corresponds to a voice on a staff.
   This context handles the conversion of noteheads,
   dynamic signs, stems, beams, super- and subscripts, slurs, ties and rests.
 
+dit(code(ChordNamesVoice)) A voice with chord names.  Handles printing
+of a line of chord names.  
+
+dit(code(ChordNames))  Typesets chord names.  Can contain
+code(ChordNamesVoice) contexts.  
+
 dit(code(Lyrics)) Typesets lyrics.  It can contain code(LyricVoice) contexts.
 
 dit(code(Staff)) Handles clefs, bar lines, keys,
@@ -1177,6 +1361,10 @@ contexts.  It adds a brace on the left side grouping the staffs
 together. The bar lines of the contained staffs are connected vertically.
 It can contain code(Staff) contexts.
 
+dit(code(PianoStaff)) Just like code(GrandStaff) but with
+code(minVerticalAlign) set equal to code(maxVerticalAlign) so that
+interstaff beaming and slurring can be used.  
+
 dit(code(StaffGroup)) Contains code(Staff) or code(RhythmicStaff)
 contexsts.  Adds a bracket on the left side, grouping the staffs
 together.  The bar lines of the contained staffs are connected vertically.
@@ -1262,7 +1450,7 @@ direction, set to code(\up) to force slurs up, set to code(\down) to
 force slurs down.  The shorthands code(\slurup), code(\slurdown), and
 code(\slurboth) are available.
 
-dit(code(tieYDirection)) Set to code(\free) for free choice of tie
+dit(code(tieydirection)) Set to code(\free) for free choice of tie
 direction, set to code(\up) to force ties up, set to code(\down) to
 force ties down.  
 
@@ -1275,7 +1463,7 @@ horizontally if they collide with other notes.  This is useful when
 typesetting many voices on one staff.  The identifier code(\shift) is
 defined to enable this.
 
-dit(code(dynamicdir)) Determines location of dynamic marks.  Set to
+dit(code(dynamicDir)) Determines location of dynamic marks.  Set to
 code(\up) to print marks above the staff; set to code(\down) to print
 marks below the staff.
 
@@ -1379,6 +1567,8 @@ mudela(fragment,center)(
 }
 )
 
+COMMENT(Broken!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
+
 
 )
    
@@ -1420,8 +1610,12 @@ beams with zero slope.  The identifiers code(\beamslopeproportional),
 code(\beamslopedamped), and code(\beamslopezero) each set the
 corresponding value.
 
+dit(code(chordInversion)) Determines whether LilyPond should look for
+chord inversions when translating from notes to chord names.  Set to 1
+to find inversions.  The default is 0 which does not look for inversions.
+
 )
-       
+
 
 COMMENT(
 
@@ -1429,10 +1623,6 @@ Mystery properties:
 
 bar-number-engraver.cc:  "barScriptPadding"  vertical space for numbers
 span-bar-engraver.cc:    "singleStaffBracket" do single staffs get a bracket?
-bar-column-engraver.cc:  "barColumnPriority"        
-bar-number-engraver.cc:  "barNumberBreakPriority"   Control horizontal ordering
-mark-engraver.cc:        "markBreakPriority"      of bars, clefs, keysig
-staff-margin-engraver.cc:"marginBreakPriority"    etc.  Slated for revision
 )
 
 sect(Pre-defined Identifiers)
@@ -1556,6 +1746,8 @@ at the top level, these assignments must be terminated by a semicolon.
 
 subsect(Paper variables)
 
+Warning: this section is outdated and inaccurate.  
+
 There are a large number of paper variables that are used to control
 details of the layout.  Usually you will not want to change these
 variables; they are set by default to vaules that depend on the font
@@ -1601,17 +1793,10 @@ whether beams go up or down.  It is real valued.  If set to 2.0 then
 majority selection is used.  If set to 3.0, then mean selection is
 used based on the mean center distance.  If set to 4.0 then median
 selection is used, based on the median center distance.  
-dit(code(beam_ideal_stem1))
-dit(code(beam_ideal_stem2))
-dit(code(beam_minimum_stem1))
-dit(code(beam_minimum_stem2))
-dit(code(beam_multiple_break))
-dit(code(beam_slope_damp_correct_factor))
-dit(code(beam_thickness)) Specify the thickness of beams.
 dit(code(castingalgorithm)) 
 dit(code(forced_stem_shorten)) Stems that have been forced to go the
 unnatural direction are shortened by this amount.  Equal to
-code(\interline) by default.  
+dit(code(forced_stem_shorten0))
 dit(code(gourlay_energybound))
 dit(code(gourlay_maxmeasures)) Maximum number of measures per line
 when using Gourlay method.
@@ -1792,7 +1977,6 @@ The engravers for paper output are:
 
 description(
 dit(code(Abbreviation_beam_engraver))
-dit(code(Bar_column_engraver)) 
 dit(code(Bar_engraver)) Engraves bar lines.  Normally in code(Staff) and
 code(RhythmicStaff).  
 dit(code(Bar_number_engraver)) Engrave bar numbers.  These numbers
@@ -1806,6 +1990,8 @@ with flags instead of beams.
 
 dit(code(Beam_req_swallow_translator)) Swallows beam requests.  In
 code(LyricVoice).  
+dit(code(Chord_name_engraver)) Engraves chord names.  Normally in
+code(ChordNameVoice) 
 dit(code(Clef_engraver)) Engraves the clef symbol.  Normally in code(Staff).
 dit(code(Collision_engraver))
 dit(code(Dot_column_engraver)) Engraves dots on dotted notes shifted to the
@@ -1822,11 +2008,6 @@ dit(code(Piano_bar_engraver))
 dit(code(Pitch_squash_engraver)) Treat all pitches as middle C.  Used in
 code(RhythmicStaff).  Note that the notes move, but the locations of
 accidentals stay the same. 
-dit(code(Plet_engraver)) Engraves brackets and the number over tuplets.  In
-code(Voice).  
-dit(code(Plet_swallow_engraver)) Swallows tuplet requests without any output.
-In code(LyricVoice).  
-COMMENT( Should this be named Plet_req_swallow_translator? )
 dit(code(Priority_horizontal_align_engraver))
 dit(code(Repeat_engraver)) Handles repeats? In code(Staff) and 
    code(RhythmicStaff).
index 25f8d74ea662a8daa4952c0c25dfef831313baf4..b8c65bdf4fef51d9e92fbd05f240bb10599f282a 100644 (file)
@@ -98,16 +98,16 @@ mudela(verbatim)(
            \time 3/4;          
 
        \repeat 2 {
-           d4 [g,8 a b c] d4 g, g |
-           e'4 [c8 d e fis] g4 g, g |
-           c4 [d8( )c b a( ] )b4 [c8 b a g] |
-           a4 [b8 a g fis] g2.  |
+           d4 g,8 a b c d4 g, g |
+           e'4 c8 d e fis g4 g, g |
+           c4 d8( )c b a( )b4 c8 b a g |
+           a4 b8 a g fis g2.  |
        }
 
-        b'4 [g8 a b g]
-        a4 [d,8 e fis d] |
-        g4 [e8 fis g d] cis4 [b8 cis] a4 |
-        [a8-. b-. cis-. d-. e-. fis-. ] 
+        b'4 g8 a b g
+        a4 d,8 e fis d |
+        g4 e8 fis g d cis4 b8 cis a4 |
+        a8-. b-. cis-. d-. e-. fis-.
         g4 fis e |
         fis a,  r8 cis8
         d2.-\fermata
@@ -223,16 +223,6 @@ verb(
 code(c''), the real pitch of this note is code(d'').  The 4 
 designates the duration of the note (it is a quarter note). COMMENT(
 
-)verb(
-        [g,8
-)COMMENT(
-
-)The open bracket starts a beam.  Lily can set beams automatically,
-but we want to specify them ourselves.  This bracket is connected to the
-following note, which is an eighth with pitch code(g') (remember
-relative mode for pitches!)
-COMMENT(
-
 )verb(
         a b
 )COMMENT(
@@ -242,16 +232,6 @@ duration is the same as the code(g), there is no need to enter the
 duration (It is not illegal to enter it anyway.  You would then enter
 code(a8 b8)) COMMENT(
 
-)verb(
-          c]
-) COMMENT(
-
-) This ends the beam started four notes earlier, at the code(g).  In
-the output, you will notice a measure bar following this note.  You do
-not have to enter anything to make LilyPond create a bar.  Instead
-Lily will deduce where bars have to be by comparing durations of notes with
-the current time signature.  COMMENT(
-
 )verb(
           d4 g, g |
 ) COMMENT(
@@ -260,7 +240,7 @@ the current time signature.  COMMENT(
 music, LilyPond will check  that barchecks are found at the start of
 a bar.  This can help you track down notes you forgot to enter. 
 verb(
-        e'4 [c8 d e fis]
+        e'4 c8 d e fis
 ) COMMENT(
 
 ) So far, no notes were chromatically altered.  Here is the first one
@@ -269,17 +249,16 @@ that is: code(fis). Mudela by default uses Dutch note names, and
 sharp sign in the output. The program keeps track of key signatures,
 and will only print accidentals if they are needed.
 verb(
-        c4 [d8( )c b a( ] )b4 [c8 b a g] |
+        c4 d8( )c b a( )b4 c8 b a g |
 ) COMMENT(
 
 ) The next line shows something new: In mudela, one enters a slur by
 marking the beginning and ending note of the slur with an opening and
 closing parenthesis respectively.  In the line shown above this is
 done for two slurs.  Note that parentheses (slur markers) are between
-the notes, and the brackets (beam markers) around the notes. As you
-can see, the brackets and parentheses do not have to nest.
+the notes.  As you can see, parentheses do not have to nest.
 verb(
-        a4 [b8 a g fis] g2.  |
+        a4 b8 a g fis g2.  |
 ) COMMENT(
 
 ) A duration that is to be augmented with a duration dot, is notated
@@ -291,14 +270,14 @@ verb(
 
 ) The end of the repeated music.  LilyPond will typset a repeat bar.
 verb(
-     cis'4 [b8 cis] a4 |
+     cis'4 b8 cis a4 |
 ) COMMENT(
 
 ) This line shows that Lily will print an accidental if that is
 needed: the first C sharp will be printed with an accidental, the
 second one without.  COMMENT(
 
-)verb( [a8-. b-. cis-. d-. e-. fis-. ] % try some super and subscripts.)COMMENT(
+)verb( a8-. b-. cis-. d-. e-. fis-. % try some super and subscripts.)COMMENT(
 
 )There is more to music than just pitches and rhythms.  An important
 aspect is articulation.  You can enter articulation signs either in an
@@ -545,8 +524,8 @@ that is covered in bind(Section)ref(sec:polyphonic).
 
 subsect(Chords with names)
 
-In the previous section we have been talking more about 'stacked notes'
-rather than 'chords'.
+In the previous section we have been talking more about `stacked notes'
+rather than `chords'.
 If you need to enter a lot of chords that have proper names, you can use 
 the code(\chords) mode as an alternative:
 COMMENT(
@@ -1256,7 +1235,10 @@ perfor0mable: COMMENT(
 
 )mudela(fragment,verbatim)(
   <
-    \type Staff  { c''8. c''16 bes'8. a'16 g'4 f'8 g'4. }
+    \type Staff  { 
+      \property Voice.beamAuto = "0" % no beams in melody
+      c''8. c''16 bes'8. a'16 g'4 f'8 g'4. 
+    }
     \type Lyrics \lyrics { 'got8. me16 on8. my16 knees,4 Le-8 lie!4. }
   >
 ) COMMENT(
@@ -1276,7 +1258,10 @@ urg
 )COMMENT(
 
 )mudela(fragment,verbatim)(<
-  \type Staff  { c''8. c''16 bes'8. a'16 g'4 f'8 g'4. }
+  \type Staff  { 
+    \property Voice.beamAuto = "0" % no beams in melody
+    c''8. c''16 bes'8. a'16 g'4 f'8 g'4. 
+  }
   \type Lyrics \lyrics { 'got8 me8 on8. m$\cal_Y$16 "3s,"4 Le-8 lie!4.}
 >
 )COMMENT(
@@ -1684,9 +1669,14 @@ COMMENT(
 
 Of course, you can also use different ratios, and use beamed notes or
 rests:
+COMMENT( BROKEN
+
+lilypond: score-element.cc:134: class Paper_def * Score_element::paper() const: Assertion `pscore_l_' failed.
+
 mudela(fragment)(
        \type Voice \times 4/5 { [c''8 c''16 c''16] r8 [g'8 g'8] }
 )
+)
 If you make a tuplet of  beamed notes, where the beam is as wide as
 the bracket, the bracket is omitted.
 
index 4f251a61fe109d0579dd3fd67b4e401d5a3e42fc..854c957dd4741a83d337468edf78d6c99b4908c2 100644 (file)
@@ -39,8 +39,6 @@ AC_STEPMAKE_TEXMF
 AC_STEPMAKE_YODL
 AC_STEPMAKE_GUILE
 
-CXXFLAGS="$CXXFLAGS -fhandle-signatures" 
-
 dnl should check out -print
 dnl huh?
 dnl AC_CHECK_SEARCH_RESULT($FIND, find, Please use --enable-tex-dir)
index cc489fdf10f0b05a1985c518038a903e63f508a1..c8fe30f16fb36d362c016606e6aae092b76097d7 100644 (file)
@@ -56,15 +56,12 @@ protected:
 
 public:
   /// check invariants
-  void OK() const 
-    {
-      assert (max_ >= size_ && size_ >=0);
-      if (max_) assert (array_p_);
-    }
+  void OK() const ;
   /** report the size_.
       @see 
       {setsize_}
   */
+
   int size() const  
     {
       return size_;
@@ -88,10 +85,10 @@ public:
 
   // ugh, get around gcc 2.8.1 ice; see bezier.cc
   Array (int i) 
-  { 
-    max_ = size_ = i; 
-    array_p_ = new T[i];
-  }
+    
+      max_ = size_ = i; 
+      array_p_ = new T[i];
+    }
 
 
   /** set the size_ to #s#.
@@ -107,17 +104,13 @@ public:
     { delete[] array_p_; }
 
   /// return a  "new"ed copy of array 
-    T* copy_array() const 
+  T* copy_array() const 
     {
       T* Tarray = new T[size_];
       arrcpy (Tarray, array_p_, size_);
       return Tarray;
     }
-  // depracated
-  operator T*() const 
-    {
-      return copy_array();     
-    }
+
   void operator=(Array const & src) 
     {
       set_size (src.size_);
@@ -130,37 +123,36 @@ public:
     }
 
   /// tighten array size_.
-    void precompute()     {
-      remax (size_);
-    }
-    
-  T * remove_array_p () {
-    T * p = array_p_;
-    size_ = 0;
-    max_ = 0;
-    array_p_ =0;
-    return p;
+  void precompute()     {
+    remax (size_);
   }
+    
+  T * remove_array_p ();
 
   /// access element
   T &operator[] (int i)  
     {
-      return elem (i);
+      return elem_ref (i);
     }
   /// access element
-    T const & operator[] (int i) const 
+  T const & operator[] (int i) const 
     {
-      return elem (i);
+      return elem_ref (i);
     }
   /// access element
-    T &elem (int i) const 
+  T &elem_ref (int i) const 
     {
       assert (i >=0&&i<size_);
       return ((T*)array_p_)[i];        
     }
+  /// access element
+  T elem (int i) const 
+    {
+      return elem_ref (i);
+    }
 
   /// add to the end of array
-    void push (T x) 
+  void push (T x) 
     {
       if (size_ == max_)
        remax (2*max_ + 1);
@@ -170,7 +162,7 @@ public:
       array_p_[size_++] = x;
     }
   /// remove and return last entry 
-    T pop() 
+  T pop() 
     {
       assert (!empty());
       T l = top (0);
@@ -178,12 +170,12 @@ public:
       return l;
     }
   /// access last entry
-    T& top (int j=0) 
+  T& top (int j=0) 
     {
       return (*this)[size_-j-1];
     }
   /// return last entry
-    T top (int j=0) const 
+  T top (int j=0) const 
     {
       return (*this)[size_-j-1];
     }
@@ -195,7 +187,7 @@ public:
       (*this)[i]=(*this)[j];
       (*this)[j]=t;
     }
-  bool empty() const 
+  bool empty () const 
     { return !size_; }
 
   void insert (T k, int j);
@@ -209,9 +201,8 @@ public:
       return t;
     }
   void unordered_del (int i)
-    
     {
-      elem (i) = top();
+      elem_ref (i) = top();
       set_size (size() -1);
     }
   void del (int i) 
@@ -229,15 +220,7 @@ public:
       set_size (size_ + src.size_);
       arrcpy (array_p_+s,src.array_p_, src.size_);     
     }
-  Array<T> slice (int lower, int upper) 
-    {
-      assert (lower >= 0 && lower <=upper&& upper <= size_);
-      Array<T> r;
-      int s =upper-lower;
-      r.set_size (s);
-      arrcpy (r.array_p_, array_p_  + lower, s);
-      return r;
-    }
+  Array<T> slice (int lower, int upper) ;
   void reverse();
 };
 
index 0077a01d08f6b52d3323fe6970ac973d9bbd0174..807382880e61624d90875ff9f325dec28de9c5d6 100644 (file)
@@ -64,3 +64,34 @@ Array<T>::reverse ()
     swap (i,j);
 }
 
+template<class T> INLINE
+void
+Array<T>::OK() const
+{
+  assert (max_ >= size_ && size_ >=0);
+  if (max_) assert (array_p_);
+}
+
+template<class T> INLINE
+T *
+Array<T>::remove_array_p ()
+{
+  T * p = array_p_;
+  size_ = 0;
+  max_ = 0;
+  array_p_ =0;
+  return p;
+}
+
+template<class T> INLINE
+Array<T>
+Array<T>::slice (int lower, int upper)
+{
+  assert (lower >= 0 && lower <=upper&& upper <= size_);
+  Array<T> r;
+  int s =upper-lower;
+  r.set_size (s);
+  arrcpy (r.array_p_, array_p_  + lower, s);
+  return r;
+}
+
index df560285f2958bfb802a236a6d88c5e54e44dfd1..4b3c886aad95625ec4d06b3e6aebb60837694a2d 100644 (file)
@@ -10,11 +10,11 @@ Link<T>::OK() const
 #ifndef NDEBUG
   if (previous_) 
     {
-       assert (previous_->next_ == this);
+      assert (previous_->next_ == this);
     }
   if (next_) 
     {
-       assert (next_->previous_ == this);
+      assert (next_->previous_ == this);
     }
 #endif    
 }
@@ -60,7 +60,7 @@ Link<T>::add (const T& thing)
   
   Link<T>* l = new Link<T>(this, next_, thing);
   if (next_)
-      next_->previous_ = l;
+    next_->previous_ = l;
   next_ = l;
 }
 
@@ -72,7 +72,7 @@ Link<T>::insert (const T& thing)
                                // bugfix hwn 16/9/96
   Link<T>* l = new Link<T>(previous_, this, thing);
   if (previous_)
-      previous_->next_ = l;
+    previous_->next_ = l;
   previous_ = l;
 }
 
@@ -84,14 +84,14 @@ inline void
 Link<T>::remove (List<T> &l)
 {
   if (previous_) 
-      previous_->next_ = next_;
+    previous_->next_ = next_;
   else 
-       l.top_ = next_;
+    l.top_ = next_;
 
   if (next_)
-      next_->previous_ = previous_;
+    next_->previous_ = previous_;
   else
-       l.bottom_ = previous_;
+    l.bottom_ = previous_;
 }
 
 template<class T>
index 77a69b519a1d87bd4725cb745e813b718c848042..79ef5e6a7f6d258b32ec478f0fab8035b397cd53 100644 (file)
   an array of pointers.
 
   TODO
-  should init to 0. Derive from Array<void*>? 
+  should init to 0.
  */
 template<class T>
-class Link_array : public Array<T*>
+class Link_array : private Array<void *>
 {
   static default_compare (T *const& p1, T  *const&p2) {
     /* can't do p1 -p2, since T might be an incomplete type */
@@ -29,13 +29,64 @@ class Link_array : public Array<T*>
       return 1;
     return 0;
   }
+  Link_array (Array<void*> v)
+    :Array<void*> (v)
+    {
+    }
 public:
+  Link_array()
+    {}
+  Link_array (Link_array<T> const &src)
+    : Array<void*> (src)
+    {
+    }
+  /// access element
+  T *elem (int i) const 
+    {
+      return elem_ref (i);
+    }
+  T *&elem_ref  (int i) const
+    {
+      return (T*&) Array<void*>::elem_ref (i);
+    }
+
+  /// access element
+  T* &operator[] (int i)  
+    {
+      return (T*&) Array<void*>::elem_ref (i);
+    }
+  /// access element
+  T *const operator[] (int i) const 
+    {
+      return (T *const) Array<void*>::elem (i);
+    }
+  T *pop ()
+    {
+      return (T*) Array<void*>::pop ();
+    }
+  void insert (T *t, int i)
+    {
+      Array<void*>::insert (t, i);
+    }
+  void push (T* t)
+    {
+      Array<void*>::push (t);
+    }
+  /// return last entry
+  T* top (int j=0) const 
+    {
+      return (T*) Array<void*>::top (j);
+    }
+  T *& top (int i=0)
+    {
+      return (T*&) Array<void*>::top (i);
+    }
   void substitute (T *old, T*new_l)
     {
       int i;
       while ((i = find_i (old)) >=0) 
        if (new_l)
-         elem (i) =new_l;
+         elem_ref (i) =new_l;
        else
          del (i);
     }
@@ -44,7 +95,7 @@ public:
       int i;
       while ((i = find_i (old)) >=0) 
        if (new_l)
-         elem (i) =new_l;
+         elem_ref (i) =new_l;
        else {
          unordered_del (i);
        }
@@ -53,6 +104,10 @@ public:
   void default_sort() {
     sort (default_compare);
   }
+  // quicksort.
+  void sort (int (*compare)(T *const&,T *const&),
+            int lower = -1, int upper = -1);
+  
   void uniq() {
     Link_array<T> l_arr;
     for (int i=0; i < size(); i++) 
@@ -60,7 +115,26 @@ public:
        l_arr.push (elem (i)); 
     *this = l_arr;
   }
-
+  Array<void*>::del;
+  Array<void*>::unordered_del;  
+  Array<void*>::size;
+  Array<void*>::clear;
+  Array<void*>::set_size;
+  Array<void*>::empty;
+  Array<void*>::reverse;  
+  T * get (int i)
+    {
+      return (T*) Array<void*>::get (i);
+    }
+  Link_array<T>
+  slice(int l,int u)
+    {
+      return Array<void*>::slice (l,u);
+    }
+  void concat (Link_array<T> const &a2)
+    {
+      Array<void*>::concat (a2);
+    }
   int find_i (T const * t) const {
     for (int i=0; i < size(); i++)
       if (elem (i) == t)
@@ -75,6 +149,7 @@ public:
       else
        return 0;
     }
+  
 };
 
 template<class T, class V>
@@ -88,5 +163,27 @@ typecast_array (Link_array<V> const &a, T * /* dummy */ )
 }
 
 
+
+template<class T> inline void
+Link_array<T>::sort (int (*compare)(T *const&,T *const&),
+               int lower = -1, int upper = -1) 
+{
+  if (lower < 0) 
+    {
+      lower = 0 ;
+      upper = size () - 1;
+    }
+  if (lower >= upper)
+    return;
+  swap (lower, (lower+upper)/2);
+  int last = lower;
+  for (int i= lower +1; i <= upper; i++)
+    if (compare (elem (i), elem(lower)) < 0)
+      swap (++last,i);
+  swap (lower, last);
+  sort (compare, lower, last-1);
+  sort (compare, last+1, upper);
+}
+
 #endif // PARRAY_HH
 
diff --git a/input/bugs/time-grouping.ly b/input/bugs/time-grouping.ly
new file mode 100644 (file)
index 0000000..b0cc682
--- /dev/null
@@ -0,0 +1,16 @@
+%{
+  wierd grouping bug
+%}
+
+\score{
+    \notes \relative c''{
+       % be sure it's not related to auto-beamer
+       \property Voice.beamAuto = "0"
+       \time 1/2;
+       [ c8 c c c ]
+       \time 1/4;
+       [ c8 c ]
+    }
+    \paper{
+    }
+}
diff --git a/input/just-friends.ly b/input/just-friends.ly
new file mode 100644 (file)
index 0000000..8082c7b
--- /dev/null
@@ -0,0 +1,58 @@
+\header {
+  filename =    "just-friends.ly";
+  title =       "Just Friends";
+  description = "Jazz chords example with bar lines";
+  opus =        "";
+  source =      "mutex@gmd.de";
+  composer =    "";
+  enteredby =   "jcn";
+  copyright =   "Public Domain";
+}
+
+%{
+In response to
+
+Message-Id: <19990206153950.A7474@gil.physik.rwth-aachen.de>
+Date: Sat, 6 Feb 1999 15:39:50 +0100
+From: Christoph Kukulies <kuku@gilberto.physik.RWTH-Aachen.DE>
+Subject: chord bars
+
+I was looking out for a FAQ on the www.gmd.de/Misc/Music page but didn't
+find any so bear with me when asking a FAQ question:
+
+I want to generate some sheets that contain only the chords (changes)
+of a certain tune (Jazz, Real Book, for example), like
+
+              Just Friends
+
+[...]
+
+%}
+
+\score{
+       \type ChordNames \chords{
+               \property Score.chordInversion = 1
+               \property Score.barAtLineStart = 1
+               \repeat 2 {
+                       f1-maj f-maj f-7 bes-7
+                       c-maj c-maj es es
+                       d-7 g-7 b2-7/fis e-7 a1-7\break
+                       d-7 d-7 d-7 g2-7 ges-7
+
+                       f1-maj f1-maj f-7 bes-7
+                       c-maj c-maj es es
+                       d-7 g-7 b2-7/fis e-7 a1-7\break
+                       d-7 d2-7 g-7 c1-6 g2-7 c-7
+               }
+       }
+       \paper{
+               indent = 0.0\mm;
+               linewidth = 100.0\mm;
+               \translator{
+                       \ChordNameContext
+                       barAuto = "1";
+                       \consists Bar_engraver;
+                       \consists "Repeat_engraver";
+               }
+       }
+}
index 0bb12e66c0920e88a95a60ea593293292dea843c..bd01cf52e2f1cd902630f1f6c35c12a11e16ac30 100644 (file)
@@ -63,12 +63,6 @@ cello = \notes\relative c'{
        >
        \paper{
                \translator { \OrchestralScoreContext }
-               \translator {
-                       \VoiceContext
-                       \consists Auto_beam_engraver;
-                       beamAuto = 1.;
-                       beamAutoEnd = "3/8";
-               }
        }
        \midi{ \tempo 4 = 160; }
 }
index d05c396cfa5beea4a2a93ef7ff8cf32221a18730..f5b05d1e3525efd6e602df580337f680451ced1a 100644 (file)
@@ -114,13 +114,6 @@ global = \notes {
                \translator {
                        \BarNumberingStaffContext
                }
-               \translator{
-                       \VoiceContext
-                       \consists Auto_beam_engraver;
-                       beamAuto = 1.;
-                       beamAutoEnd8 = "1/4";
-                       beamAutoEnd16 = "1/4";
-               }
        }
 }
 
diff --git a/input/test/auto-beam-override.ly b/input/test/auto-beam-override.ly
new file mode 100644 (file)
index 0000000..ad378a5
--- /dev/null
@@ -0,0 +1,38 @@
+%{
+  Currently (1.1.27.jcn3), the auto-beam engraver will only engrave
+  sensible beams, which means that it will end a beam when:
+    * a rest is encountered
+    * another beam (entered manually) is encountered
+    * there's a 'gap' in the beam note's durations
+
+  The beam will be ended also when
+
+    now / beamAutoEnd = 0
+%}
+       
+\score{
+    \notes \relative c''{
+       \time 2/4;
+       % one beam per measure
+       c8 c c c
+       c16 c c c c c c c
+       % from here on consider ending beam every 1/4 note
+       \property Voice.beamAutoEnd = "1/4"
+       c8 c c c
+       % manually override autobeam with weird beaming
+       c8 [c c] c
+       c8 c c r
+       c8 c c4
+       r8 c c c
+       % no autobeaming
+       \property Voice.beamAuto = "0"
+       c8 c c c
+    }
+    \paper{
+       \translator{
+           \VoiceContext
+           % consider ending beam at every 1/2 note
+           beamAutoEnd = "1/2";
+       }
+    }
+}
index 02e7711dbad2e7d2764ed592cab0fb2ed1d74b4e..6839be66002153275db80220a48ff497bfbcd6df 100644 (file)
@@ -1,49 +1,62 @@
 %{
-  Currently (1.1.22.jcn5), the auto-beam engraver will only engrave
-  sensible beams (hopefully), which means that it will give up the
-  whole beam if:
-    * a rest is encountered
-    * another beam (entered manually) is encountered
-    * there's a 'gap' in the beam note's durations
-
-  There's no smart algorithm, beginning a beam is considered when
-   
-    now / beamAutoBegin = 0
-
-  the beam will be ended when
-
-    * now / beamAutoEnd = 0
+  The auto-beam engraver has presets for common time signatures.
 %}
-       
+
 \score{
     \notes \relative c''{
-       \time 2/4;
-       % one beam per measure
-       c8 c c c
-       c16 c c c c c c c
-       % from here on two beams per measure
-       \property Voice.beamAutoEnd = "1/4";
-       c8 c c c
-       % manually override autobeam with weird beaming
-       c8 [c c] c
-       c8 c c r
-       c8 c c4
-       r8 c c c
-       % no autobeaming
-       \property Voice.beamAuto = "0"
-       c8 c c c
+%{
+       % urg: something breaks in grouping ; see input/bugs/time-grouping.ly
+       \time 1/2;
+       c8 c c c
+       c16 c c c c c c c
+       c32 c c c c c c c c c c c c c c c
+       \time 1/4;
+       c8 c 
+       c16 c c c
+       c32 c c c c c c c
+       \time 1/8;
+       c8
+       c16 c
+       c32 c c c
+%}
+       \time 2/2;
+       c8 c c c c c c c
+       c16 c c c c c c c c c c c c c c c
+       c32 c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c
+       \time 2/4;
+       c8 c c c
+       c16 c c c c c c c
+       c32 c c c c c c c c c c c c c c c
+       \time 2/8;
+       c8 c
+       c16 c c c
+       c32 c c c c c c c
+       \time 3/2;
+       c8 c c c c c c c c c c c
+       c16 c c c c c c c c c c c c c c c c c c c c c c c
+       \time 3/4;
+       c8 c c c c c
+       c16 c c c c c c c c c c c
+       c32 c c c c c c c c c c c c c c c c c c c c c c c
+       \time 3/8;
+       c8 c c
+       c16 c c c c c
+       c32 c c c c c c c c c c c
+       \time 4/4;
+       c8 c c c c c c c
+       c16 c c c c c c c c c c c c c c c
+       c32 c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c
+       \time 4/8;
+       c8 c c c
+       c16 c c c c c c c
+       c32 c c c c c c c c c c c c c c c
+       \time 6/8;
+       c8 c c c c c
+       c16 c c c c c c c c c c c
+       \time 9/8;
+       c8 c c c c c c c c
+       c16 c c c c c c c c c c c c c c c c c
     }
     \paper{
-       \translator{
-           \VoiceContext
-           % add experimental auto-beaming
-           \consists Auto_beam_engraver;
-           % switch it on (perhaps a bit double, but we want to be able 
-           % to switch it off conveniently
-           beamAuto = 1.;
-           % consider starting beam at every 4 note
-           % beamAutoBegin = "1/4";
-           beamAutoEnd = "1/2";
-       }
     }
 }
index 543502d4a03b1c7114ac25d97518ac7d28aa5eea..2e06840c5e2a25c735ad01ba371d0234d6d1c00b 100644 (file)
@@ -9,9 +9,8 @@ inversions = \notes\transpose c''\chords{
        c1 c-sus c-6 c/e c/g c/d
        % now try to find chords with inversions
        \property Score.chordInversion = 1 
-       \property Score.chordInversionPreserve = 1 
        c1 c-sus c-6 
-       c/e % c/e is not found because preserving doesn't work fully yet...
+       c/e
        c/g
        c/d % this triggers a warning: no 'd' in chord of c
 }
index 14c758c52ef9fb8c2c0ba2050555dd30e4c84f88..98174f1cf7d6da52295ac7c3d6e7f38875be06f7 100644 (file)
@@ -5,7 +5,7 @@ enteredby =     "jcn";
 }
 
 tab = \notes\transpose c'''\chords{
-       c1 c-m c-4 c-m4 c-5+ c-5- c-m5- c-5.5+ c-6\break %c-m6\break
+       c1 c-m c-4 c-m4 c-5+ c-5- c-m5- c-5-.5+ c-6\break %c-m6\break
 }
 
 \score{
diff --git a/input/test/coda-kludge.ly b/input/test/coda-kludge.ly
new file mode 100644 (file)
index 0000000..982a815
--- /dev/null
@@ -0,0 +1,52 @@
+%{
+Hi,
+       I want to write some music that has the structure:
+
+       Intro
+       \repeat 4 { Chorus [first-ending] verse }
+       fifth-ending final
+
+       The obvious:
+
+       \repeat 4 { Chorus \alternative{{first-ending}{}} verse}
+       \alternative{{}{fifth-ending}}
+       final
+
+       doesn't work.
+
+       And the (logically correct but ugly)
+
+       \repeat 4 {Chorus}
+       \alternative {{first-ending verse}{fifth ending}}
+       final
+
+       is very ugly, because the volta bracket keeps going for so
+       long.
+
+       Peter C
+%}
+
+\score{
+       <
+               \type Staff \notes\relative c''{
+                       c c c c
+                       % coda-klugde: let volta span only one bar
+                       \property Staff.voltaSpannerDuration = "1"
+                       \repeat 5 { d d d d }
+                               \alternative { { e e e e f f f f }
+                       { g g g g } }
+               }
+               \type Lyrics \lyrics{
+                       intro1
+                       \repeat 5 {}
+                       \alternative <
+                               { chorus1 one verse1 }
+                               { chorus1 two verse1 }
+                               { chorus1 three verse }
+                               { chorus1 four verse }
+                       >
+                       five1
+               }
+       >
+}
+
diff --git a/input/test/ly2dvi-testpage.ly b/input/test/ly2dvi-testpage.ly
new file mode 100644 (file)
index 0000000..ba3e51f
--- /dev/null
@@ -0,0 +1,40 @@
+
+%{
+  Test ly2dvi features.
+%}
+
+\header {
+copyright = "copyright";
+title = "title";
+subtitle = "subtitle";
+composer = "composer";
+arranger = "arranger";
+instrument = "instrument";
+metre = "metre";
+opus = "opus";
+piece = "piece";
+poet = "poet";
+}
+
+
+\score {
+       \notes { c1 c1 c1 c1 }
+}
+
+\score {
+       \notes { c1 c1 c1 c1 }
+       
+       \header {
+
+       title = "localtitle";
+       subtitle = "localsubtitle";
+       composer = "localcomposer";
+       arranger = "localarranger";
+       instrument = "localinstrument";
+       metre = "localmetre";
+       opus = "localopus";
+       piece = "localpiece";
+       poet = "localpoet";
+       copyright = "localcopyright";
+       }
+}
index 2b79795ecc904435fa3c643a2ffe7ffb6f70549e..1275606bb0800bf9f5782465f13c4c1a3fae5889 100644 (file)
@@ -2,7 +2,7 @@
        <
                  \type Staff \notes\relative c'{ 
                          c4 d e f
-                         \repeat 2 { g a b c }
+                         \repeat 3 { g a b c }
 %                        \alternative { { c b a g } { f e d c } } c c c c
                          \alternative { { c b a g } { f e d c } { c d e f } }
                          g g g g
diff --git a/input/test/span-bars.ly b/input/test/span-bars.ly
new file mode 100644 (file)
index 0000000..5c7fb2c
--- /dev/null
@@ -0,0 +1,23 @@
+
+\version "1.0.14";
+nt = \notes { c1 \break c1 c1 } 
+stuff = \notes \relative c'' <
+  \type Staff = stone  { \nt }
+  \type Staff = sttwo { \nt }
+>
+
+\score{ 
+    \type StaffGroup \stuff
+}
+
+\score{ 
+    \type StaffGroup < \type GrandStaff \stuff
+        \type Staff = stthree \nt 
+    >
+}
+
+\score{ 
+    \type ChoirStaff \stuff
+}
+
+
index c1240f3cddf73bd3320e56fb9a75490a53647b01..4f2e2a9015af5175870cd381bb03284d6582079a 100644 (file)
@@ -105,14 +105,14 @@ Duration_convert::mom2_dur (Moment mom)
 
   Duration dur = mom2standardised_dur (mom);
   //   if (!dur.mom () || (dur.mom () == mom))
-  if (!dur.length () || (dur.length () == mom))
+  if (!dur.length_mom () || (dur.length_mom () == mom))
     return dur;
   assert (midi_as_plet_b_s);
 
   //   dur.set_plet (type_mom, Duration::division_1_i_s / 4); 
 
   //   Moment as_plet_mom = mom / dur.mom ();
-  Moment as_plet_mom = mom / dur.length ();
+  Moment as_plet_mom = mom / dur.length_mom ();
   as_plet_mom *= dur.plet_.mom ();
   long num = as_plet_mom.num ();
   long den = as_plet_mom.den ();
@@ -185,7 +185,7 @@ Duration_convert::ticks2_dur (int ticks_i)
 
   Duration dur = mom2standardised_dur (mom);
 
-  if (dur.length () == mom)
+  if (dur.length_mom () == mom)
     return dur;
                
   return mom2_dur (mom);
index f65348ae6daa2a199124f5e49867bf42bf7ef337..8e254ba0f226555425b944268df71b92963b671a 100644 (file)
@@ -45,10 +45,8 @@ Duration::compress (Moment m)
   plet_.type_i_ *= m.den_i (); 
 }
 
-// ugh, what's this?
-// i should be called "mom ()", ... or at least "length_mom ()"
 Moment
-Duration::length () const
+Duration::length_mom () const
 {
   return Duration_convert::dur2_mom (*this);
 }
index 509a6d69d93765e96155f42d545f32cee43355cb..1ece5771d85da6a6376cb4b709a8c1f1f5184280 100644 (file)
@@ -31,7 +31,7 @@ struct Duration {
 
   static bool duration_type_b (int t);
   void set_ticks (int ticks_i );
-  Moment length () const ;     // zo naai mij
+  Moment length_mom () const ;
   static int division_1_i_s;
 
   /// Logarithm of the base duration.
index c61ab3e81e4bb9e5955ac487dcc552ca030ab69d..1de3dc99c25743fa46900e4ef99e91247945d908 100644 (file)
@@ -8,6 +8,9 @@ SUBDIRS = include
 
 MODULE_LIBS=$(depth)/lib $(depth)/flower 
 MODULE_INCLUDES=$(depth)/lib/include $(depth)/flower/include 
+MODULE_CXXFLAGS=
+
+
 
 STEPMAKE_TEMPLATES= c++ executable po
 
index 04eb7dec728b6a204171349f84259336a8bf1ea9..af2849d91a2942243a95b5d69db59c74f1d0bf2b 100644 (file)
@@ -13,6 +13,7 @@
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "stem.hh"
+#include "offset.hh"
 
 Abbreviation::Abbreviation ()
 {
@@ -44,15 +45,15 @@ Abbreviation::do_brew_molecule_p () const
   } 
   Real sl = slope_f * internote_f;
 
-  Atom a (lookup_l ()->beam (sl, w, beam_f));
+  Molecule a (lookup_l ()->beam (sl, w, beam_f));
   a.translate (Offset (-w/2, w / 2 * slope_f));
 
   Molecule *beams= new Molecule; 
   for (int i = 0; i < abbrev_flags_i_; i++)
     {
-      Atom b (a);
+      Molecule b (a);
       b.translate_axis (interbeam_f * i, Y_AXIS);
-      beams->add_atom (b);
+      beams->add_molecule (b);
     }
   beams->translate_axis (-beams->extent ()[Y_AXIS].center (), Y_AXIS);
 
index 94aa9f4d08b777b55c92ce5b0f73212b7fd7f5e4..c2e2650da2850afa96a71f3822b171fe51d7f3b9 100644 (file)
@@ -13,7 +13,7 @@
 #include "abbreviation-beam.hh"
 #include "misc.hh"
 #include "debug.hh"
-#include "atom.hh"
+
 #include "molecule.hh"
 #include "leastsquares.hh"
 #include "stem.hh"
index 0d71f4e240ae769ea5289d11bbdd5c066a61558a..119f2315ff1490cd61150c68d965d3960a9d4791 100644 (file)
 #include "dimensions.hh"
 #include "lookup.hh"
 #include "main.hh"
+#include "global-ctor.hh"
 
-inline bool
-Atom::check_infinity_b ()const
+Atom::Atom(SCM s)
 {
-  bool ridiculous = false;
-  
-#ifndef NDEBUG
-  /* infinity checks. */
-  for (int a = X_AXIS; a < NO_AXES; a++)
-    {
-      Axis ax = (Axis)a;
-      if (abs (off_[ax]) >= 100 CM)
-       {
-         warning (_f ("ridiculous dimension: %s, %s", axis_name_str (ax),
-                  print_dimen (off_[ax])));
-         
-         if (experimental_features_global_b)
-           assert (false);
-
-         ( (Atom*)this)->off_[ax] = 0.0;
-         ridiculous = true;
-       }
-    }
-#endif
-  return ridiculous;
+  func_ = s;
 }
 
 
-void
-Atom::print () const
+#if 0
+int
+Atom::smob_display (SCM smob, SCM port, scm_print_state*)
 {
-#ifndef NPRINT
-  DOUT << "string: " << str_ << '\n';
-
-  DOUT << "dim:";
-  for (Axis i=X_AXIS; i < NO_AXES; incr (i))
-    DOUT << axis_name_str (i) << " = " << dim_[i].str ();
+  Atom* a =(Atom*) SCM_CDR(smob);
+  String i (a->off_.str ());
+  
+  scm_puts ("#<Atom ", port);
+  scm_puts (i.ch_C(), port);
+  gh_display (a->func_);
+  scm_puts (">", port);
 
-  DOUT << "\noffset: " << off_.str ();
-#endif
+  /* non-zero means success */
+  return 1;
 }
 
-Box
-Atom::extent () const
+
+scm_sizet
+Atom::smob_free (SCM smob)
 {
-  Box b (dim_);
-  b.translate (off_);
-  return b;
+  Atom * a= (Atom*) SCM_CDR(smob);
+  delete a;
+  return sizeof (Atom);
 }
 
-Interval
-Atom::extent (Axis a) const
+SCM
+Atom::smob_mark (SCM smob) 
 {
-  return dim_[a] + off_[a];
+  Atom * a= (Atom*) SCM_CDR(smob);
+  scm_gc_mark (a->func_);
+  return a->font_;
 }
 
+long Atom::smob_tag_;
 
-
-Atom::Atom ()
-  : dim_ (Interval (0,0),Interval (0,0))
+void
+Atom::init_smob ()
 {
-  str_ = "unknown\n";
-  origin_l_ = 0;
-}
+  static scm_smobfuns type_rec;
 
-Atom::Atom (String s, Box b)
-  :  dim_ (b)
-{
-  str_ = s;
-  origin_l_ = 0;  
+  type_rec.mark = smob_mark;
+  type_rec.free = smob_free;
+  type_rec.print = smob_display;
+  type_rec.equalp = 0;
+
+  smob_tag_ = scm_newsmob (&type_rec);
 }
 
 
-String
-Atom::str () const
+SCM
+Atom::make_smob () const
 {
-  return String ("Atom (\'") + str_ + "\', (" + dim_.x ().str () + ", "
-    + dim_.y ().str () + "))";
+  SCM smob;
+  SCM_NEWCELL (smob);
+  SCM_SETCAR (smob, smob_tag_);
+  SCM_SETCDR (smob, this);
+  return smob;
 }
 
-Offset
-Atom::offset () const
+SCM
+Atom::make_atom (SCM outputfunc)
 {
-  check_infinity_b ();
-  return off_;
+  Atom * a= new Atom(outputfunc);
+  return a->make_smob ();
 }
 
-void
-Atom::translate_axis (Real r, Axis a)
+SCM
+Atom::copy_self () const
 {
-  off_[a] += r;
-  check_infinity_b ();
+  return (new Atom (*this))->make_smob ();
 }
 
-void
-Atom::translate (Offset o)
+bool
+Atom::Atom_b (SCM obj)
 {
-  off_ += o;
-  check_infinity_b ();
+  return(SCM_NIMP(obj) && SCM_CAR(obj) == smob_tag_);
 }
 
-bool
-Atom::empty() const
+Atom* 
+Atom::atom_l (SCM a)
 {
-  return (dim_.y().length() == 0);
+  assert (Atom_b (a));
+  return (Atom*) SCM_CDR(a);
 }
+
+
+ADD_GLOBAL_CTOR_WITHNAME(atomsmob, Atom::init_smob);
+#endif
+
+
index 23698891e4f0d51f17dafea2ea23bc23a77444e0..2ce8813b6d229d8e2f08b374651244a5e87fc67f 100644 (file)
@@ -11,7 +11,7 @@
 #include "musical-request.hh"
 #include "bar.hh"
 #include "beam.hh"
-#include "grouping.hh"
+#include "rhythmic-grouping.hh"
 #include "rest.hh"
 #include "stem.hh"
 #include "debug.hh"
@@ -22,6 +22,7 @@ ADD_THIS_TRANSLATOR (Auto_beam_engraver);
 Auto_beam_engraver::Auto_beam_engraver ()
 {
   beam_p_ = 0;
+  mult_i_ = 0;
   finished_beam_p_ = 0;
   finished_grouping_p_ = 0;
   grouping_p_ = 0;
@@ -37,22 +38,92 @@ void
 Auto_beam_engraver::consider_end_and_begin ()
 {
   Time_description const *time = get_staff_info().time_C_;
+  int num = time->whole_per_measure_ / time->one_beat_;
+  int den = time->one_beat_.den_i ();
+  String time_str = String ("time") + to_str (num) + "_" + to_str (den);
+  int type = 1 << (mult_i_ + 2);
+  String type_str = to_str (type);
+
+  /*
+    Determine end moment for auto beaming (and begin, mostly 0==anywhere) 
+    In order of increasing priority:
+
+    i.   every beat <den>
+    ii.  time<num>_<den>beamAutoEnd
+    iii. time<num>_<den>beamAutoEnd<type>
+    iv.  beamAutoEnd
+    v.   beamAutoEnd<type>
+
+
+    Rationale:
+
+    [to be defined in config file]
+    i.   easy catch-all rule
+    ii.  exceptions for time signature
+    iii. exceptions for time signature, for specific duration type
 
-  Scalar begin = get_property ("beamAutoBegin", 0);
-  Moment begin_mom = begin.to_rat ();
+    [user override]
+    iv.  generic override
+    v.   override for specific duration type
+
+    The user overrides should be required for common cases.
+   */
   
-  Scalar end = get_property ("beamAutoEnd", 0);
-  Moment end_mom = end.to_rat ();
+  /*
+    first guess: begin beam at any position
+  */
+  Moment begin_mom (0);
+  /*
+    first guess: end beam at end of beat
+  */
+  Moment end_mom = time->one_beat_;
+
+  /*
+    second guess: property generic time exception
+  */
+  Scalar begin = get_property (time_str + "beamAutoBegin", 0);
+  if (begin.length_i ())
+    begin_mom = begin.to_rat ();
 
+  Scalar end = get_property (time_str + "beamAutoEnd", 0);
+  if (end.length_i ())
+    end_mom = end.to_rat ();
+
+  /*
+    third guess: property time exception, specific for duration type
+  */
+  if (mult_i_)
+    {
+      Scalar end_mult = get_property (time_str + "beamAutoEnd" + type_str, 0);
+      if (end_mult.length_i ())
+       end_mom = end_mult.to_rat ();
+      Scalar begin_mult = get_property (time_str + "beamAutoBegin" + type_str, 0);
+      if (begin_mult.length_i ())
+       begin_mom = begin_mult.to_rat ();
+    }
+
+  /*
+    fourth guess [user override]: property plain generic
+  */
+  begin = get_property ("beamAutoBegin", 0);
+  if (begin.length_i ())
+    begin_mom = begin.to_rat ();
+  
+  end = get_property ("beamAutoEnd", 0);
+  if (end.length_i ())
+    end_mom = end.to_rat ();
+
+  /*
+    fifth guess [user override]: property plain, specific for duration type
+  */
   if (mult_i_)
     {
-      int type = 1 << (mult_i_ + 2);
-      Scalar end_mult = get_property (String ("beamAutoEnd")
-                                     + to_str (type), 0);
+      Scalar end_mult = get_property (String ("beamAutoEnd") + type_str, 0);
       if (end_mult.length_i ())
        end_mom = end_mult.to_rat ();
-      else if (Moment (type, 4) / end_mom > Moment (4))
-       end_mom /= Moment (type, 8);
+      Scalar begin_mult = get_property (String ("beamAutoBegin") + type_str, 0);
+      if (begin_mult.length_i ())
+       begin_mom = begin_mult.to_rat ();
     }
 
   Real f;
@@ -83,7 +154,7 @@ Auto_beam_engraver::consider_end_and_begin ()
 void
 Auto_beam_engraver::begin_beam ()
 {
-  DOUT << String ("starting autobeam at: ") + now_moment ().str () + "\n";
+  DOUT << String ("starting autobeam at: ") + now_mom ().str () + "\n";
   beam_p_ = new Beam;
   grouping_p_ = new Rhythmic_grouping;
 
@@ -112,7 +183,7 @@ Auto_beam_engraver::begin_beam ()
 void
 Auto_beam_engraver::end_beam ()
 {
-  DOUT << String ("ending autobeam at: ") + now_moment ().str () + "\n";
+  DOUT << String ("ending autobeam at: ") + now_mom ().str () + "\n";
   if (beam_p_->stems_.size () < 2)
     {
       DOUT << "junking autombeam: less than two stems\n";
@@ -241,12 +312,12 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info)
              consider_end_and_begin ();
            }
          mult_i_ = m;
-         grouping_p_->add_child (start, rhythmic_req->duration ());
+         grouping_p_->add_child (start, rhythmic_req->length_mom ());
          stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_;
          beam_p_->add_stem (stem_l);
-         Moment now = now_moment ();
+         Moment now = now_mom ();
          last_add_mom_ = now;
-         extend_mom_ = extend_mom_ >? now + rhythmic_req->duration ();
+         extend_mom_ = extend_mom_ >? now + rhythmic_req->length_mom ();
        }
     }
 }
@@ -276,7 +347,7 @@ Auto_beam_engraver::process_acknowledged ()
 {
   if (beam_p_)
     {
-      Moment now = now_moment ();
+      Moment now = now_mom ();
       if ((extend_mom_ < now)
          || ((extend_mom_ == now) && (last_add_mom_ != now )))
        {
index 57436ae70f2bee7ae42f3f120d3951537f952166..5d3993f232aa4de588d5d9a9baa4e46d9e71d55a 100644 (file)
@@ -61,6 +61,11 @@ Bar_engraver::create_bar ()
        {
          bar_p_->type_str_ = default_type;
        }
+      Scalar prop = get_property ("barAtLineStart", 0);
+      if (prop.to_bool ())
+       {
+         bar_p_->at_line_start_b_ = true;
+       }
       announce_element (Score_element_info (bar_p_, bar_req_l_));
     }
 }
@@ -68,6 +73,13 @@ Bar_engraver::create_bar ()
 void
 Bar_engraver::request_bar (String type_str)
 {
+  Scalar prop = get_property ("barAtLineStart", 0);
+  if (!now_mom ())
+    {
+      Scalar prop = get_property ("barAtLineStart", 0);
+      if (!prop.to_bool ())
+       return;
+    }
   create_bar ();
   if (((type_str == "|:") && (bar_p_->type_str_ == ":|"))
     || ((type_str == ":|") && (bar_p_->type_str_ == "|:")))
@@ -104,10 +116,10 @@ Bar_engraver::do_process_requests()
       create_bar ();    
       bar_p_->type_str_ = bar_req_l_->type_str_;
     }
-  else if (!now_moment ())
+  else if (!now_mom ())
     {
       create_bar ();
-      bar_p_->type_str_ = "";
+      bar_p_->type_str_ = "|";
     }
   else 
     {
index 7adc8dcdea11546bd76121830c06bfdba24698e5..433e82126e204f25d8f94842e4f701b0e28ae5eb 100644 (file)
@@ -18,7 +18,7 @@ Bar_number_engraver::Bar_number_engraver()
   axis_ = Y_AXIS;
   type_ = "barNumber";
   visibility_lambda_
-    = gh_eval_str ("(lambda (d) (if (= d 1) '(#f . #f) '(#t . #t)))");
+    = gh_eval_str ("postbreak_only_visibility");
 }
 
 void
@@ -28,7 +28,7 @@ Bar_number_engraver::do_process_requests ()
   Timing_translator *timer = dynamic_cast<Timing_translator*>(tr);
   Time_description *time = &timer->time_;
 
-  if (!time->whole_in_measure_ && !time->cadenza_b_ && now_moment () > Moment (0))
+  if (!time->whole_in_measure_ && !time->cadenza_b_ && now_mom () > Moment (0))
     {
       create_items (0);
        
index cf741641df458873b038d39cd12d19d70439427f..e197da6a9c934a38ec0f9622ce30d391c401d17f 100644 (file)
@@ -19,7 +19,7 @@ Bar_script_engraver::Bar_script_engraver ()
   staff_side_p_ = 0;
   text_p_ =0;
   visibility_lambda_ 
-    = gh_eval_str ("(lambda (d) (if (= d -1) '(#t . #t) '(#f . #f)))");
+    = gh_eval_str ("non_postbreak_visibility");
 }
 
 void
index 824e2316a1116f6f545408250a30eee448727ca3..0bb7365076bac158c4bfd660dffdef3e8f1d9b7f 100644 (file)
@@ -18,6 +18,7 @@ Bar::Bar ()
 {
   breakable_b_ = true;
   type_str_ = "|";
+  at_line_start_b_ = false;
 }
 
 void
@@ -50,6 +51,9 @@ static char const *bar_breaks[][3] ={
   {":|", ":|", ""},
   {"||", "||", ""},
   {".|.", ".|.", ""},
+  {"", "scorebar", "|"},
+  {"", "{", "{"},
+  {"", "[", "["},  
   {0,0,0}
 };
 
@@ -59,7 +63,13 @@ Bar::do_pre_processing ()
   for (int i=0; bar_breaks[i][0]; i++) 
     {
       if (bar_breaks[i][1] == type_str_)
-       type_str_ = bar_breaks[i][break_status_dir ()+1];
+       {
+         type_str_ = bar_breaks[i][break_status_dir ()+1];
+         if (at_line_start_b_ && (break_status_dir_ == 1) && (type_str_ == ""))
+           {
+             type_str_ = "|";
+           }
+       }
     }
   
   /*
diff --git a/lily/base-span-bar-engraver.cc b/lily/base-span-bar-engraver.cc
new file mode 100644 (file)
index 0000000..1f90617
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+  span-bar-grav.cc -- implement Base_span_bar_engraver
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "span-bar.hh"
+#include "base-span-bar-engraver.hh"
+#include "vertical-align-spanner.hh"
+
+Base_span_bar_engraver::Base_span_bar_engraver()
+{
+  spanbar_p_ =0;
+  valign_l_ =0;
+  use_priority_b_ = true;
+  break_priority_i_ = 0;
+}
+
+Span_bar*
+Base_span_bar_engraver::get_span_bar_p() const
+{
+  return new Span_bar;
+}
+
+
+void
+Base_span_bar_engraver::acknowledge_element (Score_element_info i)
+{
+  int depth = i.origin_grav_l_arr_.size();
+  if (depth > 1
+      && dynamic_cast<Bar *> (i.elem_l_)) 
+    {
+      bar_l_arr_.push (dynamic_cast<Bar *> (i.elem_l_));
+       
+      if (bar_l_arr_.size() >= 2 && !spanbar_p_) 
+       /*
+         hmm, i do want a bracket with one staff some times, but not always
+         if (bar_l_arr_.size() >= 1 && !spanbar_p_)
+
+         --jcn
+       */
+
+       /*
+
+         use a property?  get_property ("singleStaffBracket", 0) ?
+
+         --hwn
+        */
+       {
+         spanbar_p_ = get_span_bar_p();
+
+         if (use_priority_b_)
+           {
+             spanbar_p_->break_priority_i_ = break_priority_i_;
+           }
+         else
+           {
+             spanbar_p_->dim_cache_[X_AXIS].parent_l_ = &bar_l_arr_[0]->dim_cache_[X_AXIS];      
+           }
+         
+         announce_element (Score_element_info (spanbar_p_,0));
+         if (spanbar_p_->type_str_.empty_b ())
+           spanbar_p_-> type_str_ = bar_l_arr_[0]->type_str_;
+       }
+    }
+  else if  (dynamic_cast<Vertical_align_spanner *> (i.elem_l_) 
+           && i.origin_grav_l_arr_.size() <= 2) 
+    {
+      valign_l_ = dynamic_cast<Vertical_align_spanner *> (i.elem_l_);
+    }
+}
+
+void
+Base_span_bar_engraver::do_pre_move_processing()
+{
+  if (spanbar_p_) 
+    {
+      for (int i=0; i < bar_l_arr_.size() ; i++)
+       spanbar_p_->add_bar (bar_l_arr_[i]);
+      spanbar_p_->set_align (valign_l_);
+      typeset_element (spanbar_p_);
+      spanbar_p_ =0;
+    }
+  bar_l_arr_.set_size (0);
+}
+
+
+
+ADD_THIS_TRANSLATOR(Base_span_bar_engraver);
index ac7a02a26b2dbc1ef504bcbd977675c8ae3b187c..4bd2e9e5917ec5fcc0402e850a98c7c32faf6d2b 100644 (file)
@@ -10,7 +10,7 @@
 #include "beam-engraver.hh"
 #include "musical-request.hh"
 #include "beam.hh"
-#include "grouping.hh"
+#include "rhythmic-grouping.hh"
 #include "stem.hh"
 #include "warn.hh"
 #include "time-description.hh"
@@ -22,6 +22,7 @@ Beam_engraver::Beam_engraver ()
   finished_grouping_p_ = 0;
   grouping_p_ =0;
   reqs_drul_[LEFT] = reqs_drul_[RIGHT] =0;
+  prev_start_req_ =0;
 }
 
 bool
@@ -50,6 +51,7 @@ Beam_engraver::do_process_requests ()
     {
       if (!beam_p_)
        reqs_drul_[STOP]->warning (_("No beam to end"));
+      prev_start_req_ =0;
       finished_beam_p_ = beam_p_;
       finished_grouping_p_ = grouping_p_;
 
@@ -111,7 +113,11 @@ Beam_engraver::typeset_beam ()
 void
 Beam_engraver::do_post_move_processing ()
 {
-  reqs_drul_ [START] =0;
+  if (reqs_drul_[START])
+    {
+      prev_start_req_ = reqs_drul_[START];
+      reqs_drul_ [START] =0;
+    }      
 }
 
 void
@@ -126,7 +132,7 @@ Beam_engraver::do_removal_processing ()
   typeset_beam ();
   if (beam_p_)
     {
-      warning (_ ("Unfinished beam"));
+      prev_start_req_->warning (_ ("Unfinished beam"));
       finished_beam_p_ = beam_p_;
       finished_grouping_p_ = grouping_p_;
       typeset_beam ();
@@ -171,7 +177,7 @@ Beam_engraver::acknowledge_element (Score_element_info info)
        if (!grouping_p_->child_fit_b (start))
          {
            String s (_ ("please fix me") + ": " 
-                     + _f ("stem at %s doesn't fit in beam", now_moment ().str ()));
+                     + _f ("stem at %s doesn't fit in beam", now_mom ().str ()));
 
            if (info.req_l_)
              info.req_l_->warning(s);
@@ -180,7 +186,7 @@ Beam_engraver::acknowledge_element (Score_element_info info)
          }
        else
          {
-           grouping_p_->add_child (start, rhythmic_req->duration ());
+           grouping_p_->add_child (start, rhythmic_req->length_mom ());
            stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_;
            beam_p_->add_stem (stem_l);
          }
index 90476e1e9f4b3acaed60ffe8341a0482f199a557..094ca9f8553275145be9f321373454b5edb596dc 100644 (file)
 #include "abbreviation-beam.hh"
 #include "misc.hh"
 #include "debug.hh"
-#include "atom.hh"
+
 #include "molecule.hh"
 #include "leastsquares.hh"
 #include "stem.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
-#include "grouping.hh"
+#include "rhythmic-grouping.hh"
 
 Beam::Beam ()
 {
@@ -629,15 +629,15 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
        */
       Real w = here->hpos_f () - prev->hpos_f ();
       w = w/2 <? nw_f;
-      Atom a;
+      Molecule a;
       if (lhalfs)              // generates warnings if not
        a =  lookup_l ()->beam (sl, w, beam_f);
       a.translate (Offset (-w, -w * sl));
       for (int j = 0; j  < lhalfs; j++)
        {
-         Atom b (a);
+         Molecule b (a);
          b.translate_axis (-dir_ * dy * (lwholebeams+j), Y_AXIS);
-         leftbeams.add_atom (b);
+         leftbeams.add_molecule (b);
        }
     }
 
@@ -647,7 +647,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
       int rwholebeams = here->beams_i_drul_[RIGHT] <? next->beams_i_drul_[LEFT];
 
       Real w = next->hpos_f () - here->hpos_f ();
-      Atom a = lookup_l ()->beam (sl, w + stemdx, beam_f);
+      Molecule a = lookup_l ()->beam (sl, w + stemdx, beam_f);
       a.translate_axis( - stemdx/2, X_AXIS);
       int j = 0;
       Real gap_f = 0;
@@ -656,9 +656,9 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
          int nogap = rwholebeams - here->beam_gap_i_;
          for (; j  < nogap; j++)
            {
-             Atom b (a);
+             Molecule b (a);
              b.translate_axis (-dir_ * dy * j, Y_AXIS);
-             rightbeams.add_atom (b);
+             rightbeams.add_molecule (b);
            }
          // TODO: notehead widths differ for different types
          gap_f = nw_f / 2;
@@ -668,9 +668,9 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
 
       for (; j  < rwholebeams; j++)
        {
-         Atom b (a);
+         Molecule b (a);
          b.translate (Offset (gap_f, -dir_ * dy * j));
-         rightbeams.add_atom (b);
+         rightbeams.add_molecule (b);
        }
 
       w = w/2 <? nw_f;
@@ -679,9 +679,9 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
 
       for (; j  < rwholebeams + rhalfs; j++)
        {
-         Atom b (a);
+         Molecule b (a);
          b.translate_axis (-dir_ * dy * j, Y_AXIS);
-         rightbeams.add_atom (b);
+         rightbeams.add_molecule (b);
        }
 
     }
index bd4827ba9169a7c5a617be83d16e446047b688a8..ce0e3e4f3f6707e1f115d310267c6e15a836eecb 100644 (file)
@@ -33,7 +33,7 @@ Bow::do_brew_molecule_p () const
   Real thick = paper ()->get_var ("slur_thickness");
   Array<Offset> c = get_controls ();
   Real dy = c[3].y () - c[0].y ();
-  Atom a;
+  Molecule a;
 
   if (!dash_i_)
     a = lookup_l ()->slur (c);
@@ -56,7 +56,7 @@ Bow::do_brew_molecule_p () const
   a.translate (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
 
   Molecule* mol_p = new Molecule;
-  mol_p->add_atom (a);
+  mol_p->add_molecule (a);
   mol_p->translate_axis (-interstaff_f_, Y_AXIS);
 
   return mol_p;
index 92c8fa6c5aab8f5d7484a2dc2d3d897c4095afce..af9d230e0b6f50f1c305fed40b59947c97eee2a7 100644 (file)
@@ -30,6 +30,13 @@ Box::Box()
 {        
 }
 
+void
+Box::set_empty ()
+{
+  interval_a_[X_AXIS].set_empty ();
+  interval_a_[Y_AXIS].set_empty (); 
+}
+
 Box::Box (Interval ix, Interval iy)
 {
   x() = ix;
index f6c374dce5c88f3cdb745131398adb0190422ba3..dd88023ec668e0cec91e275f75b39c9062068fd9 100644 (file)
@@ -103,7 +103,8 @@ Break_algorithm::find_breaks () const
 Line_spacer*
 Break_algorithm::generate_spacing_problem (Line_of_cols curline, Interval line) const
 {
-  Spring_spacer * sp= (Spring_spacer*) (*get_line_spacer) (); // ugh
+  // ugh
+  Spring_spacer * sp= dynamic_cast<Spring_spacer*> ((*get_line_spacer) ());
 
   sp->paper_l_ = pscore_l_->paper_l_;
   sp->add_column (curline[0], true, line[LEFT]);
@@ -146,7 +147,7 @@ Break_algorithm::feasible (Line_of_cols curline) const
   for (int i=0; i < curline.size (); i++)
     {
       if (i && i < curline.size () -1
-         && (((Score_column*)curline[i])->break_penalty_i () >= Break_req::FORCE))
+         && ((dynamic_cast<Score_column*>(curline[i]))->break_penalty_i () >= Break_req::FORCE))
        return false;
     }
   return true;
index 81352999e6ebb84cc354e1138a07c02f9c437045..028d19f69fe65d1583ca739ef4bb14974454d437 100644 (file)
@@ -15,8 +15,9 @@
 void
 Change_iterator::error (String reason)
 {
-  String to_type = change_l ()->change_to_type_str_;
-  String to_id =  change_l ()->change_to_id_str_;
+  Change_translator const * t = dynamic_cast<Change_translator const*> (music_l_);   
+  String to_type = t->change_to_type_str_;
+  String to_id =  t->change_to_id_str_;
 
   String warn1 = _f ("can't change `%s\' to `%s\'", to_type, to_id) 
     + ": " + reason;
@@ -24,13 +25,7 @@ Change_iterator::error (String reason)
     + report_to_l ()->type_str_ + " = `"
     + report_to_l ()->id_str_ + "\': ";
   warning (warn2);
-  change_l ()->warning (warn1);
-}
-
-Change_translator *
-Change_iterator::change_l ()
-{
-  return (Change_translator*) music_l_;
+  t->warning (warn1);
 }
 
 /*
@@ -42,8 +37,9 @@ Change_iterator::do_process_and_next (Moment m)
   Translator_group * current = report_to_l ();
   Translator_group * last = 0;
 
-  String to_type = change_l ()->change_to_type_str_;
-  String to_id =  change_l ()->change_to_id_str_;
+  Change_translator const * t = dynamic_cast<Change_translator const*> (music_l_); 
+  String to_type = t->change_to_type_str_;
+  String to_id =  t->change_to_id_str_;
 
   /* find the type  of translator that we're changing.
      
index 336eacb3ed4a36437d5485c61e58bc948e86f7b8..95784a44bcfdbbbe74734792b45a43836f0f6f36 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1998, 1999 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "chord-name-engraver.hh"
@@ -20,6 +20,7 @@ ADD_THIS_TRANSLATOR (Chord_name_engraver);
 
 Chord_name_engraver::Chord_name_engraver ()
 {
+  tonic_req_ = 0;
 }
 
 void
@@ -37,6 +38,11 @@ Chord_name_engraver::do_try_music (Music* m)
       pitch_arr_.push (n->pitch_);
       return true;
     }
+  if (Tonic_req* t = dynamic_cast<Tonic_req*> (m))
+    {
+      tonic_req_ = t;
+      return true;
+    }
   return false;
 }
 
@@ -48,37 +54,33 @@ Chord_name_engraver::do_process_requests ()
   if (!pitch_arr_.size ())
     return;
 
-  /*
-   Banter style chord names (almost).
-   TODO:
-     - move this stuff to new Item class Chord_name
-     - switch on property, add american (?) chordNameStyle
-
-  Scalar chordNameStyle = get_property ("chordNameStyle", 0);
-  if (chordNameStyle == "Banter")
-     chord = pitches_to_banter (pitch_arr_));
-
-   */
-
   Chord chord (pitch_arr_);
   Musical_pitch* inversion = 0;
   Scalar chord_inversion = get_property ("chordInversion", 0);
   if (chord_inversion.to_bool ())
     {
-      int tonic_i = chord.find_tonic_i ();
+      int tonic_i = tonic_req_
+       ? chord.find_notename_i (tonic_req_->pitch_) : chord.find_tonic_i ();
+       
       if (tonic_i)
        {
          inversion = &pitch_arr_[0];
-         Scalar preserve = get_property ("chordInversionPreserve", 0);
-         if (preserve.to_bool ())
-           chord.rebuild_from_base (tonic_i);
-         else
-           chord.rebuild_insert_inversion (tonic_i);
+         chord.rebuild_insert_inversion (tonic_i);
        }
     }
     
   G_text_item* item_p =  new G_text_item;
 
+  /*
+   TODO:
+     - switch on property, add american (?) chordNameStyle:
+       Chord::american_str (...)
+
+  Scalar chordNameStyle = get_property ("chordNameStyle", 0);
+  if (chordNameStyle == "Banter")
+    item_p->text_str_ = chord.banter_str (inversion);
+   */
+
   item_p->text_str_ = chord.banter_str (inversion);
   
   Scalar style = get_property ("textstyle", 0);
@@ -98,4 +100,5 @@ Chord_name_engraver::do_pre_move_processing ()
     }
   text_p_arr_.clear ();
   pitch_arr_.clear ();
+  tonic_req_ = 0;
 }
index 26ae4ce2714059b200324da0238a0327321aa83c..c85ea0610a58be729dc22cd449f2ecd74d8840bf 100644 (file)
@@ -9,57 +9,71 @@
 #include "chord.hh"
 #include "warn.hh"
 
+// doesn't seem common, and we should know about this during purple hit
+// #define INVERSION_ADDED_AS_BASE 1
+
 Chord::Chord (Array<Musical_pitch> pitch_arr)
 {
   pitch_arr_ = pitch_arr;
 }
 
-// construct from parser output
-// urg: should split this up into understandable chunks
-Chord::Chord (Musical_pitch tonic, Array<Musical_pitch>* add_arr_p, Array<Musical_pitch>* sub_arr_p, Musical_pitch* inversion_p)
+static void
+rebuild_transpose (Musical_pitch tonic, Array<Musical_pitch>* pitch_arr_p)
 {
-  for (int i = 0; i < add_arr_p->size (); i++)
+  for (int i = 0; i < pitch_arr_p->size (); i++)
     {
       Musical_pitch p = tonic;
-      Musical_pitch q = (*add_arr_p)[i];
+      Musical_pitch q = (*pitch_arr_p)[i];
       // duh, c7 should mean <c bes>
       if (q.notename_i_ == 6)
         q.accidental_i_--;
       p.transpose (q);
-      (*add_arr_p)[i] = p;
+      (*pitch_arr_p)[i] = p;
     }
-  add_arr_p->sort (Musical_pitch::compare);
-  for (int i = 0; i < sub_arr_p->size (); i++)
+  pitch_arr_p->sort (Musical_pitch::compare);
+}
+
+static int
+find_pitch_i (Array<Musical_pitch> const* pitch_arr_p, Musical_pitch p)
+{
+  for (int i = 0; i < pitch_arr_p->size (); i++)
+    if (p == (*pitch_arr_p)[i])
+      return i;
+  return -1;
+}
+
+static int
+find_notename_i (Array<Musical_pitch> const* pitch_arr_p, Musical_pitch p)
+{
+  int i = find_pitch_i (pitch_arr_p, p);
+  if (i == -1)
     {
-      Musical_pitch p = tonic;
-      Musical_pitch q = (*sub_arr_p)[i];
-      // duh, c7 should mean <c bes>
-      if (q.notename_i_ == 6)
-        q.accidental_i_--;
-      p.transpose (q);
-      (*sub_arr_p)[i] = p;
+      for (int i = 0; i < pitch_arr_p->size (); i++)
+       {
+         p.octave_i_ = (*pitch_arr_p)[i].octave_i_;
+         if (p == (*pitch_arr_p)[i])
+           return i;
+       }
     }
-  sub_arr_p->sort (Musical_pitch::compare);
+  return i;
+}
+
+static int
+trap_i (Musical_pitch tonic, Musical_pitch p)
+{
+  int i = p.notename_i_ - tonic.notename_i_
+    + (p.octave_i_ - tonic.octave_i_) * 7;
+  while (i < 0)
+    i += 7;
+  i++;
+  return i;
+}
 
+static Array<Musical_pitch>
+missing_triads_pitch_arr (Array<Musical_pitch>const* pitch_arr_p)
+{
   Musical_pitch third (2);
   Musical_pitch mthird (2, -1);
-  Musical_pitch missing;
-  missing = tonic;
-  missing.transpose (third);
-
-  Musical_pitch p;
-  p = tonic;
-  p.transpose (third);
-  p.transpose (mthird);
-
-  /*
-   must have minimum at 5 (3 is added automatically as missing)
-   */
-  if (!add_arr_p->size ())
-    add_arr_p->push (p);
-  else if ((add_arr_p->top () < p) && (add_arr_p->top ().notename_i_ != p.notename_i_))
-    add_arr_p->push (p);
-  add_arr_p->sort (Musical_pitch::compare);
 
   Array<Musical_pitch> triads;
   triads.push (third);   // c e 
@@ -70,49 +84,87 @@ Chord::Chord (Musical_pitch tonic, Array<Musical_pitch>* add_arr_p, Array<Musica
   triads.push (mthird);  // a c 
   triads.push (mthird);  // b d 
 
+  Musical_pitch tonic = (*pitch_arr_p)[0];
+  Musical_pitch last = tonic;
+  Array<Musical_pitch> missing_arr;
+
+  for (int i = 0; i < pitch_arr_p->size ();)
+    {
+      Musical_pitch p = (*pitch_arr_p)[i];
+      int trap = trap_i (tonic, p);
+      if (last.notename_i_ == p.notename_i_)
+       last.transpose (triads[(last.notename_i_ - tonic.notename_i_ + 7) % 7]);
+      if (trap > trap_i (tonic, last))
+       {
+         while (trap > trap_i (tonic, last))
+           {
+             if ((last.notename_i_ - tonic.notename_i_ + 7) % 7 == 6)
+               {
+                 Musical_pitch special_seven = last;
+                 Musical_pitch lower (0, -1);
+                 special_seven.transpose (lower);
+                 missing_arr.push (special_seven);
+               }
+             else
+               {
+                 missing_arr.push (last);
+               }
+             last.transpose (triads[(last.notename_i_ - tonic.notename_i_ + 7) % 7]);
+           }
+       }
+      else
+       {
+         i++;
+       }
+    }
+  return missing_arr;
+}
+
+
+/*
+  construct from parser output
+*/
+Chord::Chord (Musical_pitch tonic, Array<Musical_pitch>* add_arr_p, Array<Musical_pitch>* sub_arr_p, Musical_pitch* inversion_p)
+{
+  rebuild_transpose (tonic, add_arr_p);
+  rebuild_transpose (tonic, sub_arr_p);
+
+  Musical_pitch fifth = tonic;
+  fifth.transpose (Musical_pitch (2));
+  fifth.transpose (Musical_pitch (2, -1));
+
+  /*
+    default chord includes upto 5: <1, 3, 5>
+   */
+  add_arr_p->insert (tonic, 0);
+  int highest_trap = trap_i (tonic, add_arr_p->top ());
+  if (highest_trap < 5)
+    add_arr_p->push (fifth);
+
   /*
-    if first addition is 4, assume sus4 and don't add third implicitely
+    find missing triads
    */
-  Musical_pitch sus (3);
-  sus.transpose (tonic);
-  if (add_arr_p->size ())
-    if ((*add_arr_p)[0] == sus)
-      missing.transpose (mthird);
+  Array<Musical_pitch> missing_arr = missing_triads_pitch_arr (add_arr_p);
 
   /*
-   add missing triads
+    if additions include 4, assume sus4 and don't add third implicitely
    */
-  for (int i = 0; i < add_arr_p->size ();)
+  Musical_pitch third = tonic;
+  third.transpose (Musical_pitch (2));
+  Musical_pitch sus = tonic;
+  sus.transpose (Musical_pitch (3));
+  if (::find_pitch_i (add_arr_p, sus) != -1)
     {
-      Musical_pitch p = (*add_arr_p)[i];
-      if (p > missing)
-        while (p > missing)
-         {
-           if (p.notename_i_ != missing.notename_i_)
-             {
-               if ((missing.notename_i_ - tonic.notename_i_ + 7) % 7 == 6)
-                 {
-                   Musical_pitch special_seven = missing;
-                   Musical_pitch lower (0, -1);
-                   special_seven.transpose (lower);
-                   add_arr_p->insert (special_seven, i++);
-                 }
-               else
-                 add_arr_p->insert (missing, i++);
-             }
-           missing.transpose (triads[(missing.notename_i_ - tonic.notename_i_ + 7) % 7]);
-         }
-      else if (p.notename_i_ == missing.notename_i_)
-        missing.transpose (triads[(missing.notename_i_ - tonic.notename_i_ + 7) % 7]);
-      else
-       i++;
+      int i = ::find_pitch_i (&missing_arr, third);
+      if (i != -1)
+       missing_arr.get (i);
     }
-
+  
   /*
-    add tonic
+    complete the list of triads to be added
    */
-  if (!add_arr_p->size () || ((*add_arr_p)[0] != tonic))
-    add_arr_p->insert (tonic, 0);
+  add_arr_p->concat (missing_arr);
+  add_arr_p->sort (Musical_pitch::compare);
 
   /*
    add all that aren't subtracted
@@ -132,6 +184,8 @@ Chord::Chord (Musical_pitch tonic, Array<Musical_pitch>* add_arr_p, Array<Musica
         pitch_arr_.push (p);
     }
 
+  pitch_arr_.sort (Musical_pitch::compare);
+
   for (int i = 0; i < sub_arr_p->size (); i++)
     warning (_f ("invalid subtraction: not part of chord: %s",
                 (*sub_arr_p)[i].str ()));
@@ -140,42 +194,90 @@ Chord::Chord (Musical_pitch tonic, Array<Musical_pitch>* add_arr_p, Array<Musica
     {
       int i = 0;
       for (; i < pitch_arr_.size (); i++)
-       if ((pitch_arr_[i].notename_i_ == inversion_p->notename_i_)
-         && (pitch_arr_[i].accidental_i_ == inversion_p->accidental_i_))
-         break;
+       {
+         if ((pitch_arr_[i].notename_i_ == inversion_p->notename_i_)
+             && (pitch_arr_[i].accidental_i_ == inversion_p->accidental_i_))
+           break;
+       }
       if (i == pitch_arr_.size ())
-       warning (_f ("invalid inversion pitch: not part of chord: %s",
-                     inversion_p->str ()));
+       {
+         warning (_f ("invalid inversion pitch: not part of chord: %s",
+                      inversion_p->str ()));
+       }
       else
-        {
-         /*
-           urg
-           should be run-time switchable "chordInversionPreserve", howto?
-
-           there are two ways commonly used to rearrange a chord with
-           an inversion:
-
-           1. rebuild pitch list, taking inversion as base
-             */
-#if 0
-         rebuild_from_base (i);
+       {
+#if INVERSION_ADDED_AS_BASE
+         pitch_arr_.insert (pitch_arr_[i], 0);
+         rebuild_with_bass (0);
 #else
-         /*
-           or
-           2. insert inversion as lowest (at first position)
-         */
          rebuild_with_bass (i);
 #endif
+         
        }
       delete inversion_p;
     }
 }
 
+void
+Chord::find_additions_and_subtractions(Array<Musical_pitch>* add_arr_p, Array<Musical_pitch>* sub_arr_p)
+{
+  Musical_pitch tonic = pitch_arr_[0];
+  /*
+    all the triads that should be there
+   */
+  Array<Musical_pitch> all_arr;
+  all_arr.push (tonic);
+  all_arr.push (pitch_arr_.top ());
+  all_arr.concat (missing_triads_pitch_arr (&all_arr));
+  all_arr.sort (Musical_pitch::compare);
+  
+  int i = 0;
+  int j = 0;
+  while ((i < all_arr.size ()) || (j < pitch_arr_.size ()))
+    {
+      i = i <? all_arr.size () - 1;
+      j = j <? pitch_arr_.size () - 1;
+      Musical_pitch a = all_arr[i];
+      Musical_pitch p = pitch_arr_[j];
+      if (a == p)
+       {
+         i++;
+         j++;
+       }
+      else if ((p < a) || (p.notename_i_ == a.notename_i_))
+       {
+         add_arr_p->push (p);
+         j++;
+       }
+      else
+       {
+         sub_arr_p->push (a);
+         i++;
+       }
+    }
+      
+  /*
+    add highest addition, because it names chord
+   */
+  if (trap_i (tonic, pitch_arr_.top () > 5))
+    add_arr_p->push (pitch_arr_.top ());
+}
+
 String
 Chord::banter_str (Musical_pitch* inversion) const
 {
   Musical_pitch tonic = pitch_arr_[0];
 
+  //urg, should do translation in scheme.
+  char const *acc[] = {"\\textflat\\textflat ", "\\textflat ", "", "\\textsharp " , "\\textsharp\\textsharp "};
+  String tonic_str = tonic.str ();
+  tonic_str = tonic_str.left_str (1).upper_str ()
+    + acc[tonic.accidental_i_ + 2];
+
+  Array<Musical_pitch> add_arr;
+  Array<Musical_pitch> sub_arr;
+  find_additions_and_subtractions (&add_arr, &sub_arr);
+                          
   Array<Musical_pitch> scale;
   scale.push (Musical_pitch (0)); // c
   scale.push (Musical_pitch (1)); // d
@@ -183,79 +285,81 @@ Chord::banter_str (Musical_pitch* inversion) const
   scale.push (Musical_pitch (3)); // f
   scale.push (Musical_pitch (4)); // g
   scale.push (Musical_pitch (5)); // a
+  scale.push (Musical_pitch (6)); // b
   // 7 always means 7-...
-  scale.push (Musical_pitch (6, -1)); // b
-
+  //  scale.push (Musical_pitch (6, -1)); // b
 
-  for (int i = 0; i < scale.size (); i++)
-    scale[i].transpose (tonic);
-
-  //urg, should do translation in scheme.
-  char const *acc[] = {"\\textflat\\textflat ", "\\textflat ", "", "\\textsharp " , "\\textsharp\\textsharp "};
-  String tonic_str = tonic.str ();
-  tonic_str = tonic_str.left_str (1).upper_str ()
-    + acc[tonic.accidental_i_ + 2];
-
-  String add_str;
-  String sub_str;
+  rebuild_transpose (tonic, &scale);
+  
+  bool has3m_b = false;
+  bool has4_b = false;
+  String str;
   String sep_str;
-  String sub_sep_str;
-  int last_trap = 1;
-  for (int i=1; i < pitch_arr_.size (); i++)
+  for (int i = 0; i < add_arr.size (); i++)
     {
-      Musical_pitch p = pitch_arr_[i];
-      int trap = p.notename_i_ - tonic.notename_i_
-        + (p.octave_i_ - tonic.octave_i_) * 7;
-      while (trap < 0)
-        trap += 7;
-      trap++;
-      while (trap - last_trap > 2)
-       {
-         last_trap += 2;
-         sub_str += sub_sep_str + "no" + to_str (last_trap);
-         sub_sep_str = "/";
-       }
-      last_trap = trap;
+      Musical_pitch p = add_arr[i];
+      int trap = trap_i (tonic, p);
+      if (trap == 4)
+       has4_b = true;
       int accidental = p.accidental_i_ - scale[(trap - 1) % 7].accidental_i_;
       if ((trap == 3) && (accidental == -1))
-        tonic_str += "m"; // hmm
-      else if (accidental || (!(trap % 2) || ((i + 1 == pitch_arr_.size ()) && (trap > 5))))
+       {
+         tonic_str += "m";
+         has3m_b = true;
+       }
+      else if (accidental
+              || (!(trap % 2) || ((i + 1 == add_arr.size ()) && (trap > 5))))
         {
-         add_str += sep_str;
+         str += sep_str;
           if ((trap == 7) && (accidental == 1))
-            add_str += "maj7";
+            str += "maj7";
           else
             {
-              add_str += to_str (trap);
+              str += to_str (trap);
               if (accidental)
-                add_str += accidental < 0 ? "-" : "+";
-             // catch "C4/no3"; remove "no3"
-             if (trap == 4)
-               {
-                 int i = sub_str.index_i ("no3");
-                 if (i != -1)
-                   sub_str = sub_str.nomid_str (i, 3);
-                 if (!sub_str.length_i ())
-                   sub_sep_str = "";
-               }
+                str += accidental < 0 ? "-" : "+";
             }
          sep_str = "/";
        }
     }
 
+  for (int i = 0; i < sub_arr.size (); i++)
+    {
+      Musical_pitch p = sub_arr[i];
+      int trap = trap_i (tonic, p);
+      /*
+       if chord has 3-, assume minor and don't display 'no3'
+       if additions include 4, assume sus4 and don't display 'no3'
+      */
+      if (!((trap == 3) && (has3m_b || has4_b)))
+       {
+         str += sep_str + "no" + to_str (trap);
+         sep_str = "/";
+       }
+    }
+
   String inversion_str;
   if (inversion)
     {
       inversion_str = inversion->str ();
       inversion_str = "/" + inversion_str.left_str (1).upper_str ()
-       + acc[tonic.accidental_i_ + 2];
+       + acc[inversion->accidental_i_ + 2];
 
     }
 
-  if (sub_str.length_i ())
-    sub_str = sep_str + sub_str;
-  String str = tonic_str + "$^{" + add_str + sub_str + "}$" + inversion_str;
-  return str;
+  return tonic_str + "$^{" + str + "}$" + inversion_str;
+}
+
+int
+Chord::find_notename_i (Musical_pitch p) const
+{
+  return ::find_notename_i (&pitch_arr_, p);
+}
+
+int
+Chord::find_pitch_i (Musical_pitch p) const
+{
+  return ::find_pitch_i (&pitch_arr_, p);
 }
 
 int
@@ -318,6 +422,7 @@ Chord::find_tonic_i () const
 void
 Chord::rebuild_from_base (int base_i)
 {
+  assert (base_i >= 0);
   Musical_pitch last (0, 0, -5);
   Array<Musical_pitch> new_arr;
   for (int i = 0; i < pitch_arr_.size (); i++)
@@ -338,6 +443,12 @@ Chord::rebuild_from_base (int base_i)
 void
 Chord::rebuild_insert_inversion (int tonic_i)
 {
+  assert (tonic_i > 0);
+#if INVERSION_ADDED_AS_BASE
+  // inversion was added; don't insert
+  Musical_pitch inversion = pitch_arr_.get (0);
+  (void)inversion;
+#else
   Musical_pitch inversion = pitch_arr_.get (0);
   rebuild_from_base (tonic_i - 1);
   if (pitch_arr_.size ())
@@ -352,11 +463,13 @@ Chord::rebuild_insert_inversion (int tonic_i)
        pitch_arr_.insert (inversion, i);
        break;
       }
+#endif
 }
 
 void
 Chord::rebuild_with_bass (int bass_i)
 {
+  assert (bass_i >= 0);
   Musical_pitch inversion = pitch_arr_.get (bass_i);
   // is lowering fine, or should others be raised?
   if (pitch_arr_.size ())
index 5e5fee9cbf1d2e6a1af704c84568d876e3983f05..3f76f6f0c3a72fa0c8b5c32e85ac9e43b9c09fa4 100644 (file)
@@ -12,7 +12,6 @@
 #include "molecule.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
-#include "clef-engraver.hh"
 #include "g-text-item.hh"
 #include "p-score.hh"
 
@@ -78,10 +77,8 @@ Clef_item::do_brew_molecule_p() const
   String t = symbol_;
   if  (change_b_)
     t += "_change";
-  //  Atom s = lookup_l ()-> text ("roman", to_str (break_status_dir ()));
-    
-  Atom s = lookup_l ()->clef (t);
-  Molecule*output = new Molecule (Atom (s));
+
+  Molecule*output = new Molecule (lookup_l ()->clef (t));
   return output;
 }
 
index 149e39fc2326117b901fac288e05eb5c2c1e35ea..db99d7b4c701fa07a2f723b8a280b3f3e0a58e19 100644 (file)
@@ -155,7 +155,8 @@ Collision::do_pre_processing()
             (shaddup)
             */
          Offset o (x_off[j] * wid_f, y_off[j] * inter_f);
-         ((Score_element*)col_l_a[j])->translate (o);
+         col_l_a[j]->translate (o);
+         //      ((Score_element*)col_l_a[j])->translate (o);
        }
     }
 }
index 1ab0353bc558ab32d3c74da961a4e5e34e09e678..aa5b3877d79aa54b634f3c6e83dc6050866fb1ac 100644 (file)
@@ -74,7 +74,7 @@ Bar_req::Bar_req (String s)
 
 Partial_measure_req::Partial_measure_req (Moment m)
 {
-  duration_ =m;
+  length_mom_ =m;
 }
 
 bool
@@ -82,7 +82,7 @@ Partial_measure_req::do_equal_b (Request* r) const
 {
   Partial_measure_req *p = dynamic_cast <Partial_measure_req *> (r);
 
-  return p&& p->duration_ == duration_;
+  return p&& p->length_mom_ == length_mom_;
 }
 
 
@@ -133,7 +133,7 @@ Clef_change_req::Clef_change_req (String s)
 void
 Partial_measure_req::do_print() const
 {
-  DOUT << duration_;
+  DOUT << length_mom_;
 }
 
 
@@ -181,7 +181,7 @@ Tempo_req::do_equal_b (Request *r) const
 {
   Tempo_req *t = dynamic_cast <Tempo_req *> (r);
 
-  return t&& t->dur_.length()== dur_.length () && metronome_i_ == t->metronome_i_;
+  return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_;
 }
 
 
index 47eff97b90bc308bab4722999612d962772f390e..024a697c1799f1cf038581e0cb2ac077b2a9b918 100644 (file)
@@ -14,7 +14,7 @@
 #include "debug.hh"
 #include "score-column.hh"
 
-Crescendo::Crescendo()
+Crescendo::Crescendo ()
 {
   grow_dir_ =0;
   dir_ = DOWN;
@@ -22,17 +22,17 @@ Crescendo::Crescendo()
 }
 
 Interval
-Crescendo::symbol_height() const
+Crescendo::symbol_height () const
 {
-  return get_symbol().dim_[Y_AXIS];
+  return get_symbol ().dim_[Y_AXIS];
 }
 
 static Real absdyn_dim = 10 PT;        // ugh
 
-Atom
-Crescendo::get_symbol() const
+Molecule
+Crescendo::get_symbol () const
 {
-  Real w_dim = extent(X_AXIS).length ();
+  Real w_dim = extent (X_AXIS).length ();
   if (dyn_b_drul_[LEFT])
     {
       w_dim -= absdyn_dim;
@@ -44,24 +44,24 @@ Crescendo::get_symbol() const
 
   if (w_dim < 0)
     {
-      warning (_ ("crescendo") + " " + _("too small"));
+      warning (_ ("crescendo") + " " + _ ("too small"));
       w_dim = 0;
     }
 
   Drul_array<bool> broken;
   Direction d = LEFT;
   do {
-    Score_column* s = (Score_column* )spanned_drul_[d] ; // UGH
-    broken[d] = (!s->musical_b());
-  } while (flip(&d) != LEFT);
+    Score_column* s = dynamic_cast<Score_column*>(spanned_drul_[d]); // UGH
+    broken[d] = (!s->musical_b ());
+  } while (flip (&d) != LEFT);
   
 
-  bool continued = broken[(Direction)-grow_dir_];
-  return Atom (lookup_l ()->hairpin (w_dim, grow_dir_ < 0, continued));
+  bool continued = broken[Direction (-grow_dir_)];
+  return Molecule (lookup_l ()->hairpin (w_dim, grow_dir_ < 0, continued));
 }
 
 Molecule*
-Crescendo::do_brew_molecule_p() const
+Crescendo::do_brew_molecule_p () const
 {
   Molecule* m_p =0;
   Real x_off_dim=0.0;
@@ -69,8 +69,8 @@ Crescendo::do_brew_molecule_p() const
     x_off_dim += absdyn_dim;
 
   m_p = new Molecule;
-  Atom s (get_symbol());
-  m_p->add_atom  (s);
+  Molecule s (get_symbol ());
+  m_p->add_molecule (s);
   m_p->translate (Offset (x_off_dim, coordinate_offset_f_));
   return m_p;
 }
index 8746337cca4b96bac67fd08dfcb7cd38726fed47..6713e82b191276fba92d2fac48e698988e6c3f93 100644 (file)
@@ -13,6 +13,7 @@ Dimension_cache::Dimension_cache (Dimension_cache const &d)
 {
   init();
   empty_b_ = d.empty_b_;
+  offset_ = d.offset_; //let's hope others will copy  the refpoint appropriately. 
 }
 
 Dimension_cache::Dimension_cache ()
index 1a40a51570dc0a2ddc813bd60d9d59993a0658d6..ea37e88f115692b4c02e39fe9cd1f49220d72661 100644 (file)
@@ -33,18 +33,18 @@ Molecule*
 Dots::do_brew_molecule_p () const
 {
   Molecule *out = new Molecule;
-  Atom fill = lookup_l ()->fill (Box (Interval (0,0),
+  Molecule fill = lookup_l ()->fill (Box (Interval (0,0),
                                               Interval (0,0)));
-  out->add_atom (fill);
+  out->add_molecule (fill);
 
-  Atom d = lookup_l ()->dots ();
+  Molecule d = lookup_l ()->dots ();
 
   Real dw = d.dim_[X_AXIS].length ();
   d.translate_axis (-dw, X_AXIS);
   for (int i=no_dots_i_; i--; )
     {
       d.translate_axis (2*dw,X_AXIS);
-      out->add_atom (d);
+      out->add_molecule (d);
     }
   Real inter_f = paper ()->internote_f ();
   out->translate_axis (inter_f * position_i_, Y_AXIS);
index d36eeb250a5e16e6520cc8fba33c92120bcd170e..bf7a65429569d81bb078b0188ee9617ea8efb971 100644 (file)
@@ -92,10 +92,10 @@ Dynamic_engraver::do_process_requests()
              continue;
            }
          
-         String loud = absd->loudness_str ();
+         String loud = absd->loudness_str_;
 
          text_p_ = new G_text_item;
-         text_p_->text_str_ =  "dyn" + loud; // ugh
+         text_p_->text_str_ =  loud; // ugh
          Scalar prop = get_property ("dynamicStyle", 0);
 
          text_p_->style_str_ = prop.length_i () ? prop :  "dynamic";
index a255c4c5cd9aeb3b1552a1c86d2d14f550184d13..ab01127f61eaf6c3194f5ecbcfba4d9c26fcb9b8 100644 (file)
@@ -30,11 +30,9 @@ Engraver_group_engraver::do_announces()
   Link_array<Translator_group> groups = group_l_arr ();
   for (int i=0; i < groups.size(); i++) 
     {
-      Engraver * eng = dynamic_cast<Engraver*> (groups[i]);
-      if (eng)
+      Engraver_group_engraver * group = dynamic_cast<Engraver_group_engraver*> (groups[i]);
+      if (group)
        {
-         Engraver_group_engraver * group =
-           (Engraver_group_engraver*) eng;
          group->do_announces();
        }
     }
index 762d800ed4d5f84d87270967b850178acdc4507e..947209376b63c707a203d4039e2957e1d75da8e9 100644 (file)
@@ -11,6 +11,7 @@
 #include "engraver.hh"
 #include "engraver-group.hh"
 #include "debug.hh"
+#include "paper-def.hh"
 
 void
 Engraver::fill_staff_info (Staff_info&)
@@ -36,7 +37,7 @@ Engraver::typeset_element (Score_element*p)
 Paper_def*
 Engraver::paper() const
 {
-  return (Paper_def*)output_def_l_;
+  return dynamic_cast<Paper_def*>(output_def_l_);
 }
 
 
index 7c727b128cc20e77c0f402c16a9cf2a72691055e..9be7106bef5a886b697f1202271503f945fd7f62 100644 (file)
@@ -6,7 +6,7 @@
   (c)  1998 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#include "atom.hh"
+
 #include "box.hh"
 #include "debug.hh"
 #include "lookup.hh"
@@ -52,12 +52,11 @@ Extender_spanner::do_brew_molecule_p () const
   Real w = extent (X_AXIS).length ();
   
   w += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]);
-  
-  Atom a = lookup_l ()->extender (w);
-
+  Real h = paper ()->get_realvar (ly_symbol ("extender_height"));
+  Molecule a = lookup_l ()->filledbox ( Box (Interval (0,w), Interval (0,h)));
   a.translate (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
 
-  mol_p->add_atom (a);
+  mol_p->add_molecule (a);
 
   return mol_p;
 }
index 26751aecb9f8673fed8e6e23ae5263ca15630985..8d9d9cf1523facbd010f1a2190035802cb7579d5 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "g-text-item.hh"
-#include "atom.hh"
+
 #include "molecule.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
@@ -16,7 +16,7 @@
 Molecule*
 G_text_item::do_brew_molecule_p () const
 {
-  Atom a= paper ()->lookup_l(0)->text (style_str_,text_str_); 
+  Molecule a= paper ()->lookup_l(0)->text (style_str_,text_str_); 
   return new Molecule (a);
 }
 
index 3ce45fbf5c6271d3cb05983d49db88807c9328e0..360a0123f056af78df6121fb7758268250a642b7 100644 (file)
@@ -6,10 +6,10 @@
   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-
+#include "molecule.hh"
 #include "general-script-def.hh"
 #include "debug.hh"
-#include "atom.hh"
+
 
 Direction
 General_script_def::staff_dir() const
@@ -60,19 +60,13 @@ General_script_def::do_print() const
 {
 }
 
-Atom
-General_script_def::get_atom (Paper_def*, Direction) const
+Molecule
+General_script_def::get_molecule (Paper_def*, Direction) const
 {
-  Atom s;
-  return Atom (s);
+  Molecule s;
+  return Molecule (s);
 }
 
 
 
 
-Interval
-General_script_def::width (Paper_def*) const
-{
-  Interval t;
-  return t;
-}
diff --git a/lily/global-ctor.cc b/lily/global-ctor.cc
new file mode 100644 (file)
index 0000000..562bd61
--- /dev/null
@@ -0,0 +1,27 @@
+/*   
+  global-ctor.cc --  implement 
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+#include "global-ctor.hh"
+#include "array.hh"
+
+static Array<Global_ctor> *ctor_global_static_arr_p_;
+
+void
+add_constructor (Global_ctor c)
+{
+  if (!ctor_global_static_arr_p_)
+    ctor_global_static_arr_p_ = new Array<Global_ctor>;
+  ctor_global_static_arr_p_->push (c);
+}
+
+void
+call_constructors ()
+{
+  for (int i=0; i < ctor_global_static_arr_p_->size (); i++)
+    (ctor_global_static_arr_p_->elem (i)) ();
+}
index d6785e6d052fc27a28dd3ea7b388145a9b968e75..b92a7a992ad2e4e41b2ec24da8674a095681d877 100644 (file)
@@ -47,7 +47,7 @@ Global_translator::prepare (Moment m)
 }
 
 Moment
-Global_translator::now_moment () const
+Global_translator::now_mom () const
 {
   return now_mom_;
 }
index 921608e9aed2252571cc6069cdace6ea14157b09..940a9720256dc34d0a98d11ef683280ba64c854c 100644 (file)
@@ -84,8 +84,7 @@ Graphical_element::set_empty (bool b)
 Interval
 Graphical_element::extent (Axis a) const
 {
-  Dimension_cache const * d = //(Dimension_cache*)
-    &dim_cache_[a];
+  Dimension_cache const * d = &dim_cache_[a];
 
   if (d->empty_b ())
     return Interval ();
index 4e894ba4383d46692e6d7bb8f0f44a4768c29b9a..cd1719260dfb231104bf5efee80d10a656adaed4 100644 (file)
@@ -16,13 +16,17 @@ Note_heads_engraver::Note_heads_engraver()
 }
 
 bool
-Note_heads_engraver::do_try_music (Music *req_l
+Note_heads_engraver::do_try_music (Music *m
 {
-  if (Note_req * n =dynamic_cast <Note_req *> (req_l))
+  if (Note_req * n =dynamic_cast <Note_req *> (m))
     {
       note_req_l_arr_.push (n);
       return true;
     }
+  if (Tonic_req* t = dynamic_cast<Tonic_req*> (m))
+    {
+      return true;
+    }
   return false;
 }
 
index 22c5d15a0cf4ca32584431c295d5ecbee805468e..b4f656094a0508a9c664c9b8f009981b84d0957b 100644 (file)
 #include "string.hh"
 #include "box.hh"
 #include "lily-proto.hh"
+#include "lily-guile.hh"
 
+#if 0
 /// a symbol which can be translated, and freely copied
 class Atom {
+  static long smob_tag_;
+
+  static SCM smob_mark (SCM);
+  static scm_sizet smob_free (SCM);
+  static int smob_display (SCM, SCM, scm_print_state*);
+  Atom (SCM s);
+  SCM make_smob () const;
+public:
   Offset off_;
 
+  static SCM make_atom (SCM outputfunc);
+  SCM copy_self () const;
+  static Atom *atom_l (SCM);
+
+  /// Is #obj# a Foo?
+  static bool Atom_b(SCM obj);
+  static void init_smob ();
   
+  SCM func_;
+  SCM font_;
+};
+
+#else
+
+class Atom {
 public:
-  Protected_scm lambda_;
-  Score_element * origin_l_;
-
-  // urg, only used as a temp buffer
-  String str_;
-  String font_;
-  Box dim_;
-
-  Offset offset () const;
-  String str() const;          // for printing.
-  Atom (String, Box);
-  Atom ();
-  void translate (Offset o);
-  void translate_axis (Real r,Axis a);
-  /// how big is #this#?
-  Box extent() const;
-  Interval extent (Axis)const;
-  void print() const;
-  bool check_infinity_b () const;
-  bool empty() const;
+  Atom (SCM s);
+  Offset off_;
+  /*
+    SCM expression that (when evaluated) gives a TeX string
+representing a musical notation symbol.  */
+  Protected_scm func_;
+  Protected_scm font_;
 };
+
+#endif
+
 #endif
index 1bd1d6d8e6572f46c078d544f0f5e351b46645d8..c315e2137aa143452c91beccb4c8520d1d5c4fc8 100644 (file)
@@ -15,6 +15,7 @@
 class Bar:public Item {
 public:
   String type_str_;
+  bool at_line_start_b_;
 
   
   VIRTUAL_COPY_CONS(Score_element);
diff --git a/lily/include/base-span-bar-engraver.hh b/lily/include/base-span-bar-engraver.hh
new file mode 100644 (file)
index 0000000..6d8ddf7
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+  base-span-bar-engraver.hh -- declare Span_bar_engraver
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+
+#ifndef SPAN_BAR_GRAV_HH
+#define SPAN_BAR_GRAV_HH
+
+#include "engraver.hh"
+
+/** 
+
+  Make bars that span multiple "staffs". Catch bars, and span a
+  Span_bar over them if we find more than 2 bars
+
+  */
+class Base_span_bar_engraver : public Engraver
+{
+  Span_bar * spanbar_p_;
+  Array<Bar*> bar_l_arr_;
+  Vertical_align_spanner * valign_l_;
+public:
+  VIRTUAL_COPY_CONS(Translator);
+  
+    
+  Base_span_bar_engraver();
+protected:
+  /**
+    Do we use break priorities?  If true, use break_priority_i_ as
+    horizontal alignment priority, otherwise, hang the spanbar on the
+    acknowledged bar.  */
+  bool use_priority_b_;
+  int break_priority_i_;
+  
+  virtual void acknowledge_element (Score_element_info);
+  virtual void do_pre_move_processing();
+  virtual Span_bar* get_span_bar_p() const;
+};
+
+#endif // SPAN_BAR_GRAV_HH
index 898e8b048d778a8d3d1fa1d6b548513eace63d11..5bd35d4b9404050d31f54d0eab807238603c6bed 100644 (file)
@@ -18,7 +18,7 @@ class Beam_engraver : public Engraver {
 
   Beam *finished_beam_p_;
   Beam *beam_p_;
-
+  Beam_req * prev_start_req_;
   Rhythmic_grouping*grouping_p_;
   Rhythmic_grouping*finished_grouping_p_;
   
index b26c6e36955b0c85fab3f7f083414014dfd11916..c53543d05855087590009b5e1dff587cbe182709 100644 (file)
@@ -24,6 +24,7 @@ struct Box {
     
   void translate (Offset o);
   /// smallest box enclosing #b#
+  void set_empty ();
   void unite (Box b);
   Box();
   Box (Interval ix, Interval iy);
index 9dec9ba80cdf216f414d06b69597bec09a178874..6a703ac3138f6781f0b153795aa9d4382d35745d 100644 (file)
@@ -15,7 +15,6 @@
 
 class Change_iterator : public Music_iterator
 {
-  Change_translator *change_l ();
   void  error (String);
 
 protected:
index 233714f017ce578569067613a359a7759555fdfe..4e13194916705fda53ad2b27035130b6d211ada9 100644 (file)
 #include "engraver.hh"
 #include "array.hh"
 #include "musical-pitch.hh"
-
 #include "lily-proto.hh"
 
-Array<Musical_pitch> rebuild_from_base_pitch_arr (Array<Musical_pitch> pitch_arr, int base_i);
-Array<Musical_pitch> rebuild_insert_inversion_pitch_arr (Array<Musical_pitch> pitch_arr, int tonic_i);
-Array<Musical_pitch> rebuild_with_bass_pitch_arr (Array<Musical_pitch> pitch_arr, int bass_i);
-
-
 class Chord_name_engraver : public Engraver 
 {
+public:
+  Chord_name_engraver ();
+  VIRTUAL_COPY_CONS (Translator);
+
 protected:
   virtual void do_pre_move_processing ();
   virtual void acknowledge_element (Score_element_info i);
   virtual void do_process_requests ();
   virtual bool do_try_music (Music* m);
 
-public:
-  Chord_name_engraver ();
-  VIRTUAL_COPY_CONS (Translator);
-
 private:
   Array<Musical_pitch> pitch_arr_;
   Link_array<Item> text_p_arr_;
-
-  String banter_str (Array<Musical_pitch> pitch_arr, Musical_pitch* inversion) const;
-  int find_tonic_i () const;
   Array<Musical_pitch> rebuild_pitch_arr (int tonic_i) const;
+  Tonic_req* tonic_req_;
 };
 
 #endif // CHORD_NAME_ENGRAVER_HH
index 0fc7601aeb9b3f4b8a098615637e55a8de8bc03b..a863e76572e3d341e14b5ea9602d61adc0355a72 100644 (file)
@@ -25,9 +25,11 @@ public:
 
   String banter_str (Musical_pitch* inversion) const;
   int find_tonic_i () const;
+  int find_pitch_i (Musical_pitch p) const;
+  int find_notename_i (Musical_pitch p) const;
+  void find_additions_and_subtractions(Array<Musical_pitch>* add_arr_p, Array<Musical_pitch>* sub_arr_p);
 
   Array<Musical_pitch> pitch_arr_;
-  int tonic_i_;
 };
 
 #endif // CHORD_HH
index 964933e2df6d2a3acf9d70f9da71b90bb24c6955..ee770c3b3d4cf9b25fcf1399993082e4c2c956e1 100644 (file)
@@ -7,10 +7,10 @@
 #ifndef COLHPOS_HH
 #define COLHPOS_HH
 
-#include "array.hh"
+#include "parray.hh"
 #include "lily-proto.hh"
 
-typedef Array<Paper_column*>  Line_of_cols;
+typedef Link_array<Paper_column>  Line_of_cols;
 
 struct Column_x_positions {
   Line_spacer * spacer_l_;
index 7d539fb6660711336c865bb8fffccada7820191a..cf3c897efcbfec100c0a6153232ca47c6115b135 100644 (file)
@@ -69,7 +69,7 @@ public:
 
 class Partial_measure_req  : public Timing_req  {
 public:
-  Moment duration_;
+  Moment length_mom_;
 
   Partial_measure_req (Moment);
   REQUESTMETHODS(Partial_measure_req);
diff --git a/lily/include/cons.cc b/lily/include/cons.cc
new file mode 100644 (file)
index 0000000..39ed309
--- /dev/null
@@ -0,0 +1,10 @@
+/*   
+  cons.cc --  implement 
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "cons.hh"
diff --git a/lily/include/cons.hh b/lily/include/cons.hh
new file mode 100644 (file)
index 0000000..4b4de47
--- /dev/null
@@ -0,0 +1,43 @@
+/*   
+  cons.hh -- declare 
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef CONS_HH
+#define CONS_HH
+
+template<class T>
+class Cons
+{
+public:
+  T * car_;
+  Cons * next_;
+  virtual ~Cons ();
+  Cons () {
+    car_=0;
+    next_ =0;
+  }
+  Cons (T*t, Cons<T>*c)
+    {
+      car_ = t;
+      next_ = c;
+    }
+};
+
+template<class T>
+class Killing_cons : public Cons<T>
+{
+public:
+  Killing_cons (T *t, Cons<T> *p)
+    : Cons<T>( t,p)
+    {
+    }
+  virtual ~Killing_cons ();
+};
+
+#endif /* CONS_HH */
+
index f39f1dbaf732871e012650e365d9eb308b24a463..dec066bef9b5416d93aa9aa9d80483986b3e70b3 100644 (file)
@@ -30,7 +30,7 @@ protected:
   
     
 private:
-  Atom get_symbol() const;
+  Molecule get_symbol() const;
 };
 
 #endif // CRESCENDO_HH
index 2cd36becb66deee947b56b8024e728c6f635f5a1..dde24d58c84826c4ed352cf50e7bd840197d90be 100644 (file)
@@ -27,11 +27,9 @@ public:
   virtual Direction rel_stem_dir() const;
   virtual int priority_i() const;
   virtual bool inside_b() const;
-  virtual Atom get_atom (Paper_def* p, Direction dir_) const;
+  virtual Molecule get_molecule (Paper_def* p, Direction dir_) const;
   bool equal_b (General_script_def const&) const;
   virtual ~General_script_def() {}
-    
-  virtual Interval width (Paper_def *) const;
 protected:
   virtual bool do_equal_b (General_script_def const *) const;
   virtual void do_print() const;
diff --git a/lily/include/global-ctor.hh b/lily/include/global-ctor.hh
new file mode 100644 (file)
index 0000000..53d25a4
--- /dev/null
@@ -0,0 +1,32 @@
+/*   
+  global-ctor.hh -- declare Global construction stuff.
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef GLOBAL_CTOR_HH
+#define GLOBAL_CTOR_HH
+
+
+#define ADD_GLOBAL_CTOR_WITHNAME(y,x)\
+class Global_ctor_ ## y  \
+{\
+public:        \
+  Global_ctor_ ## y () {               \
+    add_constructor (x);       \
+  }                            \
+}  _ ## y ## _ctor_init;       \
+
+
+#define ADD_GLOBAL_CTOR(x) ADD_GLOBAL_CTOR_WITHNAME(x,x);
+
+
+typedef void (* Global_ctor ) ();
+void add_constructor (Global_ctor ctor);
+void call_constructors ();
+
+#endif /* GLOBAL_CTOR_HH */
+
index 0e12f150fd97997ed58518b2f92760733c03b280..7028dbc92fafaf8bb2428eb8775ad3cf9a3f81b2 100644 (file)
@@ -34,7 +34,7 @@ public:
 
   
 protected:
-  virtual Moment now_moment () const;
+  virtual Moment now_mom () const;
   virtual Global_translator *global_l() { return this; }
 };
 
index 51aa0937adf9d45c9cf3d0c07cd617435349c117..23b972439447ab2669b778f450110f42bf93ea42 100644 (file)
@@ -13,7 +13,7 @@
 #include <FlexLexer.h>
 
 #include "string.hh"
-#include "array.hh"
+#include "parray.hh"
 #include "fproto.hh"
 #include "proto.hh"
 
@@ -29,7 +29,7 @@ class Includable_lexer : public yyFlexLexer
 
 protected:
   bool  close_input ();
-  Array<Source_file*> include_stack_;
+  Link_array<Source_file> include_stack_;
   Array<int> char_count_stack_;
 
 public:
diff --git a/lily/include/killing-cons.tcc b/lily/include/killing-cons.tcc
new file mode 100644 (file)
index 0000000..3c9a971
--- /dev/null
@@ -0,0 +1,27 @@
+/*   
+  killing-cons.tcc -- declare Killing_cons
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef KILLING_CONS_TCC
+#define KILLING_CONS_TCC
+
+template<class T>
+Cons<T>::~Cons ()
+{
+}
+
+template<class T>
+Killing_cons<T>::~Killing_cons ()
+{
+  delete car_;
+  delete next_;
+}
+
+
+#endif /* KILLING_CONS_TCC */
+
index 0c600002f8c8258a2c2dcfb94a9227afbb6d6498..bf37e6218903560302f16ea913851a149a051e21 100644 (file)
@@ -251,6 +251,7 @@ struct Time_signature;
 struct Time_signature_change_req;
 struct Time_signature_engraver;
 struct Time_signature_performer;
+struct Tonic_req;
 struct Translator;
 struct Translator_group;
 struct Timing_req;
index ab91f4d1f8e882fadce0dab0cf96bffb72822a21..b3183efc9725c237f2af3900fc31d49aa48fe7d0 100644 (file)
@@ -15,7 +15,7 @@
 class Line_of_score : public Spanner , public Super_element
 {
 public:
-  Link_array<Paper_column> cols;
+  Link_array<Paper_column> cols_;
   bool error_mark_b_;
 
   
index 955ce1e87d70feeccf429b67945a8c3a20dc00b3..d61766a1f12be2079d1ea1c9ed3fa06760a22923 100644 (file)
 #ifndef LOOKUP_HH
 #define LOOKUP_HH
 
-#include "atom.hh"
 #include "molecule.hh"
 #include "fproto.hh"
-#include "scalar.hh"
 #include "direction.hh"
 #include "box.hh"
 
@@ -27,33 +25,34 @@ public:
 
 
   
-  Atom special_ball (int, String) const;
-  Atom simple_bar (String s, Real w) const;
+  Molecule special_ball (int, String) const;
+  Molecule simple_bar (String s, Real w) const;
   Molecule accidental (int, bool cautionary) const;
-  Atom afm_find (String, bool warn=true) const;
-  Atom ball (int) const;
+  Molecule afm_find (String, bool warn=true) const;
+  Molecule ball (int) const;
   Molecule bar (String, Real height) const;
-  Atom beam (Real, Real, Real) const;
-  Atom clef (String) const;
-  Atom dashed_slur (Array<Offset> controls, Real thick, Real dash) const;
-  Atom dots () const;
-  Atom extender (Real) const;
-  Atom fill (Box b) const;
-  Atom flag (int, Direction) const;
-  Atom hairpin (Real width, bool decresc, bool continued) const;
-  Atom plet (Real dy, Real dx, Direction dir) const;
-  Atom rest (int, bool outside) const;
-  Atom rule_symbol (Real height, Real width) const;
-  Atom script (String idx) const;
-  Atom stem (Real y1_pos, Real y2_pos) const;
-  Atom slur (Array<Offset> controls) const;
-  Atom streepje (int type) const;
-  Atom text (String style, String text) const;
-  Atom vbrace (Real &dy) const;
-  Atom vbracket (Real &dy) const;
-  Atom volta (Real w, bool last_b) const;
-  Atom special_time_signature (String, Array<int>) const;
-  Atom time_signature (Array<int>) const;
+  Molecule beam (Real, Real, Real) const;
+  Molecule clef (String) const;
+  Molecule dashed_slur (Array<Offset> controls, Real thick, Real dash) const;
+  Molecule dots () const;
+  Molecule ledger_line (Interval) const;
+  Molecule fill (Box b) const;
+  Molecule filledbox (Box b) const;  
+  Molecule flag (int, Direction) const;
+  Molecule hairpin (Real width, bool decresc, bool continued) const;
+  Molecule plet (Real dy, Real dx, Direction dir) const;
+  Molecule rest (int, bool outside) const;
+  Molecule rule_symbol (Real height, Real width) const;
+  Molecule script (String idx) const;
+  Molecule stem (Real y1_pos, Real y2_pos) const;
+  Molecule slur (Array<Offset> controls) const;
+  Molecule streepje (int type) const;
+  Molecule text (String style, String text) const;
+  Molecule staff_brace (Real dy) const;
+  Molecule staff_bracket (Real dy) const;
+  Molecule volta (Real w, bool last_b) const;
+  Molecule special_time_signature (String, int,int) const;
+  Molecule time_signature (int n,int d) const;
 
   Paper_def * paper_l_;
 
index 4f83376ad469f3c4c073599ce3a4774cac9ab75e..baf31a47a9f0b45ad0bd9c6faec2a532c008c6f7 100644 (file)
@@ -25,7 +25,7 @@ protected:
   virtual void do_process_requests();
 
 private:
-  Array<Lyric_req*> lreq_arr_;
+  Link_array<Lyric_req> lreq_arr_;
 };
 
 #endif // LYRIC_PERFOMER_HH
index ef0029b418fbc84aa3db5f0eef454db3d296bfbf..85975ee8dd8a7b2d3379fd1dfe384566281822f8 100644 (file)
@@ -31,7 +31,7 @@ public:
   Midi_def();
   ~Midi_def();
 
-  Real duration_to_seconds_f (Moment);
+  Real length_mom_to_seconds_f (Moment);
   int get_tempo_i (Moment moment);
   void print() const;
   void set_tempo (Moment moment, int count_per_minute_i);
index 5b3eaf6a1a5484e4e8e858124ca7236ed5a91079..2b251c4286c485459b0ac09e79062f37392c6ea1 100644 (file)
@@ -112,7 +112,7 @@ struct Midi_note : public Midi_item {
   
   Midi_note (Audio_item* audio_item_l); 
 
-  Moment duration () const;
+  Moment length_mom () const;
   int pitch_i () const;
   virtual String str () const;
 
index e659602e991497492d17a7611972426150918e2d..d45eabe840e958dfd34685f0b08835fc08f9fdb2 100644 (file)
@@ -27,7 +27,7 @@ sign (int i) {
 
 #ifndef STANDALONE
 #include "lily-proto.hh"
-Interval itemlist_width (const Array<Item*> &its);
+Interval itemlist_width (const Link_array<Item> &its);
 #endif
 
 void set_frobnify (void*, size_t);
index 757a26ac3443b7858f986887bcf7307e3a15ff08..53da1c511a18728b4ab2c2909519f11eb4f8c98c 100644 (file)
 #include "box.hh"
 #include "axes.hh"
 #include "direction.hh"
+#include "protected-scm.hh"
+#include "cons.hh"
 
 /** a group of individually translated symbols. You can add molecules
     to the top, to the right, etc.  */
-struct Molecule {
-  Pointer_list<Atom*> atoms_;  // change to List<Atom>? 
+class Molecule {
+  //  Protected_scm atom_list_;        // change to List<Atom>?
+  Killing_cons<Atom> *atom_list_;
+  friend class Paper_outputter;
+public:
+  Box dim_;
 
-    
-  Molecule() { }
-  Molecule (Atom const &a);
+  Molecule();
+  ~Molecule();
 
   void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding);
   
   void add_molecule (Molecule const &m);
   void translate (Offset);
+  void do_center (Axis);
   void translate_axis (Real,Axis);
-  void add_atom (Atom const & a) ;
+  
+  void add_atom (Atom const *a);
   /// how big is #this#? 
   Box extent() const;
   Interval extent (Axis) const;
 
   Molecule (const Molecule&s);
   void print() const;
-private:
-  void operator=(const Molecule&);
+  void operator=(const Molecule&);  
 };
 #endif
index 7cbbffee49f780c979d5f96f9e6bb2fe2f362bf4..9665ff9df45949fb13beacde87899dd88d322af6 100644 (file)
@@ -55,7 +55,7 @@ public:
   
   Simultaneous_music(Music_list *);
   virtual Musical_pitch to_relative_octave (Musical_pitch);
-  virtual Moment duration () const;
+  virtual Moment length_mom () const;
 };
 
 
@@ -84,6 +84,6 @@ public:
 
   virtual Musical_pitch to_relative_octave (Musical_pitch);
   Sequential_music(Music_list*);
-  virtual Moment duration () const;
+  virtual Moment length_mom () const;
 };
 #endif // Music_sequence_HH
index 50d9bbea272f278e31bfa7c3395a6a629f0680bb..fc149876c8ff0dc5001b62fedb4a7695a513c9e8 100644 (file)
@@ -29,7 +29,6 @@ public:
   virtual bool ok () const;
 
 protected:
-  Music_wrapper *music_wrapper_l () const;
   virtual void do_print () const;
   virtual void do_process_and_next (Moment) ;
 
index 26fea0ec7bec649bdb8e482bb6dc31f072194df0..adbd86979046bc98f4a1081d8b8cd50bda164640 100644 (file)
@@ -30,7 +30,7 @@ public:
   
   VIRTUAL_COPY_CONS(Music);
   Music_wrapper (Music_wrapper const&);
-  virtual Moment duration () const;
+  virtual Moment length_mom () const;
   virtual ~Music_wrapper ();
   virtual Musical_pitch to_relative_octave (Musical_pitch);
   
index 8f30e4469821cf537ab226714d3dfef3ad6ae47c..15ee2f7074fcbcc22231eaf99ed74b88039fb0a2 100644 (file)
@@ -44,7 +44,7 @@ public:
   virtual Musical_pitch to_relative_octave (Musical_pitch);
 
   /// The duration of this piece of music
-  virtual Moment duration () const;
+  virtual Moment length_mom () const;
 
   virtual ~Music(){}
   void print() const;
index cdc293a5f63dcc8e741c996dd8b6c9500b40af07..a25dd1d2436f9a38301a0403072c023645382d1c 100644 (file)
@@ -37,7 +37,7 @@ public:
     
   bool do_equal_b (Request*) const;
   void compress (Moment);
-  virtual Moment duration() const;
+  virtual Moment length_mom () const;
   static int compare (Rhythmic_req const&,Rhythmic_req const&);
   REQUESTMETHODS(Rhythmic_req);
 };
@@ -88,6 +88,13 @@ struct Melodic_req :virtual Musical_req
   REQUESTMETHODS(Melodic_req);
 };
 
+/// specify tonic of a chord
+struct Tonic_req : public Melodic_req
+{
+  Tonic_req ();
+  REQUESTMETHODS(Tonic_req);
+};
+
 /// Put a note of specified type, height, and with accidental on the staff.
 class Note_req  : public Rhythmic_req, virtual public Melodic_req  {
 public:
@@ -163,21 +170,12 @@ public:
 
 class Dynamic_req  : public virtual Musical_req  {
 public:
-  /**
-    for absolute dynamics
-
-    This sux. We'd want increasing numbers for FFF till PPP, but not 
-    for FP, SF, SFZ (FP is *not* louder than FFF)
-   */
-  enum Loudness {
-    FFFFFF, FFFFF, FFFF, FFF, FF, F, MF, MP, P, PP, PPP, PPPP, PPPPP, PPPPPP, FP, SF, SFF, SFZ, SP, SPP, RFZ };
-  static String loudness_static_str (Loudness);
   REQUESTMETHODS(Dynamic_req);
 };
 
 class Absolute_dynamic_req  : public Dynamic_req  {
 public:
-  Loudness loudness_;
+  String loudness_str_;
   virtual bool do_equal_b (Request*) const;
   String loudness_str () const;
   Absolute_dynamic_req();
index 91e51c635bfe27d1ab5ad83627412e80118dbc1a..c303c258e98cc90595fc7b6949f274265edb0183 100644 (file)
@@ -36,7 +36,7 @@ public:
 
   Notename_table *chordmodifier_tab_p_;
   Notename_table *note_tab_p_;
-  Array<Scope*> scope_l_arr_;
+  Link_array<Scope> scope_l_arr_;
   Keyword_table * keytable_p_;
   int errorlevel_i_;
 
index 889ccf1bb746635998c790e5bc5185c0bb0e6283..fe5f4480be214bee41bb8ed42f47239d2b1c0120 100644 (file)
@@ -11,7 +11,7 @@
 #define MY_LILY_PARSER_HH
 #include "lily-proto.hh"
 #include "string.hh"
-#include "array.hh"
+#include "parray.hh"
 #include "lily-proto.hh"
 #include "lily-proto.hh"
 #include "duration.hh"
@@ -36,7 +36,7 @@ public:
     
   bool first_b_;
 
-  Array<Request*> pre_reqs, post_reqs;
+  Link_array<Request> pre_reqs, post_reqs;
   int fatal_error_i_;
   Sources * source_l_;
   int error_level_i_;
@@ -52,7 +52,7 @@ public:
   void do_yyparse();
   void parser_error (String);
 
-  Array<Request*>* get_parens_request (int t);
+  Link_array<Request>* get_parens_request (int t);
     
   void set_debug();
   void set_yydebug (bool);
index df73bea785c5c5668039ac6e2288de572a5c5b8d..4364350592653d8f0ade328d4617bf1f343d3403 100644 (file)
@@ -86,7 +86,7 @@ public:
   /** convert a duration to an idealspacing
     influence using the geometric_ and  paratime_signatures.
     */
-  Real duration_to_dist (Moment, Real) const;
+  Real length_mom_to_dist (Moment, Real) const;
   Real geometric_spacing (Moment) const;
   Real arithmetic_constant (Moment minimal_mom) const;
   Real arithmetic_spacing (Moment mom,Real constant) const;
index 42c580768e9a5d24a8c2c22c998fd9667702844a..6348379e17d98dd3bfd968205e16afcc506aab17 100644 (file)
@@ -39,8 +39,6 @@ public:
   void stop_line ();
   void switch_to_font (String fontname);
 
-  Array<String> font_arr_;
-  String current_font_;
   Paper_stream* outstream_l_;
 };
 
index f02ced787bda655c9d33d51238e0315f10e8c20f..eafcc54c9ca08a6397fa469513f2a7d14cf159b1 100644 (file)
@@ -24,7 +24,7 @@ public:
   Protected_scm (Protected_scm const &);
   ~Protected_scm ();
   Protected_scm &operator = (Protected_scm const &);
-  operator SCM ();
+  operator SCM () const;
   SCM to_SCM () const;
 };
 
index cef330a7187953b1a8b1acdf70d295bb6500123b..ba5ac43066c75a9dc8a63faaad8734669567ec9c 100644 (file)
@@ -37,6 +37,7 @@ private:
   Array<Moment> stop_mom_arr_;
   Array<Moment> alternative_start_mom_arr_;
   Array<Moment> alternative_stop_mom_arr_;
+  Array<String> alternative_str_arr_;
 };
 
 #endif // REPEAT_ENGRAVER_HH
index 1e8c48a2d4671586b9721650c8f2d6afa816c524..9f8b720132cfe9eea9949ce09c2b2c6e29bc3162 100644 (file)
@@ -23,11 +23,8 @@ public:
   virtual bool ok () const;
 
 protected:
-  virtual Repeated_music* repeated_music_l () const;
-
   virtual void do_print () const;
   virtual void do_process_and_next (Moment);
-
 private:
   void start_next_element ();
 
index 6175d45864782b4d7026d1283fa791fd313614aa..5e2e2b28c71abaac3f4e3e3eba3f62a05a7d2627 100644 (file)
@@ -29,7 +29,7 @@ public:
   
   virtual void do_print () const;
   virtual void transpose (Musical_pitch p);
-  virtual Moment duration () const;
+  virtual Moment length_mom () const;
   virtual Musical_pitch to_relative_octave (Musical_pitch p);
   VIRTUAL_COPY_CONS(Music);
 };
index d374d5929f4af2fd31dd6979e484463252b3d3d9..4d078dca4600246b53494772ab43e0cc95db8fd0 100644 (file)
@@ -18,9 +18,9 @@
 class Request_chord_iterator : public Music_iterator {
   Request_chord * elt_l () const;
   /**
-     cache elt_l ()->duration ().
+     cache elt_l ()->length_mom ().
    */
-  Moment elt_duration_;
+  Moment elt_length_mom_;
   bool last_b_;
 
 public:
diff --git a/lily/include/rhythmic-grouping.hh b/lily/include/rhythmic-grouping.hh
new file mode 100644 (file)
index 0000000..edccad7
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+  rhythmic-grouping.hh -- part of GNU LilyPond
+
+  (c) 1996--1998 Han-Wen Nienhuys
+*/
+
+#ifndef RHYTHMIC_GROUPING_HH
+#define RHYTHMIC_GROUPING_HH
+
+#include "minterval.hh"
+#include "parray.hh"
+
+/** data structure which represents rhythmic units   this is a tree. It groupes notes according to rules
+
+  TODO Documentation. Unhairing
+ */
+struct Rhythmic_grouping {
+    Link_array<Rhythmic_grouping> children;
+    MInterval *interval_;
+    
+
+    Array<MInterval> intervals();
+    MInterval interval() const;
+    Moment length_mom () const;
+    void intersect (MInterval);
+    
+    void operator=(Rhythmic_grouping const&);
+    Rhythmic_grouping (Rhythmic_grouping const&);
+    Rhythmic_grouping (MInterval, int n=1);
+    Rhythmic_grouping();
+    Rhythmic_grouping (Link_array<Rhythmic_grouping>);
+    ~Rhythmic_grouping();
+
+    void add_child (Moment start, Moment len);
+    bool child_fit_b (Moment start);
+    void split (Rhythmic_grouping r);
+    void split (Array<MInterval>);
+    void split (int n);
+
+    void print() const;
+    void OK() const;
+
+    Array<int> generate_beams (Array<int>, int&);
+
+    /** multiply self to span #i#.
+      In implementation, this isn't really const, but conceptually it is.
+      */
+    void extend (MInterval i) const;
+    void translate (Moment);
+private:
+    void init();
+    void junk();
+    void copy (Rhythmic_grouping const&);
+};
+
+
+Rhythmic_grouping parse_grouping (Array<int> beat_i_arr, Array<Moment> elt_length_arr);
+
+
+#endif // RHYTHMIC_GROUPING_HH
index 19586ede51c55ace81d796603af5fa1b4e54f33a..594e8114521640c4d5c06c1ab2fcf2f6a38f0f6c 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "scalar.hh"
 #include "lily-proto.hh"
-#include "array.hh"
+#include "parray.hh"
 
 /**
   Data container for broadcasts 
@@ -20,7 +20,7 @@
 struct Score_element_info {
     Score_element * elem_l_;
     Music *req_l_;
-    Array<Engraver*> origin_grav_l_arr_;
+    Link_array<Engraver> origin_grav_l_arr_;
 
     Score_element_info (Score_element*, Music*);
     Score_element_info();
index 1bf61fd493d6eaa52cc026462266c31b740d1f81..e7f7697a495d43765d9cc91a7d31eb1f1a0cfd6f 100644 (file)
@@ -34,7 +34,7 @@ public:
   virtual Direction rel_stem_dir() const;
   virtual int priority_i() const;
   virtual bool inside_b() const;
-  virtual Atom get_atom (Paper_def* p, Direction dir_) const;
+  virtual Molecule get_molecule (Paper_def* p, Direction dir_) const;
   
 
   virtual bool do_equal_b (General_script_def const *) const;
index afef25c8b7eb495fe364b21255ff12f8cd324f26..5e009bbfa39837ae8629bd9ff38b34da0205c16a 100644 (file)
@@ -12,8 +12,8 @@
 
 
 class Script_engraver : public Engraver {
-  Array<Script *> script_p_arr_;
-  Array<Script_req *> script_req_l_arr_;
+  Link_array<Script> script_p_arr_;
+  Link_array<Script_req> script_req_l_arr_;
 
 public:
   VIRTUAL_COPY_CONS(Translator);
index f13a6a18402ae4dfa40fb62994a4871291ef792e..0c05cc94a0862273748046d100c6a03d0e14af85 100644 (file)
@@ -21,7 +21,6 @@ protected:
   virtual void do_substitute_dependency (Score_element*,Score_element*);
   virtual void do_print() const;
   virtual Interval symbol_height() const;
-  virtual Interval symbol_width () const;
   virtual void do_pre_processing();
   virtual Interval do_width() const;
   VIRTUAL_COPY_CONS(Score_element);
index b463f1a1832fc742af2616a50f1e56e85539e925..dc862eaf6f2ebec8e96c7b20dcb775e4990b8727 100644 (file)
 #include "engraver.hh"
 
 class Slur_engraver :public Engraver {
-  Array<Slur_req*> requests_arr_;
-  Array<Slur_req*> new_slur_req_l_arr_;
-  Array<Slur *> slur_l_stack_;
-  Array<Slur*> end_slur_l_arr_;
+  Link_array<Slur_req> requests_arr_;
+  Link_array<Slur_req> new_slur_req_l_arr_;
+  Link_array<Slur> slur_l_stack_;
+  Link_array<Slur> end_slur_l_arr_;
 
 protected:
   virtual bool do_try_music (Music*);
index 410b527a1b8157c66f625b1084d9f1b01889c102..173cd04fa45b404e73a17771c7f1238f5c898647 100644 (file)
 
 class Span_bar : public virtual Bar
 {
-    Link_array<Score_element> spanning_l_arr_;
-
+  Link_array<Score_element> spanning_l_arr_;
+  Interval get_spanned_interval () const;
 public:
-    Span_bar();
+  Real extra_x_off_;
+  bool no_width_b_;
+  Span_bar();
     
-    VIRTUAL_COPY_CONS(Score_element);
-    void add_bar (Bar*);
-    void set_align (Align_element *);
+  VIRTUAL_COPY_CONS(Score_element);
+  void add_bar (Bar*);
+  void set_align (Align_element *);
 
 protected:
-    void evaluate_empty ();
-    virtual Interval do_width() const;
-    virtual void do_pre_processing();
-    virtual void do_post_processing();
-    
-    virtual void do_substitute_dependency (Score_element*,Score_element*);
-    virtual Molecule * do_brew_molecule_p() const;
-    virtual Molecule get_bar_sym (Real dy) const;
+  void evaluate_empty ();
+  virtual Interval do_width() const;
+  virtual void do_pre_processing();
+  virtual void do_post_processing();
+  virtual Interval do_height () const;
+  virtual void do_substitute_dependency (Score_element*,Score_element*);
+  virtual Molecule * do_brew_molecule_p() const;
 };
 
 #endif // SPAN_BAR_HH
index f3660ae8429c16ec37acd71c68df926306be7dcc..793112f3374f3184339af7e833ae9cd2d01e3f32 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef SPAN_SCORE_BAR_GRAV_HH
 #define SPAN_SCORE_BAR_GRAV_HH
 
-#include "span-bar-engraver.hh"
+#include "base-span-bar-engraver.hh"
 
 /** 
 
 
   */
 
-class Span_score_bar_engraver : public Span_bar_engraver 
+class Span_score_bar_engraver : public Base_span_bar_engraver 
 {
 public:
   VIRTUAL_COPY_CONS (Translator);
-  
+  Span_score_bar_engraver ();
   virtual Span_bar* get_span_bar_p () const;
 };
 
index b2bcd70de4444805126f00b8cb0ac6f2bd6aeaf7..7f06116ed2edcc3ae3050a1c37f397a7f67db194 100644 (file)
@@ -44,7 +44,6 @@ public:
     
 protected:
   virtual Interval symbol_height () const;
-  virtual Interval symbol_width () const;
   Interval symbol_extent () const;
   virtual Real get_position_f () const;
   virtual void do_substitute_dependency (Score_element *, Score_element*);
index c87555367f6d94ec4367fe325f30f6da362f049f..7e05f77640c0221d43f35188a000598424cc7f3f 100644 (file)
@@ -46,10 +46,10 @@ class Stem : public Item {
     */
   Direction  stem_xdir_;
 
-public:
   Link_array<Note_head> head_l_arr_;
   Link_array<Rest> rest_l_arr_;
     
+public:
   /// how many abbrev beam don't reach stem?
   int beam_gap_i_;
 
index 825b18f7ede8681d5474aacf43e084e09ea7abc1..c740f04c77959c5760b03363bd9b5aad43a3fbab 100644 (file)
@@ -29,14 +29,11 @@ public:
     
   virtual void do_print() const;
   virtual Direction staff_dir() const;
-  virtual Atom get_atom (Paper_def* p, Direction dir_) const;
+  virtual Molecule get_molecule (Paper_def* p, Direction dir_) const;
   virtual ~Text_def() {};
   virtual bool do_equal_b (const General_script_def*) const;
   Text_def();
   virtual void print() const;
-  virtual Interval width (Paper_def*) const;
-private:
-  Real guess_width_f(Atom&) const;
 };
 
 #endif // TEXT_DEF_HH
index 460939d59b8cf128ef0bfebfd9852a5bb38caf44..122e1ec45e0a7a07cb1aa5bf22e86ee781bc71ff 100644 (file)
@@ -7,11 +7,11 @@
 */
 
 
-#ifndef METERGRAV_HH
-#define METERGRAV_HH
+#ifndef TIME_SIG_ENGRAVER_HH
+#define TIME_SIG_ENGRAVER_HH
 #include "engraver.hh"
 #include "time-description.hh"
-#include "grouping.hh"
+#include "rhythmic-grouping.hh"
 
 /**
   generate time_signatures. 
@@ -27,4 +27,4 @@ public:
   Time_signature_engraver();
   
 };
-#endif // METERGRAV_HH
+#endif // TIME_SIG_ENGRAVER_HH
index 7074d9c873b6d256658d2b9e4a337c20a12cf57e..2e97184c5f685b4d38fd4b6c2cce2f1ec8717cac 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "translator.hh"
 #include "time-description.hh"
-#include "grouping.hh"
+#include "rhythmic-grouping.hh"
 #include "parray.hh"
 
 class Timing_translator : public virtual Translator
index f089df51b417f464f570999971bb6e25d7dcca74..7709c98f92925fadd6f7013caf0a9fc62f4428e3 100644 (file)
@@ -9,7 +9,7 @@
 
 #ifndef TRANSLATOR_HH
 #define TRANSLATOR_HH
-
+#include "global-ctor.hh"
 #include "string.hh"
 #include "lily-proto.hh"
 #include "virtual-methods.hh"
@@ -61,7 +61,7 @@ public:
     */
   Music_output_def *output_def_l () const;
   Scalar get_property (String, Translator_group **) const;
-  virtual Moment now_moment () const;  
+  virtual Moment now_mom () const;  
 
 protected:
    enum { 
@@ -90,32 +90,21 @@ protected:
 };
 
 
-template<class T>
-class Translator_adder
-{
-public:
-  static Translator *ctor ()
-    {
-      T *t = new T;
-      t->type_str_ = classname (t);
-      return t;
-    }
-  Translator_adder () {        
-    add_constructor (ctor);
-  }                            
-};
-
 /**
   A macro to automate administration of translators.
  */
-#define ADD_THIS_TRANSLATOR(c)                         \
-  Translator_adder<c> _ ## c ## init;
+#define ADD_THIS_TRANSLATOR(T)                         \
+static void  _ ## T ## _adder () {\
+      T *t = new T;\
+      t->type_str_ = classname (t);\
+      add_translator (t);\
+}\
+ADD_GLOBAL_CTOR(_ ## T ## _adder);
+
 
-typedef Translator *(*Translator_ctor) ();
 
 extern Dictionary<Translator*> *global_translator_dict_p;
 void add_translator (Translator*trans_p);
-void add_constructor (Translator_ctor ctor);
 
 Translator*get_translator_l (String s);
 
index 2ba9b270451836129db87de1dd70b6d376ca19ba..701ebc2760ef686f1a288dd9b4152415b3cdcafd 100644 (file)
@@ -122,7 +122,7 @@ Item*
 Item::find_prebroken_piece (Line_of_score*l) const
 {
   if (line_l() == l) 
-    return (Item*)this;
+    return (Item*)(this);
   else if (broken_to_drul_[LEFT] && broken_to_drul_[LEFT]->line_l() == l)
     return broken_to_drul_[LEFT];
   else if (broken_to_drul_[RIGHT] && broken_to_drul_[RIGHT]->line_l() == l)
@@ -135,9 +135,9 @@ Item*
 Item::find_prebroken_piece (Direction breakstatus) const
 {
   if (!breakstatus)
-    return (Item *) this;      // ugh
+    return (Item *)(this);     // ugh
   else
-    return (Item*) broken_to_drul_[breakstatus];
+    return dynamic_cast<Item*>( broken_to_drul_[breakstatus]);
 }
 
 void
index e2de809d0196bf0bbaad96d5c101fc2377963f9f..e9a0c10371b4a4058317ea1056693b3e0dee2d5c 100644 (file)
@@ -180,13 +180,13 @@ EXTENDER  __
        cerr << _ ("missing end quote") << endl;
        exit (1);
 }
-<notes>{RESTNAME}      {
+<chords,notes>{RESTNAME}       {
        const char *s = YYText ();
        yylval.string = new String (s); 
        DOUT << "rest:"<< yylval.string;
        return RESTNAME;
 }
-<notes>R               {
+<chords,notes>R                {
        return MEASURES;
 }
 <INITIAL,chords,lyrics,notes>\\\${BLACK}*{WHITE}       {
@@ -294,6 +294,9 @@ EXTENDER    __
                yylval.i = String_convert::dec2_i (String (YYText ()));
                return UNSIGNED;
        }
+       \" {
+               start_quote ();
+       }
        . {
                return yylval.c = YYText ()[0];
        }
index ba549cb99de6bb57159e3c76aeff981549b7e466..b1aaa245e320e0570497267552d8e68d7795138e 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "line-of-score.hh"
 #include "spanner.hh"
-#include "atom.hh"
+
 #include "paper-def.hh"
 #include "p-col.hh"
 #include "p-score.hh"
@@ -33,14 +33,14 @@ Line_of_score::add_element (Score_element*e)
 bool
 Line_of_score::contains_b (Paper_column const* c) const
 {
-  return cols.find_l ((Paper_column*)c);
+  return cols_.find_l ((Paper_column*)(c));
 }
 
 Line_of_score*
 Line_of_score::set_breaking (Array<Column_x_positions> const &breaking, int j) const
 {
-  const Array<Paper_column*> &curline (breaking[j].cols);
-  const Array<Paper_column*> &errors (breaking[j].error_col_l_arr_);
+  const Link_array<Paper_column> &curline (breaking[j].cols);
+  const Link_array<Paper_column> &errors (breaking[j].error_col_l_arr_);
   const Array<Real> &config (breaking[j].config);
        
   for (int i=0; i < errors.size(); i++)
@@ -53,9 +53,11 @@ Line_of_score::set_breaking (Array<Column_x_positions> const &breaking, int j) c
       line_l = dynamic_cast <Line_of_score*> (clone());
     }
   else 
-    line_l = (Line_of_score*) this;
-       
-  ((Array<Paper_column*> &)line_l->cols) = curline;
+    line_l = (Line_of_score*)( this);
+
+  line_l->cols_ = curline;
+  /*  Array<Paper_column*> &
+      ((Array<Paper_column*> &)) = */
   line_l->set_bounds(LEFT,curline[0]);
       
   line_l->set_bounds(RIGHT,curline.top());
@@ -63,7 +65,7 @@ Line_of_score::set_breaking (Array<Column_x_positions> const &breaking, int j) c
   for (int i=0; i < curline.size(); i++)
     {
       curline[i]->translate_axis (config[i],X_AXIS);
-      curline[i]->line_l_ = (Line_of_score*)line_l;
+      curline[i]->line_l_ = dynamic_cast<Line_of_score*>(line_l);
     }
 
   return line_l;
@@ -88,8 +90,8 @@ Link_array<Score_element>
 Line_of_score::get_extra_dependencies () const
 {
   Link_array<Score_element> r;
-  for (int i=0; i < cols.size (); i++)
-    r.push (cols[i]);
+  for (int i=0; i < cols_.size (); i++)
+    r.push (cols_[i]);
   return r;
 }
 
@@ -97,14 +99,14 @@ void
 Line_of_score::do_unlink () 
 {
   Spanner::do_unlink ();
-  for (int i=0; i < cols.size (); i++)
-    cols[i]->line_l_ =0;
-  cols.set_size (0);
+  for (int i=0; i < cols_.size (); i++)
+    cols_[i]->line_l_ =0;
+  cols_.set_size (0);
 }
 
 
 void
 Line_of_score::do_junk_links () 
 {
-  cols.set_size (0);
+  cols_.set_size (0);
 }
index 7efba44136d823f30422b3cdcf6a19b8c545a116..d4a6a637109668759981de144857560180e28f05 100644 (file)
@@ -25,6 +25,7 @@
 #include "afm.hh"
 #include "scope.hh"
 #include "molecule.hh"
+#include "atom.hh"
 
 SCM
 array_to_list (SCM *a , int l)
@@ -52,15 +53,35 @@ Lookup::Lookup (Lookup const& s)
 }
 
 
+Molecule
+Lookup::ledger_line (Interval xwid) const
+{
+  Molecule end (afm_find ("noteheads-ledgerending"));
+  Interval ed = end.dim_[X_AXIS];
+  xwid = Interval (xwid[LEFT] - ed[LEFT],
+                  xwid[RIGHT] - ed[RIGHT]);
+  Molecule mid = filledbox (Box (xwid, end.dim_[Y_AXIS]));
+  Molecule l (mid);
+
+  Molecule e2 = end;
+  Molecule e1 = end;
+  e1.translate_axis (xwid[RIGHT], X_AXIS);
+  e2.translate_axis (xwid[LEFT], X_AXIS);
+
+  l.add_molecule (e1);
+  l.add_molecule (e2);
+  return l;
+}
+
 
 Molecule
 Lookup::accidental (int j, bool cautionary) const
 {
-  Molecule m(afm_find (String ("accidentals") + String ("-") + to_str (j)));
+  Molecule m(afm_find (String ("accidentals-") + to_str (j)));
   if (cautionary) 
     {
-      Atom open = afm_find (String ("accidentals") + String ("-("));
-      Atom close = afm_find (String ("accidentals") + String ("-)"));
+      Molecule open = afm_find (String ("accidentals-("));
+      Molecule close = afm_find (String ("accidentals-)"));
       m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0);
       m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0);
     }
@@ -69,12 +90,12 @@ Lookup::accidental (int j, bool cautionary) const
 
 
 
-Atom
+Molecule
 Lookup::afm_find (String s, bool warn) const
 {
   if (!afm_l_)      
     {
-      Lookup * me =     ((Lookup*)this);
+      Lookup * me =     (Lookup*)(this);
       me->afm_l_ = all_fonts_global_p->find_afm (font_name_);
       if (!me->afm_l_)
        {
@@ -82,31 +103,30 @@ Lookup::afm_find (String s, bool warn) const
          warning (_f("Search path %s\n", global_path.str ().ch_C()));
        }
     }
-  Adobe_font_char_metric m = afm_l_->find_char (s, warn);
-
-  Atom a;
-  if (m.code () < 0)
-    return a;
+  Adobe_font_char_metric cm = afm_l_->find_char (s, warn);
+  Molecule m;
+  if (cm.code () < 0)
+    return m;
     
-  a.dim_ = m.dimensions();
-  
-  a.lambda_ = gh_list (ly_symbol ("char"),
-                      gh_int2scm (m.code ()),
-                      SCM_UNDEFINED);
-  a.font_ = font_name_;
-  return a;
+  Atom at (gh_list (ly_symbol ("char"),
+                   gh_int2scm (cm.code ()),
+                   SCM_UNDEFINED));
+  at.font_ = ly_symbol (font_name_.ch_C());
+  m.dim_ = cm.dimensions();
+  m.add_atom (&at);
+  return m;
 }
 
-Atom
+Molecule
 Lookup::ball (int j) const
 {
   if (j > 2)
     j = 2;
 
-  return afm_find (String ("balls") + String ("-") + to_str (j));
+  return afm_find (String ("noteheads-") + to_str (j));
 }
 
-Atom
+Molecule
 Lookup::simple_bar (String type, Real h) const
 {
   SCM thick = ly_symbol ("barthick_" + type);
@@ -115,35 +135,30 @@ Lookup::simple_bar (String type, Real h) const
     {
       w = paper_l_->get_realvar (thick);
     }
-  
-  Atom a;
-  a.lambda_ = gh_list (ly_symbol ("filledbox"),
-                      gh_double2scm (0),
-                      gh_double2scm (w),                      
-                      gh_double2scm (h/2),
-                      gh_double2scm (h/2),                    
-                      SCM_UNDEFINED);
-
-  a.dim_[X_AXIS] = Interval(0,w);
-  a.dim_[Y_AXIS] = Interval (-h/2, h/2);
-  return a;
+
+  return filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
 }
 
   
 Molecule
 Lookup::bar (String str, Real h) const
 {
+  if (str == "[")
+    return staff_bracket (h);
+  else if (str == "{")
+    return staff_brace (h);
+  
   Real kern = paper_l_->get_var ("bar_kern");
   Real thinkern = paper_l_->get_var ("bar_thinkern");  
-  Atom thin = simple_bar ("thin", h);
-  Atom thick = simple_bar ("thick", h);
-  Atom colon = afm_find ("dots-repeatcolon");  
+  Molecule thin = simple_bar ("thin", h);
+  Molecule thick = simple_bar ("thick", h);
+  Molecule colon = afm_find ("dots-repeatcolon");  
 
   Molecule m;
-
+  
   if (str == "")
     {
-      return fill (Box (Interval(0,0),Interval (-h/2, h/2)));
+      return fill (Box (Interval(0, 0), Interval (-h/2, h/2)));
     }
   else if (str == "|")
     {
@@ -152,7 +167,7 @@ Lookup::bar (String str, Real h) const
   else if (str == "|.")
     {
       m.add_at_edge (X_AXIS, LEFT, thick, 0);      
-      m.add_at_edge (X_AXIS, LEFT, thin,kern);
+      m.add_at_edge (X_AXIS, LEFT, thin, kern);
     }
   else if (str == ".|")
     {
@@ -167,55 +182,57 @@ Lookup::bar (String str, Real h) const
     }
   else if (str == "|:")
     {
-      m.add_at_edge (X_AXIS, RIGHT, thick,0);
-      m.add_at_edge (X_AXIS, RIGHT, thin,kern);
-      m.add_at_edge (X_AXIS, RIGHT, colon,kern);      
+      m.add_at_edge (X_AXIS, RIGHT, thick, 0);
+      m.add_at_edge (X_AXIS, RIGHT, thin, kern);
+      m.add_at_edge (X_AXIS, RIGHT, colon, kern);      
     }
   else if (str == ":|:")
     {
-      m.add_at_edge (X_AXIS, LEFT, thick,thinkern);
-      m.add_at_edge (X_AXIS, LEFT, colon,kern);      
-      m.add_at_edge (X_AXIS, RIGHT, thick,kern);
-      m.add_at_edge (X_AXIS, RIGHT, colon,kern);      
-    }
-  else if (str == "||")
-    {
-      m.add_at_edge (X_AXIS, RIGHT, thin,0);
-      m.add_at_edge (X_AXIS, RIGHT, thin,thinkern);      
+      m.add_at_edge (X_AXIS, LEFT, thick, thinkern);
+      m.add_at_edge (X_AXIS, LEFT, colon, kern);      
+      m.add_at_edge (X_AXIS, RIGHT, thick, kern);
+      m.add_at_edge (X_AXIS, RIGHT, colon, kern);      
     }
-
   else if (str == ".|.")
     {
-      m.add_at_edge (X_AXIS, RIGHT, thick, 0);
+      m.add_at_edge (X_AXIS, LEFT, thick, thinkern);
       m.add_at_edge (X_AXIS, RIGHT, thick, kern);      
     }
+  else if (str == "||")
+    {
+      m.add_at_edge (X_AXIS, RIGHT, thin, 0);
+      m.add_at_edge (X_AXIS, RIGHT, thin, thinkern);      
+    }
 
   return m;
 }
 
-Atom 
+Molecule 
 Lookup::beam (Real slope, Real width, Real thick) const
 {
   Real height = slope * width; 
   Real min_y = (0 <? height) - thick/2;
   Real max_y = (0 >? height) + thick/2;
 
-  Atom a;
-  a.lambda_ =   gh_list (ly_symbol ("beam"),
-          gh_double2scm (width),
-          gh_double2scm (slope),
-          gh_double2scm (thick),
-          SCM_UNDEFINED);
-
-  a.dim_[X_AXIS] = Interval (0, width);
-  a.dim_[Y_AXIS] = Interval (min_y, max_y);
-  return a;
+  
+  Molecule m;
+  Atom at
+     (gh_list (ly_symbol ("beam"),
+                               gh_double2scm (width),
+                               gh_double2scm (slope),
+                               gh_double2scm (thick),
+                               SCM_UNDEFINED));
+
+  m.dim_[X_AXIS] = Interval (0, width);
+  m.dim_[Y_AXIS] = Interval (min_y, max_y);
+  m.add_atom (&at);
+  return m;
 }
 
-Atom
+Molecule
 Lookup::clef (String st) const
 {
-  return afm_find (String ("clefs") + String ("-") + st);
+  return afm_find (String ("clefs-" + st));
 }
 
 SCM
@@ -225,7 +242,7 @@ offset2scm (Offset o)
                  SCM_UNDEFINED);
 }
 
-Atom
+Molecule
 Lookup::dashed_slur (Array<Offset> controls, Real thick, Real dash) const
 {
   assert (controls.size () == 8);
@@ -234,10 +251,11 @@ Lookup::dashed_slur (Array<Offset> controls, Real thick, Real dash) const
   Real dx = d[X_AXIS];
   Real dy = d[Y_AXIS];
 
-  Atom a;
-  a.font_ = font_name_;
-  a.dim_[X_AXIS] = Interval (0, dx);
-  a.dim_[Y_AXIS] = Interval (0 <? dy,  0 >? dy);
+  Molecule m;
+
+
+  m.dim_[X_AXIS] = Interval (0, dx);
+  m.dim_[Y_AXIS] = Interval (0 <? dy, 0 >? dy);
 
   SCM sc[4];
   for (int i=0; i<  4; i++)
@@ -245,101 +263,107 @@ Lookup::dashed_slur (Array<Offset> controls, Real thick, Real dash) const
       sc[i] =  offset2scm (controls[i]);
     }
 
-  a.lambda_ = 
-    gh_list (ly_symbol ("dashed-slur"),
-            gh_double2scm (thick), 
-            gh_double2scm (dash),
-            ly_quote_scm (array_to_list (sc, 4)),
-            SCM_UNDEFINED);
-
-  return a;
+  Atom at
+     (gh_list (ly_symbol ("dashed-slur"),
+                               gh_double2scm (thick), 
+                               gh_double2scm (dash),
+                               ly_quote_scm (array_to_list (sc, 4)),
+                               SCM_UNDEFINED));
+  
+  
+  m.add_atom (&at);
+  return m;
 }
 
-Atom
+Molecule
 Lookup::dots () const
 {
-  return afm_find (String ("dots") + String ("-") + String ("dot"));
+  return afm_find (String ("dots-dot"));
 }
 
 
-Atom
-Lookup::extender (Real width) const
-{
-  Atom a;
-  a.lambda_ = gh_list (ly_symbol ("extender"),
-                      gh_double2scm (width),
-                      SCM_UNDEFINED);
 
-  a.dim_[X_AXIS] = Interval (0, width);
-  a.dim_[Y_AXIS] = Interval (0,0);
-  
-  a.font_ = font_name_;
-  return a;
-}
-
-Atom
+Molecule
 Lookup::fill (Box b) const
 {
-  Atom a;
-  a.dim_ = b;
-  return a;
+  Molecule m;
+  m.dim_ = b;
+  return m;
 }
 
-Atom
+Molecule
 Lookup::flag (int j, Direction d) const
 {
   char c = (d == UP) ? 'u' : 'd';
-  Atom a = afm_find (String ("flags") + String ("-") + to_str (c) + to_str (j));
-  return a;
+  return  afm_find (String ("flags-") + to_str (c) + to_str (j));
 }
 
-Atom
+Molecule
 Lookup::rest (int j, bool o) const
 {
-   return afm_find (String ("rests")
-                   + String ("-") + to_str (j) + (o ? "o" : ""));
+  return afm_find (String ("rests-") + to_str (j) + (o ? "o" : ""));
 }
 
-Atom
+Molecule
 Lookup::rule_symbol (Real height, Real width) const
 {
-  Atom a;
-  a.lambda_ = gh_list (ly_symbol ("rulesym"),
-                      gh_double2scm (height),
-                      gh_double2scm (width),
-                      SCM_UNDEFINED);
-  a.dim_.x () = Interval (0, width);
-  a.dim_.y () = Interval (0, height);
-  return a;
+  Atom at  (gh_list (ly_symbol ("rulesym"),
+                                        gh_double2scm (height),
+                                        gh_double2scm (width),
+                                        SCM_UNDEFINED));
+
+  Molecule m;
+  m.dim_.x () = Interval (0, width);
+  m.dim_.y () = Interval (0, height);
+  
+  m.add_atom (&at);
+
+  return m;
 }
 
-Atom
+Molecule
 Lookup::script (String str) const
 {
-  return afm_find (String ("scripts") + String ("-") + str);
+  return afm_find (String ("scripts-") + str);
 }
 
-Atom
-Lookup::special_time_signature (String s, Array<int> arr) const
+Molecule
+Lookup::special_time_signature (String s, int n, int d) const
 {
   // First guess: s contains only the signature style
-  assert (arr.size () >1);
-  String symbolname = "timesig-" + s + to_str (arr[0]) + "/" + to_str (arr[1]);
+  String symbolname = "timesig-" + s + to_str (n) + "/" + to_str (d);
   
-  Atom a = afm_find (symbolname, false);
-  if (!a.empty ()) 
-    return a;
+  Molecule m = afm_find (symbolname, false);
+  if (!m.dim_[X_AXIS].empty_b ()) 
+    return m;
 
   // Second guess: s contains the full signature name
-  a = afm_find ("timesig-"+s, false);
-  if (!a.empty ()) 
-    return a;
+  m = afm_find ("timesig-"+s, false);
+  if (!m.dim_[X_AXIS].empty_b ()) 
+    return m;
 
   // Resort to default layout with numbers
-  return time_signature (arr);
+  return time_signature (n,d);
 }
 
-Atom
+Molecule
+Lookup::filledbox (Box b ) const
+{
+  Molecule m;
+  
+  Atom at  (gh_list (ly_symbol ("filledbox"),
+                                        gh_double2scm (-b[X_AXIS][LEFT]),
+                                        gh_double2scm (b[X_AXIS][RIGHT]),                     
+                                        gh_double2scm (-b[Y_AXIS][DOWN]),
+                                        gh_double2scm (b[Y_AXIS][UP]),                
+                                        SCM_UNDEFINED));
+
+  m.dim_ = b;
+  m.add_atom (&at);
+  return m;
+}
+
+Molecule
 Lookup::stem (Real y1, Real y2) const
 {
   if (y1 > y2)
@@ -348,32 +372,11 @@ Lookup::stem (Real y1, Real y2) const
       y1 = y2;
       y2 = t;
     }
-  Atom a;
-
-  a.dim_.x () = Interval (0,0);
-  a.dim_.y () = Interval (y1,y2);
-
   Real stem_width = paper_l_->get_var ("stemthickness");
-
-  a.lambda_ = gh_list (ly_symbol ("filledbox"),
-                      gh_double2scm(stem_width /2),
-                      gh_double2scm(stem_width/2),
-                      gh_double2scm(y2),
-                      gh_double2scm(-y1),
-                      SCM_UNDEFINED);
-
-  a.font_ = font_name_;
-  return a;
+  return filledbox (Box (Interval (-stem_width/2,stem_width/2),
+                        Interval (y1, y2)));
 }
 
-Atom
-Lookup::streepje (int type) const
-{
-  if (type > 2)
-    type = 2;
-
-  return  afm_find ("balls" + String ("-") +to_str (type) + "l");
-}
 
 static Dict_initialiser<char const*> cmr_init[] = {
   {"bold", "cmbx"},
@@ -384,26 +387,24 @@ static Dict_initialiser<char const*> cmr_init[] = {
   {"large", "cmbx"},
   {"Large", "cmbx"},
   {"mark", "feta-nummer"},
-  {"nummer", "feta-nummer"},
+  {"number", "feta-nummer"},
   {0,0}
 };
 
 static Dictionary<char const *> cmr_dict (cmr_init);
 
-Atom
+Molecule
 Lookup::text (String style, String text) const
 {
-  Atom a;
-  a.lambda_ = gh_list(ly_symbol ("set" + style),
-                     gh_str02scm (text.ch_C()),
-                     SCM_UNDEFINED);
+  Molecule m;
+  
 
   Real font_h = paper_l_->get_var ("font_normal");
   if (paper_l_->scope_p_->elem_b ("font_" + style))
     {
       font_h = paper_l_->get_var ("font_" + style);
     }
-  
+   
   if (cmr_dict.elem_b (style))
     {
       style = String (cmr_dict [style]) + to_str  ((int)font_h); // ugh
@@ -429,90 +430,107 @@ Lookup::text (String style, String text) const
     }
 
   DOUT << "\n" << to_str (w) << "\n";
-  a.dim_.x () = Interval (0, w);
-  a.dim_.y () = ydims;
-  a.font_ = font_name_;
-  return a;
+  m.dim_.x () = Interval (0, w);
+  m.dim_.y () = ydims;
+  Atom at  (gh_list (ly_symbol ("text"),
+                    gh_str02scm (text.ch_C()),
+                    SCM_UNDEFINED));
+  at.font_ = ly_symbol (style);
+  
+  m.add_atom (&at);
+  return m;
 }
   
 
 /*
-  TODO: should return a molecule with 2 stacked nums.
  */
-Atom
-Lookup::time_signature (Array<int> a) const
+Molecule
+Lookup::time_signature (int num, int den) const
 {
-  Atom s;
-  s.lambda_ = gh_list (ly_symbol ("generalmeter"),
-                      gh_int2scm (a[0]),
-                      gh_int2scm (a[1]),
-                      SCM_UNDEFINED);
-
-  Real r = paper_l_->interline_f () ;
-  s.dim_[Y_AXIS] =  Interval (-2*r, 2*r);
-  s.dim_[X_AXIS] = Interval (0, 2*r);
-  return s;
+  String sty = "number";
+  Molecule n (text (sty, to_str (num)));
+  Molecule d (text (sty, to_str (den)));
+  n.do_center (X_AXIS);
+  d.do_center (X_AXIS);
+  Molecule m;
+  if (den)
+    {
+      m.add_at_edge (Y_AXIS, UP, n, 0.0);
+      m.add_at_edge (Y_AXIS, DOWN, d, 0.0);
+    }
+  else
+    {
+      m = n;
+      m.do_center (Y_AXIS);
+    }
+  return m;
 }
 
-Atom
-Lookup::vbrace (Real &y) const
+Molecule
+Lookup::staff_brace (Real y) const
 {
-  Atom a;
-  a.lambda_ = gh_list (ly_symbol ("pianobrace"),
+  Molecule m;
+  
+  Atom at  (gh_list (ly_symbol ("pianobrace"),
                       gh_double2scm (y),
                       SCM_UNDEFINED
-                      );
-  a.dim_[Y_AXIS] = Interval (-y/2,y/2);
-  a.dim_[X_AXIS] = Interval (0,0);
-  a.font_ = font_name_;
-  return a;
+                      ));
+  
+  m.dim_[Y_AXIS] = Interval (-y/2,y/2);
+  m.dim_[X_AXIS] = Interval (0,0);
+  m.add_atom (&at);
+  return m;
 }
 
-Atom
+Molecule
 Lookup::hairpin (Real width, bool decresc, bool continued) const
 {
-  Atom a;  
+  Molecule m;   
   Real height = paper_l_->staffheight_f () / 6;
 
   String hairpin = String (decresc ? "de" : "") + "crescendo";
-  a.lambda_ = gh_list (ly_symbol (hairpin),
+  Atom at  (gh_list (ly_symbol (hairpin),
                       gh_double2scm (width),
                       gh_double2scm (height),
                       gh_double2scm (continued ? height/2 : 0.0),
-                      SCM_UNDEFINED);
-  a.dim_.x () = Interval (0, width);
-  a.dim_.y () = Interval (-2*height, 2*height);
-  a.font_ = font_name_;
-  return a;
+                      SCM_UNDEFINED));
+  m.dim_.x () = Interval (0, width);
+  m.dim_.y () = Interval (-2*height, 2*height);
+
+  m.add_atom (&at);
+  return m;
 }
 
-Atom
+Molecule
 Lookup::plet (Real dy , Real dx, Direction dir) const
 {
-  Atom a;
+  Molecule m;
   SCM thick = ly_symbol ("tuplet_thick");
   Real t = 0.1 PT;
   if (paper_l_->scope_p_->elem_b (thick))
     {
       t = paper_l_->get_realvar (thick);
     }
-  a.lambda_ = gh_list(ly_symbol ("tuplet"),
+  
+  Atom at  (gh_list(ly_symbol ("tuplet"),
                      gh_double2scm (dx),
                      gh_double2scm (dy),
                      gh_double2scm (t),
                      gh_int2scm (dir),
-                     SCM_UNDEFINED);
-  return a;
-}
+                     SCM_UNDEFINED));
+m.add_atom (&at);
 
+  return m;
+}
 
-Atom
+/*
+  Make a smooth curve along the points 
+ */
+Molecule
 Lookup::slur (Array<Offset> controls) const
 {
-  assert (controls.size () == 8);
-  Real dx = controls[3].x () - controls[0].x ();
-  Real dy = controls[3].y () - controls[0].y ();
-  Atom a;
+  Offset  delta_off = controls[3]- controls[0];
+  Molecule m; 
 
   SCM scontrols [8];
   int indices[] = {5,6,7,4,1,2,3,0};
@@ -521,57 +539,63 @@ Lookup::slur (Array<Offset> controls) const
     scontrols[i] = offset2scm (controls[indices[i]]);
 
 
-  a.lambda_ =gh_list (ly_symbol ("slur"),
+  Atom at  (gh_list (ly_symbol ("bezier-sandwich"),
                      ly_quote_scm (array_to_list (scontrols, 8)),
-                     SCM_UNDEFINED);
+                     SCM_UNDEFINED));
 
-  a.dim_[X_AXIS] = Interval (0, dx);
-  a.dim_[Y_AXIS] = Interval (0 <? dy,  0 >? dy);
-  a.font_ = font_name_;
-  return a;
+  m.dim_[X_AXIS] = Interval (0, delta_off[X_AXIS]);
+  m.dim_[Y_AXIS] = Interval (0 <? delta_off[Y_AXIS], 0 >? delta_off[Y_AXIS]);
+  m.add_atom (&at);
+  return m;
 }
 
-Atom
-Lookup::vbracket (Real &y) const
+Molecule
+Lookup::staff_bracket (Real y) const
 {
-  Atom a;
-  a.lambda_ =  gh_list (ly_symbol ("bracket"),
+  Molecule m; 
+  Atom at  ( gh_list (ly_symbol ("bracket"),
                        gh_double2scm (y),
-                       SCM_UNDEFINED);
-  a.dim_[Y_AXIS] = Interval (-y/2,y/2);
-  a.dim_[X_AXIS] = Interval (0,4 PT);
-  return a;
+                       SCM_UNDEFINED));
+  m.add_atom (&at);                             
+  m.dim_[Y_AXIS] = Interval (-y/2,y/2);
+  m.dim_[X_AXIS] = Interval (0,4 PT);
+
+  m.translate_axis (- 4. / 3. * m.dim_[X_AXIS].length (), X_AXIS);
+  return m;
 }
 
-Atom
+Molecule
 Lookup::volta (Real w, bool last_b) const
 {
-  Atom a;
+  Molecule m; 
   SCM thick = ly_symbol ("volta_thick");
   Real t = 0.1 PT;
   if (paper_l_->scope_p_->elem_b (thick))
     {
       t = paper_l_->get_realvar (thick);
     }
-  a.lambda_ = gh_list (ly_symbol ("volta"),
+  Atom at  (gh_list (ly_symbol ("volta"),
                       gh_double2scm (w),
                       gh_double2scm (t),
                       gh_int2scm (last_b),
-                      SCM_UNDEFINED);
+                      SCM_UNDEFINED));
 
   Real interline_f = paper_l_->interline_f ();
 
-  a.dim_[Y_AXIS] = Interval (-interline_f, interline_f);
-  a.dim_[X_AXIS] = Interval (0, w);
-  return a;
+  m.dim_[Y_AXIS] = Interval (-interline_f, interline_f);
+  m.dim_[X_AXIS] = Interval (0, w);
+
+  m.add_atom (&at);
+  return m;
 }
 
 
-Atom
+Molecule
 Lookup::special_ball (int j, String kind_of_ball) const
 {
   if (j > 2)
     j = 2;
 
-  return afm_find (String ("balls") + String ("-") + kind_of_ball);
+  return afm_find (String ("noteheads-") + kind_of_ball);
 }
+
index 64c5f1757556d86e5453d533c4579064ac740d90..aeb5bf17277269bcd0a8ac19a8e0fc5d8089da68 100644 (file)
@@ -28,6 +28,7 @@
 #include "lily-guile.hh"
 #include "paper-def.hh"
 #include "midi-def.hh"
+#include "global-ctor.hh"
 
 #if HAVE_GETTEXT
 #include <libintl.h>
@@ -248,6 +249,12 @@ setup_paths ()
 void
 main_prog (int argc, char **argv)
 {
+  /*
+    need to do this first. Engravers use lily.scm contents.
+   */
+  read_lily_scm_file ( "lily.scm");
+  cout << endl;
+
   call_constructors ();
   default_outname_base_global = "lelie";
   all_fonts_global_p = new All_font_metrics (global_path.str ());
index e12162159305f57b3dff512cbd25f6626af34fea..81ea51e5afe96857ec4db889caf40da0fc2968f6 100644 (file)
@@ -31,7 +31,7 @@ Midi_def::~Midi_def()
 }
 
 Real
-Midi_def::duration_to_seconds_f (Moment mom)
+Midi_def::length_mom_to_seconds_f (Moment mom)
 {
   if (!mom)
     return 0;
index 106ee8bcbaaa1f249fe7e4c89b69a51e1f0fe5ed..15d0c289b6179f9016f2e7293b1685195ab0b4ba 100644 (file)
@@ -403,9 +403,9 @@ Midi_note::Midi_note (Audio_item* audio_item_l)
 }
 
 Moment
-Midi_note::duration () const
+Midi_note::length_mom () const
 {
-  Moment m = dynamic_cast <Rhythmic_req *> (audio_item_l_->req_l_)->duration ();
+  Moment m = dynamic_cast <Rhythmic_req *> (audio_item_l_->req_l_)->length_mom ();
   if (m < Moment (1, 1000))
     {
       warning (_ ("silly duration"));
@@ -418,7 +418,7 @@ int
 Midi_note::pitch_i () const
 {
   int p = dynamic_cast <Melodic_req*> (audio_item_l_->req_l_)->pitch_.semitone_pitch () 
-    + ((Audio_note*)audio_item_l_)->transposing_i_;
+    + dynamic_cast<Audio_note*>(audio_item_l_)->transposing_i_;
   if (p == INT_MAX)
     {
       warning (_ ("silly pitch"));
@@ -453,7 +453,7 @@ int
 Midi_note_off::pitch_i () const
 {
   return dynamic_cast <Melodic_req *> (audio_item_l_->req_l_)->pitch_.semitone_pitch ()
-    + ((Audio_note*)audio_item_l_)->transposing_i_;
+    + dynamic_cast<Audio_note*>(audio_item_l_)->transposing_i_;
 }
 
 String
@@ -470,7 +470,7 @@ Midi_note_off::str () const
 Midi_tempo::Midi_tempo (Audio_item* audio_item_l)
   : Midi_item (audio_item_l)
 {
-  per_minute_4_i_ = ( (Audio_tempo*)audio_item_l_)->per_minute_4_i_;
+  per_minute_4_i_ = dynamic_cast<Audio_tempo*>(audio_item_l_)->per_minute_4_i_;
 }
 
 Midi_tempo::Midi_tempo (int per_minute_4_i)
@@ -491,8 +491,8 @@ Midi_tempo::str () const
 Midi_text::Midi_text (Audio_item* audio_item_l)
   : Midi_item (audio_item_l)
 {
-  text_str_ = ( (Audio_text*)audio_item_l_)->text_str_;
-  type_ = (Type) ( (Audio_text*)audio_item_l_)->type_;
+  text_str_ = dynamic_cast<Audio_text*>(audio_item_l_)->text_str_;
+  type_ = (Type) dynamic_cast<Audio_text*>(audio_item_l_)->type_;
 }
 
 Midi_text::Midi_text (Midi_text::Type type, String text_str)
index 1af44cd1fb65ee70d441b6c628aa1b97f1cd8ef2..3709fc755c9eacfe3c35b61bcc7611d798d40de5 100644 (file)
@@ -45,7 +45,7 @@ Midi_walker::~Midi_walker()
 void 
 Midi_walker::do_start_note (Midi_note* note_p)
 {
-  Moment stop_mom = note_p->duration() + ptr ()->audio_column_l_->at_mom ();
+  Moment stop_mom = note_p->length_mom () + ptr ()->audio_column_l_->at_mom ();
   for (int i=0; i < stop_note_queue.size(); i++) 
     {
       if (stop_note_queue[i].val->pitch_i() == note_p->pitch_i ()) 
index 4e0bb337667a553918cbc633908ce4a51183e2be..cca0e93c3b44be9c4b5f355cb84a39ac99f6a04f 100644 (file)
 #include "molecule.hh"
 #include "atom.hh"
 #include "debug.hh"
+#include "killing-cons.tcc"
 
 Box
 Molecule::extent() const
 {
-  Box b;
-  for (iter_top (atoms_,c); c.ok(); c++)
-    b.unite (c->extent());
-  return b;
+  return dim_;
 }
 
 Interval
 Molecule::extent(Axis a) const
 {
-  Interval i;
-  for (iter_top (atoms_,c); c.ok(); c++)
-    i.unite (c->extent(a));
-  return i;
+  return dim_[a];
 }
 
 void
 Molecule::translate (Offset o)
 {
-  for (iter_top (atoms_,c); c.ok(); c++)
-    c->translate (o);
+  for (Cons<Atom> *  ptr = atom_list_; ptr; ptr = ptr->next_)
+    {
+      ptr->car_->off_ += o;
+    }
+  dim_.translate (o);
 }
 
 void
 Molecule::translate_axis (Real x,Axis a)
 {
-  for (iter_top (atoms_,c); c.ok(); c++)
-    c->translate_axis (x,a);
+  for (Cons<Atom> *  ptr = atom_list_; ptr; ptr = ptr->next_)
+    {
+      ptr->car_->off_[a] += x;
+    }
+  dim_[a] += x;
 }
 
 void
 Molecule::add_molecule (Molecule const &m)
 {
-  for (iter_top (m.atoms_,c); c.ok(); c++) 
+  for (Cons<Atom> *  ptr = m.atom_list_; ptr; ptr = ptr->next_)
     {
-      add_atom (**c);
+      add_atom (ptr->car_);
     }
-}
 
+  dim_.unite (m.dim_);
+}
 
 void
-Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding)
+Molecule::add_atom (Atom const *al)
 {
-  Real my_extent= atoms_.size()
-    ? extent ()[a][d] 
-    : 0.0;
-  
-  Real offset = my_extent -  m.extent ()[a][-d];
-  Molecule toadd (m);
-  toadd.translate_axis (offset + d * padding, a);
-  add_molecule (toadd);
+  Atom *a = new Atom(*al);
+
+  atom_list_ = new Killing_cons<Atom> (a, atom_list_);
 }
 
-  
-  
 void
-Molecule::operator = (Molecule const &)
+Molecule::operator=(Molecule const & src)
 {
-  assert (false);
+  if (&src == this) return;
+  delete atom_list_;
+  atom_list_ = 0;
+  dim_= src.dim_;
+  add_molecule (src);
 }
 
 Molecule::Molecule (Molecule const &s)
 {
+  atom_list_ = 0;
   add_molecule (s);
 }
 
+Molecule::~Molecule ()
+{
+  delete atom_list_;
+}
+
 void
 Molecule::print() const
 {
 #ifndef NPRINT
   if (! check_debug)
     return;
-  for (iter_top (atoms_,c); c.ok(); c++)
-    c->print();
+  DOUT << "dim:";
+  for (Axis i=X_AXIS; i < NO_AXES; incr (i))
+    DOUT << axis_name_str (i) << " = " << dim_[i].str ();
 #endif
 }
 
 void
-Molecule::add_atom (Atom const &a)
+Molecule::do_center (Axis a)
 {
-  atoms_.bottom().add (new Atom (a)); 
+  Interval i (extent (a));
+  translate_axis (-i.center (), a);
 }
 
-Molecule::Molecule (Atom const &a)
+Molecule::Molecule ()
+{
+  dim_ = Box (Interval(0,0),Interval( 0,0  ));
+  atom_list_ = 0;
+}
+
+
+void
+Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding)
 {
-  add_atom (a) ;
+  Real my_extent= dim_[a][d];
+  
+  Real offset = my_extent -  m.extent ()[a][-d];
+  Molecule toadd (m);
+  toadd.translate_axis (offset + d * padding, a);
+  add_molecule (toadd);
 }
index 8dd071d6d5acbe89dd185b897644eafbb2cf3673..0143543c6e94b9d8844b9fcafece92c431247879 100644 (file)
@@ -49,13 +49,13 @@ Multi_measure_rest_engraver::do_try_music (Music* req_l)
    {
      if (multi_measure_req_l_)
        if (!multi_measure_req_l_->equal_b (mr)
-          || rest_moments_[START] != now_moment ())
+          || rest_moments_[START] != now_mom ())
         return false;
   
      multi_measure_req_l_ = mr;
-     rest_moments_[START] = now_moment ();
+     rest_moments_[START] = now_mom ();
      
-     rest_moments_[STOP] = rest_moments_[START] + multi_measure_req_l_->duration_.length ();
+     rest_moments_[STOP] = rest_moments_[START] + multi_measure_req_l_->duration_.length_mom ();
      return true;
    }
  return false;
@@ -76,7 +76,7 @@ Multi_measure_rest_engraver::do_process_requests ()
 void
 Multi_measure_rest_engraver::do_pre_move_processing ()
 {
-  Moment now (now_moment ());
+  Moment now (now_mom ());
   Time_description const *time = get_staff_info().time_C_;
   if (mmrest_p_ && (now >= rest_moments_[START]) 
     && !time->whole_in_measure_
@@ -98,7 +98,7 @@ void
 Multi_measure_rest_engraver::do_post_move_processing ()
 {
   Time_description const *time = get_staff_info().time_C_;
-  Moment now (now_moment ());
+  Moment now (now_mom ());
 
   if (mmrest_p_ && !time->whole_in_measure_)
     {
index 77a49ca7bb3a8b5f90d64953f9f6d58a3f61740a..12b66ee7742fd459b95844b3b448e96f51d79ba3 100644 (file)
@@ -44,7 +44,7 @@ Multi_measure_rest::do_brew_molecule_p () const
   if (!column_arr_.size ())
     return mol_p;
 
-  Atom s;
+  Molecule s;
   if (measures_i_ == 1 || measures_i_ == 2 || measures_i_ == 4) 
     {
       s = (lookup_l ()->rest (- intlog2(measures_i_), 0));
@@ -54,7 +54,7 @@ Multi_measure_rest::do_brew_molecule_p () const
     {
       s = (lookup_l ()->rest (-4, 0));
     }
-  mol_p->add_atom (s);
+  mol_p->add_molecule (s);
   Real interline_f = paper ()->interline_f ();
   if (measures_i_ == 1)
     {
@@ -67,9 +67,9 @@ Multi_measure_rest::do_brew_molecule_p () const
       text.text_str_ = to_str (measures_i_);
       text.style_str_ = "number";
       text.align_dir_ = CENTER;
-      Atom s = text.get_atom (paper (), UP);
+      Molecule s = text.get_molecule (paper (), UP);
       s.translate_axis (3.0 * interline_f, Y_AXIS);
-      mol_p->add_atom (s);
+      mol_p->add_molecule (s);
     }
 
   return mol_p;
index 3d155a90c67fc132ac966aacff0e8a62d9efff81..bf409cb878bea3e01b28d8c8c741148899c86a8b 100644 (file)
 #include "main.hh"
 
 Moment
-Simultaneous_music::duration () const
+Simultaneous_music::length_mom () const
 {
   Moment dur = 0;
   for (iter (music_p_list_p_->top(), i); i.ok (); i++)
-    dur = dur >? i->duration ();
+    dur = dur >? i->length_mom ();
 
   return dur;
 }
@@ -41,12 +41,12 @@ Sequential_music::Sequential_music(Music_list *p)
 }
 
 Moment
-Sequential_music::duration () const
+Sequential_music::length_mom () const
 {
   Moment last=0;
   for (iter (music_p_list_p_->top(), i); i.ok (); i++) 
     {
-      last += i->duration ();
+      last += i->length_mom ();
     }
   return  last;
 }
index 33fd876c38f8c7652b08ab25c724268918c877da..cb8f31b4635c9e231f484c2d38b3a33a51a2d734 100644 (file)
@@ -27,7 +27,8 @@ Music_wrapper_iterator::do_print () const
 void
 Music_wrapper_iterator::construct_children ()
 {
-  child_iter_p_ = get_iterator_p (music_wrapper_l ()->element_l ());  
+  child_iter_p_ =
+    get_iterator_p (dynamic_cast<Music_wrapper const*> (music_l_)->element_l ());
 }
 
 Music_wrapper_iterator::~Music_wrapper_iterator ()
@@ -35,11 +36,6 @@ Music_wrapper_iterator::~Music_wrapper_iterator ()
   delete child_iter_p_;
 }
 
-Music_wrapper*
-Music_wrapper_iterator::music_wrapper_l () const
-{
-  return (Music_wrapper*) music_l_;
-}
 
 bool
 Music_wrapper_iterator::ok () const
index 57ab04b7414f43bcf73f4cc363e8cd58342d34ce..b84394d86d82ebe86a50e88ed7d53df4a2e25c02 100644 (file)
@@ -45,9 +45,9 @@ Music_wrapper::Music_wrapper(Music*p)
 
 
 Moment
-Music_wrapper::duration () const
+Music_wrapper::length_mom () const
 {
-  return element_p_->duration ();
+  return element_p_->length_mom ();
 }
 
 
index 8d7ce5cb881c3d4acbbc54613875fb0c86529329..ffecc3fafd5bc812a5748d3bdc760c7d2c95462a 100644 (file)
@@ -27,7 +27,7 @@ Music::do_print() const
 }
 
 Moment
-Music::duration () const
+Music::length_mom () const
 {
   return 0;
 }
index a359be8dfd4072c22b5195eeecdded95ee75518d..e0bc2458e3a2d17166c7bd4f16d9296c47ad924b 100644 (file)
@@ -120,10 +120,23 @@ Melodic_req::do_print () const
 pitch_.print ();
 }
 
+
+Tonic_req::Tonic_req ()
+{
+}
+
+void
+Tonic_req::do_print () const
+{
+#ifndef NPRINT
+  Melodic_req::do_print ();
+#endif
+}
+
 int
 Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2)
 {
-  return (r1.duration () - r2.duration ());
+  return (r1.length_mom () - r2.length_mom ());
 }
 
 bool
@@ -147,9 +160,9 @@ Rhythmic_req::do_print () const
 
 
 Moment
-Rhythmic_req::duration () const
+Rhythmic_req::length_mom () const
 {
-  return duration_.length ();
+  return duration_.length_mom ();
 }
 
 void
@@ -309,7 +322,7 @@ void
 Skip_req::do_print () const
 {
 #ifndef NPRINT
-  DOUT << "duration: " << duration ();
+  DOUT << "duration: " << length_mom ();
 #endif
 }
 
@@ -323,8 +336,7 @@ void
 Absolute_dynamic_req::do_print () const
 {
 #ifndef NPRINT
-  Dynamic_req::do_print ();
-  DOUT << " loudness " <<loudness_str ();
+  DOUT << " loudness " <<loudness_str_ ;
 #endif
 }
 
@@ -332,58 +344,12 @@ bool
 Absolute_dynamic_req::do_equal_b (Request *r) const
 {
   Absolute_dynamic_req *a = dynamic_cast <Absolute_dynamic_req *> (r);
-  return a&& loudness_ == a->loudness_;
+  return a&& loudness_str_ == a->loudness_str_;
 }
 
-String
-Dynamic_req::loudness_static_str (Loudness l)
-{
-  switch (l)
-    {
-    case FFFFFF: return "ffffff";
-    case FFFFF : return "fffff";
-    case FFFF: return "ffff";
-    case FFF: return "fff";
-    case FF: return "ff";
-    case F: return "f";
-    case MF: return "mf";
-    case MP: return "mp";
-    case P: return "p";
-    case PP: return "pp";
-    case PPP: return "ppp";
-    case PPPP: return "pppp";
-    case PPPPP: return "ppppp";
-    case PPPPPP: return "pppppp";    
-
-    case FP: return "fp";
-    case SF: return "sf";
-    case SFF: return "sff";
-    case SFZ: return "sfz";
-    case SP: return "sp";
-    case SPP: return "spp";
-    case RFZ: return "rfz";
-    }
-  return "";
-}
-
-String
-Absolute_dynamic_req::loudness_str () const
-{
-  String str = loudness_static_str (loudness_);
-  if (str.empty_b ())
-    {
-      String s = "mf";
-      warning (_f ("never heard of dynamic scale `\%s\', assuming %s",
-       str, s));
-      str = s;
-    }
-  return str;
-}
-
-
 Absolute_dynamic_req::Absolute_dynamic_req ()
 {
-  loudness_ = MF;
+  loudness_str_ = "fm";                // yes, "illegal" on purpose.
 }
 
 
index 8cbd830662d8e3b9939d5d73f264b55f505ddb62..73ee46778927fcfbe2a181d4a09b5b83afed352f 100644 (file)
@@ -154,6 +154,10 @@ My_lily_parser::get_chord (Musical_pitch tonic, Array<Musical_pitch>* add_arr_p,
 
   Chord chord (tonic, add_arr_p, sub_arr_p, inversion_p);
 
+  Tonic_req* t = new Tonic_req;
+  t->pitch_ = tonic;
+  v->add_music (t);
+
   for (int i = 0; i < chord.pitch_arr_.size (); i++)
     {
       Musical_pitch p = chord.pitch_arr_[i];
@@ -163,7 +167,6 @@ My_lily_parser::get_chord (Musical_pitch tonic, Array<Musical_pitch>* add_arr_p,
       v->add_music (n);
     }
 
-  v->set_spot (here_input ());
   return v;
 }
 
@@ -185,10 +188,10 @@ My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p)
 /*
   UGH.
  */
-Array<Request*>*
+Link_array<Request>*
 My_lily_parser::get_parens_request (int t)
 {
-  Array<Request*>& reqs = *new Array<Request*>;
+  Link_array<Request>& reqs = *new Link_array<Request>;
   switch (t)
     {
     case '~':
index 2a0805d9029955b293aaec937ad365c6ac7254e4..68913c931cc7179009fbca435c649d47e6807620 100644 (file)
@@ -13,8 +13,6 @@
 #include "rest.hh"
 #include "debug.hh"
 
-
-
 bool
 Note_column::rest_b () const
 {
@@ -49,16 +47,6 @@ Note_column::head_positions_interval() const
   return iv;
 }
 
-/*
-Interval 
-Note_column::do_width () const
-{
-  if (head_l_arr_.size ())
-    return head_l_arr_[0]->extent (X_AXIS);
-  else
-    return Interval (0,0);
-}
-*/
 void
 Note_column::do_pre_processing()
 {
@@ -121,15 +109,15 @@ Note_column::do_substitute_dependency (Score_element*o, Score_element*n)
 void
 Note_column::add_head (Rhythmic_head *h)
 {
-  if (dynamic_cast<Rest *> (h))
+  if (Rest*r=dynamic_cast<Rest *> (h))
     {
-      rest_l_arr_.push ((Rest*)h);
-      add_support (h);  
+      rest_l_arr_.push (r);
+      add_support (r);  
     }
-  if (dynamic_cast<Note_head *> (h))
+  if (Note_head *nh=dynamic_cast<Note_head *> (h))
     {
-      head_l_arr_.push ((Note_head*) h);
-      add_support (h);
+      head_l_arr_.push (nh);
+      add_support (nh);
     }
 }
 
index f26cfc4c51d1d026302d22fb59204f569181d1ad..8806f5f7be55cb77a5a50ff91cdf625ba4d01cd5 100644 (file)
@@ -47,7 +47,7 @@ Note_head::compare (Note_head *const  &a, Note_head * const &b)
 Interval
 Note_head::do_width () const
 {
-  Atom a =  lookup_l ()->ball (balltype_i_);
+  Molecule a =  lookup_l ()->ball (balltype_i_);
   Interval i = a.dim_[X_AXIS];
   i+= x_dir_ * i.length ();
   return i;
@@ -65,38 +65,39 @@ Note_head::do_brew_molecule_p() const
     ? 0
     : (abs(position_i_) - staff_size_i_/2) /2;
   
-  //Atom  s = lookup_l()->ball (balltype_i_);
-  
-  Atom  s; // = lookup_l()->ball (balltype_i_);
+  Molecule head; 
 
   if (note_head_type_str_.length_i ()) {
-    if (note_head_type_str_ == "normal")
+    if (note_head_type_str_ == "normal") // UGH
       note_head_type_str_ = "";
-    s = lookup_l()->special_ball (balltype_i_, note_head_type_str_);
+    head = lookup_l()->special_ball (balltype_i_, note_head_type_str_);
     }
   else
-    s = lookup_l()->ball (balltype_i_);
-  out = new Molecule (Atom (s));
-  out->translate_axis (x_dir_ * s.dim_[X_AXIS].length (), X_AXIS);
+    head = lookup_l()->ball (balltype_i_);
+  
+  out = new Molecule (Molecule (head));
+  out->translate_axis (x_dir_ * head.dim_[X_AXIS].length (), X_AXIS);
 
 
-  //out = new Molecule (Atom (s));
-  //out->translate_axis (x_dir_ * s.dim_[X_AXIS].length (), X_AXIS);
 
   if (streepjes_i) 
     {
-      int dir = sign (position_i_);
-      Atom streepje = lookup_l ()->streepje (balltype_i_);
+      Direction dir = sign (position_i_);
+      Interval hd = head.dim_[X_AXIS];
+      Real hw = hd.length ()/4;
+      
+      Molecule ledger
+       = lookup_l ()->ledger_line  (Interval (hd[LEFT] - hw,
+                                              hd[RIGHT] + hw));
       
-      int parity =  (position_i_ % 2) ? 1 : 0;
-       
+      int parity =  abs(position_i_) % 2;
       
       for (int i=0; i < streepjes_i; i++)
        {
-         Atom s = streepje;
+         Molecule s (ledger);
          s.translate_axis (-dir * inter_f * (i*2 + parity),
                           Y_AXIS);
-         out->add_atom (s);
+         out->add_molecule (s);
        }
     }
   
index 22fff9ce36f4738f659630a1d1bdc4727571668b..d28f39a9ada1cc254d73c95139f68954bd7c62df 100644 (file)
@@ -91,13 +91,13 @@ Paper_column::compare (Paper_column const &c1, Paper_column const &c2)
 Paper_column*
 Paper_column::prebreak_l() const
 {
-  return (Paper_column*)broken_to_drul_[LEFT];
+  return dynamic_cast<Paper_column*>(broken_to_drul_[LEFT]);
 }
 
 Paper_column*
 Paper_column::postbreak_l() const
 {
-  return(Paper_column*) broken_to_drul_[RIGHT];
+  return dynamic_cast<Paper_column*>( broken_to_drul_[RIGHT]);
 }
 bool
 Paper_column::breakpoint_b() const
@@ -130,7 +130,7 @@ Paper_column::used_b() const
 Paper_column*
 Paper_column::column_l () const
 {
-  return (Paper_column*)this;
+  return (Paper_column*)(this);
 }
 
 
index aed825ed878ad952f9c1d986851b94e4295e76db..f7b4238de813b3a9a109178e72d999c89b499e40 100644 (file)
@@ -120,38 +120,6 @@ Paper_score::find_col (Paper_column const *c) const
 }
 
 
-#if 0
-void
-Paper_score::set_breaking (Array<Column_x_positions> const &breaking)
-{
-  for (iter (span_p_list_.top (),i); i.ok  ();)
-    {
-      Spanner *span_p = i.remove_p ();
-      if (span_p->broken_b ()
-         || !((Score_element*)span_p)->line_l ())
-       {
-         span_p->unlink ();
-         delete span_p;
-       }
-      else 
-       {
-         typeset_broken_spanner (span_p);
-       }
-    }
-  for (iter (elem_p_list_.top (),i); i.ok  () ;)
-    {
-      Item *i_l =dynamic_cast <Item *> (i);
-      if (i_l && !i_l->line_l ())
-       {
-         i_l->unlink ();
-         Score_element * item_p= i.remove_p ();
-         delete item_p;
-       }
-      else
-       i++;
-    }
-}
-#endif
 
 
 Array<Column_x_positions>
index 626881eea545ea2ceeb02e324039d32ffaca00bc..8f6cefcc497d13a2c7da6f35674f77fcbd8c0cf3 100644 (file)
@@ -109,7 +109,7 @@ SCMVAR(linewidth);
 }
 
 Real
-Paper_def::duration_to_dist (Moment d,Real k) const
+Paper_def::length_mom_to_dist (Moment d,Real k) const
 {
   return arithmetic_spacing (d,k);
 }
index 8ad55ac3a1e97947c908223f68df635b2c63d54f..2d80618a2b224822453eca452f4cead79886c182 100644 (file)
@@ -15,7 +15,6 @@
 #include "paper-outputter.hh"
 #include "paper-stream.hh"
 #include "molecule.hh"
-#include "atom.hh"
 #include "array.hh"
 #include "string-convert.hh"
 #include "debug.hh"
@@ -24,6 +23,7 @@
 #include "scope.hh"
 #include "identifier.hh"
 #include "lily-version.hh"
+#include "atom.hh"
 
 Paper_outputter::Paper_outputter (Paper_stream *s)
 {
@@ -40,7 +40,18 @@ Paper_outputter::~Paper_outputter ()
 void
 Paper_outputter::output_header ()
 {
+#if 0
+  int gobble = 10000;
+  {// alloc big chunk of memory.
+    SCM beg = SCM_EOL;
+    String bigstr = String_convert::char_str (' ', 50);
+    for (int i = gobble; i--; )
+      {
+       beg = gh_cons (gh_str02scm (bigstr.ch_C()), beg);
+      }
+  }
+#endif
+  
   if (safe_global_b)
     {
       ly_set_scm ("security-paranoia", SCM_BOOL_T);
@@ -88,30 +99,36 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
   if (check_debug)
     *outstream_l_ << String ("\n%start: ") << nm << "\n";
 
-  for (PCursor <Atom*> i (m->atoms_); i.ok (); i++)
+
+  if (check_debug)
     {
-      Offset a_off = i->offset ();
+      output_comment (nm);
+    }
+      
+
+  for (Cons<Atom> *ptr = m->atom_list_; ptr; ptr = ptr->next_)
+    {
+      Atom * i = ptr->car_;
+      Offset a_off = i->off_;
       a_off += o;
 
-      if (!i->lambda_)
+      if (!i->func_)
        continue; 
 
-      if (check_debug)
+      if (i->font_)
        {
-         output_comment (classname (i.ptr ()->origin_l_));
-
+         output_scheme (gh_list (ly_symbol ("select-font"),
+                                 gh_str02scm (symbol_to_string (i->font_).ch_C()),
+                                 SCM_UNDEFINED));
        }
-      
-      switch_to_font (i->font_);
-
-      SCM args_scm = gh_list (gh_double2scm (a_off.x ()),
-                gh_double2scm (a_off.y ()), 
-                i->lambda_.to_SCM (),
-                SCM_UNDEFINED);
-
-
-      SCM box_scm = gh_cons (ly_symbol ("placebox"), args_scm);
 
+      SCM box_scm
+       = gh_list (ly_symbol ("placebox"),
+                  gh_double2scm (a_off.x ()),
+                  gh_double2scm (a_off.y ()), 
+                  i->func_.to_SCM(),
+                  SCM_UNDEFINED);
+      
       output_scheme (box_scm);
     }
 }
@@ -133,8 +150,6 @@ Paper_outputter::output_comment (String str)
 void
 Paper_outputter::output_scheme (SCM scm)
 {
-  String o = String ("\'") + output_global_ch;
-
   if (String (output_global_ch) == "scm")
     {
       static SCM port = 0;
@@ -203,28 +218,6 @@ Paper_outputter::output_version ()
   output_String_def ( "LilyIdString", id_str);
 }
 
-void
-Paper_outputter::switch_to_font (String fontname)
-{
-  if (fontname.length_i () && fontname != current_font_)
-    {
-      current_font_ = fontname;
-      int i=0;
-
-      for (; i< font_arr_.size (); i++)
-       if (font_arr_[i] == fontname)
-           break;
-
-      if (i == font_arr_.size ())
-       {
-         font_arr_.push (fontname);
-         output_font_def (i, fontname);
-       }
-      output_font_switch (i);
-    }
-  return;
-}
-
 void
 Paper_outputter::start_line ()
 {
@@ -281,22 +274,11 @@ Paper_outputter::output_int_def (String k, int v)
   gh_define (k.ch_l (), gh_int2scm (v));
 }
 
-void
-Paper_outputter::output_font_switch (int i)
-{
-  SCM scm = gh_list (ly_symbol ("font-switch"),
-                    gh_int2scm (i),
-                    SCM_UNDEFINED);
 
-  output_scheme (scm);
-}
 
 void
 Paper_outputter::stop_line ()
 {
   SCM scm =    gh_list (ly_symbol ("stop-line"), SCM_UNDEFINED);
   output_scheme (scm);
-
-  current_font_ = "";
-  font_arr_.clear ();
 }
index 73a7557a4758d7be0d0324e8012df4c010377889..59193862adc9db5f08b52f787b3734ab2f1298c5 100644 (file)
@@ -690,7 +690,7 @@ midi_body: /* empty */              {
                $$-> assign_translator ($2);
        }
        | midi_body tempo_request ';' {
-               $$->set_tempo ($2->dur_.length (), $2->metronome_i_);
+               $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
                delete $2;
        }
        | midi_body error {
@@ -946,7 +946,7 @@ verbose_command_req:
                $$ = new Cadenza_req ($2);
        }
        | PARTIAL duration_length       {
-               $$ = new Partial_measure_req ($2->length ());
+               $$ = new Partial_measure_req ($2->length_mom ());
                delete $2;
        }
        | CLEF STRING {
@@ -987,11 +987,11 @@ post_requests:
                THIS->post_reqs.push ($2);
        }
        | post_requests close_request_parens    {
-               Array<Request*>& r = *THIS->get_parens_request ($2);
-               for (int i = 0; i < r.size (); i++ )
-                       r[i]->set_spot (THIS->here_input ());
-               THIS->post_reqs.concat (r);
-               delete &r;
+               Link_array<Request> *r = THIS->get_parens_request ($2);
+               for (int i = 0; i < r->size (); i++ )
+                       r->elem (i)->set_spot (THIS->here_input ());
+               THIS->post_reqs.concat (*r);
+               delete r;
        }
        ;
 
@@ -1129,9 +1129,10 @@ extender_req:
        };
 
 dynamic_req:
-       ABSDYNAMIC '{' unsigned '}'     {
+       ABSDYNAMIC '{' STRING '}'       {
                Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
-               ad_p ->loudness_ = (Dynamic_req::Loudness)$3;
+               ad_p ->loudness_str_ = *$3;
+               delete $3;
                $$ =ad_p;
        }
        | SPANDYNAMIC '{' int int '}' {
@@ -1267,12 +1268,11 @@ pre_requests:
                        
        }
        | pre_requests open_request_parens {
-
-               Array<Request*>& r = *THIS->get_parens_request ($2);
-               for (int i = 0; i < r.size (); i++ )
-                       r[i]->set_spot (THIS->here_input ());
-               THIS->pre_reqs.concat (r);
-               delete &r;
+               Link_array<Request>* r = THIS->get_parens_request ($2);
+               for (int i = 0; i < r->size (); i++ )
+                       r->elem (i)->set_spot (THIS->here_input ());
+               THIS->pre_reqs.concat (*r);
+               delete r;
        }
        ;
 
index 0cc85e14d5d7959f34f59cfaaf489c12d67129d9..ebd69cb77c4aaf45c6797681d75b74cf69ef8caf 100644 (file)
@@ -43,10 +43,13 @@ Protected_scm::operator =(Protected_scm const &s)
 Protected_scm::~Protected_scm ()
 {
   if  (object_)
-    scm_unprotect_object (object_);
+    {
+      scm_unprotect_object (object_);
+      object_ =0L;             // be nice to conservative GC
+    }
 }
 
-Protected_scm::operator SCM ()
+Protected_scm::operator SCM () const
 {
   return object_;
 }
index ab634c71da15e37d9e1f17629d6ccda180305a19..59f2176b46133a05a8a4caf711dffdcb060c6097 100644 (file)
@@ -36,36 +36,53 @@ Repeat_engraver::do_try_music (Music* m)
         return true;
  
       Music_sequence* alt = r->alternative_p_;
-      Moment stop_mom = now_moment () + r->repeat_p_->duration ();
-      for (PCursor<Music*> i (alt->music_p_list_p_->top ()); i.ok () && (i != alt->music_p_list_p_->bottom ()); i++)
+      Moment repeat_length_mom = r->repeat_p_->length_mom ();
+      Moment stop_mom = now_mom () + repeat_length_mom;
+      Moment alt_mom = now_mom () + repeat_length_mom;
+      if (repeat_length_mom)
        {
-         stop_mom += i->duration ();
-         if (dynamic_cast<Simultaneous_music *> (alt))
-           break;
+         for (PCursor<Music*> i (alt->music_p_list_p_->top ()); i.ok () && (i != alt->music_p_list_p_->bottom ()); i++)
+           {
+             stop_mom += i->length_mom ();
+             if (dynamic_cast<Simultaneous_music *> (alt))
+               break;
+           }
+         repeated_music_arr_.push (r);
+         stop_mom_arr_.push (stop_mom);
        }
-      Moment alt_mom = now_moment () + r->repeat_p_->duration ();
-      /*
-        TODO: 
-         figure out what we don't want.
-
-         we don't want to print more than one set of
-         |: :| and volta brackets on one staff.
 
-         counting nested repeats, it seems safest to forbid
-         two pieces of alternative music to start at the same time.
-       */
+      /* 
+        Counting nested repeats, it seems safest to forbid
+        two pieces of alternative music to start at the same time.
+      */
       for (int i = 0; i < alternative_start_mom_arr_.size (); i++)
         if (alternative_start_mom_arr_[i] == alt_mom)
          return false;
-      repeated_music_arr_.push (r);
-      stop_mom_arr_.push (stop_mom);
+
+      /*
+       Coda kludge: see input/test/coda-kludge.ly
+       */
+      Moment span_mom;
+      Scalar prop = get_property ("voltaSpannerDuration", 0);
+      if (prop.length_i ())
+       span_mom = prop.to_rat ();
+      int alt_i = r->repeats_i_ + 1 - alt->music_p_list_p_->size () >? 1;
       for (PCursor<Music*> i (alt->music_p_list_p_->top ()); i.ok (); i++)
         {
          alternative_music_arr_.push (i.ptr ());
          alternative_start_mom_arr_.push (alt_mom);
-         alternative_stop_mom_arr_.push (alt_mom + i->duration ());
+         if (span_mom)
+           alternative_stop_mom_arr_.push (alt_mom + span_mom);
+         else
+           alternative_stop_mom_arr_.push (alt_mom + i->length_mom ());
+         String str;
+         if ((alt_i != 1) && (alt_i != r->repeats_i_) && (i == alt->music_p_list_p_->top ()))
+           str = "1.-";
+         str += to_str (alt_i) + ".";
+         alt_i++;
+         alternative_str_arr_.push (str);
          if (!dynamic_cast<Simultaneous_music *> (alt))
-           alt_mom += i->duration ();
+           alt_mom += i->length_mom ();
        }
       return true;
     }
@@ -75,7 +92,7 @@ Repeat_engraver::do_try_music (Music* m)
 void
 Repeat_engraver::acknowledge_element (Score_element_info i)
 {
-  Moment now = now_moment ();
+  Moment now = now_mom ();
   if (Note_column *c = dynamic_cast<Note_column *> (i.elem_l_))
     {
       for (int i = 0; i < volta_p_arr_.size (); i++)
@@ -101,12 +118,12 @@ Repeat_engraver::do_removal_processing ()
 void
 Repeat_engraver::do_process_requests ()
 {  
-  Moment now = now_moment ();
+  Moment now = now_mom ();
   Bar_engraver* bar_engraver_l = dynamic_cast <Bar_engraver*>
     (daddy_grav_l ()->get_simple_translator ("Bar_engraver"));
   for (int i = bar_b_arr_.size (); i < repeated_music_arr_.size (); i++)
     {
-      if (bar_engraver_l && (now > Moment (0)))
+      if (bar_engraver_l)
        bar_engraver_l->request_bar ("|:");
       bar_b_arr_.push (true);
     }
@@ -118,16 +135,16 @@ Repeat_engraver::do_process_requests ()
            bar_engraver_l->request_bar (":|");
        }
     }
-  int bees = volta_p_arr_.size ();
   for (int i = volta_p_arr_.size (); i < alternative_music_arr_.size (); i++)
     {
       Volta_spanner* v = new Volta_spanner;
       Scalar prop = get_property ("voltaVisibility", 0);
       v->visible_b_ = prop.to_bool ();
-      if (i == alternative_music_arr_.size () - 1)
+      prop = get_property ("voltaSpannerDuration", 0);
+      if ((i == alternative_music_arr_.size () - 1) || prop.length_i ())
         v->last_b_ = true;
       Text_def* t = new Text_def;
-      t->text_str_ = to_str (i - bees + 1) + ".";
+      t->text_str_ = alternative_str_arr_[i];
       v->number_p_.set_p (t);
       volta_p_arr_.push (v);
       announce_element (Score_element_info (v, alternative_music_arr_[i]));
@@ -137,7 +154,7 @@ Repeat_engraver::do_process_requests ()
 void 
 Repeat_engraver::do_pre_move_processing ()
 {
-  Moment now = now_moment ();
+  Moment now = now_mom ();
   for (int i = bar_b_arr_.size (); i--; )
     {
       if (bar_b_arr_[i])
@@ -161,6 +178,7 @@ Repeat_engraver::do_pre_move_processing ()
          alternative_music_arr_.del (i);
          alternative_start_mom_arr_.del (i);
          alternative_stop_mom_arr_.del (i);
+         alternative_str_arr_.del (i);
        }
     }
 }
@@ -168,22 +186,5 @@ Repeat_engraver::do_pre_move_processing ()
 void 
 Repeat_engraver::do_post_move_processing ()
 {
-#if 0
-  Time_description const *time = get_staff_info().time_C_;
-  Moment now = now_moment ();
-  for (int i = volta_p_arr_.size (); i--; )
-    {
-      if ((now > alternative_stop_mom_arr_[i])
-         && !time->whole_in_measure_)
-        {
-         volta_p_arr_[i] = 0;
-         volta_p_arr_.del (i);
-         alternative_music_arr_[i] = 0;
-         alternative_music_arr_.del (i);
-         alternative_start_mom_arr_.del (i);
-         alternative_stop_mom_arr_.del (i);
-       }
-    }
-#endif
 }
 
index 8c6982ce7beb85b6febaa9fb96c5590d37b94ef7..04c774594783883221775500e8b2a00598793353 100644 (file)
@@ -18,10 +18,6 @@ Repeated_music_iterator::Repeated_music_iterator ()
   repeat_iter_p_ = 0;
   alternative_iter_p_ = 0;
   here_mom_ = 0;
-#if 0
-  unfold_i_ = repeated_music_l ()->unfold_b_ ? 
-    repeated_music_l ()->repeats_i_ - 1 : 0;
-#endif
   unfold_i_ = -1; 
 }
 
@@ -41,11 +37,7 @@ Repeated_music_iterator::do_print () const
 void
 Repeated_music_iterator::construct_children ()
 {
-#if 0
-  unfold_i_ = repeated_music_l ()->unfold_b_ ? 
-    repeated_music_l ()->repeats_i_ - 1 : 0;
-#endif
-  repeat_iter_p_ = get_iterator_p (repeated_music_l ()->repeat_p_);  
+  repeat_iter_p_ = get_iterator_p (dynamic_cast<Repeated_music const*> (music_l_)->repeat_p_);
 }
 
 void
@@ -53,7 +45,7 @@ Repeated_music_iterator::do_process_and_next (Moment m)
 {
   if (first_b_)
     {
-      bool success = report_to_l ()->try_music (repeated_music_l ());
+      bool success = report_to_l ()->try_music (dynamic_cast<Repeated_music const*> (music_l_));
       if (!success)
        music_l_->warning ( _("No one to print a volta bracket"));
     }
@@ -67,17 +59,19 @@ Repeated_music_iterator::do_process_and_next (Moment m)
 Moment
 Repeated_music_iterator::next_moment () const
 {
+  
   if (repeat_iter_p_)
     return repeat_iter_p_->next_moment () + here_mom_;
   else if (alternative_iter_p_)
     return alternative_iter_p_->next_moment () + here_mom_;
-  // huh?
-//  return repeated_music_l ()->repeat_p_->duration () 
-//    * Moment (repeated_music_l ()->repeats_i_)
-//   + repeated_music_l ()->alternative_p_->duration () + here_mom_;
-  return repeated_music_l ()->alternative_p_->duration () + here_mom_;
+
+  Repeated_music const*r = dynamic_cast<Repeated_music const*>(music_l_);
+  return r->alternative_p_->length_mom () + here_mom_;
 }
 
+/*
+  FIXME
+ */
 bool
 Repeated_music_iterator::ok () const
 {
@@ -95,24 +89,22 @@ Repeated_music_iterator::ok () const
   return ok ();
 }
 
-Repeated_music*
-Repeated_music_iterator::repeated_music_l () const
-{
-  return (Repeated_music*)Music_iterator::music_l_;
-}
 
 void
 Repeated_music_iterator::start_next_element ()
 {
-  if (repeat_iter_p_)
+  Repeated_music const*rep =dynamic_cast<Repeated_music const*> (music_l_);
+
+
+ if (repeat_iter_p_)
     {
       assert (!repeat_iter_p_->ok ());
       assert (!alternative_iter_p_);
       delete repeat_iter_p_;
       repeat_iter_p_ = 0;
       alternative_iter_p_ = dynamic_cast<Music_list_iterator*>
-       (get_iterator_p ((Music*)repeated_music_l ()->alternative_p_));  
-      here_mom_ += repeated_music_l ()->repeat_p_->duration ();
+       (get_iterator_p ((Music*)rep->alternative_p_));  
+      here_mom_ += rep->repeat_p_->length_mom ();
     }
   else if (alternative_iter_p_)
     {
@@ -121,14 +113,14 @@ Repeated_music_iterator::start_next_element ()
       delete alternative_iter_p_;
       alternative_iter_p_ = 0;
       if (unfold_i_ < 0)
-       unfold_i_ = repeated_music_l ()->unfold_b_ ? 
-         repeated_music_l ()->repeats_i_ - 1 : 0;
+       unfold_i_ = rep->unfold_b_ ? 
+         rep->repeats_i_ - 1 : 0;
       if (unfold_i_)
         {
          unfold_i_--;
-         repeat_iter_p_ = get_iterator_p (repeated_music_l ()->repeat_p_);
+         repeat_iter_p_ = get_iterator_p (rep->repeat_p_);
          // urg, assume same length alternatives for now...
-//       here_mom_ += repeated_music_l ()->alternative_p_->music_p_list_p_->top ()->duration ();
+//       here_mom_ += rep->alternative_p_->music_p_list_p_->top ()->length_mom ();
          /*
            URG
            this is *wrong* but at least it doesn't dump core
@@ -137,7 +129,7 @@ Repeated_music_iterator::start_next_element ()
 
            how to intercept this...
           */
-         here_mom_ += repeated_music_l ()->alternative_p_->duration ();
+         here_mom_ += rep->alternative_p_->length_mom ();
        }
     }
 }
index 1bbd2be8c25d2f046456e63aa882998a39b3a8b1..ee103dbdc60b4c3284ec5a23e4298b9f29ebb0e2 100644 (file)
@@ -27,6 +27,7 @@ Repeated_music::~Repeated_music ()
 Repeated_music::Repeated_music (Repeated_music const& s)
   : Music (s)
 {
+  repeats_i_ = s.repeats_i_;
   repeat_p_ = (s.repeat_p_) ? s.repeat_p_->clone () : 0;
   // urg?
   alternative_p_ = (s.alternative_p_) ? dynamic_cast <Music_sequence*> (s.alternative_p_->clone ()) : 0;
@@ -51,13 +52,13 @@ Repeated_music::transpose (Musical_pitch p)
 }
 
 Moment
-Repeated_music::duration () const
+Repeated_music::length_mom () const
 {
   Moment m;
   if (repeat_p_)
-    m += repeat_p_->duration ();
+    m += repeat_p_->length_mom ();
   if (alternative_p_)
-    m += alternative_p_->duration ();
+    m += alternative_p_->length_mom ();
   return m;
 }
 
index 410a38d37cd7cbfb870c60f5395e6154484b7e06..b2f8a712a4b6182d8ecae57fe04d0568f2c8b38d 100644 (file)
@@ -17,7 +17,7 @@
 void
 Request_chord_iterator::construct_children()
 {
-  elt_duration_ =elt_l ()->duration ();
+  elt_length_mom_ =elt_l ()->length_mom ();
   get_req_translator_l();
 }
 
@@ -36,7 +36,7 @@ Request_chord_iterator::Request_chord_iterator ()
 bool
 Request_chord_iterator::ok() const
 {
-  return (elt_duration_ && !last_b_) || first_b_;
+  return (elt_length_mom_ && !last_b_) || first_b_;
 }
 
 
@@ -46,7 +46,7 @@ Request_chord_iterator::next_moment() const
 {
   Moment m (0);
   if  (!first_b_)
-    m = elt_duration_;
+    m = elt_length_mom_;
   return m;
 }
 
@@ -54,7 +54,7 @@ void
 Request_chord_iterator::do_print() const
 {
 #ifndef NPRINT
-  DOUT << "duration: " << elt_duration_;
+  DOUT << "duration: " << elt_length_mom_;
 #endif
 }
 
@@ -78,6 +78,6 @@ Request_chord_iterator::do_process_and_next (Moment mom)
       first_b_ = false;
     }
 
-  if (mom >= elt_duration_)
+  if (mom >= elt_length_mom_)
     last_b_ = true;
 }
index 0c527bd9ba8d9595f6d8d13bc51031645937b43f..acfcc3617b6d3e65e5782b56c0c8442d37ff5165 100644 (file)
@@ -41,8 +41,8 @@ Rest::do_brew_molecule_p () const
   bool streepjes_b = abs(position_i_) > staff_size_i_ /2 &&  
     (balltype_i_ == 0 || balltype_i_ == 1);
   
-  Atom s(lookup_l ()->rest (balltype_i_, streepjes_b));
-  Molecule * m = new Molecule ( Atom (s));
+  Molecule s(lookup_l ()->rest (balltype_i_, streepjes_b));
+  Molecule * m = new Molecule ( Molecule (s));
   m->translate_axis (position_i_ *  paper ()->internote_f (), Y_AXIS);
   return m;
 }
index 28e3cf89c4be93e84154ab31f78b2f76aa90fea2..ccca90f9a722c119a84131eb7a040ef5e8816df0 100644 (file)
@@ -70,23 +70,24 @@ Rhythmic_column_engraver::acknowledge_element (Score_element_info i)
   Item * item =  dynamic_cast <Item *> (i.elem_l_);
   if (!item)
     return;
-  if (dynamic_cast<Script *> (item)
-      && i.req_l_
-      && dynamic_cast <Musical_req *> (i.req_l_)) 
+  if (Script *s=dynamic_cast<Script *> (item))
     {
-      script_l_arr_.push ((Script*)item);
+      if (i.req_l_ && dynamic_cast <Musical_req *> (i.req_l_)) 
+       {
+         script_l_arr_.push (s);
+       }
     }
-  else if (dynamic_cast<Stem *> (item))
+  else if (Stem*s=dynamic_cast<Stem *> (item))
     {
-      stem_l_ = (Stem*) item;
+      stem_l_ = s;
     }
-  else if (dynamic_cast<Rhythmic_head *> (item))
+      else if (Rhythmic_head*r=dynamic_cast<Rhythmic_head *> (item))
     {
-      rhead_l_arr_.push ((Rhythmic_head*)item);
+      rhead_l_arr_.push (r);
     }
-  else if (dynamic_cast<Dot_column *> (item))
+      else if (Dot_column*d =dynamic_cast<Dot_column *> (item))
     {
-      dotcol_l_ = (Dot_column*) item;
+      dotcol_l_ = d;
     }
 }
 
diff --git a/lily/rhythmic-grouping.cc b/lily/rhythmic-grouping.cc
new file mode 100644 (file)
index 0000000..d166d9d
--- /dev/null
@@ -0,0 +1,383 @@
+/*
+  rhythmic-grouping.cc -- implement Rhythmic_grouping
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "debug.hh"
+#include "rhythmic-grouping.hh"
+#include "interval.hh"
+
+void
+Rhythmic_grouping::init()
+{
+  interval_ = 0;
+  children.clear();     
+}
+
+void
+Rhythmic_grouping::OK() const
+{
+#ifndef NDEBUG
+  assert (bool (children.size()) != bool (interval_));
+
+  for (int i= 0; i < children.size(); i++) 
+    {
+      children[i]->OK();
+      if (i>0)
+       assert (children[i-1]->interval().right ==
+               children[i]->interval().left);
+    }
+#endif
+}
+
+Moment
+Rhythmic_grouping::length_mom () const
+{
+  return interval().length ();
+}
+
+MInterval
+Rhythmic_grouping::interval() const
+{
+  if (interval_)
+    return *interval_;
+  else
+    return
+      MInterval (children[0]->interval().left,
+                children.top()->interval ().right);
+}
+
+void
+Rhythmic_grouping::split (Rhythmic_grouping r)
+{
+  if (interval_)
+    return ;
+  
+  r.intersect (interval());
+  split (r.intervals());
+  
+  for (int i= 0; i < children.size(); i++) 
+    {
+      if (!children[i]->interval_) 
+       {
+         Rhythmic_grouping here (r);   
+         children[i]->split (here);
+       }
+    }
+}
+
+
+Array<MInterval>
+Rhythmic_grouping::intervals()
+{
+  Array<MInterval> r;
+  if (interval_ || children.size() == 1) 
+    {
+      MInterval i (interval());
+      MInterval r1(i), r2(i);
+      r1.right = r2.left = i.center();
+      r.push (r1); r.push (r2);
+    }
+  else 
+    {
+      for (int i=0; i < children.size(); i++)
+       r.push (children[i]->interval());
+    }
+  return r;
+}
+
+void
+Rhythmic_grouping::intersect (MInterval t)
+{
+  if (interval_) 
+    {
+      interval_->intersect (t);
+      return;
+    }
+  
+  for (int i=0; i < children.size(); i++) 
+    {
+      MInterval inter = intersection (t, children[i]->interval());
+      if (inter.empty_b() || inter.length () <= Moment (0)) 
+       {
+         delete children[i];
+         children[i] =0;
+       }
+      else 
+       {
+         children[i]->intersect (t);
+       }
+    }
+  for (int i=0; i < children.size();) 
+    {
+      if (!children[i])
+       children.del (i);
+      else
+       i++;
+    }
+
+}
+
+/**
+  Put our children in branches of #this#.
+  The min and max time intervals coincide with elements of #splitpoints#
+
+  I really should be documenting what is happening here, but I find
+  that difficult, since I don't really understand what's going on here.
+
+  */
+void
+Rhythmic_grouping::split (Array<MInterval> splitpoints)
+{
+  //check on splitpoints..
+  int j = 0, i = 0, starti = 0, startj = 0;
+  
+  Link_array<Rhythmic_grouping> ch;
+  while (1) 
+    {
+      if  (i >= children.size() || j >= splitpoints.size ())
+       break;
+       
+      assert (
+             children[starti]->interval().left== splitpoints[startj].left);
+      if (children[i]->interval().right < splitpoints[j].right) 
+       {
+         i ++;
+       }
+      else if (children[i]->interval().right > splitpoints[j].right) 
+       {
+         j ++;
+       }
+      else 
+       {
+
+         if (i == starti) 
+           {
+             ch.push (children[i]);
+           }
+         else 
+           {
+             Link_array<Rhythmic_grouping> slice = children.slice (starti, i+1);
+             Rhythmic_grouping *newchild=new Rhythmic_grouping (slice);
+
+             ch.push (newchild);
+           }
+         i ++;
+         j++;
+         starti = i;
+         startj = j;
+
+
+       }
+    }
+  if (ch.size() != 1)
+    children = ch;
+}
+
+
+Rhythmic_grouping::Rhythmic_grouping (MInterval t, int n)
+{
+  init();
+  if (n == 1 || !n) 
+    {
+      interval_ = new MInterval (t);
+      return;
+    }
+  Moment dt = t.length ()/Moment (n);
+  MInterval basic = MInterval (t.left, t.left+dt);
+  for (int i= 0; i < n; i++)
+    children.push (new Rhythmic_grouping (dt*Moment (i) + basic));
+}
+
+
+Rhythmic_grouping::Rhythmic_grouping (Link_array<Rhythmic_grouping> r)
+  :children (r)
+{
+  interval_ =0;
+}
+
+Rhythmic_grouping::~Rhythmic_grouping()
+{
+  junk();    
+}
+
+void
+Rhythmic_grouping::copy (Rhythmic_grouping const&s)
+{
+  interval_ =  (s.interval_)? new MInterval (*s.interval_) : 0;
+  for (int i=0; i < s.children.size(); i++)
+    children.push (new Rhythmic_grouping (*s.children[i]));
+}
+
+void
+Rhythmic_grouping::operator=(Rhythmic_grouping const &s)
+{
+  junk();
+  copy (s);
+}
+
+Rhythmic_grouping::Rhythmic_grouping (Rhythmic_grouping const&s)
+{
+  init();
+  copy (s);
+}
+
+void
+Rhythmic_grouping::junk()
+{
+  delete interval_;
+  for (int i=0; i < children.size(); i++)
+    delete children[i];
+  init();
+}
+
+void
+Rhythmic_grouping::print() const    
+{
+#ifndef NPRINT
+  DOUT << "{ \n";
+  if (interval_)
+    DOUT <<" Interval "<< interval_->str();
+  for (int i=0; i < children.size(); i++) 
+    {
+      children[i]->print();
+    }
+  DOUT << "}\n";
+#endif
+}
+
+bool
+Rhythmic_grouping::child_fit_b (Moment start)
+{
+  if (children.size())
+    return (children.top()->interval ().right== start);
+
+  return true;
+}  
+
+void
+Rhythmic_grouping::add_child (Moment start, Moment len)
+{
+  Moment stop = start+len;
+  assert (child_fit_b (start));
+  children.push (new Rhythmic_grouping (MInterval (start, stop)));
+}
+
+Rhythmic_grouping::Rhythmic_grouping()
+{
+  interval_ =0;
+}
+
+int
+min_elt (Array<int> v)
+{
+  int i = 1000;                // ugh
+  for (int j = 0 ; j <  v.size(); j++)
+    i = i <? v[j];
+  return i;
+}
+
+Array<int>
+Rhythmic_grouping::generate_beams (Array<int> flags, int &flagidx)
+{
+  assert (!interval_) ;
+  
+  Array< Array<int> > children_beams;
+  for (int i=0; i < children.size(); i++) 
+    {
+      Array<int> child_beams;
+      if (children[i]->interval_) 
+       {
+         int f = flags[flagidx++];
+         child_beams.push (f);
+       }
+      else 
+       {
+         child_beams = children[i]->
+           generate_beams (flags, flagidx);
+       }
+      children_beams.push (child_beams);
+    }
+  Array<int> beams;
+  int lastm, m, nextm;
+  for (int i=0; i  < children_beams.size(); i++) 
+    {
+      bool add_left =  (i >0);
+      bool add_right = (i  < children_beams.size() -1);
+
+      if (!i)
+       m =  min_elt (children_beams[i]);
+      if (add_right)
+       nextm = min_elt (children_beams[i+1]);
+       
+      if (children_beams[i].size() == 1) 
+       {
+         if (add_right)
+           beams.push (m);
+         if (add_left)
+           beams.push (m);
+       }
+      else 
+       {
+         if (add_left) 
+           beams.push (lastm <? m);
+         beams.concat (children_beams[i]);
+         if (add_right)
+           beams.push (m <? nextm);
+       }
+      lastm = m;
+      m = nextm;       
+    }
+  assert (!(beams.size()%2));
+  return beams;
+}
+
+void
+Rhythmic_grouping::translate (Moment m)
+{
+  if (interval_)
+    *interval_ += m;
+  else
+    for (int i=0; i < children.size(); i++)
+      children[i]->translate (m);
+}
+
+void
+Rhythmic_grouping::extend (MInterval m) const
+{    
+  assert (m.left >= interval().left);
+  while (m.right  >interval().right) 
+    {
+      Link_array<Rhythmic_grouping> a (children);
+      for (int i=0; i < a.size(); i++) 
+       {
+         a[i] =new Rhythmic_grouping (*children[i]);
+         a[i]->translate (children.top()->interval ().right);      
+       }
+      ((Rhythmic_grouping*)this)->children.concat (a);
+    }
+  assert (m.right <= interval().right);
+  OK();
+}
+
+Rhythmic_grouping
+parse_grouping (Array<int> beat_i_arr, Array<Moment> elt_length_arr)
+{
+  Moment here =0;
+  assert (beat_i_arr.size() == elt_length_arr.size ());
+  
+  Link_array<Rhythmic_grouping> children;
+  for (int i=0; i < beat_i_arr.size(); i++) 
+    {
+      Moment last = here;
+      here += elt_length_arr[i] * Moment (beat_i_arr[i]);
+      children.push (
+                    new Rhythmic_grouping (MInterval (last, here),
+                                           beat_i_arr[i]));
+    }
+  return Rhythmic_grouping (children);
+}
+
index c78a0bef0d510a055be671c7847ff3019166ae11..7985f952eb3435a4397d70cbf08146c3bab2eaf3 100644 (file)
@@ -59,7 +59,7 @@ Score_element::~Score_element()
 Score_element*
 Score_element::dependency (int i) const
 {
-  return (Score_element*) get_out_edge_arr ()[i];
+  return (Score_element*) (get_out_edge_arr ()[i]);
 }
 
 int
@@ -71,7 +71,7 @@ Score_element::dependency_size () const
 Score_element*
 Score_element::dependent (int i) const
 {
-  return (Score_element*) get_in_edge_arr()[i];
+  return (Score_element *)( get_in_edge_arr()[i]);
 }
 
 int
@@ -184,11 +184,6 @@ Score_element::output_processing ()
     delete output_p_;
   
   output_p_ = do_brew_molecule_p ();
-  for (PCursor<Atom*> i(output_p_->atoms_); i.ok(); i++)
-    {
-      i->origin_l_ = this;
-    }
-  
   pscore_l_->outputter_l_->output_molecule (output_p_,
                                            absolute_offset (),
                                            classname(this));
@@ -256,7 +251,7 @@ Score_element::do_junk_links()
 Molecule*
 Score_element::do_brew_molecule_p() const
 {
-  Atom a (lookup_l ()->fill (Box (Interval (0,0), Interval (0,0))));
+  Molecule a (lookup_l ()->fill (Box (Interval (0,0), Interval (0,0))));
   return new Molecule (a);
 }
 
index e1ab3ab2fb5ea2e055d531f17ac289792b8c35df..7596d9dd0c544c2ef4e656eb91c575ac3aa0aeaf 100644 (file)
@@ -106,7 +106,7 @@ Score_engraver::do_announces()
          {
            if (Rhythmic_req *rq = dynamic_cast <Rhythmic_req *> (announce_info_arr_[i].req_l_))
              {
-               musical_column_l_->add_duration (rq->duration());
+               musical_column_l_->add_duration (rq->length_mom ());
              }
          }
       Engraver_group_engraver::do_announces();
@@ -267,5 +267,5 @@ Score_engraver::do_add_processing ()
   assert (dynamic_cast<Paper_def *> (output_def_l_));
   assert (!daddy_trans_l_);
   pscore_p_ = new Paper_score;
-  pscore_p_->paper_l_ = (Paper_def*)output_def_l_;
+  pscore_p_->paper_l_ = dynamic_cast<Paper_def*>(output_def_l_);
 }
index f34dddf2827730f516858cb609dbe129b7db42c8..ec5caa910eeb6b07bf98356ae5d71bb0dd451e35 100644 (file)
@@ -35,13 +35,13 @@ Score_performer::~Score_performer()
 void
 Score_performer::play (Audio_element * p)
 {
-  if  (dynamic_cast<Audio_item *> (p)) 
+  if  (Audio_item * i=dynamic_cast<Audio_item *> (p)) 
     {
-      audio_column_l_->add_audio_item ((Audio_item*)p);
+      audio_column_l_->add_audio_item (i);
     }
-  else if (dynamic_cast<Audio_staff *> (p)) 
+  else if (Audio_staff*s=dynamic_cast<Audio_staff *> (p)) 
     {
-      performance_p_->add_staff ((Audio_staff*)p);
+      performance_p_->add_staff (s);
     }
   performance_p_->add_element (p);
 }
@@ -97,5 +97,5 @@ Score_performer::do_add_processing ()
   Translator_group::do_add_processing ();
   assert (dynamic_cast<Midi_def *> (output_def_l_));
   performance_p_ = new Performance;
-  performance_p_->midi_l_ = (Midi_def*) output_def_l_;  
+  performance_p_->midi_l_ = dynamic_cast<Midi_def*>(output_def_l_); 
 }
index 291616b8822d81c84fa1228a7f713aa5b5f87859..4f85afc8ff71bc05f018e59d07d52f98b9d0a1e1 100644 (file)
@@ -58,7 +58,7 @@ Score::run_translator (Music_output_def *odef_l)
       return ;
     }
   *mlog << '\n' << _("Interpreting music...") << flush;
-  trans_p->last_mom_ = music_p_->duration ();
+  trans_p->last_mom_ = music_p_->length_mom ();
 
   Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_, trans_p);
   
index b74cf814f00dfbbf8c89d514681350d6368dbd08..579a80ea8acae14c503d5ade504b7c6249c3ddcc 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "debug.hh"
 #include "script-def.hh"
-#include "atom.hh"
+
 #include "paper-def.hh"
 #include "lookup.hh"
 
@@ -71,8 +71,8 @@ Script_def::inside_b() const
   return inside_staff_b_; 
 }
 
-Atom
-Script_def::get_atom (Paper_def *p , Direction d) const
+Molecule
+Script_def::get_molecule (Paper_def *p , Direction d) const
 {
   String preidx_str ="";
   if (invertsym_b_)
index 2012f053ba47bb1f461d0f99f3bab9d86b3dd07f..37a838b0aee8a2cbcc9490fd8c047d08492b8dc0 100644 (file)
@@ -61,9 +61,8 @@ Script_engraver::do_pre_move_processing()
       if (!script_p->specs_p_->inside_b())
        script_p->add_support (s_l);
 
-      if (dynamic_cast<Text_def *> (script_p->specs_p_)) // UGH
+      if (Text_def*td_l = dynamic_cast<Text_def *> (script_p->specs_p_)) // UGH
        {
-         Text_def * td_l = (Text_def*)script_p->specs_p_;
          if (!td_l->style_str_.length_i ())
            {
              Scalar style = get_property ("textstyle", 0);
index 73c731190ee96387b78357136dfc9a421f9027cf..ea999f69c9f50e816961103dc4a11153692df4fc 100644 (file)
@@ -73,7 +73,7 @@ Script::set_default_dir ()
 Interval
 Script::do_width () const
 {
-  return specs_p_->get_atom (paper (), dir_).extent ().x ();
+  return specs_p_->get_molecule (paper (), dir_).extent ().x ();
 }
 
 void
@@ -93,21 +93,16 @@ Script::do_pre_processing ()
 Interval
 Script::symbol_height () const
 {
-  return specs_p_->get_atom (paper (), dir_).extent ().y ();
+  return specs_p_->get_molecule (paper (), dir_).extent ().y ();
 }
 
-Interval
-Script::symbol_width () const
-{
-  return specs_p_->width (paper ());
-}
 
 Molecule*
 Script::do_brew_molecule_p () const
 {
   Real dx =0.;
 
-  Molecule*mol_p = new Molecule (specs_p_->get_atom (paper (), dir_));
+  Molecule*mol_p = new Molecule (specs_p_->get_molecule (paper (), dir_));
   /*
     ugh, staccato dots are not centred between stafflines (how?)?
   */
index 5ec0a76cd98588483c468654e1b5d02177d3c31a..d5ba03eef698f46ea8764c48daa172b651924220 100644 (file)
@@ -50,7 +50,7 @@ Sequential_music_iterator::leave_element()
 {
   delete iter_p_;
   iter_p_ =0;
-  Moment elt_time = cursor_p_->ptr()->duration ();
+  Moment elt_time = cursor_p_->ptr()->length_mom ();
   here_mom_ += elt_time;
   cursor_p_->next();
 }
index ef773b2cc6e5baf54f18d50bccd710572fa5a83f..b33a6de7ca96b62164c2759cd9e197aad654757c 100644 (file)
@@ -265,9 +265,11 @@ Slur::get_encompass_offset_arr () const
       notes.push (info.o_ - left);
     }
   Encompass_info info (encompass_arr_[encompass_arr_.size () - 1], dir_);
+
   // urg:
   Slur* urg = (Slur*)this;
   urg->interstaff_f_ = info.interstaff_f_;
+  
   d.y () += interstaff_f_;
 
   // prebreak
index 0e1e00841faa12bd8b3f890f2e5add9b2b915034..3848b84164daa58e39762735a6b7dfe312d3128e 100644 (file)
@@ -1,88 +1,19 @@
-/*
-  span-bar-grav.cc -- implement Span_bar_engraver
+#include "base-span-bar-engraver.hh"
 
-  source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "span-bar.hh"
-#include "span-bar-engraver.hh"
-#include "vertical-align-spanner.hh"
-
-Span_bar_engraver::Span_bar_engraver()
-{
-  spanbar_p_ =0;
-  valign_l_ =0;
-}
-
-Span_bar*
-Span_bar_engraver::get_span_bar_p() const
-{
-  return new Span_bar;
-}
-
-
-void
-Span_bar_engraver::do_creation_processing ()
-{
-}
-
-void
-Span_bar_engraver::do_removal_processing ()
+class Span_bar_engraver : public Base_span_bar_engraver
 {
-}    
-
-void
-Span_bar_engraver::acknowledge_element (Score_element_info i)
-{
-  int depth = i.origin_grav_l_arr_.size();
-  if (depth > 1
-      && dynamic_cast<Bar *> (i.elem_l_)) 
-    {
-      bar_l_arr_.push (dynamic_cast<Bar *> (i.elem_l_));
-       
-      if (bar_l_arr_.size() >= 2 && !spanbar_p_) 
-       /*
-         hmm, i do want a bracket with one staff some times, but not always
-         if (bar_l_arr_.size() >= 1 && !spanbar_p_)
-
-         --jcn
-       */
+protected:
+  Span_bar *get_span_bar_p ();
+public:
+  Span_bar_engraver ();
+  VIRTUAL_COPY_CONS (Translator);
+};
 
-       /*
 
-         use a property?  get_property ("singleStaffBracket", 0) ?
-
-         --hwn
-        */
-       {
-         spanbar_p_ = get_span_bar_p();
-         announce_element (Score_element_info (spanbar_p_,0));
-         spanbar_p_-> type_str_ = bar_l_arr_[0]->type_str_;
-       }
-    }
-  else if  (dynamic_cast<Vertical_align_spanner *> (i.elem_l_) 
-           && i.origin_grav_l_arr_.size() <= 2) 
-    {
-      valign_l_ = dynamic_cast<Vertical_align_spanner *> (i.elem_l_);
-    }
-}
-
-void
-Span_bar_engraver::do_pre_move_processing()
+Span_bar_engraver::Span_bar_engraver ()
 {
-  if (spanbar_p_) 
-    {
-      for (int i=0; i < bar_l_arr_.size() ; i++)
-       spanbar_p_->add_bar (bar_l_arr_[i]);
-      spanbar_p_->set_align (valign_l_);
-      typeset_element (spanbar_p_);
-      spanbar_p_ =0;
-    }
-  bar_l_arr_.set_size (0);
+  use_priority_b_ = false;
 }
 
-
-
 ADD_THIS_TRANSLATOR(Span_bar_engraver);
index fab0b28aaafd37ca8793d3d365b99e18247a62a2..f2ea6a5a71248fbd6300e3e524f64046e4fed8f0 100644 (file)
@@ -9,7 +9,7 @@
 #include "span-bar.hh"
 #include "lookup.hh"
 #include "dimensions.hh"
-#include "atom.hh"
+
 #include "paper-def.hh"
 #include "molecule.hh"
 #include "align-element.hh"
@@ -36,6 +36,11 @@ Span_bar::set_align (Align_element *a)
 Interval
 Span_bar::do_width () const
 {
+  if (no_width_b_)
+    {
+      return Interval (0,0);
+    }
+  
   Molecule m = lookup_l ()->bar (type_str_, 40 PT);
   
   return m.extent (X_AXIS);
@@ -47,6 +52,9 @@ Span_bar::do_pre_processing ()
   Bar::do_pre_processing ();
   
   evaluate_empty ();
+  translate_axis (extra_x_off_, X_AXIS);
+  
+  dim_cache_[Y_AXIS].set_empty (false); // a hack to make mark scripts work.
 }
 
 void
@@ -82,17 +90,8 @@ Span_bar::evaluate_empty ()
     }
 }
 
-Molecule
-Span_bar::get_bar_sym (Real dy) const
-{
-  if (dy < paper ()->staffheight_f () / 2)
-    return Atom ();
-  
-  return lookup_l ()->bar (type_str_, dy);
-}
-
-Molecule*
-Span_bar::do_brew_molecule_p () const
+Interval
+Span_bar::get_spanned_interval () const
 {
   Interval y_int;
   for (int i=0; i < spanning_l_arr_.size (); i++) 
@@ -105,9 +104,22 @@ Span_bar::do_brew_molecule_p () const
 
       y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
     }
+  return y_int;
+}
+
+Interval
+Span_bar::do_height () const
+{
+  return get_spanned_interval ();
+}
+
+Molecule*
+Span_bar::do_brew_molecule_p () const
+{
+  Interval iv (get_spanned_interval ());
+  Molecule*output = new Molecule (lookup_l ()->bar (type_str_, iv.length ()));
 
-  Molecule*output = new Molecule (get_bar_sym (y_int.length ()));
-  output->translate_axis (y_int.center (), Y_AXIS);
+  output->translate_axis (iv.center (), Y_AXIS);
   return output;
 }
 
@@ -116,4 +128,6 @@ Span_bar::do_brew_molecule_p () const
 Span_bar::Span_bar ()
 {
   type_str_ = "";
+  extra_x_off_ = 0.0;
+  no_width_b_ = false;
 }
index da1dfd2e7847b96a039be41432f6b81943539b38..c72a97155a98084fb1d848be6c5a5c75a95ffa1e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  span-score-bar-grav.cc -- implement Span_score_bar_engraver,
+  span-score-bar-engraver.cc -- implement Span_score_bar_engraver,
   Piano_bar_engraver and Staff_group_bar_engraver
 
   source file of the GNU LilyPond music typesetter
@@ -7,52 +7,58 @@
   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "span-score-bar.hh"
-#include "piano-brace.hh"
-#include "staff-bracket.hh"
+#include "span-bar.hh"
 #include "span-score-bar-engraver.hh"
 #include "paper-def.hh"
 
-
 Span_bar*
 Span_score_bar_engraver::get_span_bar_p () const
 {
-  Span_bar*s =  new Span_score_bar;
-  s->break_priority_i_ = -4;
+  Span_bar*s =  new Span_bar;
+  s->visibility_lambda_
+    = gh_eval_str ("spanbar_non_postbreak_visibility");
+  s->type_str_ = "scorebar";
     
   return s;
 }
 
 
-
-
-
+Span_score_bar_engraver::Span_score_bar_engraver ()
+{
+  use_priority_b_ = true;
+  break_priority_i_ = -4;
+}
 
 Span_bar*
 Piano_bar_engraver::get_span_bar_p () const
 {
-  Span_bar *s= new Piano_brace;
-  s->break_priority_i_ = -4;
+  Span_bar *s= new Span_bar;
+  s->visibility_lambda_
+    = gh_eval_str ("spanbar_postbreak_only_visibility");
+  s->no_width_b_ =true;
+  s->type_str_ = "{";
   return s;
 }
 
 Span_bar*
 Staff_group_bar_engraver::get_span_bar_p () const
 {
-  Span_bar *s= new Staff_bracket;
-  s->break_priority_i_ = -4;
+  Span_bar *s= new Span_bar;
+  s->visibility_lambda_
+    = gh_eval_str ("spanbar_postbreak_only_visibility");
+  s->no_width_b_ =true;
+  s->type_str_ = "[";
   return s;
 }
 
 void
 Staff_group_bar_engraver::acknowledge_element (Score_element_info i)
 {
-  Span_bar_engraver::acknowledge_element (i);
-  if (dynamic_cast<Piano_brace *> (i.elem_l_))
+  Base_span_bar_engraver::acknowledge_element (i);
+  if (Span_bar * b = dynamic_cast<Span_bar *> (i.elem_l_))
     {
-      Span_bar* b =  dynamic_cast <Span_bar *> (i.elem_l_);
-      Piano_brace * piano_l = (Piano_brace*) b;
-      piano_l->extra_move_left_f_  = paper ()->interline_f (); // ugh
+      if (b->type_str_ == "{")
+       b->extra_x_off_ -=  paper ()->interline_f (); // ugh
     }
 }
 
index cbf3f2e7c305c2a3add6243e33faf9d85fb5f48b..d3334fb478d499915cc7b410716c65ea30bb1c47 100644 (file)
@@ -31,7 +31,7 @@ Spring_spacer::default_solution() const
 Score_column*
 Spring_spacer::scol_l (int i)
 {
-  return (Score_column*)cols_[i].pcol_l_;
+  return dynamic_cast<Score_column*>(cols_[i].pcol_l_);
 }
 
 const Real COLFUDGE=1e-3;
@@ -394,7 +394,7 @@ Spring_spacer::add_column (Paper_column  *col, bool fixed, Real fixpos)
 Line_of_cols
 Spring_spacer::error_pcol_l_arr() const
 {
-  Array<Paper_column*> retval;
+  Link_array<Paper_column> retval;
   for (int i=0; i< cols_.size(); i++)
     if (cols_[i].ugh_b_)
       retval.push (cols_[i].pcol_l_);
@@ -599,7 +599,7 @@ Spring_spacer::calc_idealspacing()
          if (delta_t)
            {
              Real k=  paper_l()->arithmetic_constant (context_shortest_arr[i]);
-             durational_distance =  paper_l()->duration_to_dist (delta_t,k);
+             durational_distance =  paper_l()->length_mom_to_dist (delta_t,k);
            }
          symbol_distance += -cols_[i+1].width_[LEFT];
  
@@ -632,7 +632,7 @@ Spring_spacer::calc_idealspacing()
            }
          Moment delta_t = scol_l (i+1)->when() - scol_l (i)->when ();
          Real k=  paper_l()->arithmetic_constant(context_shortest);
-         Real dist = paper_l()->duration_to_dist (shortest_playing_len, k);
+         Real dist = paper_l()->length_mom_to_dist (shortest_playing_len, k);
          dist *= (double)(delta_t / shortest_playing_len);
 
          /*
@@ -682,8 +682,8 @@ Spring_spacer::calc_idealspacing()
          */
          if (i + 1 < cols_.size () && scol_l(i+1)->breakable_b_)
            {
-             // one interline minimum seems ok for last column too?
-             dist = dist >? interline_f;
+             // two interline minimum ok for last column?
+             dist = dist >? 2 * interline_f;
 
              // set minimum rod 
              /*
@@ -703,7 +703,7 @@ Spring_spacer::calc_idealspacing()
                -- jcn
               */
 
-             cols_[i].width_[RIGHT] = cols_[i].width_[RIGHT] >? interline_f;
+             cols_[i].width_[RIGHT] = cols_[i].width_[RIGHT] >? 2 * interline_f;
            }
 
          // ugh, do we need this?
index 3b1301cbb8a59b19cb900079816b6bf700299271..42dcf5c4460140d4f06c770c56328f5f1171aa45 100644 (file)
@@ -19,7 +19,7 @@ Staff_margin_engraver::Staff_margin_engraver ()
   axis_ = X_AXIS;
   type_ = "margin";
   visibility_lambda_
-    = gh_eval_str ("(lambda (d) (if (= d 1) '(#f . #f) '(#t . #t)))");
+    = gh_eval_str ("postbreak_only_visibility");
 }
 
 
@@ -49,7 +49,7 @@ Staff_margin_engraver::acknowledge_element (Score_element_info i)
 
   String long_str = get_property ("instrument", 0);
   String str = get_property ("instr", 0);
-  if (now_moment () > Moment (0) && str.length_i ())
+  if (now_mom () > Moment (0) && str.length_i ())
     long_str = str;
 
   if (long_str.empty_b ())
index 4c8cc8d6f799ce53b79167c18917352c684e252e..45d47a2e63f6c8918784eaa0d72ab2d96704a211 100644 (file)
@@ -97,9 +97,9 @@ Staff_performer::new_instrument_str ()
 void 
 Staff_performer::play (Audio_element* p)
 {
-  if (dynamic_cast<Audio_item *> (p)) 
+  if (Audio_item *ai = dynamic_cast<Audio_item *> (p)) 
     {
-      audio_staff_p_->add_audio_item ( (Audio_item*)p);
+      audio_staff_p_->add_audio_item (ai);
     }
   Performer::play (p);
 }
index 31180f0f6e9b2992cf774c65d5cae66f1e3b1d31..a88f1ba0381d6f998c0c9ef189509bb24e9caed4 100644 (file)
@@ -79,8 +79,6 @@ Staff_side::get_position_f () const
       if (!(abs (coordinate_offset_f_i) % 2))
        y += (Real)dir_ * inter_f;
     }
-//  else
-//    y = v[dir_] + 1 * dir_ * inter_f;
 
   return y;
 }
@@ -91,12 +89,6 @@ Staff_side::symbol_height() const
   return Interval (0,0);
 }
 
-Interval
-Staff_side::symbol_width () const
-{
-  return Interval (0,0);
-}
-
 void
 Staff_side::do_pre_processing ()
 {
@@ -123,7 +115,9 @@ Staff_side::symbol_extent () const
   if (axis_ == Y_AXIS)
     return symbol_height ();
   else
-    return symbol_width ();
+    {
+      assert (false);
+    }
 }
 
 
index 72cb1a93d1d219e0ab8b267f4e086dbbeb02b0cf..6ac749eb3f993108a437bea8f497e9c1ddc27b78 100644 (file)
@@ -44,22 +44,18 @@ Molecule*
 Staff_symbol::do_brew_molecule_p() const
 {
   Real w = extent (X_AXIS).length ();
-  Real left_dx = -spanned_drul_[LEFT]->extent (X_AXIS)[LEFT];
-  Real right_dx = spanned_drul_[RIGHT]->extent (X_AXIS)[RIGHT];
-  
   Paper_def * p = paper();
-  Atom rule  = lookup_l ()->rule_symbol (p->get_var ("rulethickness"),
-                                        w);
+  Molecule rule  = lookup_l ()->rule_symbol (p->get_var ("rulethickness"),
+                                            w);
   Real height = (no_lines_i_-1) * inter_note_f();
   Molecule * m = new Molecule;
   for (int i=0; i < no_lines_i_; i++)
     {
-      Atom a (rule);
+      Molecule a (rule);
       a.translate_axis (height - i * inter_note_f()*2, Y_AXIS);
       m->add_molecule (a);
     }
 
-  //  m->translate_axis (-left_dx, X_AXIS);
   return m;
 }
 
index 14f10606232709e3f20ec7ac28df8981914d84a1..bcc6934d535eab03edb1cfb2a4ac969aaa8a3a98 100644 (file)
@@ -10,7 +10,7 @@
 #include "proto.hh"
 #include "misc.hh"
 #include "debug.hh"
-#include "atom.hh"
+
 #include "stem.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
index 7c780fadd7244aab8c69e6f95b70ebd09d665644..7ddd077474d4a6add0cf8d0f2278a78f4e36813d 100644 (file)
@@ -125,13 +125,13 @@ void
 Stem::add_head (Rhythmic_head *n)
 {
   n->add_dependency (this);    // ?
-  if (dynamic_cast<Note_head *> (n))
+  if (Note_head *nh = dynamic_cast<Note_head *> (n))
     {
-      head_l_arr_.push ((Note_head*)n);
+      head_l_arr_.push (nh);
     }
-  else if (dynamic_cast<Rest *> (n))
+  else if (Rest *r = dynamic_cast<Rest *> (n))
     {
-      rest_l_arr_.push ((Rest*)n);
+      rest_l_arr_.push (r);
     }
 }
 
@@ -294,16 +294,16 @@ Stem::do_brew_molecule_p () const
   
   if (!invisible_b ())
     {
-      Atom ss =lookup_l ()->stem (stem_y[DOWN]*dy,
+      Molecule ss =lookup_l ()->stem (stem_y[DOWN]*dy,
                                     stem_y[UP]*dy);
-      mol_p->add_atom (ss);
+      mol_p->add_molecule (ss);
     }
 
   if (!beam_l_ && abs (flag_i_) > 2)
     {
-      Atom fl = lookup_l ()->flag (flag_i_, dir_);
+      Molecule fl = lookup_l ()->flag (flag_i_, dir_);
       fl.translate_axis(stem_y[dir_]*dy, Y_AXIS);
-      mol_p->add_atom (fl);
+      mol_p->add_molecule (fl);
     }
 
   if (head_l_arr_.size())
index d33baffddcf1ac9daa2b803489d76fc1369040aa..392aa8a0600cf62da1070c5280d72a56824cddf1 100644 (file)
@@ -5,7 +5,7 @@
 
   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-
+#if 0
 #ifndef __CYGWIN32__
 #include "proto.hh"
 #include "pcursor.hh"
@@ -22,3 +22,4 @@
 #include "plist.tcc"
 
 #endif
+#endif
index b55d3cb7431e4079630ebcf7d2536fa505ea4822..019157dfd11fda783346e7cc09e063cfbc60f125 100644 (file)
@@ -21,21 +21,6 @@ Text_def::staff_dir () const
   return DOWN;
 }
 
-Real
-Text_def::guess_width_f(Atom& a) const
-{
-  return a.dim_.x ().length ();
-}
-
-Interval
-Text_def::width (Paper_def * p) const
-{
-  Atom a = get_atom (p,CENTER);
-
-  Interval i (0, guess_width_f (a));
-  i += - (align_dir_ + 1)* i.center ();
-  return i;
-}
 
 void
 Text_def::do_print() const
@@ -59,12 +44,12 @@ Text_def::do_equal_b (General_script_def const *gdef) const
        && style_str_ == def->style_str_;
 }
 
-Atom
-Text_def::get_atom (Paper_def *p, Direction) const
+Molecule
+Text_def::get_molecule (Paper_def *p, Direction) const
 {
-  Atom a= p->lookup_l(0)->text (style_str_, text_str_);
+  Molecule a= p->lookup_l(0)->text (style_str_, text_str_);
 
-  a.translate_axis (-(align_dir_ + 1)* guess_width_f (a) / 2, X_AXIS);
+  a.translate_axis (-(align_dir_ + 1)* a.dim_[X_AXIS].center (), X_AXIS);
   
   return a;
 }
index ba48473450e0da8ea869d48cb70cac022a7e183d..f93b9d653f9437fbd047838c35e7d07f961ed89c 100644 (file)
@@ -82,7 +82,9 @@ Text_engraver::do_process_requests ()
       G_staff_side_item *ss = new G_staff_side_item;
       ss->set_victim (text);
       ss->dir_ = r->dir_;
-
+      Scalar p (get_property ("textstyle", 0)); // textStyle?
+      if (p.length_i ())
+       text->style_str_ = p;
       text->text_str_ = t->text_str_;
 
       announce_element (Score_element_info (text, r));
index 4768d9f96e9dde07bbc0fb67d8174b486f36e36e..05491f7c4b7267ac38316e235d9f5887dff4eb5b 100644 (file)
@@ -12,7 +12,7 @@
 #include "text-def.hh"
 #include "debug.hh"
 #include "paper-def.hh"
-#include "atom.hh"
+
 
 
 void
@@ -57,11 +57,11 @@ Text_spanner::do_post_processing()
 Molecule*
 Text_spanner::do_brew_molecule_p() const
 {
-  Atom tsym (spec_p_->get_atom (paper(),CENTER));
+  Molecule tsym (spec_p_->get_molecule (paper(),CENTER));
   tsym.translate (text_off_);
 
   Molecule*output = new Molecule;
-  output->add_atom (tsym);
+  output->add_molecule (tsym);
   return output;
 }
 
index 9a78dd4109829124ee8bddde34f71b32f2fd4876..2a8cc741dd1c5075d381ac13c87628a015c67cc9 100644 (file)
@@ -36,7 +36,7 @@ Tie_engraver::acknowledge_element (Score_element_info i)
   if (Note_head *nh = dynamic_cast<Note_head *> (i.elem_l_))
     {
       Note_req * m = dynamic_cast<Note_req* > (i.req_l_);
-      now_heads_.push (CHead_melodic_tuple (nh, m, now_moment()+ m->duration ()));
+      now_heads_.push (CHead_melodic_tuple (nh, m, now_mom()+ m->length_mom ()));
     }
 }
 
@@ -45,7 +45,7 @@ Tie_engraver::do_process_requests ()
 {
   if (req_l_)
     {
-      Moment now = now_moment ();
+      Moment now = now_mom ();
       Link_array<Note_head> nharr;
       
       stopped_heads_.clear ();
@@ -116,7 +116,7 @@ void
 Tie_engraver::do_post_move_processing ()
 {
   req_l_ =0;
-  Moment now = now_moment ();
+  Moment now = now_mom ();
   while (past_notes_pq_.size () && past_notes_pq_.front ().end_ < now)
     past_notes_pq_.delmin ();
 }
index 22ab2d9acc761770355926bb80694538e948e555..cdbc54aebed99bd81ba155e44fa789199bb764a1 100644 (file)
@@ -18,7 +18,7 @@ Time_description::str () const
   s += "at ";
   s += when_.str ();
   s +="\ntime_signature " + (whole_per_measure_/one_beat_).str () +":" +
-        (Rational (Rational (1)/one_beat_)).str ();
+        (Moment (Moment (1)/one_beat_)).str ();
   s += "\nposition " + to_str (bars_i_) + ":"+ whole_in_measure_.str () +"\n}\n";
   return s;
 }
@@ -69,7 +69,7 @@ Time_description::Time_description()
 void
 Time_description::add (Moment dt)
 {
-  assert (dt >= Rational (0));
+  assert (dt >= Moment (0));
   when_ +=  dt;
   whole_in_measure_ += dt;
 
@@ -84,7 +84,7 @@ void
 Time_description::set_time_signature (int l, int o)
 {
   assert (o);
-  one_beat_ = Rational (1)/Moment (o);
+  one_beat_ = Moment (1)/Moment (o);
   whole_per_measure_ = Moment (l) * one_beat_;
 }
 
@@ -102,7 +102,7 @@ Time_description::allow_time_signature_change_b()
 String
 Time_description::try_set_partial_str (Moment p) const
 {
-  if (p<Rational (0))
+  if (p<Moment (0))
        return (_ ("partial measure must be non-negative"));
   if (p > whole_per_measure_)
        return (_ ("partial measure too large"));
index de236c0c6e2bc8a0ba50d64b72f3901cd5a739e0..2df4423e79c0b1aeda771849a84a1f332fce29b6 100644 (file)
@@ -21,24 +21,20 @@ Time_signature::Time_signature ()
 Molecule*
 Time_signature::do_brew_molecule_p () const
 {
-  Atom s;
   if (time_sig_type_str_.length_i ())
     {
       if (time_sig_type_str_[0]=='1')
        {
          Array<int> tmparr = args_;
-         tmparr[1]= 0;
-         s = lookup_l ()->time_signature (tmparr);
+         return new Molecule( lookup_l ()->time_signature (args_[0], 0));
        }
       else
        {
-         s = lookup_l ()-> special_time_signature (time_sig_type_str_ ,args_);
+         return new Molecule( lookup_l ()-> special_time_signature (time_sig_type_str_ ,args_[0], args_[1]));
        }
     }
   else
-    s = lookup_l ()->time_signature (args_);
-  s.translate_axis (-s.extent ()[Y_AXIS].center (), Y_AXIS);
-  return new Molecule (Atom (s));
+    return new Molecule(lookup_l ()->time_signature (args_[0], args_[1]));
 }
 
 
index 8e8d58a76d1cce368b55da74997c734a0faffd18..26e2f21dec54a2df7b8b6881bc02c0a7557dd6b3 100644 (file)
@@ -74,7 +74,7 @@ Timing_translator::do_process_requests()
        }
       else if (Partial_measure_req *pm = dynamic_cast <Partial_measure_req *> (tr_l))
        {
-         Moment m = pm->duration_;
+         Moment m = pm->length_mom_;
          String error = time_.try_set_partial_str (m);
          if (error.length_i ())
            {
@@ -131,13 +131,13 @@ ADD_THIS_TRANSLATOR(Timing_translator);
 void
 Timing_translator::do_creation_processing()
 {
-  time_.when_ = now_moment ();
+  time_.when_ = now_mom ();
 }
 
 void
 Timing_translator::do_post_move_processing()
 {
-  time_.add (now_moment ()  - time_.when_);
+  time_.add (now_mom ()  - time_.when_);
 }
 
 void
index 60c608497638a0fc00fff68fd5c8996f93ab0cf1..98b09e0ce41453eedb12cecd6a0a34c75dd33e0f 100644 (file)
@@ -41,24 +41,3 @@ get_translator_l (String s)
   return 0;
 }
 
-Array<Translator_ctor> *ctor_global_static_arr_p_;
-
-
-/*
-  Very special greetings go out to Steve Jobs for creating a system 
-  that doesn't handle global construction correctly.
- */
-void
-add_constructor (Translator_ctor c)
-{
-  if (!ctor_global_static_arr_p_)
-    ctor_global_static_arr_p_ = new Array<Translator_ctor>;
-  ctor_global_static_arr_p_->push (c);
-}
-
-void
-call_constructors ()
-{
-  for (int i=0; i < ctor_global_static_arr_p_->size (); i++)
-    add_translator (ctor_global_static_arr_p_->elem (i) ());
-}
index b378cad83a0a5ace7287742686f7dc1210298fdf..49cf960b399ea7697e4743976002facdc89fc5cb 100644 (file)
@@ -245,7 +245,7 @@ Translator_group::nongroup_l_arr () const
 void
 Translator_group::terminate_translator (Translator*r_l)
 {
-  DOUT << "Removing " << classname (r_l) << " at " << now_moment () << '\n';
+  DOUT << "Removing " << classname (r_l) << " at " << now_mom () << '\n';
   r_l->removal_processing();
   Translator * trans_p =remove_translator_p (r_l);
 
index 30205ed7fd6e62e8fabd375c1422f8d81e8d37ab..2e20760894acadee45d66b2d6966d50e5c882bc3 100644 (file)
@@ -47,9 +47,9 @@ Translator::do_try_music (Music *)
                            
 
 Moment
-Translator::now_moment () const
+Translator::now_mom () const
 {
-  return daddy_trans_l_->now_moment ();
+  return daddy_trans_l_->now_mom ();
 }
 
 
index 5bcfa0aa5660741356f81e24b26e2fec00d44018..b751d5eae7d4d4a9ae825e4642c3e786ba9f79d0 100644 (file)
@@ -25,7 +25,7 @@ Tuplet_engraver::do_try_music (Music *r)
       if (!dynamic_cast<Request_chord*> (el))
        {
          compressed_music_arr_.push (c);
-         stop_moments_.push (now_moment () + c->duration ());
+         stop_moments_.push (now_mom () + c->length_mom ());
        }
       return true;
     }
@@ -66,7 +66,7 @@ Tuplet_engraver::acknowledge_element (Score_element_info i)
 void
 Tuplet_engraver::do_post_move_processing ()
 {
-  Moment now = now_moment ();
+  Moment now = now_mom ();
   for (int i= started_span_p_arr_.size (); i--; )
     {
       if (now >= stop_moments_[i])
index 8793d78271057721f38f6a8f7eb2aec26bcca751..9a0ea71eeb65e0614bef9d05bd088dc5828e8f2a 100644 (file)
@@ -9,7 +9,7 @@
   todo: handle breaking elegantly.
  */
 #include "beam.hh"
-#include "atom.hh"
+
 #include "box.hh"
 #include "debug.hh"
 #include "lookup.hh"
@@ -39,11 +39,12 @@ Tuplet_spanner::do_brew_molecule_p () const
 
   if (column_arr_.size ()){
     Real ncw = column_arr_.top ()->extent (X_AXIS).length ();
-    Atom num (tdef_p_->get_atom (paper (), CENTER));
+    Molecule num (tdef_p_->get_molecule (paper (), CENTER));
 
     if (beam_l_ && !bracket_visibility_b_)
       {
-       num.translate (((Directional_spanner*)beam_l_)->center ());
+       Directional_spanner* ds = dynamic_cast<Directional_spanner*>(beam_l_);
+       num.translate (ds->center ());
        num.translate_axis (ncw, X_AXIS);
       }
     
@@ -54,11 +55,11 @@ Tuplet_spanner::do_brew_molecule_p () const
        Real w = extent (X_AXIS).length () + ncw;
 
        num.translate (Offset (w/2, dy/2));
-       mol_p->add_atom (lookup_l ()->plet (dy, w, dir_));
+       mol_p->add_molecule (lookup_l ()->plet (dy, w, dir_));
       }
 
     if (num_visibility_b_)
-      mol_p->add_atom (num);
+      mol_p->add_molecule (num);
   }
   return mol_p;
 }
index 4ce91373f29f9ad32ea91fd1dd52b5f18054a218..970e2839d75f42a2f9708d112c968761e4d038d9 100644 (file)
@@ -6,7 +6,7 @@
   (c)  1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#include "atom.hh"
+
 #include "box.hh"
 #include "debug.hh"
 #include "lookup.hh"
@@ -22,7 +22,6 @@
 
 template class P<Text_def>;            // UGH
 
-
 Volta_spanner::Volta_spanner ()
 {
   last_b_ = false;
@@ -45,9 +44,9 @@ Volta_spanner::do_brew_molecule_p () const
   Real internote_f = paper ()->internote_f ();
   Real dx = internote_f;
   Real w = extent (X_AXIS).length () - dx;
-  Atom volta (lookup_l ()->volta (w, last_b_));
+  Molecule volta (lookup_l ()->volta (w, last_b_));
   Real h = volta.dim_.y ().length ();
-  Atom num (number_p_->get_atom (paper (), LEFT));
+  Molecule num (number_p_->get_molecule (paper (), LEFT));
   Real dy = column_arr_.top ()->extent (Y_AXIS) [UP] > 
      column_arr_[0]->extent (Y_AXIS) [UP];
   dy += 2 * h;
@@ -59,12 +58,16 @@ Volta_spanner::do_brew_molecule_p () const
     dy = dy >? note_column_arr_[i]->extent (Y_AXIS).max ();
   dy -= h;
 
-  Real gap = num.dim_.x ().length () / 2;
+  Text_def two_text;
+  two_text.text_str_ = "2";
+  two_text.style_str_ = number_p_->style_str_;
+  Molecule two (two_text.get_molecule (paper (), LEFT));
+  Real gap = two.dim_.x ().length () / 2;
   Offset off (num.dim_.x ().length () + gap, 
              h / internote_f - gap);
   num.translate (off);
-  mol_p->add_atom (volta);
-  mol_p->add_atom (num);
+  mol_p->add_molecule (volta);
+  mol_p->add_molecule (num);
   mol_p->translate (Offset (0, dy));
   return mol_p;
 }
@@ -78,7 +81,7 @@ Volta_spanner::do_add_processing ()
       set_bounds (RIGHT, column_arr_.top ());  
     }
 
-  number_p_->style_str_ = "number-1";
+  number_p_->style_str_ = "number"; // number-1
 }
   
 Interval
diff --git a/ly/auto-beam-settings.ly b/ly/auto-beam-settings.ly
new file mode 100644 (file)
index 0000000..d528021
--- /dev/null
@@ -0,0 +1,24 @@
+%
+% setup for auto beamer
+%
+time2_8beamAutoEnd = "2/8";
+time3_2beamAutoEnd = "1/2";
+time3_2beamAutoEnd16 = "1/4";
+time3_2beamAutoEnd32 = "1/8";
+time3_4beamAutoBegin = "1/4";
+time3_4beamAutoEnd8 = "3/4";
+time3_4beamAutoEnd32 = "1/8";
+time3_8beamAutoBegin = "1/8";
+time3_8beamAutoEnd = "3/8";
+time4_4beamAutoEnd8 = "1/2";
+time4_4beamAutoEnd32 = "1/8";
+time4_8beamAutoEnd8 = "1/4";
+time4_8beamAutoEnd16 = "1/4";
+time4_8beamAutoEnd32 = "1/8";
+time4_16beamAutoEnd = "1/8";
+time6_8beamAutoEnd8 = "3/8";
+time6_8beamAutoEnd16 = "3/8";
+time6_8beamAutoEnd32 = "1/8";
+time9_8beamAutoEnd8 = "3/8";
+time9_8beamAutoEnd16 = "3/8";
+time6_8beamAutoEnd32 = "1/8";
index 14c25e424a97cb10f319ad6fbc5a20c84125b0ed..a76c0abcbbff6019e24ade0c77a16bc9d7545c9d 100644 (file)
@@ -40,7 +40,7 @@ minor = 3
 
 \include "property.ly"
 
-\scmfile "lily.scm";
+
 
 unusedEntry = \notes { c4 }            % reset default duration
 
index 68f02880db4034a7ebd55169a73c21cc959a8915..2602a61787de833f6c5c5e3914601cc0d206f934 100644 (file)
@@ -2,28 +2,29 @@
 % declare the standard dynamic identifiers.
 %
 
-pppppp = \absdynamic { 13 }
-ppppp = \absdynamic { 12 }
-pppp = \absdynamic { 11 }
-ppp = \absdynamic { 10 }
-pp = \absdynamic { 9 }
-p = \absdynamic { 8 }
-mp = \absdynamic { 7 }
-mf = \absdynamic { 6 }
-f = \absdynamic { 5 } % f is a notename too.
-ff = \absdynamic { 4 }
-fff = \absdynamic { 3 }
-ffff = \absdynamic { 2 }
-fffff = \absdynamic { 1 }
-ffffff = \absdynamic { 0 }
+pppppp = \absdynamic { "pppppp" }      % Yeah yeah, \absdynamic "foo"; would/should also work. 
 
-fp = \absdynamic { 14 }
-sf = \absdynamic { 15 }
-sff = \absdynamic { 16 }
-sfz = \absdynamic { 17 }
-sp = \absdynamic { 18 }
-spp = \absdynamic { 19 }
-rfz = \absdynamic { 20 }
+ppppp = \absdynamic { "ppppp" }
+pppp = \absdynamic { "pppp" }
+ppp = \absdynamic { "ppp" }
+pp = \absdynamic { "pp" }
+p = \absdynamic { "p" }
+mp = \absdynamic { "mp" }
+mf = \absdynamic { "mf" }
+f = \absdynamic { "f" }
+ff = \absdynamic { "ff" }
+fff = \absdynamic { "fff" }
+ffff = \absdynamic { "ffff" }
+fffff = \absdynamic { "fffff" }
+ffffff = \absdynamic { "ffffff" }
+
+fp = \absdynamic { "fp" }
+sf = \absdynamic { "sf" }
+sff = \absdynamic { "sff" }
+sfz = \absdynamic { "sfz" }
+sp = \absdynamic { "sp" }
+spp = \absdynamic { "spp" }
+rfz = \absdynamic { "rfz" }
 
 cr = \spandynamic { 1 1 } 
 decr = \spandynamic { -1 1 }
index f98ac790802d1a8fa872817db0e2e8d97b758b9c..f434d57cf425e990e15d72867dfb9fdd32507d41 100644 (file)
@@ -127,6 +127,8 @@ barthick_thin = 1.6*\staffline;
 tuplet_thick = 1.0*\staffline;
 volta_thick = 1.6*\staffline;
 
+extender_height = 0.8*\staffline;
+
 
 \include "engraver.ly";
 
index d572351c07e2e624e11165b0b061fa68c8be3752..fbd082d12ff79ed6d650069b66038254db7e1dd6 100644 (file)
@@ -56,6 +56,7 @@ barAlways             1       generate bar at every moment
 [Staff]
 barAuto                        0       none
 barAuto                        1       auto-generate bar every measure
+barAtLineStart         0/1     generate bar at beginning of line
 
 [Staff]
 beamAuto                0/1     auto-beam on/off
@@ -72,6 +73,8 @@ timeSignatureStyle    oldn/m  Set symbol explicitly,
                                n/m=2/2,3/2,3/4,4/4,6/4 or 9/4.
 [Staff]
 voltaVisibility         0/1     on/off
+voltaSpannerDuration    Rat.    Coda kludge: set length of volta-spanner,
+                                typically set to one measure: "1"
 
 [Staff?]
 instrument             ascii   midi instrument table lookup
index 57f966047c93583d87fe7a133515e06063d51f8c..b2db6331c515640eeb975182d0b2db7207663879 100644 (file)
@@ -6,8 +6,7 @@ STEPMAKE_TEMPLATES=metafont metapost install install-out
 
 EXTRA_DIST_FILES += TODO README feta.mp mfplain.ini
 
-FET_FILES = $(wildcard feta[0-9]*.mf) feta-din10.mf \
-  $(wildcard feta-nummer[0-9]*.mf)
+FET_FILES = $(wildcard feta[0-9]*.mf)
 
 LYTABLES = $(addprefix $(outdir)/, $(FET_FILES:.mf=.ly))
 LOG_FILES = $(addprefix $(outdir)/, $(FET_FILES:.mf=.log))
index 0067bb3c4ac05ada532cb1d8bb3d296e2d33a794..0a124358175b3125f99030423f66c86c9ea7c3be 100644 (file)
@@ -1,5 +1,7 @@
 % -*- Fundamental -*-
 
+
+
 accreg_dot_size# := .7interline#;
 accreg_linethickness# := 1.3stafflinethickness#;
 
index 410e4375bf7968ea439a11fd7a9307a669c6d68f..3aac7752a9f2e12a563bb7de9a445f557c02b4f3 100644 (file)
@@ -1,4 +1,4 @@
-% 
+%  -*-Fundamental-*-
 % feta-bolletjes.mf --  implement noteheads
 % 
 % source file of LilyPond's pretty-but-neat music font
@@ -16,7 +16,7 @@
 save black_notehead_width;
 numeric black_notehead_width;
 
-fet_begingroup("balls");
+fet_begingroup("noteheads");
 
 noteheight#:=interline#+ (1 + overdone_heads) *stafflinethickness#;
 define_pixels(noteheight);
@@ -74,12 +74,19 @@ def draw_ledger(expr wid)=
        draw z1 .. z2;
 enddef;
 
+fet_beginchar("Ledger ending", "ledgerending", "ledgerending")
+set_char_box (5/2 ledgerlinethickness#, 5/2 ledgerlinethickness#,
+               ledgerlinethickness#/2,ledgerlinethickness#/2);
+        pickup pencircle scaled ledgerlinethickness;
+       lft x1 = -b;
+       rt x2 = w;
+       y1 =0; y2 =0;
+       draw z1 .. z2;
+fet_endchar;
+
 fet_beginchar("Brevis notehead", "-1", "brevisball")
        draw_brevis(brevis_wid#);
 fet_endchar;
-fet_beginchar("Brevis ledger", "-1l", "brevisledger")
-       draw_ledger(brevis_wid#);
-fet_endchar;
 
 %
 % Some sources (eg Musix/OpusTeX think that the appendage should be on
@@ -97,9 +104,6 @@ fet_beginchar("Longa notehead", "-2", "longaball");
        fill z7r .. z6r{z6-z7} .. {z7-z6} z6l -- z7l -- cycle;
        penlabels(6,7);
 fet_endchar;
-fet_beginchar("Longa ledger", "-2l", "longaledger")
-       draw_ledger(brevis_wid#);
-fet_endchar;
 
 
 % setup user vars
@@ -175,9 +179,6 @@ fet_beginchar("Whole notehead", "0", "wholeball")
 fet_endchar;
 
 
-fet_beginchar("Whole ledger line", "0l", "wholeledger")
-       draw_ledger(whole_notehead_width#);
-fet_endchar;
 
 % half note
 % Wanske, p.39
@@ -207,9 +208,6 @@ fet_beginchar("Half notehead", "1",
 fet_endchar;
 
 
-fet_beginchar("Half ledger", "1l", "halfledger")
-       draw_ledger(half_notehead_width#);
-fet_endchar;
 
 % quarter note
 % Wanske p.38
@@ -235,9 +233,6 @@ fet_beginchar("Quart notehead", "2", "quartball")
 fet_endchar;
 
 
-fet_beginchar("Quart ledger", "2l", "quartledger")
-       draw_ledger(black_notehead_width#);
-fet_endchar;
 
 
 
@@ -316,11 +311,8 @@ fet_beginchar("Harmonic notehead","harmonic","harmonicball")
        draw_harmonic_notehead(harmonic_wid#)
 fet_endchar;
 
-fet_beginchar("Harmonic ledger", "harmonicl", "harmonicledger")
-        draw_ledger(harmonic_wid#);
-fet_endchar;
 %fi
 
-fet_endgroup("balls");
+fet_endgroup("noteheads");
 
 define_pixels(black_notehead_width);
index 46256868619f607ec7b1c3055909d407f72a7d11..498d09a1b65ff0e02e63086e056583eb205d9107 100644 (file)
@@ -152,8 +152,6 @@ lower = \type Staff \notes \relative c{
     \translator{ \OrchestralScoreContext }
     \translator{
            \VoiceContext
-           \consists Auto_beam_engraver;
-           beamAuto = 1.;
            beamAutoEnd8 = "1/4";
            beamAutoEnd16 = "1/4";
     }
index 2b1d22055e4c8bcdabe1d617e56f1df0a80beaa2..757db58c92f86b5e848b84ccd6099868351d242f 100644 (file)
@@ -133,13 +133,6 @@ global = \notes{
                        minVerticalAlign = 3.0*\staffheight;
                        maxVerticalAlign = 3.0*\staffheight;
                }
-               \translator{
-                       \VoiceContext
-                       \consists Auto_beam_engraver;
-                       beamAuto = "1";
-                       beamAutoEnd8 = "1/2";
-                       beamAutoEnd16 = "1/4";
-               }
        }
        \midi{ \tempo 4 = 80; }
        \header {
index d8bf07e30026ddd8f1bbee9fae224e4ff216cc65..91b3d1eab89daa9e074cdea1b97484193d151a2a 100644 (file)
@@ -114,13 +114,6 @@ global = \notes{
        \paper{
                \include "preludes-paper.ly";
                gourlay_maxmeasures = 4.0;
-               \translator{
-                       \VoiceContext
-                       \consists Auto_beam_engraver;
-                       beamAuto = "1";
-                       beamAutoEnd8 = "1/2";
-                       beamAutoEnd16 = "1/4";
-               }
        }
        \midi{ \tempo 4 = 100; }
        \header {
index 88b12333034c33d18207cf0da67e30f4efc2f235..757de5889b6ade39084a6561df9a7626717a5fd2 100644 (file)
@@ -210,13 +210,6 @@ global = \notes{
                        minVerticalAlign = 3.0*\staffheight;
                        maxVerticalAlign = 3.0*\staffheight;
                }
-               \translator{
-                       \VoiceContext
-                       \consists Auto_beam_engraver;
-                       beamAuto = "1";
-                       beamAutoEnd8 = "1/2";
-                       beamAutoEnd16 = "1/4";
-               }
        }
        \midi{ \tempo 4 = 70; }
        \header{
index 7f7c3b03ffdd8f9a879a88abd8055ffc09b19831..7073930a1e7cecd7de0984faf645b9647b7f5c23 100644 (file)
@@ -205,13 +205,6 @@ global = \notes{
                        minVerticalAlign = 3.0*\staffheight;
                        maxVerticalAlign = 3.0*\staffheight;
                }
-               \translator{
-                       \VoiceContext
-                       \consists Auto_beam_engraver;
-                       beamAuto = "1";
-                       beamAutoEnd8 = "3/4";
-                       beamAutoEnd16 = "1/4";
-               }
        }
        \midi{ \tempo 4 = 90; }
        \header{
index 1a11dcfc489683bee2a8dc13b5ff2850dbd39811..dd1472ae6a2a110633884ad6ccb4d4560ab9265b 100644 (file)
@@ -124,14 +124,6 @@ global = \notes{
                        minVerticalAlign = 3.0*\staffheight;
                        maxVerticalAlign = 3.0*\staffheight;
                }
-               \translator{
-                       \VoiceContext
-                       \consists Auto_beam_engraver;
-                       beamAuto = "1";
-                       beamAutoEnd8 = "1/2";
-                       beamAutoEnd16 = "1/4";
-                       beamAutoEnd32 = "1/4";
-               }
        }
        \midi{ \tempo 4 = 40; }
        \header{
index 3c909d4daf754f0f6f2023c0160ac3b241b89e5e..145e9737475834484c42386d80edcf224ab375f7 100644 (file)
@@ -1,11 +1,3 @@
 linewidth = 180.\mm;
 gourlay_maxmeasures = 10.0;
 \translator { \BarNumberingStaffContext }
-\translator {
-       \VoiceContext
-       \consists Auto_beam_engraver;
-       beamAuto = 1.0;
-       beamAutoEnd8 = "1/4";
-       beamAutoEnd16 = "1/4";
-       beamAutoEnd32 = "1/4";
-}
index 3ae97919be75f17ccc2043b922e677caa1d9bbf1..7166c55fdb3660d093354afe12f76e23e2984196 100644 (file)
@@ -194,13 +194,6 @@ bassdux = \type Voice=three \notes \relative c' {
            minVerticalAlign = 3.0*\staffheight;
            maxVerticalAlign = 3.0*\staffheight;
        }
-       \translator {
-           \VoiceContext
-           \consists Auto_beam_engraver;
-           beamAuto = 1.;
-           % eights end at 1/2, 16 at 1/4
-           beamAutoEnd = "1/2";
-       }
     }
     \header{
        opus = "BWV 847";
index 90735771b948c9c10f8baa98a6bc7b61b1397e8b..9c1710e3b2175cc08ff9e88a6c83f6bb782fa81e 100644 (file)
@@ -96,7 +96,8 @@
        stroke
 } bind def
 
-/draw_slur
+% this is for drawing slurs.
+/draw_bezier_sandwich 
 {
        stafflinethickness setlinewidth
        moveto
index c215e827ad32b5840e7dcd039ac302ca687a99c4..b0dc1b9a83da3d33829d5c6809ef143d511bce46 100644 (file)
@@ -4,10 +4,8 @@
 ; 
 ; (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
 
-; TODO
-;   - naming
-;   - ready ps code (draw_bracket) vs tex/ps macros/calls (pianobrace),
-;     all preparations from ps,tex to scm
+
+(debug-enable 'backtrace)
 
 ;;; library funtions
 (define
 (define security-paranoia #f)
 
 
-;;;;;;;;
-;;; UGH.  THESE SUCK!
-
-(define (empty) 
-  "")
-
-(define (empty1 a)
-  "")
-
-(define (empty2 a b )
-  "")
-
-(define emptybar empty1)
-
-;;; and these suck as well.
-(define (setdynamic s) (text "dynamic" (string-append "\\" s)))
-(define (setroman s) (text "text" s))
-(define (settypewriter s) (text "typewriter" s))
-(define (setnumber s) (text "number" s))
-(define (setbold s) (text "bold" s))
-(define (setlarge s) (text "large" s))
-(define (setLarge s) (text "Large" s))
-(define (setmark s) (text "mark" s))
-(define (setfinger s) (text "finger" s))
-(define (setitalic s) (text "italic" s))
-(define (setnumber-1 s) (text "numberj" s))
-  
+;; See documentation of Item::visibility_lambda_
+(define (postbreak_only_visibility d) (if (= d 1) '(#f . #f) '(#t . #t)))
+(define (non_postbreak_visibility d) (if (= d -1) '(#t . #t) '(#f . #f)))
+(define (spanbar_non_postbreak_visibility d) (if (= d -1) '(#t . #t) '(#f . #f)))
+(define (spanbar_postbreak_only_visibility d) (if (= d 1) '(#f . #f) '(#t . #t)))
 
 
 ;;;;;;;; TeX
   (define (unknown) 
     "%\n\\unknown%\n")
 
+  (define font-alist '())
+  (define font-count 0)
+  (define current-font "")
+  (define (clear-fontcache)
+    (begin
+      (set! font-alist '())
+      (set! font-count 0)
+      (set! current-font "")))
+  
+  (define (cached-fontname i)
+    (string-append
+     "\\lilyfont"
+     (make-string 1 (integer->char (+ 65 i)))
+     )
+    )
+    
+  (define (select-font font-name)
+      (if (not (equal? font-name current-font))
+         (begin
+           (set! current-font font-name)
+           (define font-cmd (assoc font-name font-alist))
+           (if (eq? font-cmd #f)
+               (begin
+                 (set! font-cmd (cached-fontname font-count))
+                 (set! font-alist (acons font-name font-cmd font-alist))
+                 (set! font-count (+ 1 font-count))
+                 (string-append "\\font" font-cmd "=" font-name font-cmd)
+                 )
+               (cdr font-cmd))
+           )
+         
+         ""                            ;no switch needed
+
+         )
+      
+      )
+
+
+  
   (define (beam width slope thick)
     (embedded-ps ((ps-scm 'beam) width slope thick)))
 
   (define (decrescendo w h cont)
     (embedded-ps ((ps-scm 'decrescendo) w h cont)))
 
-  (define 
-    (doublebar h)
-    (invoke-dim1  "doublebar" h))
 
   (define (embedded-ps s)
     (string-append "\\embeddedps{" s "}"))
   
   (define (experimental-on) "\\turnOnExperimentalFeatures")
 
-  (define (extender h)
-    (invoke-dim1 "extender" h))
 
-  (define
-    (fatdoublebar h)
-    (invoke-dim1  "fatdoublebar" h))
 
-  (define
-    (finishbar h)
-    (invoke-dim1  "finishbar" h))
+
 
   (define (font-switch i)
     (string-append
     (string-append
      "{\\bracefont " (char  (/  (- (min y (- maxht step)) minht)   step)) "}"))
   
-  (define
-    (repeatbar h)
-    (invoke-dim1  "repeatbar" h))
 
-  (define
-    (repeatbarstartrepeat h)
-    (invoke-dim1  "repeatbarstartrepeat" h))
 
   (define (rulesym h w) 
     (string-append 
      )
     )
 
-  (define (slur l)
-    (embedded-ps ((ps-scm 'slur) l)))
-
-  (define
-    (startbar h)
-    (invoke-dim1  "startbar" h))
+  (define (bezier-sandwich l)
+    (embedded-ps ((ps-scm 'bezier-sandwich) l)))
 
-  (define
-    (startrepeat h)
-    (invoke-dim1  "startrepeat" h))
 
-  (define (start-line) 
-    (string-append 
-     "\\hbox{%\n")
+  (define (start-line)
+    (begin
+      (clear-fontcache)
+      "\\hbox{%\n")
     )
 
-  (define (filledbox breapth width height depth
+  (define (filledbox breapth width depth height
     (string-append 
      "\\kern" (number->dim (- breapth))
      "\\vrule width " (number->dim (+ breapth width))
   (define (stop-line) 
     "}\\interscoreline")
 
-  (define
-    (stoprepeat h)
-    (invoke-dim1 "stoprepeat" h))
 
-  (define (text s)
-    (string-append "\\set" f "{" (output-tex-string s) "}"))
+  (define (text s)
+    (string-append "\\hbox{" (output-tex-string s) "}"))
   
   (define (tuplet dx dy thick dir)
     (embedded-ps ((ps-scm 'tuplet) dx dy thick dir)))
   (define (volta w thick last)
     (embedded-ps ((ps-scm 'volta) w thick last)))
 
-  (define (maatstreep h)
-    (string-append "\\maatstreep{" (number->dim h) "}"))
-  
-  ; urg: generate me
+
+  ;; The procedures listed below form the public interface of TeX-scm.
+  ;; (should merge the 2 lists)
   (cond ((eq? action-name 'all-definitions)
         `(begin
            (define beam ,beam)
            (define bracket ,bracket)
            (define crescendo ,crescendo)
            (define dashed-slur ,dashed-slur) 
-           (define doublebar ,doublebar)
-           (define emptybar ,emptybar)
            (define decrescendo ,decrescendo) 
-           (define empty ,empty)
            (define end-output ,end-output)
-           (define extender ,extender)
-           (define fatdoublebar ,fatdoublebar)
-           (define finishbar ,finishbar)
            (define font-def ,font-def)
            (define font-switch ,font-switch)
            (define generalmeter ,generalmeter)
            (define invoke-char ,invoke-char) 
            (define invoke-dim1 ,invoke-dim1)
            (define placebox ,placebox)
-           (define repeatbar ,repeatbar)
-           (define repeatbarstartrepeat ,repeatbarstartrepeat)
            (define rulesym ,rulesym)
-           (define slur ,slur)
-           (define startbar ,startbar)
-           (define startrepeat ,startrepeat)
-           (define stoprepeat ,stoprepeat)
+           (define bezier-sandwich ,bezier-sandwich)
+           (define select-font ,select-font)
            (define start-line ,start-line)
            (define filledbox ,filledbox)
            (define stop-line ,stop-line)
            (define text ,text)
            (define experimental-on  ,experimental-on)
            (define char  ,char)
-           (define maatstreep ,maatstreep)
            (define pianobrace ,pianobrace)
            (define volta ,volta)
            ))
        ((eq? action-name 'bracket) bracket)
        ((eq? action-name 'crescendo) crescendo)
        ((eq? action-name 'dashed-slur) dashed-slur) 
-       ((eq? action-name 'doublebar) doublebar)
        ((eq? action-name 'decrescendo) decrescendo) 
-       ((eq? action-name 'empty) empty)
        ((eq? action-name 'end-output) end-output)
-       ((eq? action-name 'extender) extender)
-       ((eq? action-name 'fatdoublebar) fatdoublebar)
-       ((eq? action-name 'finishbar) finishbar)
        ((eq? action-name 'font-def) font-def)
        ((eq? action-name 'font-switch) font-switch)
        ((eq? action-name 'generalmeter) generalmeter)
        ((eq? action-name 'invoke-char) invoke-char) 
        ((eq? action-name 'invoke-dim1) invoke-dim1)
        ((eq? action-name 'placebox) placebox)
-       ((eq? action-name 'repeatbar) repeatbar)
-       ((eq? action-name 'repeatbarstartrepeat) repeatbarstartrepeat)
        ((eq? action-name 'rulesym) rulesym)
-       ((eq? action-name 'slur) slur)
-       ((eq? action-name 'startbar) startbar)
-       ((eq? action-name 'startrepeat) startrepeat)
-       ((eq? action-name 'stoprepeat) stoprepeat)
+       ((eq? action-name 'bezier-sandwich) bezier-sandwich)
        ((eq? action-name 'start-line) start-line)
        ((eq? action-name 'stem) stem)
        ((eq? action-name 'stop-line) stop-line)
      (numbers->string (list w h (inexact->exact cont)))
      "draw_decrescendo"))
 
-  (define (empty) 
-    "\n empty\n")
 
   (define (end-output)
     "\nshowpage\n")
      (number->string y) " "
      "rulesym"))
 
-  (define (slur l)
+  (define (bezier-sandwich l)
     (string-append 
      (apply string-append (map control->string l)) 
-     " draw_slur"))
-
-  (define (start-line) 
-    "\nstart_line {\n")
+     " draw_bezier_sandwich"))
 
+  (define (start-line)
+    (begin
+      (clear-fontcache)
+      "\nstart_line {\n"))
+  
   (define (stem kern width height depth) 
     (string-append (numbers->string (list kern width height depth))
                   "draw_stem" ))
 
-  (define (stop-line) 
-    "}\nstop_line\n")
+  (define (stop-line)
+      "}\nstop_line\n")
 
   (define (text f s)
     (string-append "(" s ") set" f " "))
            (define bracket ,bracket)
            (define crescendo ,crescendo)
            (define volta ,volta)
-           (define slur ,slur)
+           (define bezier-sandwich ,bezier-sandwich)
            (define dashed-slur ,dashed-slur) 
            (define decrescendo ,decrescendo) 
-           (define empty ,empty)
+
            (define end-output ,end-output)
            (define font-def ,font-def)
            (define font-switch ,font-switch)
        ((eq? action-name 'bracket) bracket)
        ((eq? action-name 'crescendo) crescendo)
        ((eq? action-name 'volta) volta)
-       ((eq? action-name 'slur) slur)
+       ((eq? action-name 'bezier-sandwich) bezier-sandwich)
        ((eq? action-name 'dashed-slur) dashed-slur) 
        ((eq? action-name 'decrescendo) decrescendo)
        (else (error "unknown tag -- PS-SCM " action-name))
   )
   
 
+;
+; Russ McManus, <mcmanus@IDT.NET>  
+; 
+; I use the following, which should definitely be provided somewhere
+; in guile, but isn't, AFAIK:
+; 
+; 
 
+(define (hash-table-for-each fn ht)
+  (do ((i 0 (+ 1 i)))
+      ((= i (vector-length ht)))
+    (do ((alist (vector-ref ht i) (cdr alist)))
+       ((null? alist) #t)
+      (fn (car (car alist)) (cdr (car alist))))))
+
+(define (hash-table-map fn ht)
+  (do ((i 0 (+ 1 i))
+       (ret-ls '()))
+      ((= i (vector-length ht)) (reverse ret-ls))
+    (do ((alist (vector-ref ht i) (cdr alist)))
+       ((null? alist) #t)
+      (set! ret-ls (cons (fn (car (car alist)) (cdr (car alist))) ret-ls)))))
 
index 3e7f824e5fa78dd0dd70c7ef852bb622900759f9..b3ac3e42070af4e061c7910d099ed34ac220aecf 100644 (file)
 
 % stacked horizontal lines 
 \def\interscoreline{\vskip 16pt}
-\def\setdynamic#1{\dynfont #1}
-\def\setfinger#1{\fingerfont #1}
-\def\setnumber#1{\fetanummer #1}
-\def\setnumberj#1{\fetanummerj #1}
-\def\setmark#1{\markfont #1}
 
 % big fat marks, if errors are detected.
 \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}}
   %{\bf u} %FIXME
 }
 
-\input dyndefs
 \input fetdefs
 
 
-\def\deprecated#1S{%%%%%%%%%
-
-\def\emptybar{}
-
-
-
-\def\defaultthinbar{\thinbar{\staffheight}}
-\def\defaultthickbar{\thickbar{\staffheight}}
-%? what-s wrong with rightalign?
-\def\repeatstopbar{\rightalign{\repeatcolon\kern2\smallspace\defaultthinbar\kern\smallspace\defaultthickbar}}
-\def\repeatstartbar{\hbox{\defaultthickbar\kern\smallspace\defaultthinbar\kern2\smallspace\repeatcolon}}
-\def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\defaultthickbar\kern\smallspace\defaultthickbar\kern2\smallspace\repeatcolon}}
-
-%compatibility
-%urg
-\fetdef\repeatcolon{21}
-\def\repeatbar#1{\repeatstopbar}
-\def\startrepeat#1{\repeatstartbar}
-\def\repeatbarstartrepeat#1{\repeatstopstart}
-
-\def\doublebar#1{\hbox{\thinbar{#1}\hskip\smallspace\thinbar{#1}}}
-\def\thinbar#1{\dimen0=#1%
-        \vrule height .5\dimen0 depth .5\dimen0 width 1.6\stafflinethickness} % TODO parametric.
-\def\thickbar#1{\dimen0=#1%
-        \vrule height .5\dimen0 depth .5\dimen0 width 2\smallspace}
-\def\maatstreep#1{\thinbar{#1}}
-\def\startbar#1{\leftalign{\thickbar{#1}\kern\smallspace\thinbar{#1}}}
-\def\finishbar#1{\rightalign{\thinbar{#1}\kern\smallspace\thickbar{#1}}}
-\def\fatdoublebar#1{\hbox{\phantom{\repeatcolon\kern2\smallspace}\thickbar{#1}\kern\smallspace\thickbar{#1}}}
-}
-
-
-\def\extender#1{\vrule width#1 height .8\stafflinethickness}
-
 % ugh
 % see e.g. input/test/beam-pos.ly
 %