From: Han-Wen Nienhuys Date: Wed, 18 Nov 1998 16:09:22 +0000 (+0100) Subject: release: 1.1.7 X-Git-Tag: release/1.1.7 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bd0a24bfd5968f97b8817f6e1442403a35ebcdf6;p=lilypond.git release: 1.1.7 --- diff --git a/Documentation/tex/tutorial.yo b/Documentation/tex/tutorial.yo index 9beb9eb9ce..a20de9a2c0 100644 --- a/Documentation/tex/tutorial.yo +++ b/Documentation/tex/tutorial.yo @@ -14,7 +14,7 @@ pipethrough(date) sucks. paragraphs have too much space. -in stead <-> instead +instead <-> instead ) COMMENT( @@ -50,7 +50,7 @@ latexlayoutcmds( whenlatex(notableofcontents()) whentexinfo(notableofcontents()) -article(Mudela, the Music-Definition Language) +article(Mudela -- Using LilyPond to typeset music) (Han-Wen Nienhuys and Jan Nieuwenhuizen) (nop()PIPETHROUGH(date "+%B %d, %Y")()()nop()) @@ -73,8 +73,8 @@ If you are reading this, you probably are interested in printing music. LilyPond is a program that can print music from a specification that you, the user, supply. Using LilyPond may be a bit quaint in the beginning, because you have to give that specification -using a em(language) named mudela. This chapter is a gentle -introduction Mudela. +using a em(language). This document is a gentle introduction to that +language, which is called Mudela. We will demonstrate the working of Mudela by presenting a examples of input alongside with the resulting output. We will comment on these @@ -87,7 +87,8 @@ sect(The first tune) label(sec:firsttune) To demonstrate what LilyPond input looks like, we start off with a -full fledged (yet simple) example. It is somewhat convoluted version of one of the menuets in J.~S.~Bach's ``Clavierbuchlein". +full fledged (yet simple) example. It is somewhat convoluted version +of one of the menuets in bind(J.)bind(S.)Bach's em(Clavierbuchlein). mudela(verbatim)( % lines preceded by a percent are comments. @@ -100,7 +101,7 @@ mudela(verbatim)( 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] | + c4 [d8( )c b a( ] )b4 [c8 b a g] | a4 [b8 a g fis] g2. | \bar ":|"; % a repeat sign @@ -109,8 +110,7 @@ mudela(verbatim)( 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-. ] - % try some super and subscripts. + [a8-. b-. cis-. d-. e-. fis-. ] % try some super and subscripts. g4 fis e | fis a, r8 cis8 d2.-\fermata @@ -145,28 +145,32 @@ verb( Now for some explanation of the input itself, we will dissect the input line by line +verb(% lines preceded by a percent are comments.)COMMENT + +)The percent sign (code(%)) introduces a line comment. If you want +make larger comments, you can use block comments. These are delimited +by code(%{) and code(%}) + + verb(\input "paper16.ly") By default, LilyPond will use definitions for a staff of 20 point high. If you want smaller output (e.g., 16 point), you have to import the setting for that size. You can do this by including a file. -code(\include "file") is replaced by the contents of the code(file). +code(\include "file") is replaced by the contents of code(file). verb(\score { -) +) COMMENT( -A mudela file combines music with directions for outputting that +) A mudela file combines music with directions for outputting that music. The music is combined with the output directions by putting them into a code(\score) block. verb( \notes % get ready for notes -) -This makes LilyPond ready for accepting notes. The percent sign -(code(%)) introduces a line comment. If you want make larger -comments, you can use block comments. These are delimited by code(%{) -and code(%}) +) COMMENT( +)This makes LilyPond ready for accepting notes. verb( \relative c'' % octave quotes are relative now ) @@ -208,8 +212,10 @@ verb( \key G; ) COMMENT( -) This command changes the current key to G-major. Notice that in the -output, the key comes before the time signature, like it should be. +) This command changes the current key to G-major. Although +this command comes after the code(\time) command, in the +output, the key comes before the time signature: LilyPond knows about +music typesetting conventions. verb( d4 ) COMMENT( @@ -231,39 +237,52 @@ duration (It is not illegal to enter it anyway. Then you would have to enter code(a8 b8)) verb( c] -) -This ends the beam started 4 notes before at the c. In the output, +) 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 deduce where bars have to be by comparing durations of notes with the current time signature. verb( d4 g, g | -) -3 more notes. The code(|) is a "barcheck". When processing the +) COMMENT( + +) Three more notes: The code(|) is a "barcheck". When processing the music, LilyPond will check that barchecks are found at the start of -a bar precisely. This makes it easy to spot where one left out a -note. +a bar precisely. This makes it easy to spot where notes are forgotten. verb( e'4 [c8 d e fis] -) -Up till now, no notes were chromaticall altered. Here is the first -one that is: code(fis). Mudela by default uses Dutch note names, and -``Fis'' is the Dutch note name for ``F -sharp''. However, there is no sharp sign in the output. The program -keeps track of key signatures, and will only print accidentals if they -are needed. - -The next 2 lines are not very interesting, nothing happens what we -haven't seen already. The next line introduces a small new feature: +) COMMENT( + +) So far, no notes were chromatically altered. Here is the first one +that is: code(fis). Mudela by default uses Dutch note names, and +``Fis'' is the Dutch note name for ``F sharp''. However, there is no +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] | +) COMMENT( + +) The next line shows something new: a slur is a symbol that is +printed over several notes. 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. + verb( a4 [b8 a g fis] g2. | -) -A duration that is to be augmented with a duration dot, is notated +) COMMENT( + +) A duration that is to be augmented with a duration dot, is notated with a number followed by periods, as many as you want augmentation dots. verb( \bar ":|"; % a repeat sign +) COMMENT( + ) Lily can not detect where you want your music to be repeated, so you have to instruct her: a special bar symbol can be entered by the @@ -272,12 +291,15 @@ that you want. Then comes a semicolon to separate the string from the rest of the notes, analogously with code(\key) and code(\time). verb( 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 without. verb( - [a8-. b-. cis-. d-. e-. fis-. ] - % try some super and subscripts. + [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 @@ -285,19 +307,26 @@ abbreviated form, e.g., by using code(-.) for staccato as shown above. verb( fis a, r8 cis8 +) COMMENT( + ) Rests are denoted by the special notename code(r). You can also make an invisible rest by using the special notename code(s). -verb(d2.-\fermata) -Finally, all articulations has a verbose form, like code(\fermata). -The ``command'' COMMENT(Hi Adrian :-) -code(\fermata) is not part of the core of the language (most of the -other discussed elements are), but it is an abbreviation of a more -complicated description of a fermata. code(\fermata) refers to that -abbreviation and is therefore called an em(identifier). +verb( + d2.-\fermata +) COMMENT( + +) Finally, all articulations has a verbose form, like code(\fermata). +The ``command'' COMMENT(Hi Adrian :-) code(\fermata) is not part of +the core of the language (most of the other discussed elements are), +but it is an abbreviation of a more complicated description of a +fermata. code(\fermata) refers to that abbreviation and is therefore +called an em(identifier). verb( } +) COMMENT( + ) This ends the sequential music. @@ -319,7 +348,7 @@ Finally, the last brace ends the code(\score) block. There are a couple of things to note here. The input format tries to capture the meaning of em(music), and not notation. Therefore the -format contains musical concepts like pitches and durations, in stead +format contains musical concepts like pitches and durations, instead of symbols and positions. Second, the format tries to be em(context-free): a note will remain to sound the same regardless of the current time signature, the key nop(etc.)COMMENT(footnote The @@ -388,9 +417,11 @@ mudela()( } \paper { linewidth = -1.0; - \translator { \StaffContext - \remove "Staff_symbol_engraver"; - \remove "Bar_engraver"; + \translator { \type "Score_engraver"; + \name "Score"; + \consists "Note_heads_engraver"; + \consists "Stem_engraver"; + \consists "Rhythmic_column_engraver"; }}} ) @@ -505,14 +536,16 @@ mudela(verbatim, fragment)( You can nest simultaneous and sequential music in any way you want, e.g., mudela(verbatim,fragment)( - < { c''4 c''4 } - { c8 c } > + < { g''4 g''4 } + { c'8 c' } > ) As you can see, LilyPond has some difficulty typesetting this elegantly. To adequately solve this, you have to persuade LilyPond to make separate stems for both sequential music lists. This is a topic that is covered in bind(Section)ref(sec:polyphonic). +[Chords and relative mode] + sect(Adding nuances: articulation and dynamics) @@ -572,68 +605,63 @@ should not enter a dash between the name and the note.footnote(This mudela(verbatim,fragment)( c4 \ff c4 \fp c4 c4 \ppp c4 c4 \sfz ) + COMMENT(UGH) sect(Bridging the notes: beams, slurs and ties) -Up till now most of the typesetting concerned simple fixed symbols -only. Now we turn to variable symbols: symbols that run from one note -to another. In LilyPond terminology, such a symbol is called a -em(spanner). To print a spanner, you have to attach a marker to the -note that begins it and to the one that ends it. +Music typesetting does not use fixed symbols only. A lot of symbols +are variable: they run from one note to another. In LilyPond +terminology, such a symbol is called a em(spanner). To print a +spanner, you have to attach a marker to the note that begins it and to +the one that ends it. +It is your job to make sure that each spanner that you start, also ends. +If it doesn't, then Bad Things are likely to happen. If you end +spanners that are not started, LilyPond will +warn you about illegal ending markers. -The first example of such a symbol is the slur. For the slur, the -start marker is the opening parenthesis. It won't be a surprise that -the stopping marker is the closing parenthesis. +LilyPond has a few spanners +description( +dit(The slur) + The slur has the opening parenthesis as +start marker is. The stopping marker is the closing parenthesis. For example: mudela(fragment,center,verbatim)( c'4( )c'4 ) -Notice that the parentheses should be between the notes.footnote(The -location of the parentheses might be changed in a future version of -the language.) - -It is your job to make sure that each slur that you start also ends. -If it doesn't end, then Bad Things are likely to happen. The slur is -quite flexible: you can nest nop(slurs,)footnote(This is inconsistent -when compared to the syntax for articulation hints. This will be -fixed some time, we hope.) and you can connect a note with a slur on -both the left and the right side: + The slur is quite flexible: you can nest nop(slurs,)footnote(This is +inconsistent when compared to the syntax for articulation hints. This +will be fixed some time, we hope.) and you can connect a note with a +slur on both the left and the right side: mudela(fragment,verbatim,center)( c'4(( )c''4 )c'4( )g'4 ) -Another spanner is the beam (see bind(Figure)ref(mud:beam)). Strictly -speaking, a beam is not a musical concept. The pattern of a beam can -be derived from the structure of the time signature and the durations -of the notes. It is merely a device that helps you understand the -rhythms notated. Unfortunately, LilyPond is not smart enough to insert -beams into your music on her own. You will have to instruct her by -marking the starting and stopping point of the beam with `code([)' and -`code(])' respectively, e.g. +dit(Beam) -latexcommand(\begin{figure}[h]) - center( - mudela(fragment,verbatim, center)([c'8 c'] [c'16 c' c' c'] [c'16. c'32 c' c'16.] ) - latexcommand(\caption{Some beams}) - label(mud:beam) - ) -latexcommand(\end{figure}) +Another spanner is the beam. The starting marker is the opening +bracket, then ending marker is the closing bracket. The brackets have +to be em(around) the beamed notes. footnote(Strictly speaking, a +beam is not a musical concept: beaming doesn't change the meaning of +music, it only clarifies the rhythmic structure. One might argue that +beams should not be present in a "music" language. Unfortunately, +LilyPond is not smart enough to insert beams into music on its own. -LilyPond has code that guesses what the pattern should look like, so -that you don't have to specify the beaming for complicated -patterns.footnote(Unfortunately the algorithm used is not foolproof yet: - code([c8. c32 c32]) will produce incorrect results.) +LilyPond does have code that guesses what the pattern should look +like, so that you don't have to specify the beaming for complicated +patterns. Alas, the algorithm used is not foolproof +yet: code([c8. c32 c32]) will produce incorrect results.) -Again, it is your responsibility to make sure that you end every beam -that you start. +mudela(fragment,verbatim)( +[c'8 c'] [c'16 c' c' c'] [c'16. c'32 c' c'16.] +) -A third spanner is similar to the slur: the tie. The tie looks like a -slur, but a slur connects whole chords, whereas the tie connects -note heads. Tied notes should be played as one long note. -In analogy with TeX()'s tie (which ties together words with a -space), LilyPond's tie is entered as a tilde, `code(~)'. +dit(The tie) The tie is similar to the slur: it looks like a +slur, but a slur connects whole chords, whereas the tie connects note +heads. Tied notes should be played as one long note. In analogy with +TeX()'s tie (which ties together words with a space), LilyPond's tie +is entered as a tilde, `code(~)'. The input convention for the tilde is somewhat peculiar when used in conjunction with chords. Internally, the extra information that is @@ -644,7 +672,22 @@ directly after a note of the chords. It does not matter which one. The following example demonstrates the use of ties: mudela(fragment,verbatim,center)( c''1 ~ c''4 - + +) + +dit(Hairpins) +Crescendi and decrescendi can be printed in hairpin style. The +starting marker for the crescendo is code(\<), and for the decrescendo +code(\>). Both have code(\!) as the ending marker. +mudela(fragment, verbatim)( + c4 \< \! c4 \> \! c2 + < c1 + { s4 \< \! s4 \> \! s2 } > +) +This example shows a trick: by attaching the markings to space rests +that run parallel to the whole note, you can have dynamic markings +within a note. + ) sect(Commands) @@ -659,21 +702,39 @@ override some of the settings. This can be done by inserting various commands between the music. The general form of these commands is COMMENT( -)center( em(keyword) sc(arguments) ) +)center(code(\keyword argument argument ... ;)) + +These are the commands that are currently supported: +description( +dit(code(\bar) var(bartype)) + This command makes LilyPond print special bar + lines and repeat symbols. You can also use it to allow line breaks + when entering cadenzas. The argument var(bartype) is a string that + describes what kind of bar line to print. + +mudela(fragment,verbatim)( + \bar "|:"; c'4 \bar ":|:"; c'4 \bar ":|"; c'4 \bar "||"; + c'4 \bar "empty"; c'4 \bar "|."; +) + + The command `code(\bar "empty")' does not create any visible bar + line, but it tells LilyPond to allow a linebreak at that + position. The `code(\bar)' command prints the specified symbol + immediately. If you give a `code(\bar)' command at the end of a + measure then the specified symbol replaces the automatic bar line; + otherwise the specified symbol appears in the middle of the measure. + The code(\bar) command does not affect metric structure. -em(keyword)s are words that have a special meaning to the parser of -Mudela. Because the parser must be able to distinguish the keywords -from note names, they have to be preceded by a so-called escape -character, the backslash, `code(\)'. To separate the arguments from -any notes that might follow the arguments, you have to end your -command with a semicolon. An added benefit of this construction is -that the commands stand out between your notes, because of the -backslashes. +dit(code(\cadenza) var(togglevalue)) This command toggles the +automatic printing of barlines. `code(\cadenza 1)' turns off the +automatically generated bar lines. They are switched on again with +`code(\cadenza 0)'. Then a bar line is printed, and LilyPond will act +as if you are again at the start of a measure. -So the general form actually is `code(\keyword argument argument ... ;)' -Let us review these commands: -description( +This is useful when typesetting music without a meter (such as an ad + libitum cadenza). + dit(code(\clef) var(clefname)) This command sets the current clef for notation, i.e., a clef symbol is printed and the notes following this command are shifted vertically. The argument is a string, the name of the @@ -683,6 +744,7 @@ dit(code(\clef) var(clefname)) This command sets the current clef for notation, \clef "treble"; c'4 \clef "alto"; c'4 ) + dit(code(\key) var(pitch) var(type)) This command changes the current key signature. The key signature is printed at the start of every line. The var(type) argument is set to code(\major) or code(\minor) @@ -696,64 +758,22 @@ This command changes the current key signature. Unlike the `code(\key)' command, this command can produce arbitrary key signatures, which can be useful for unconventional keys or modes. The key signature is given in the form of a list of notes. The notes will -be printed in the key signature in the order that they appear on the list. -For example, the key -of C-minor can be specified as `code(\keysignature bes es as)'. The -command `code(\keysignature fis es bis)' provides a more exotic -example. +be printed in the key signature in the order that they appear on the +list. For example, the key of C-minor can be specified as +`code(\keysignature bes es as)'. The command `code(\keysignature fis +es bis)' provides a more exotic example. dit(code(\time) var(numerator)code(/)var(denominator)) - This command changes the current time signature. LilyPond uses the - time signature to - calculate where to place the bars that start a measure. These bars - in turn are the places where a system can be broken into lines. - - The default value for this time signature is common time (4/4). You - can also tell this from the Twinkle ``Twinkle Little -Star'' example in bind(Figure)ref(fig:twinkle1). This -song actually has a 2/4 time signature, so a metrically more correct - version would start with as follows: - mudela(fragment,center,verbatim)( - \time 2/4; c'4 c' g' g' - ) - - -dit(code(\cadenza) var(togglevalue)) When typesetting music without a -regular meter (such as an ad libitum cadenza), no bar lines should be -printed. In LilyPond you can achieve this by issuing the command -`code(\cadenza 1)': it turns off the automatically -generated bar lines. + This command changes the current time signature. + The default value for this time signature is common time (4/4). -You switch them on again with `code(\cadenza 0)', and then a bar line -is printed. LilyPond will act as if you are again at the start of a -measure. +dit(code(\partial) var(duration)) + This command allows you to make + upsteps at the start of a piece. + The var(duration) argument has the same form as the duration of a + note. -dit(code(\bar) var(bartype)) - This command lets you print special bar - lines and repeat symbols. You can also use it to allow line breaks - when entering cadenzas. The argument var(bartype) is a string that - describes what kind of bar line to print. - -mudela(fragment,verbatim)( - \bar "|:"; c'4 \bar ":|:"; c'4 \bar ":|"; c'4 \bar "||"; - c'4 \bar "empty"; c'4 \bar "|."; -) - The command `code(\bar "empty")' does not create any visible bar - line, but it does tells LilyPond to allow a linebreak - at that position. The `code(\bar)' command prints the specified - symbol immediately. If you give a `code(\bar)' command at the end - of a measure then - the specified symbol replaces the automatic bar line; otherwise - the specified symbol appears in the middle of the measure. The - code(\bar) command does not affect metric structure. - - - -dit(code(\partial) var(duration)) some music starts with a measure that -isn't fully filled, a so-called upstep. The code(\partial) command -allows you to make -upsteps. The argument is a duration similar to the duration of a note. The `code(\partial)' command cannot be used to generate partial measures in the middle of the music. Example: @@ -763,7 +783,7 @@ Example: [d'8 dis'] e' c''4 e'8 c''4 ) - dit(code(\grouping) var(durationslist)) sets the metric structure of the measure. +dit(code(\grouping) var(durationslist)) sets the metric structure of the measure. Its effect can best be shown by an example: mudela(fragment,verbatim)( \time 5/16; @@ -783,45 +803,44 @@ of 2 and 3 beats, with as many groups of (2+2), 8/8 in 3+3+2) ) -The commands that are described above aren't really music, but they -can be used in the same places as notes. This makes the grammar of the -language simpler. It is possible to put a command into a chord. -For example, the following two snippets of Mudela produce identical output. -verb( - - \time 2/4; -) +The commands described above aren't really music, but they can best be +thought as as notes with no duration. Since they are grammatically +equivalent to notes, these commands can be used in the same places as +notes: sect(Notation context) -This section is about translation contexts, a topic of LilyPond that +COMMENT(This section is about translation contexts, a topic of LilyPond that is somewhat advanced. You don't have to understand this to use LilyPond to print simple music. If you don't want to typeset fancy polyphonic music or tweak the LilyPond notation engine, you can skip -the next two sections. +the next two sections.) -In bind(Section)ref(tutorial:more-staffs) it was explained, that there +In bind(Section)ref(tutorial:more-staffs) it was explained that there are more ways to notate a simple chord: as a single voice on a single staff or in multiple staffs (and we'll soon see, that you can typeset -it as multiple voices on a staff). Obviously the concept of staff is not -really something musical. But what is it +it as multiple voices on a staff). Obviously the concept of staff is +not really something musical. But what is it then? -The most simplistic explanation is: a staff is a peculiarity of the -notation system. In other words, a staff is a graphic device, a -special picture of five lines on which one can print note heads. To -avoid confusion, we will call this view on the concept of staff -`staff symbol' from now on. +The most simplistic explanation is: a staff is a graphic peculiarity +of the notation system. In other words, a staff is a graphic device, +a special picture of five lines on which one can print note heads. We +will call this view on the concept of staff `staff symbol' from now +on. -There is more to it than meets the eye and mind. A staff +But +there is more to a staff than just the symbol. A staff contains---besides a staff symbol--- some more components: itemize( -it()A staff can have a key signature (printed at the left) +it()A staff can have a key signature (printed at the left) it()A staff can have a time signature (printed at the left) it()A staff has bar lines it()A staff has a clef (printed at the left) +) COMMENT( + ) -To explain what a staff really is, we'll try to print music without -these components. If these components aren't printed, it is still +To explain what a staff really is, we'll try to print music without +these components. Without those, it is still possible to print music: mudela()(\score{ \notes \relative c' { \time 2/4; g'4 c,4 a'4 f4 e c d2 } @@ -836,13 +855,13 @@ mudela()(\score{ \remove "Key_engraver"; } } -}) +})COMMENT( -As you can see, one can still make out the general form of the melody -and the rhythm that is to be played, but the notation is difficult to -read and the musical information is not complete. The stress pattern -in the notes can't be deduced from this output. For this, we need a -time signature: +) As you can see, you can still make out the general form of the +melody and the rhythm that is to be played, but the notation is +difficult to read. Moreover, the musical information is not complete. +The stress pattern in the notes can't be deduced from this output. +For this, we need a time signature: mudela()( \score { @@ -856,11 +875,11 @@ mudela()( \remove "Clef_engraver"; \remove "Key_engraver"; }} - }) + }) COMMENT( -Technically speaking you know where the strong and weak beats are, but +)Technically speaking you know where the strong and weak beats are, but it is difficult to find them quickly. Bar lines help you in finding -the location within the measure of the notes: +the location of the notes within the measure: mudela()( \score { \notes \relative c' { \time 2/4; g'4 c,4 a'4 f4 e c d2 } @@ -889,8 +908,9 @@ a'4 f4 e c d2 } \paper { \remove "Key_engraver"; } } -}) +})COMMENT( +) This makes the output decidedly easier to read, but you still don't know what the pitches of the notes above are. So this is still not enough. But suppose you see the following notation: @@ -899,9 +919,9 @@ mudela()(\score { \paper { linewidth = -1.; } -}) +})COMMENT( -Now you know the pitch of the notes: you look at the start of the line +) Now you know the pitch of the notes: you look at the start of the line and see a clef, with this clef, you can determine the notated pitches. You have found the em(context) in which the notation is to be interpreted! @@ -910,34 +930,30 @@ So the context determines the relationship between a piece of music and its notation: you, the reader, use context to deduce music from notation. Because LilyPond is a notation writer instead of a reader, context works the other way around for Lily: with context a piece of -music can be converted to notation. The components of a staff form -context, and context is needed to read and write notation. This -motivates the following definition. +music can be converted to notation. -quote( -A bf(notation context) is a conversion from music to notation. -) - -The example focused mainly on on staffs, but a staff is not the only -type of notation context. Notation contexts may be nested: you can -print polyphonic music by putting multiple `Voice' contexts in one -`Staff' context. The arguments of the code(\type) command (Staff, -GrandStaff) were in fact all names of different contexts. -The notions of ``current clef'' and ``current position within the -measure'' are all properties of notation contexts. Commands like -code(\clef) and code(\cadenza) change these properties. +We see that a staff forms context, and that context is needed to +convert between notation and music. In LilyPond we turn around this +reasoning: LilyPond has a notion of notation context, and the staff is +just one example of a notation context. In fact, the arguments of the +code(\type) command (Staff, GrandStaff) were all names of different +contexts. +We make one final observation before listing the standard notation +contexts. A score can contain many staffs; A staff can contain many +voices. This suggests that notation contexts are objects that can be +nested. The following is a list of the contexts that are supported by -LilyPond: +LilyPond. Each notation context is characterised by its name, the +notation elements it creates, and the contexts that it can contain. description( - dit(Voice) The code(Voice) context is a context that 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(Staff) The code(Staff) context handles clefs, bar lines, keys, - accidentals. A code(Staff) context can contain multiple code(Voice) + accidentals. A code(Staff) context can contain code(Voice) contexts. dit(RhythmicStaff) The code(RhythmicStaff) context is like the staff, @@ -947,11 +963,11 @@ dit(RhythmicStaff) The code(RhythmicStaff) context is like the staff, dit(GrandStaff) A code(GrandStaff) context contains code(Staff) contexts, and it adds a brace to the output at the nop(left.)footnote(This is a major deficiency in the current - implementation. Currently stems, - slurs and beams cannot be printed across two staffs. -In reality, a grand staff is a hybrid of one big staff and two stacked staffs.) + implementation. Currently stems, slurs and beams cannot be printed + across two staffs. In reality, a grand staff is a hybrid of one big + staff and two stacked staffs.) - A code(GrandStaff) context can contain multiple + A code(GrandStaff) context can contain code(Staff)s. Typically, it will contain two code(Staff)s, one treble staff, and one bass staff. The bar lines of the contained staffs are connected vertically. @@ -969,24 +985,31 @@ dit(Score) The code(Score) context is the toplevel context: no context can administration of time signatures. It also makes sure that items such as clefs, time signatures, and key-signatures are aligned across staffs. - The code(Score) can contain code(Staff), code(StaffGroup), code(Lyrics), code(GrandStaff) and - code(RhythmicStaff) contexts. + The code(Score) can contain code(Staff), code(StaffGroup), + code(Lyrics), code(GrandStaff) and code(RhythmicStaff) contexts. COMMENT(do ChoireStaff) ) - Later on, in bind(Section)ref(tutorial:engravers) we will -explain how you can create your own contexts. +If you are familiar with structured documents, you might see the +analogy of a context with a stylesheet: a stylesheet is neither +presentation nor information, but rather a recipe em(how) a specific +piece of information should be presented. The big difference with +stylesheets is that in music notation the elements provided by context +are essential to understanding what is notated. + +The notions of ``current clef'' and ``current position within the +measure'' are all properties of notation contexts. Commands like +code(\clef) and code(\cadenza) change these properties, and this +explains why they are fundamentally different from musical expressions +like notes and rests. + +A notation context is not a primitive element of LilyPond, but rather + Later on, in bind(Section)ref(tutorial:engravers) we will explain + how you can create your own contexts. + -If you are familiar with structured documents (like HTML, SGML or -LaTeX()), you might see the analogy of a context with a stylesheet: a -stylesheet is neither presentation nor information, but rather a -recipe em(how) a specific piece of information should be presented. -Analogously, a notation context is neither music nor notation, but the -conversion between the two. The big difference with text is that in -music notation the elements provided by context are essential to -understanding what is notated. sect(Nested music: more than one staff) @@ -1023,13 +1046,13 @@ expressed with the code(\type) construct. The following input says verb( \type Staff e'4 -)COMMENT ( +)COMMENT( ) The same can be done for the other note, i.e., verb( \type Staff g4 -) COMMENT ( +) COMMENT( ) If you want to stack these staffs, you must create a chord of both: @@ -1055,7 +1078,7 @@ mudela(verbatim,fragment)( < \type Staff = trebleStaff e'4 \type Staff = bassStaff g4 > -)COMMENT ( +)COMMENT( ) The names that you choose do not matter just as long as they are different. This is almost right, except for the brace at the left and @@ -1096,7 +1119,7 @@ verb( \type Voice = one ... \type Voice = two ... > -) COMMENT ( +) COMMENT( ) On the ellipsis there should be music going from left to right, in otherr words, there should be sequential music, notes enclosed in @@ -1111,10 +1134,8 @@ mudela(fragment,verbatim)( As you can see the result is not quite perfect. The notes on the last two beats look like plain chords and not like separate voices. What really happened was that the stems of the upper and lower voices were -printed on top of each other. If you have tried running this example, you will probably -have noticed a complaint about ``too many -clashing notecolumns'' during the LilyPond run. -This complaint refers to the overlapping stems. +printed on top of each other. + To remedy this, engravers traditionally make the stems of the upper and lower voice point in different directions: the stems of the lower @@ -1212,14 +1233,9 @@ lyrics we have to instruct LilyPond that what we enter are not note names but words---or rather: strings. This instruction is the keyword code(\lyrics). After entering this keyword you can enter a musical construct---sequential music, simultaneous music, code(\type) -entries, etc.--- but with syllables in stead of pitches. For example: +entries, etc.--- but with syllables instead of pitches. For example: verb( \lyrics { 'got8 me on my knees4, Le-8 lie! }) -The effect of code(\lyrics) can be compared with the effect of the -doublequote character, code("), for it also changes the lexical -meaning of spaces and characters. This mode is another example of a -handy input feature of the language. - Next comes the conversion to notation. LilyPond can't (yet) figure out that lyrics need different treatment than notes. As a result, the default conversion will try to put the text you entered as note heads @@ -1231,35 +1247,31 @@ the code(\type) keyword. Here is a simple example: mudela(fragment,verbatim)( \type Lyrics \lyrics { 'got8 me on my knees,4 Le-8 lie! }) -The result is technically more or less correct, but without a melody it +The result is technically correct, but without a melody it just doesn't work, so let's add a blob of cream: mudela(fragment,verbatim)( < \type Staff { 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 -The strings that makes up each syllable in the lyrics block are passed -along to TeX() verbatim, so if you are proficient with TeX() you can -do various nifty things. Just keep in mind that a syllable either -starts with a letter (a character in the range `code(a)' to `code(z)' -or `code(A)' to `code(Z)'), or it is a string enclosed quotes. It ends -with either a number for the duration, or a space. A last feature -that should be mentioned is the space-lyric: if you want to enter -a single ``syllable'' that consists of multiple words, i.e., words -separated by spaces, you should use an -underscore instead of a space. All these tricks are demonstrated in -the following example: +) The strings that makes up each syllable in the lyrics block are +passed along to TeX() verbatim, so if you are proficient with TeX() +you can do various nifty things. Just keep in mind that a syllable +either starts with a letter (a character in the range `code(a)' to +`code(z)' or `code(A)' to `code(Z)'), or it is a string enclosed +quotes. It ends with either a number for the duration, or a space. +All these tricks are demonstrated in the following example: COMMENT( urg -\type Lyrics \lyrics { 'got_m\textbf{e}4 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.} -\type Lyrics \lyrics { 'got_m{\bf e}4 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.} +\type Lyrics \lyrics { 'got8 m\textbf{e}8 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.} +\type Lyrics \lyrics { 'got8 m{\bf e}4 on8. m$\cal_Y$16 knees,4 Le-8 lie!4.} ) mudela(fragment,verbatim)(< \type Staff { c''8. c''16 bes'8. a'16 g'4 f'8 g'4. } - \type Lyrics \lyrics { 'got_me4 on8. m$\cal_Y$16 "3s,"4 Le-8 lie!4.} + \type Lyrics \lyrics { 'got8 me8 on8. m$\cal_Y$16 "3s,"4 Le-8 lie!4.} > ) @@ -1316,12 +1328,13 @@ Another interesting feature of this example are the assignments within the paper block. Some blocks, such as code(\paper), have a scope of their own. In the case of the code(\paper) block, these variables influence the characteristics of the output. As is shown, you can -tune quantities like the stemlength, and enter simple expressions. -The purpose of the negative linewidth is to prevent the music from -being justified. The identifiers that are meaningful are for the -paper block is strongly implementation dependent, so they will not be -listed here. Moreover, since most of the values are predefined to -sensible defaults, there usually is no need to tune these values. +tune quantities like the stemlength, and enter simple +nop(expressions.)footnote(The purpose of the negative linewidth is to +prevent the music from being justified.) The identifiers that are +meaningful are for the paper block is strongly implementation +dependent, so they will not be listed here. Moreover, since most of +the values are predefined to sensible defaults, there usually is no +need to tune these values. Recall the properties of a context, that could be set with code(\property). It is a very general mechanism to tune the output of @@ -1375,12 +1388,12 @@ sect(Sound output) label(tutorial:sound) You get output by combining music with definition a conversion to -output. Up till now we have only focused on the graphic output of -traditional engraving. But there is no reason why that should be the -only form of output for music. LilyPond currently supports one other -conversion: the conversion from abstract music to sound. You can have -LilyPond play the music that you entered. The format that is used -for this output is MIDI. +output. LilyPond currently supports one other conversion besides +notation: the conversion from abstract music to sound. You can have +LilyPond play the music that you entered. The format that is used for +this output is MIDI. The most useful purpose of this sound output is +to prooflisten your files: typing errors stand out when you listen, +especially if they involve accidentals. The only information that you need to enter is the nop(tempo)footnote(Unfortunately, @@ -1392,11 +1405,9 @@ verb( \score { ...music... \midi { \tempo 4 = 76; } -}) COMMENT ( +}) COMMENT( -) The most useful purpose of this sound output is to prooflisten your -files: typing errors stand out when you listen, especially if they -involve accidentals. The output was implemented in a very rudimentary +) The output was implemented in a very rudimentary manner, so it is probably not worth listening to for any other reason. @@ -1407,6 +1418,7 @@ As was promised, we will now take a dive into the more wizardrous parts of LilyPond: redefining (notation) contexts. We previously explained that a context itemize( +it()has a name it()is a conversion from music to notation, it()can contain other contexts it()handles specific notation constructs @@ -1447,10 +1459,9 @@ verb( propertyname = "value"; propertyname = "value"; -} ) - +}) COMMENT( -The code(\translator) keyword opens the block for translation (or +) The code(\translator) keyword opens the block for translation (or context) definition. The code(\type) keyword explains to Lily that the context should be formed by taking an (empty) instance of code(Engraver_group_engraver). The code(Engraver_group_engraver) is a @@ -1469,6 +1480,7 @@ which engravers should be part of the context. The code(\consists "Foobar") entry really means ``add an instance of code(Foobar) to the translation group.'' + You can also declare contexts, and reference them. This is useful in combination with code(\remove "..."): code(\remove) does the opposite of code(\consists) @@ -1533,7 +1545,7 @@ By naming other contexts that you create, you can reference other contexts than the current context from within the music. For example, from within the music that you enter for staff code(One), one could enter a small piece of music, and send it to staff code(Two), e.g., -COMMENT ( +COMMENT( ) mudela(fragment,verbatim)( < @@ -1543,24 +1555,23 @@ COMMENT ( ) -Another useful application of this feature is making Urtexts. -em(Urtext) is the German word for `original text'. The Urtext -edition of a piece of music, is an edition that reflects the original -writing of the composer. Such editions are useful for musicologists, -and performers that want to perform authentic interpretations. However, -for mere mortals, the Urtext can be quite hard to read. It might not -contain fingering and beaming, and typically it is full of footnotes. -Moreover, common interpretations may have emerged---after the composer -died. For this reason, the music that can be had as Urtext usually is also -available in enhanced and edited editions. - -The mechanism of context selection can be used to fabricate an Urtext -and an edited edition from em(one source). We will use the first few -bars of bind(J.)bind(S.)Bach's lovely Cello suite bind(no.)I to -demonstrate this. The example makes heavy use of space rests: a space -rest takes up time, like a rest does, but it doesn't print anything. -It can be used as a placeholder, to attach articulation marks to. It -is entered as a note with the name code(s). + +The mechanism of context selection can be used to fabricate an +nop(Urtext)footnote(em(Urtext) is the German word for `original text'. +The Urtext edition of a piece of music, is an edition that reflects +the original writing of the composer. Such editions are useful for +musicologists, and performers that want to perform authentic +interpretations. However, for mere mortals, the Urtext can be quite +hard to read. It might not contain fingering and beaming, and +typically it is full of footnotes. Moreover, common interpretations +may have emerged---after the composer died. For this reason, the +music that can be had as Urtext usually is also available in enhanced +and edited editions. ) and an edited edition from em(one source). We +will use the first few bars of bind(J.)bind(S.)Bach's first Cello +suite to demonstrate this. The example makes heavy use of space +rests: a space rest takes up time, like a rest does, but it doesn't +print anything. It can be used as a placeholder, to attach +articulation marks to. It is entered as a note with the name code(s). mudela(verbatim)( bach = \notes \relative c { [g16 d' b' a] [b d, b' d,] } @@ -1581,7 +1592,7 @@ mudela(verbatim)( \staffStuff > } - \paper {} + \paper { linewidth = -1.;} } ) @@ -1647,7 +1658,7 @@ switch = \type Voice = voiceA \notes { s4 \translator Staff = staffB s4 ) Don't try to switch staffs when you are in the middle of a slur or -beam, though. It doesn't work yet. +beam, though: the spanners won't switch along. sect(Hairy durations: triplets) diff --git a/NEWS b/NEWS index d3c1f271a6..129bd32d4f 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,21 @@ -pl6.jcn1 - - repeat/alternative music layout +pl6.jcn5 + - repeatbars, volta-spanner work, alternative iteration still broken + - volta symbol + +pl5.szmulewicz2 + - more GUILE stuff. + - tutorial doco updates + +pl6.jcn4 + - volta-spanner + - repeat-engraver + - repeat/alternative music layout (hehe) + +pl6.uu1 + - Doco of music iterators. ******** -1.1.6 +pl 6 pl5.szmulewicz1 - rtti stuff diff --git a/VERSION b/VERSION index ed84e68a2d..af5d5f0449 100644 --- a/VERSION +++ b/VERSION @@ -1,8 +1,8 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 -PATCH_LEVEL=6 -MY_PATCH_LEVEL=jcn1 +PATCH_LEVEL=7 +MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/init/engraver.ly b/init/engraver.ly index 48c0145b5b..c34f9df8f3 100644 --- a/init/engraver.ly +++ b/init/engraver.ly @@ -20,6 +20,7 @@ StaffContext=\translator { \consists "Key_engraver"; \consists "Local_key_engraver"; \consists "Time_signature_engraver"; + \consists "Repeat_engraver"; \consists "Staff_symbol_engraver"; \consists "Collision_engraver"; \consists "Rest_collision_engraver"; @@ -76,6 +77,7 @@ RhythmicStaffContext=\translator{ \consists "Separating_line_group_engraver"; \name RhythmicStaff; \consists "Bar_engraver"; + \consists "Repeat_engraver"; \consists "Time_signature_engraver"; \consists "Staff_symbol_engraver"; \accepts "Voice"; @@ -206,6 +208,7 @@ HaraKiriStaffContext = \translator { \consists "Bar_engraver"; \consists "Clef_engraver"; + \consists "Repeat_engraver"; \consists "Key_engraver"; \consists "Time_signature_engraver"; \consists "Local_key_engraver"; diff --git a/init/lily.scm b/init/lily.scm index e045426a26..f813358ede 100644 --- a/init/lily.scm +++ b/init/lily.scm @@ -43,9 +43,9 @@ (string-append (number->string (cadr c)) " "))) ;;;;;;;; TeX -; (define (tex action) +;(define (tex action) -(define +(define (beam-tex width slope thick) (embedded-ps-tex (beam-ps width slope thick))) @@ -169,7 +169,14 @@ (text-tex f s) (string-append "\\set" f "{" s "}")) +(define + (tuplet-tex dx dy dir) + (embedded-ps-tex (tuplet-ps dx dy dir))) + +(define + (volta-tex w last) + (embedded-ps-tex (volta-ps w last))) ;;;;;;;;;;;; PS @@ -289,6 +296,12 @@ (string-append "(" s ") set" f " ")) +(define + (volta-ps w last) + (string-append + (numbers->string (list w (inexact->exact last))) + "draw_volta")) + ;;; output definitions (define @@ -454,10 +467,6 @@ (numbers->string (list dx dy (inexact->exact dir))) "draw_tuplet")) -(define - (tuplet-tex dx dy dir) - (embedded-ps-tex (tuplet-ps dx dy dir))) - (define (stem o kern width height depth) ((invoke-output o "stem") kern width height depth)) @@ -476,14 +485,15 @@ (startrepeat o h) ((invoke-output o "invoke-dim1") "startrepeat" h)) - (define (stop-line o) ((invoke-output o "stop-line"))) - (define (stoprepeat o h) ((invoke-output o "invoke-dim1") "stoprepeat" h)) +(define + (volta o w last) + ((invoke-output o "volta") w last)) diff --git a/input/test/repeat.fly b/input/test/repeat.fly index f3ab2c0e44..d96792051a 100644 --- a/input/test/repeat.fly +++ b/input/test/repeat.fly @@ -1,2 +1 @@ -% a'' b c d \repeat 2 { { c c c c } } \alternative { { e e e e } { e e e g } } c c c c -a'' b c d \repeat 2 { { c c c c } } \alternative { { e e e e } } c c c c +a b c d \repeat 2 { { c c c c d d d d } } \alternative { { e e e e } { e e e g } } c c c c c c c c diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index a0c361907c..91c23feb2c 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -33,13 +33,6 @@ Bar_engraver::do_try_music (Music*r_l) return true; } - else if (Repeated_music * m = dynamic_cast (r_l)) - { - if (bar_req_l_ && bar_req_l_->equal_b (b)) // huh? - return false; - bar_req_l_ = new Bar_req ("|:"); - return true; - } return false; diff --git a/lily/beam-swallow-trans.cc b/lily/beam-swallow-trans.cc deleted file mode 100644 index cf7b4d1ef6..0000000000 --- a/lily/beam-swallow-trans.cc +++ /dev/null @@ -1,14 +0,0 @@ -/* - beam-swallow-trans.cc -- instantiate Beam_swallow_translator - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys - - */ - -#include "type-swallow-trans.hh" -#include "musical-request.hh" - -DECLARE_REQUEST_SWALLOWER(Beam_req); - diff --git a/lily/compressed-music-iterator.cc b/lily/compressed-music-iterator.cc index c6393d5ecf..65fc6ad78c 100644 --- a/lily/compressed-music-iterator.cc +++ b/lily/compressed-music-iterator.cc @@ -15,44 +15,12 @@ -Compressed_music_iterator::Compressed_music_iterator () -{ - Bracket_req pr; - pr.spantype = Span_req::START; - // pr.plet_i_ = 1; - start_req_p_ = new Bracket_req (pr); - pr.spantype = Span_req::STOP; - stop_req_p_ =new Bracket_req (pr); -} - -Compressed_music_iterator::~Compressed_music_iterator () -{ - delete start_req_p_; - delete stop_req_p_; -} - -Compressed_music * -Compressed_music_iterator::compressed_l () const -{ - return (Compressed_music*) music_l_; -} - -void -Compressed_music_iterator::construct_children () -{ - /* - start_req_p_->plet_i_ = compressed_l ()->den_i_; - stop_req_p_->plet_i_ = compressed_l ()->den_i_; - */ - Music_wrapper_iterator::construct_children (); -} - void Compressed_music_iterator::do_process_and_next (Moment m) { if (first_b_) { - bool success = report_to_l ()->try_music (compressed_l ()); + bool success = report_to_l ()->try_music (dynamic_cast (music_l_)); if (!success) music_l_->warning ( _("No one to print a tuplet start bracket")); } diff --git a/lily/include/change-iterator.hh b/lily/include/change-iterator.hh index 18c0a5cc9a..9dec9ba80c 100644 --- a/lily/include/change-iterator.hh +++ b/lily/include/change-iterator.hh @@ -17,11 +17,14 @@ class Change_iterator : public Music_iterator { Change_translator *change_l (); void error (String); - -public: - + protected: virtual void do_process_and_next (Moment); + +public: + /* + CTOR is public + */ }; #endif diff --git a/lily/include/chord-iterator.hh b/lily/include/chord-iterator.hh index b66e4e8c06..6b689e945d 100644 --- a/lily/include/chord-iterator.hh +++ b/lily/include/chord-iterator.hh @@ -19,7 +19,7 @@ class Simultaneous_music_iterator : public Music_iterator Simultaneous_music *simultaneous_music_l() const; Pointer_list children_p_list_; public: - + // construction is public protected: virtual void do_print() const; virtual void construct_children(); diff --git a/lily/include/compressed-music-iterator.hh b/lily/include/compressed-music-iterator.hh index 0616345e87..a9950b5781 100644 --- a/lily/include/compressed-music-iterator.hh +++ b/lily/include/compressed-music-iterator.hh @@ -14,15 +14,10 @@ class Compressed_music_iterator : public Music_wrapper_iterator { -public: - Bracket_req* start_req_p_; - Bracket_req* stop_req_p_; - - Compressed_music_iterator(); - ~Compressed_music_iterator (); +public: + // construction +protected: virtual void do_process_and_next (Moment); - virtual void construct_children (); - Compressed_music *compressed_l ()const; }; diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 6febb7f55a..6c75f333d2 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -70,6 +70,7 @@ struct Dynamic; struct Dynamic_req; struct Element_group; struct Element_group_item; +struct Engraver; struct Engraver_group_engraver; struct Extender; struct Extender_req; @@ -165,15 +166,15 @@ struct Plet; struct Plet_engraver; struct Plet_req; struct Plet_spanner; -struct Rational; struct Piano_brace; struct Performer; struct Performer_group_performer; struct Property_iterator; +struct Rational; struct Request; struct Request_column; -struct Engraver; struct Relative_octave_music; +struct Repeat_engraver; struct Repeated_music; struct Repeated_music_iterator; struct Rest; @@ -245,6 +246,7 @@ struct Vertical_group_element; struct Vertical_group_spanner; struct Vertical_align_spanner; struct Vertical_align_engraver; +struct Volta_spanner; struct Align_element; struct Sequential_music; struct Request_chord; diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 5b5685a40c..e236e56f66 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -55,6 +55,7 @@ public: 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) const; Atom time_signature (Array) const; diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 38dff72bd3..749baac14c 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -16,35 +16,75 @@ #include "moment.hh" #include "virtual-methods.hh" +/** Walk through music and deliver music to translation units, synced + in time. This classa provides both the implementation of the shared + code, and the public interface. + + Derived classes should only have a public constructor. + The state of an iterator would be the intersection of the particular music + construct with one point in musical time. + */ class Music_iterator { Arrayreport_to_l_arr_; void push_translator (Translator_group*); void pop_translator(); + protected: Music const * music_l_; bool first_b_; + + /** + Do the actual printing. This should be overriden in derived classes. It + is called by #print#, in the public interface + */ virtual void do_print() const; + /** + Find a bottom notation context to deliver requests to. + */ virtual Translator_group* get_req_translator_l(); - Music_iterator* get_iterator_p (Music const*) const; + + /** + Get an iterator for MUS, inheriting the translation unit from THIS. + */ + Music_iterator* get_iterator_p (Music const*mus) const; void set_translator (Translator_group*); + + /** Do the actual reporting. This should be overriden in derived + classes. It is called by #process_and_next#, the public interface + */ virtual void do_process_and_next (Moment until); - void inherit_info (Music_iterator const *parent); + public: + + /** + The translation unit that we this iterator is reporting to now. + */ Translator_group*report_to_l() const; + - - static Music_iterator* static_get_iterator_p (Music const*,Translator_group*); + /** Get an iterator matching the type of MUS, and use TRANS to find + an accompanying translation unit + */ + static Music_iterator* static_get_iterator_p (Music const* mus,Translator_group* trans); + Music_iterator(); + /// Find the next interesting point in time. virtual Moment next_moment() const; + + ///Are we finished with this piece of music? virtual bool ok() const; + virtual ~Music_iterator(); + + + ///Report all musical information that occurs between now and UNTIL void process_and_next (Moment until); /** Construct sub-iterators, and set the translator to - report to + report to. */ virtual void construct_children(); void print() const; diff --git a/lily/include/music-wrapper-iterator.hh b/lily/include/music-wrapper-iterator.hh index cae63b2096..50d9bbea27 100644 --- a/lily/include/music-wrapper-iterator.hh +++ b/lily/include/music-wrapper-iterator.hh @@ -1,5 +1,5 @@ /* - music-wrapper-iterator.hh -- declare + music-wrapper-iterator.hh -- declare Music_wrapper_iterator source file of the GNU LilyPond music typesetter @@ -13,22 +13,25 @@ #include "music.hh" #include "music-iterator.hh" +/** + The iterator for a #Music_wrapper#. Since #Music_wrapper# essentially + does nothing, this iterator creates a child iterator and delegates + all work to that child. + */ class Music_wrapper_iterator : public Music_iterator { public: Music_wrapper_iterator (); + ~Music_wrapper_iterator (); -protected: - virtual ~Music_wrapper_iterator (); - - virtual void do_print () const; virtual void construct_children () ; - virtual void do_process_and_next (Moment) ; virtual Moment next_moment () const; + virtual bool ok () const; protected: - virtual Music_wrapper *music_wrapper_l () const; - virtual bool ok () const; + Music_wrapper *music_wrapper_l () const; + virtual void do_print () const; + virtual void do_process_and_next (Moment) ; private: Music_iterator *child_iter_p_; diff --git a/lily/include/music-wrapper.hh b/lily/include/music-wrapper.hh index afb153e5ca..46008d2f5c 100644 --- a/lily/include/music-wrapper.hh +++ b/lily/include/music-wrapper.hh @@ -13,6 +13,12 @@ #include "music.hh" #include "musical-pitch.hh" +/** A Music that modifies an existing Music. This data structure + corresponds to a production that takes a single Music argument, + + Music: STUFF Music + + */ class Music_wrapper : public Music { public: @@ -23,7 +29,7 @@ public: VIRTUAL_COPY_CONS(Music); Music_wrapper (Music_wrapper const&); - virtual Moment duration () const; + virtual Moment duration () const; virtual ~Music_wrapper (); }; diff --git a/lily/include/property-iterator.hh b/lily/include/property-iterator.hh index 3dc7898c2b..b42f95c797 100644 --- a/lily/include/property-iterator.hh +++ b/lily/include/property-iterator.hh @@ -11,13 +11,13 @@ #define PROPERTY_ITERATOR_HH #include "music-iterator.hh" - +/** + Iterate a property. + */ class Property_iterator : public Music_iterator { - Translation_property *property_l() const; - public: - + // construction protected: virtual void do_process_and_next (Moment); }; diff --git a/lily/include/repeated-music-iterator.hh b/lily/include/repeated-music-iterator.hh index ebc356de41..081faa7c71 100644 --- a/lily/include/repeated-music-iterator.hh +++ b/lily/include/repeated-music-iterator.hh @@ -11,25 +11,27 @@ #define REPEATED_MUSIC_ITERATOR_HH #include "music-wrapper-iterator.hh" -#include "voice-iterator.hh" +#include "sequential-music-iterator.hh" -class Repeated_music_iterator : public virtual Music_wrapper_iterator, public virtual Sequential_music_iterator +class Repeated_music_iterator : public Music_iterator { public: - Repeated_music_iterator(); - -protected: + Repeated_music_iterator (); ~Repeated_music_iterator (); - virtual Music_wrapper *music_wrapper_l () const; - virtual Sequential_music* sequential_music_l() const; + virtual void construct_children (); + virtual Moment next_moment () const; virtual bool ok () const; + +protected: + virtual Repeated_music* repeated_music_l () const; + virtual void do_print () const; virtual void do_process_and_next (Moment); - virtual void construct_children (); - virtual void start_next_element (); - virtual void leave_element (); -}; +private: + Music_iterator* repeat_iter_p_; + Sequential_music_iterator* alternative_iter_p_; +}; #endif /* REPEATED_MUSIC_ITERATOR_HH */ diff --git a/lily/include/repeated-music.hh b/lily/include/repeated-music.hh index 4f105cc580..b068c242ca 100644 --- a/lily/include/repeated-music.hh +++ b/lily/include/repeated-music.hh @@ -19,10 +19,12 @@ class Repeated_music : public Music { public: int repeats_i_; - Music_wrapper* repeat_p_; + Music* repeat_p_; +// Music_list* alternative_p_; Sequential_music* alternative_p_; - Repeated_music (Music_wrapper *, int n, Sequential_music*); +// Repeated_music (Music*, int n, Music_list*); + Repeated_music (Music*, int n, Sequential_music*); Repeated_music (Repeated_music const& s); virtual ~Repeated_music (); diff --git a/lily/include/sequential-music-iterator.hh b/lily/include/sequential-music-iterator.hh new file mode 100644 index 0000000000..bcbf81769c --- /dev/null +++ b/lily/include/sequential-music-iterator.hh @@ -0,0 +1,48 @@ +/* + Sequential_music-iter.hh -- declare Sequential_music_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997--1998 Han-Wen Nienhuys +*/ + +#ifndef SEQUENTIAL_MUSIC_ITER_HH +#define SEQUENTIAL_MUSIC_ITER_HH + +#include "music-iterator.hh" +#include "pcursor.hh" + +/** Sequential_music iteration: walk each element in turn, and + construct an iterator for every element. + + */ +class Sequential_music_iterator : public Music_iterator +{ +public: + Sequential_music_iterator (); + ~Sequential_music_iterator (); + + virtual void construct_children (); + virtual Moment next_moment () const; + virtual bool ok () const; + +protected: + Sequential_music * sequential_music_l() const; + + virtual void do_print() const; + virtual void do_process_and_next (Moment); + +private: + Moment here_mom_; + PCursor *cursor_p_; + Music_iterator * iter_p_; + + /* + perhaps these can be virtual and protected iso. private? + */ + void start_next_element(); + void leave_element(); + void set_Sequential_music_translator(); +}; + +#endif // SEQUENTIAL_MUSIC_ITER_HH diff --git a/lily/include/type-swallow-trans.hh b/lily/include/type-swallow-trans.hh index 3b7191bae1..528e612d5d 100644 --- a/lily/include/type-swallow-trans.hh +++ b/lily/include/type-swallow-trans.hh @@ -12,22 +12,22 @@ #include "translator.hh" -/// eat a certain type of request +/** eat a certain type of request. + (Duh, it's good for your skin) + */ class Type_swallow_translator : public virtual Translator { protected: - const type_info * type_; + String swallow_str_; bool do_try_music (Music*); -public: - +public: VIRTUAL_COPY_CONS(Translator); - Type_swallow_translator (); }; #define DECLARE_REQUEST_SWALLOWER(TYPE) \ struct TYPE ## _swallow_translator : public Type_swallow_translator {\ TYPE ## _swallow_translator() { \ - type_ = &typeid (TYPE);\ + swallow_str_ = #TYPE;\ }\ \ VIRTUAL_COPY_CONS(Translator);\ diff --git a/lily/include/voice-iterator.hh b/lily/include/voice-iterator.hh deleted file mode 100644 index 38f8b91473..0000000000 --- a/lily/include/voice-iterator.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* - Sequential_music-iter.hh -- declare Sequential_music_iterator - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys - -*/ - -#ifndef SEQUENTIAL_MUSIC_ITER_HH -#define SEQUENTIAL_MUSIC_ITER_HH - -#include "music-iterator.hh" -#include "pcursor.hh" - -class Sequential_music_iterator : public Music_iterator -{ -public: - Sequential_music_iterator (); - -protected: - virtual ~Sequential_music_iterator(); - - virtual Sequential_music* sequential_music_l() const; - virtual void do_print() const; - virtual void construct_children(); - virtual void do_process_and_next (Moment); - virtual Moment next_moment() const; - virtual bool ok() const; - virtual void start_next_element(); - virtual void leave_element(); - -private: - Moment here_mom_; - PCursor *cursor_p_; - Music_iterator * iter_p_; - void set_Sequential_music_translator(); -}; - -#endif // SEQUENTIAL_MUSIC_ITER_HH diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 341c6d576c..8599b9ba95 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -15,12 +15,6 @@ #include "simple-file-storage.hh" #include "file-path.hh" -SCM -ly_append (SCM a, SCM b) -{ - return gh_call2 (gh_eval_str ("append"), a, b); -} - SCM ly_list1 (SCM a) { @@ -33,10 +27,18 @@ ly_quote () return gh_eval_str ("'quote"); } +/* + scm_m_quote doesn't use any env, but needs one for a good signature in GUILE. + + Why there is no gh_quote () in GUILE beats me. +*/ + SCM ly_quote_scm (SCM s) { - return gh_list (ly_quote (), s, SCM_UNDEFINED); + // return scm_m_quote (s, SCM_UNDEFINED); + return scm_cons2 (scm_i_quote, s, SCM_EOL); + } SCM @@ -72,11 +74,12 @@ lambda_scm (String str, Array args_arr) for (int i = args_arr.size () - 1; i >= 0; i--) args_scm = gh_cons (gh_int2scm (args_arr[i]), args_scm); SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o (str.ch_l ()), args_scm))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o (str.ch_l ()), args_scm))); return scm; } +// scm_top_level_env(SCM_CDR(scm_top_level_lookup_closure_var))) SCM lambda_scm (String str, Array args_arr) { @@ -86,11 +89,11 @@ lambda_scm (String str, Array args_arr) args_arr.clear (); } SCM args_scm = SCM_EOL; - for (int i = args_arr.size () - 1; i >= 0; i--) + for (int i = args_arr.size (); i--; ) args_scm = gh_cons (gh_str02scm (args_arr[i].ch_l ()), args_scm); SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o (str.ch_l ()), args_scm))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o (str.ch_l ()), args_scm))); return scm; } @@ -107,12 +110,17 @@ lambda_scm (String str, Array args_arr) args_scm = gh_cons (gh_double2scm (args_arr[i]), args_scm); SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o (str.ch_l ()), args_scm))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o (str.ch_l ()), args_scm))); return scm; } +/** + Read a file, and shove it down GUILE. GUILE also has file read + functions, but you can't fiddle with the path of those. + + */ void read_lily_scm_file (String fn) @@ -120,5 +128,5 @@ read_lily_scm_file (String fn) String s = global_path.find (fn); Simple_file_storage f(s); - gh_eval_str (f.ch_C()); + gh_eval_str ((char *) f.ch_C()); } diff --git a/lily/lookup.cc b/lily/lookup.cc index e579ca8231..1c3d1c7145 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -181,8 +181,8 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const // (lambda (o) (dashed-slur o thick dash '(stuff)) a.lambda_ = - ly_append (ly_lambda_o (), - gh_list (ly_append (ly_func_o ("dashed-slur"), + gh_append2 (ly_lambda_o (), + gh_list (gh_append2 (ly_func_o ("dashed-slur"), gh_cons (gh_double2scm (thick), gh_cons (gh_double2scm (dash), gh_list (ly_quote_scm (gh_list (sc[1], sc[2], sc[3], sc[0], SCM_UNDEFINED)), SCM_UNDEFINED)))), SCM_UNDEFINED)); @@ -380,9 +380,10 @@ Lookup::text (String style, String text) const ; else { - if (afm_p) + int c = text[i]; + if (afm_p && ((c >= 0) && (c < afm_p->char_metrics_.size ()))) { - Adobe_font_char_metric m = afm_p->char_metrics_[(int)text[i]]; + Adobe_font_char_metric m = afm_p->char_metrics_[c]; w += m.B_.x ().length (); DOUT << to_str (m.B_.x ().length ()) << " "; } @@ -537,4 +538,15 @@ Lookup::vbracket (Real &y) const return a; } +Atom +Lookup::volta (Real w, bool last_b) const +{ + Array arr; + arr.push (w); + arr.push (last_b); + Atom a; + a.lambda_ = (lambda_scm ("volta", arr)); + a.str_ = "volta"; + return a; +} diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index f78dc6eaa5..718490df5e 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -8,7 +8,7 @@ #include "debug.hh" #include "music-list.hh" #include "music-iterator.hh" -#include "voice-iterator.hh" +#include "sequential-music-iterator.hh" #include "property-iterator.hh" #include "chord-iterator.hh" #include "request-iterator.hh" @@ -26,7 +26,6 @@ void Music_iterator::do_print() const { - } void @@ -167,16 +166,11 @@ Music_iterator::static_get_iterator_p (Music const *m, Translator_group *report_ return p; } -void -Music_iterator::inherit_info(Music_iterator const *) -{ -} Music_iterator* Music_iterator::get_iterator_p (Music const*m) const { Music_iterator*p = static_get_iterator_p (m, report_to_l()); - p->inherit_info (this); p->construct_children(); return p; } diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 0c1a88dc67..e3fe90b19d 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -233,8 +233,8 @@ output_def (Paper_outputter* p, String key, String val) SCM args_scm = gh_cons (gh_str02scm (key.ch_l ()), gh_cons (gh_str02scm (val.ch_l ()), SCM_EOL)); SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("lily-def"), args_scm))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o ("lily-def"), args_scm))); p->output_scheme (scm); } @@ -286,14 +286,14 @@ Paper_def::paper_outputter_p (Paper_stream* os_p, Header* header_l, String origi output_settings (p); SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("experimental-on"), SCM_EOL))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o ("experimental-on"), SCM_EOL))); p->output_scheme (scm); scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("header-end"), SCM_EOL))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o ("header-end"), SCM_EOL))); p->output_scheme (scm); diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 3185ce5ff3..3f31fb306f 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -28,8 +28,8 @@ Paper_outputter::Paper_outputter (Paper_stream *s) Paper_outputter::~Paper_outputter () { SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("end-output"), SCM_EOL))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o ("end-output"), SCM_EOL))); output_scheme (scm); } @@ -66,8 +66,8 @@ Paper_outputter::output_header () #endif SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("header"), args_scm))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o ("header"), args_scm))); output_scheme (scm); } @@ -86,7 +86,7 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) if (!i->lambda_) { // urg - i->lambda_ = ly_append (ly_lambda_o (), + i->lambda_ = gh_append2 (ly_lambda_o (), ly_list1 (ly_func_o ("empty"))); } @@ -113,8 +113,8 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) #endif SCM box_scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("placebox"), args_scm))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o ("placebox"), args_scm))); output_scheme (box_scm); } @@ -214,8 +214,8 @@ Paper_outputter::output_font_def (int i, String str) //urg, broken with guile-1.3 //return; SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("font-def"), + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o ("font-def"), gh_cons (gh_int2scm (i), gh_cons (gh_str02scm (str.ch_l ()), SCM_EOL))))); output_scheme (scm); @@ -227,8 +227,8 @@ Paper_outputter::output_font_switch (int i) //urg, broken with guile-1.2, 1.3 //return; SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("font-switch"), + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o ("font-switch"), gh_cons (gh_int2scm (i), SCM_EOL)))); output_scheme (scm); @@ -238,8 +238,8 @@ void Paper_outputter::stop_line () { SCM scm = - ly_append (ly_lambda_o (), - ly_list1 (ly_append (ly_func_o ("stop-line"), SCM_EOL))); + gh_append2 (ly_lambda_o (), + ly_list1 (gh_append2 (ly_func_o ("stop-line"), SCM_EOL))); output_scheme (scm); diff --git a/lily/parser.yy b/lily/parser.yy index 449c7cc122..e3622cdf4f 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -745,9 +745,9 @@ Alternative_music: { ; Repeated_music: REPEAT unsigned '{' Music '}' Alternative_music { - Music_wrapper *w= new Music_wrapper ($4); + // s/r conflicts -> '{' '}' Sequential_music* s = (Sequential_music*)$6; - $$ = new Repeated_music (w, $2, s); + $$ = new Repeated_music ($4, $2, s); } ; diff --git a/lily/property-iterator.cc b/lily/property-iterator.cc index 2037955b83..6ea772222a 100644 --- a/lily/property-iterator.cc +++ b/lily/property-iterator.cc @@ -10,18 +10,16 @@ #include "translation-property.hh" #include "translator-group.hh" +/** + There is no real processing to a property: just lookup the + translation unit, and set the property. + */ void Property_iterator::do_process_and_next (Moment m) { - if (property_l()->var_str_.length_i ()) - report_to_l ()->set_property (property_l()->var_str_, property_l()->value_); + Translation_property const * prop = dynamic_cast (music_l_); + if (prop->var_str_.length_i ()) + report_to_l ()->set_property (prop->var_str_, prop->value_); Music_iterator::do_process_and_next (m); } - - -Translation_property* -Property_iterator::property_l () const -{ - return (Translation_property*) music_l_; -} diff --git a/lily/repeated-music-iterator.cc b/lily/repeated-music-iterator.cc index 67803eb864..66180fda76 100644 --- a/lily/repeated-music-iterator.cc +++ b/lily/repeated-music-iterator.cc @@ -15,55 +15,77 @@ Repeated_music_iterator::Repeated_music_iterator () { + repeat_iter_p_ = 0; + alternative_iter_p_ = 0; } Repeated_music_iterator::~Repeated_music_iterator () { + delete repeat_iter_p_; + delete alternative_iter_p_; +} + +void +Repeated_music_iterator::do_print () const +{ + if (repeat_iter_p_) repeat_iter_p_->print (); + if (alternative_iter_p_) alternative_iter_p_->print (); } void Repeated_music_iterator::construct_children () { - Music_wrapper_iterator::construct_children (); - // Sequential_music_iterator::construct_children (); + repeat_iter_p_ = get_iterator_p (repeated_music_l ()->repeat_p_); } void Repeated_music_iterator::do_process_and_next (Moment m) { - if (Music_wrapper_iterator::ok ()) - Music_wrapper_iterator::do_process_and_next (m); -// else - //Sequential_music_iterator::do_process_and_next (m); + if (first_b_) + { + bool success = report_to_l ()->try_music (repeated_music_l ()); + if (!success) + music_l_->warning ( _("No one to print a volta bracket")); + } + if (repeat_iter_p_->ok ()) + repeat_iter_p_->process_and_next (m); + else + { + if (!alternative_iter_p_) + { + delete repeat_iter_p_; + repeat_iter_p_ = 0; + alternative_iter_p_ = dynamic_cast + (get_iterator_p (repeated_music_l ()->alternative_p_)); + } + alternative_iter_p_->process_and_next (m); + } + Music_iterator::do_process_and_next (m); } -Music_wrapper* -Repeated_music_iterator::music_wrapper_l () const +Moment +Repeated_music_iterator::next_moment () const { - return ((Repeated_music*)Music_wrapper_iterator::music_l_)->repeat_p_; + if (repeat_iter_p_) + return repeat_iter_p_->next_moment (); + else if (alternative_iter_p_) + return alternative_iter_p_->next_moment (); + return 0; } bool Repeated_music_iterator::ok () const { - return Music_wrapper_iterator::ok (); // || Sequential_music_iterator:: ok(); -} - -Sequential_music* -Repeated_music_iterator::sequential_music_l () const -{ - return ((Repeated_music*)Sequential_music_iterator::music_l_)->alternative_p_; -} - -void -Repeated_music_iterator::start_next_element () -{ - // Sequential_music_iterator::start_next_element (); + if (repeat_iter_p_) + return repeat_iter_p_->ok (); + else if (alternative_iter_p_) + return alternative_iter_p_->ok (); + return false; } -void -Repeated_music_iterator::leave_element () +Repeated_music* +Repeated_music_iterator::repeated_music_l () const { - // Sequential_music_iterator::leave_element (); + return (Repeated_music*)Music_iterator::music_l_; } diff --git a/lily/repeated-music.cc b/lily/repeated-music.cc index ab6aad0817..8f51eaf519 100644 --- a/lily/repeated-music.cc +++ b/lily/repeated-music.cc @@ -8,10 +8,10 @@ */ #include "repeated-music.hh" -#include "music-wrapper.hh" -#include "music-list.hh" +#include "musical-pitch.hh" -Repeated_music::Repeated_music (Music_wrapper *r, int n, Sequential_music* a) +//Repeated_music::Repeated_music (Music* r, int n, Music_list* a) +Repeated_music::Repeated_music (Music* r, int n, Sequential_music* a) { repeats_i_ = n; repeat_p_ = r; @@ -27,11 +27,9 @@ Repeated_music::~Repeated_music () Repeated_music::Repeated_music (Repeated_music const& s) : Music (s) { -#if 0 - // urg? - repeat_p_ = (Music_wrapper*)(s.repeat_p_) ? s.repeat_p_->clone () : 0; - alternative_p_ = (Sequential_music*)(s.alternative_p_) ? s.alternative_p_->clone () : 0; -#endif + repeat_p_ = (s.repeat_p_) ? s.repeat_p_->clone () : 0; + // urg? +// alternative_p_ = (Sequential_music*)(s.alternative_p_) ? s.alternative_p_->clone () : 0; } void @@ -62,3 +60,4 @@ Repeated_music::duration () const m += alternative_p_->duration (); return m; } + diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc new file mode 100644 index 0000000000..69c1eed124 --- /dev/null +++ b/lily/sequential-music-iterator.cc @@ -0,0 +1,135 @@ +/* + Sequential_music_iterator.cc -- implement Sequential_music_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997--1998 Han-Wen Nienhuys +*/ + +#include "translator-group.hh" +#include "debug.hh" +#include "sequential-music-iterator.hh" +#include "music-list.hh" + + +void +Sequential_music_iterator::do_print() const +{ + if (iter_p_) + iter_p_->print(); +} + +Sequential_music_iterator::Sequential_music_iterator () +{ + cursor_p_ = 0; + here_mom_ = 0; + iter_p_ =0; +} + +Sequential_music* +Sequential_music_iterator::sequential_music_l () const +{ + return (Sequential_music *)music_l_; +} + +void +Sequential_music_iterator::construct_children() +{ + cursor_p_ = new PCursor (sequential_music_l ()->music_p_list_p_->top ()); + + while (cursor_p_->ok()) + { + start_next_element(); + if (!iter_p_->ok()) + { + leave_element(); + } + else + { + set_Sequential_music_translator(); + break; + } + } +} + +void +Sequential_music_iterator::leave_element() +{ + delete iter_p_; + iter_p_ =0; + Moment elt_time = cursor_p_->ptr()->duration (); + here_mom_ += elt_time; + cursor_p_->next(); +} + +void +Sequential_music_iterator::start_next_element() +{ + assert (!iter_p_); + iter_p_ = get_iterator_p ( cursor_p_->ptr()); +} + +void +Sequential_music_iterator::set_Sequential_music_translator() +{ + if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ()) + set_translator (iter_p_->report_to_l()); +} + +Sequential_music_iterator::~Sequential_music_iterator() +{ + delete cursor_p_; + assert (! iter_p_); +} + + + + +void +Sequential_music_iterator::do_process_and_next (Moment until) +{ + while (1) + { + Moment local_until = until - here_mom_; + while (iter_p_->ok()) + { + Moment here = iter_p_->next_moment(); + if (here != local_until) + goto loopexit; + + iter_p_->process_and_next (local_until); + } + + if (!iter_p_->ok()) + { + leave_element(); + + if (cursor_p_->ok()) + { + start_next_element(); + set_Sequential_music_translator(); + } + else + { + goto loopexit; + } + } + } + +loopexit: + + Music_iterator::do_process_and_next (until); +} + +Moment +Sequential_music_iterator::next_moment() const +{ + return iter_p_->next_moment() + here_mom_; +} + +bool +Sequential_music_iterator::ok() const +{ + return iter_p_; +} + diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc index d7d9190d2d..ef7c95e233 100644 --- a/lily/tuplet-engraver.cc +++ b/lily/tuplet-engraver.cc @@ -32,7 +32,7 @@ Tuplet_engraver::do_process_requests () for (int i= started_span_p_arr_.size (); i < compressed_music_arr_.size (); i++) { - Plet_spanner* glep = new Plet_spanner (); + Plet_spanner* glep = new Plet_spanner; started_span_p_arr_.push (glep); Text_def *t = new Text_def; diff --git a/lily/type-swallow-trans.cc b/lily/type-swallow-trans.cc index ef8f39ef08..ee3bbd5947 100644 --- a/lily/type-swallow-trans.cc +++ b/lily/type-swallow-trans.cc @@ -9,20 +9,16 @@ #include "type-swallow-trans.hh" #include "musical-request.hh" -Type_swallow_translator::Type_swallow_translator () -{ - type_ =0; -} bool Type_swallow_translator::do_try_music (Music*r) { - // if (type_ && type_->before (typeid( *r))) // - // return true; - return false; // ugh. FIXME. + if (classname (r) == swallow_str_) + return true; + return false; } DECLARE_REQUEST_SWALLOWER(Skip_req); - +DECLARE_REQUEST_SWALLOWER(Beam_req); diff --git a/lily/voice-iterator.cc b/lily/voice-iterator.cc deleted file mode 100644 index a03c337664..0000000000 --- a/lily/voice-iterator.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* - Sequential_music-iter.cc -- implement Sequential_music_iterator - - source file of the GNU LilyPond music typesetter - - (c) 1997--1998 Han-Wen Nienhuys -*/ - -#include "translator-group.hh" -#include "debug.hh" -#include "voice-iterator.hh" -#include "music-list.hh" - - -void -Sequential_music_iterator::do_print() const -{ - if (iter_p_) - iter_p_->print(); -} - -Sequential_music_iterator::Sequential_music_iterator () -{ - cursor_p_ = 0; - here_mom_ = 0; - iter_p_ =0; -} - -Sequential_music* -Sequential_music_iterator::sequential_music_l () const -{ - return (Sequential_music *)music_l_; -} - -void -Sequential_music_iterator::construct_children() -{ - cursor_p_ = new PCursor (sequential_music_l ()->music_p_list_p_->top ()); - - while (cursor_p_->ok()) - { - start_next_element(); - if (!iter_p_->ok()) - { - leave_element(); - } - else - { - set_Sequential_music_translator(); - break; - } - } -} - -void -Sequential_music_iterator::leave_element() -{ - delete iter_p_; - iter_p_ =0; - Moment elt_time = cursor_p_->ptr()->duration (); - here_mom_ += elt_time; - cursor_p_->next(); -} - -void -Sequential_music_iterator::start_next_element() -{ - assert (!iter_p_); - iter_p_ = get_iterator_p ( cursor_p_->ptr()); -} - -void -Sequential_music_iterator::set_Sequential_music_translator() -{ - if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ()) - set_translator (iter_p_->report_to_l()); -} - -Sequential_music_iterator::~Sequential_music_iterator() -{ - delete cursor_p_; - assert (! iter_p_); -} - - - - -void -Sequential_music_iterator::do_process_and_next (Moment until) -{ - while (1) - { - Moment local_until = until - here_mom_; - while (iter_p_->ok()) - { - Moment here = iter_p_->next_moment(); - if (here != local_until) - goto loopexit; - - iter_p_->process_and_next (local_until); - } - - if (!iter_p_->ok()) - { - leave_element(); - - if (cursor_p_->ok()) - { - start_next_element(); - set_Sequential_music_translator(); - } - else - { - goto loopexit; - } - } - } - -loopexit: - - Music_iterator::do_process_and_next (until); -} - -Moment -Sequential_music_iterator::next_moment() const -{ - return iter_p_->next_moment() + here_mom_; -} - -bool -Sequential_music_iterator::ok() const -{ - return iter_p_; -} - diff --git a/make/out/lelievijver.lsm b/make/out/lelievijver.lsm index b9c63c30ac..5fcc48547d 100644 --- a/make/out/lelievijver.lsm +++ b/make/out/lelievijver.lsm @@ -1,15 +1,15 @@ Begin3 Titel: LilyPond -Versie: 1.1.6 -Inschrijf datum: 16NOV98 +Versie: 1.1.7 +Inschrijf datum: 18NOV98 Beschrijving: @FLAPTEKST@ Trefwoorden: muziek typezetten midi notatie Auteur: hanwen@stack.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Onderhouden door: hanwen@cs.ruu.nl (Han-Wen Nienhuys) Voornaamste plek: sunsite.unc.edu /pub/Linux/apps - 770k lilypond-1.1.6.tar.gz + 770k lilypond-1.1.7.tar.gz Oorspronkelijke plek: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 770k lilypond-1.1.6.tar.gz + 770k lilypond-1.1.7.tar.gz Copi-eer voorwaarden: GPL End diff --git a/make/out/lilypond.lsm b/make/out/lilypond.lsm index 8b42e92870..d845697099 100644 --- a/make/out/lilypond.lsm +++ b/make/out/lilypond.lsm @@ -1,7 +1,7 @@ Begin3 Title: LilyPond -Version: 1.1.6 -Entered-date: 16NOV98 +Version: 1.1.7 +Entered-date: 18NOV98 Description: LilyPond is the GNU Project music typesetter. This program can print beautiful sheet music from a music definition file. It can also play @@ -14,8 +14,8 @@ Author: hanwen@cs.ruu.nl (Han-Wen Nienhuys) janneke@gnu.org (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert - 770k lilypond-1.1.6.tar.gz + 770k lilypond-1.1.7.tar.gz Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/ - 770k lilypond-1.1.6.tar.gz + 770k lilypond-1.1.7.tar.gz Copying-policy: GPL End diff --git a/make/out/lilypond.spec b/make/out/lilypond.spec index 074d508e92..298014b9e2 100644 --- a/make/out/lilypond.spec +++ b/make/out/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 1.1.6 +Version: 1.1.7 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.6.tar.gz +Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.1.7.tar.gz Summary: A program for printing sheet music. URL: http://www.cs.uu.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys diff --git a/mf/cmr10.afm.in b/mf/cmr10.afm.in index df080fdfd3..78a59e7e2b 100644 --- a/mf/cmr10.afm.in +++ b/mf/cmr10.afm.in @@ -25,7 +25,7 @@ C 20; Character-20; B 0.00 0.00 5.24290 6.59002 C 21; Character-21; B 0.00 0.00 5.24290 7.28178 C 22; Character-22; B 0.00 0.00 5.24290 5.95357 C 23; Character-23; B 0.00 0.00 7.86434 7.28178 -C 24; Character-24; B 0.00 0.00 4.66035 0 +C 24; Character-24; B 0.00 0.00 4.66035 0.0 C 25; Character-25; B 0.00 0.00 5.24291 7.28178 C 26; Character-26; B 0.00 0.00 7.57307 4.51470 C 27; Character-27; B 0.00 0.00 8.15562 4.51470 diff --git a/ps/lily.ps b/ps/lily.ps index 32c75a0f25..6ea6920d23 100644 --- a/ps/lily.ps +++ b/ps/lily.ps @@ -16,7 +16,7 @@ closepath fill } bind def -/draw_decrescendo % cont height width +/draw_decrescendo % width height cons { stafflinethickness setlinewidth /cresc_cont exch def @@ -31,7 +31,7 @@ stroke } bind def -/draw_crescendo % cont height width +/draw_crescendo % width height cons { stafflinethickness setlinewidth /cresc_cont exch def @@ -76,6 +76,21 @@ stroke } bind def +/draw_volta % w last +{ + /last exch def + /volta_w exch def + staffheight 2 div /volta_h exch def + volta_t setlinewidth + 0 0 moveto + 0 volta_h lineto + volta_w volta_h lineto + last 0 eq { + volta_w 0 lineto + } if + stroke +} bind def + /draw_slur { stafflinethickness setlinewidth diff --git a/scripts/mudela-book.py b/scripts/mudela-book.py index f08c6043bd..cf176a6c1b 100644 --- a/scripts/mudela-book.py +++ b/scripts/mudela-book.py @@ -274,7 +274,9 @@ class Tex_output: compile('dvips -E -o %s %s' %(g[1]+'.eps', g[1]+'.dvi'), outdir, g[1]+'.dvi', g[1]+'.eps') def write_outfile(self): - file = open(self.output_fn+'.latex', 'w') + outfn = self.output_fn+'.latex' + sys.stderr.write ('Writing output to `%s\'\n'% outfn) + file = open(outfn, 'w') file.write('% Created by mudela-book\n') for line in self.__lines: if type(line)==type([]): @@ -456,7 +458,8 @@ Options:\n def write_deps (fn, out, deps): out_fn = outdir + '/' + fn - print '`writing `%s\'\n\'' % out_fn + out_fn = re.sub ('//', '/', out_fn) + print 'writing `%s\'\n' % out_fn f = open (out_fn, 'w') f.write ('%s: %s\n'% (outdir + '/' + out + '.dvi', @@ -526,7 +529,7 @@ def main(): my_depname = my_outname + '.dep' inp = Main_tex_input (input_filename, my_outname) inp.do_it () - print "LaTeX output to %s%s.latex" %(outdir, my_outname) + if do_deps: write_deps (my_depname, my_outname, inp.deps) diff --git a/stepmake/stepmake/tex-rules.make b/stepmake/stepmake/tex-rules.make index 6310a60eff..52b8ea7e39 100644 --- a/stepmake/stepmake/tex-rules.make +++ b/stepmake/stepmake/tex-rules.make @@ -1,6 +1,6 @@ -#$(outdir)/%.tex: %.tex -# $(LN) $< $@ +$(outdir)/%.tex: %.tex + cp $< $@ $(outdir)/%.dvi: $(outdir)/%.tex (cd $(outdir); tex \\nonstopmode \\input $(