From: fred Date: Tue, 26 Mar 2002 21:44:39 +0000 (+0000) Subject: lilypond-1.1.9 X-Git-Tag: release/1.5.59~2716 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=887f91597410271c1e1639778912c98b420f2d20;p=lilypond.git lilypond-1.1.9 --- diff --git a/Documentation/tex/tutorial.yo b/Documentation/tex/tutorial.yo index a6186f2444..297a1fb3a5 100644 --- a/Documentation/tex/tutorial.yo +++ b/Documentation/tex/tutorial.yo @@ -8,27 +8,24 @@ Yodl-1.30.18 to convert this to tex or html. TODO -need to rethink paper size stuff? - pipethrough(date) sucks. paragraphs have too much space. -instead <-> instead ) COMMENT( - Mainly written by Han-Wen Nienhuys, + Mainly written by Han-Wen Nienhuys, - with help of (among others) + with help of (among others) - * Jan Nieuwenhuizen + * Jan Nieuwenhuizen - * Lambert Meertens, + * Lambert Meertens, - * Adrian Mariano + * Adrian Mariano - * Mats Bengtsson + * Mats Bengtsson ) @@ -74,9 +71,10 @@ 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). This document is a gentle introduction to that -language, which is called Mudela. +language, which is called Mudela, an abbreviation for Music Definition +Language. -We will demonstrate the working of Mudela by presenting a examples of +We will demonstrate the working of Mudela by presenting examples of input alongside with the resulting output. We will comment on these examples using English terms for notation, so if you are not familiar with these terms, you should consult the glossary that is distributed @@ -87,37 +85,36 @@ 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 +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. \include "paper16.ly" \score { - \notes % let's start music - \relative c'' { % octave quotes are relative now - \key G; - \time 3/4; % set the time signature. - - 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. | - - \bar ":|"; % a repeat sign - - - 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. - g4 fis e | - fis a, r8 cis8 - d2.-\fermata - \bar "|."; + \notes + \relative c'' { + \key g; + \time 3/4; + + 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. | + + \bar ":|"; + + 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 + \bar "|."; } \paper { - linewidth = 10.0 \cm; % standard settings are too wide for a book + linewidth = 14.0 \cm; % standard settings are too wide for a book } }) @@ -126,26 +123,17 @@ you would try to enter and save this text with a text editor, compile it with LilyPond and view the output. Details of this procedure may vary from system to system. On a Unix system, you should enter the input in a file ending in file(.ly), such as file(menuet.ly). To -create the output, one would issue -verb( - ly2dvi menuet -) -file(ly2dvi) is a little program that does the job of calling the LilyPond -and -TeX() and adjusting page margins. - -If all goes well, this will create the output file file(menuet.dvi). -To view this output, isssue the command -verb( - xdvi menuet -) +create the output, one would issue code(ly2dvi menuet). -[running on W32?] +file(ly2dvi) is a little program that does the job of calling the +LilyPond and TeX() and adjusting page margins. -Now for some explanation of the input itself, we will dissect the -input line by line +If all goes well, this will create the output file file(menuet.dvi). +To view this output, issue the command code(xdvi menuet). Now that we +are familiar with the procedure to view the output, we will analyse +the input itself, line by line. -verb(% lines preceded by a percent are comments.)COMMENT +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 @@ -167,19 +155,20 @@ verb(\score { music. The music is combined with the output directions by putting them into a code(\score) block. verb( - \notes % get ready for notes + \notes ) COMMENT( )This makes LilyPond ready for accepting notes. verb( - \relative c'' % octave quotes are relative now -) -As we will see, pitches are combinations of octave, note name and -chromatic alteration. In this scheme, the octave is indicated by using raised -quotes (') and lowered" quotes (commas: code(,)). The central C is denoted -by code(c'). The C one octave higher is code(c''). One and two -octaves below central C is denoted by code(c) and code(c,) -respectively. + \relative c'' +)COMMENT( + +) As we will see, pitches are combinations of octave, note name and +chromatic alteration. In this scheme, the octave is indicated by +using raised quotes (`code (')') and ``lowered'' quotes (commas: +`code(,)'). The central C is denoted by code(c'). The C one octave +higher is code(c''). One and two octaves below central C is denoted +by code(c) and code(c,) respectively. If you have to indicate the pitches in a long piece that is written in either a high or very low octave, you would have to type very many @@ -189,10 +178,11 @@ octave that they are the closest to the preceding note. If you add a high-quote an extra octave is added. The lowered quote will substract an octave. Because the first note obviously has no predecessor, you have to give the (absolute) pitch of the note to start with. +COMMENT( -verb( +)verb( { % sequential music follows -) COMMENT( +)COMMENT( ) The brace indicates that what follows is sequential music, i.e., notes that are to be played and printed after each other. This is in @@ -202,14 +192,14 @@ coming after code(\score). verb( - \time 3/4; % set the time signature. + \time 3/4; % set the time signature. ) COMMENT( ) This command changes the time signature of the current piece: this prints a 3/4 sign. The 3/4 value is also used to generate bar lines in the right spots. verb( - \key G; + \key g; ) COMMENT( ) This command changes the current key to G-major. Although @@ -217,42 +207,51 @@ 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 + d4 ) COMMENT( ) This is a code(d) note. The relative music was started with a -code(c''), the real pitch of this note is code(d''). The 4 is -designates the duration of the note (it is a quarter note). -verb( - [g,8 -) -The open bracket starts a beam. This bracket is connected to the -following note, which is an eighth pitch code(g') (remember relative mode) -verb( - a b -) -These are notes with pitch code(a') and code(b'). Because their +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. 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( + +)These are notes with pitch code(a') and code(b'). Because their duration is the same as the code(g), there is no need to enter the duration (It is not illegal to enter it anyway. Then you would have to enter code(a8 b8)) -verb( - c] +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 deduce -where bars have to be by comparing durations of notes with the current -time signature. -verb( - d4 g, g | +) 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( ) 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 notes are forgotten. 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 @@ -261,7 +260,7 @@ 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: a slur is a symbol that is @@ -273,14 +272,15 @@ 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. | + a4 [b8 a g fis] g2. | ) 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 +with a duration number followed by periods, as many as you want +augmentation dots.COMMENT( + +)verb( + \bar ":|"; % a repeat sign ) COMMENT( ) @@ -297,26 +297,28 @@ verb( 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 -abbreviated form, e.g., by using code(-.) for staccato as shown above. +abbreviated form, by a dash and the the character for the +articulation to use, e.g. code(-.) for staccato as shown above. +COMMENT( -verb( - fis a, r8 cis8 +)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 + d2.-\fermata ) COMMENT( -) Finally, all articulations has a verbose form, like code(\fermata). +) Finally, all articulations have 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 @@ -324,14 +326,14 @@ fermata. code(\fermata) refers to that abbreviation and is therefore called an em(identifier). verb( - } + } ) COMMENT( ) This ends the sequential music. verb(\paper { - linewidth = 10.0\cm; + linewidth = 10.0\cm; }) This specifies a conversion from music to notation output. Most of the details of this conversions (font sizes, dimensions, etc.) have @@ -340,7 +342,7 @@ to be smaller. We do this by setting the line width to 10 centimeter (approximately 4 inches). verb( - } + } ) Finally, the last brace ends the code(\score) block. @@ -350,10 +352,8 @@ 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, 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 -code(\relative) mode is a concession to this, but a ) - +em(context-free): a note will sound the same regardless of the current +time signature, the key nop(etc.) The purpose of LilyPond informally is explained by the term `music typesetter'. As you may have figured out by now, this is not a really @@ -373,15 +373,15 @@ made between processing speed and the beauty of the output: you get prettier output by using LilyPond. -As you can see, the most interesting parts of the input is music +As you can see, the most interesting part of the input is music itself, in this case the sequence of notes. We will therefore focus on entering music for now. Consequently, when we mean verb(\score { - \notes { XXXX } + \notes { XXXX } \paper { } })COMMENT( -) we will leave out the the repetitive details and just print +) we will leave out the the repetitive details for now and just print code(XXXX). @@ -415,16 +415,16 @@ mudela()( \notes { c'\longa c'\breve c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 c'2. c'8. c'16 - } - \paper { - linewidth = -1.0; - \translator { \type "Score_engraver"; - \name "Score"; - \consists "Note_heads_engraver"; - \consists "Stem_engraver"; - \consists "Rhythmic_column_engraver"; - }}} - + } + \paper { + linewidth = -1.0; + \translator { \type "Score_engraver"; + \name "Score"; + \consists "Note_heads_engraver"; + \consists "Stem_engraver"; + \consists "Rhythmic_column_engraver"; + }}} + ) subsect(Basic pitches) @@ -461,8 +461,10 @@ for C sharp or C flat. For this reason, mudela uses a different, non-English convention for entering altered pitches: a note is made sharp by adding the suffix `--is' to its name, and flat by adding the suffix `--es'. For a double sharp another `--is' suffix is added, for -flats another `--es' suffix. The names for the alterations of C are -given in bind(Table)ref(notename-tab). +flats another `--es' nop(suffix.) footnote(Variations on this +convention are used in a number of germanic languages, notably Dutch, +German, Swedish, and Norwegian.) The names for the alterations of C +are given in bind(Table)ref(notename-tab). latexcommand(\begin{table}[h]) center( @@ -480,16 +482,13 @@ latexcommand(\begin{table}[h]) label(notename-tab) latexcommand(\end{table}) -Variations on this convention are used in a number of germanic -languages, notably Dutch, German, Swedish, and Norwegian. - Throughout this document we will continue to use these names.footnote( Mudela defaults to Dutch notenames. To make (Dutch) pronunciation easier, the a-flat and e-flat are contracted to code(as) and code(es). Similarly, the a double flat and e double flat are contracted to code(ases) and code(eses). For consistency, the dutch names also include code(aes), code(aeses), code(ees) and - code(eeses)) consistency + code(eeses)) If you are not comfortable with these names, you can make your own. Note names for different languages are included with the example @@ -534,11 +533,18 @@ mudela(verbatim, fragment)( } ) +There is one thing to note, in sequences of chords, the (relative) +pitch of a is taken with reference to the first note of the previous +chord. + You can nest simultaneous and sequential music in any way you want, -e.g., -mudela(verbatim,fragment)( - < { g''4 g''4 } - { c'8 c' } > +e.g., COMMENT( + +)mudela(verbatim,fragment,center)( + < { g''4 g''4 } + { c'8 c' } > +)COMMENT( + ) As you can see, LilyPond has some difficulty typesetting this elegantly. To adequately solve this, you have to persuade LilyPond to @@ -568,26 +574,26 @@ following example: mudela()( \score{ < - \property Score.textstyle = typewriter - \type Staff \notes { - c''4-. - c''4-- - c''4-+ - c''4-| - c''4-> - c''4-^ - } - \type Lyrics\lyrics { - "."4 "-" "+" "|" ">" "\^{ }" } - > - \paper { linewidth = 12.\cm; } + \property Score.textstyle = typewriter + \type Staff \notes { + c''4-. + c''4-- + c''4-+ + c''4-| + c''4-> + c''4-^ + } + \type Lyrics\lyrics { + "."4 "-" "+" "|" ">" "\^{ }" } + > + \paper { linewidth = 12.\cm; } }) Text and digits for fingering can be entered in the same manner: add a dash and the text or digit to be printed: mudela(fragment,verbatim)( c''4-1 g''4-5 c''-"Sul tasto" ) -Currently, the meaning of the +COMMENT(Currently, the meaning of the syntax `note-dash-digit/articulation/text' is just ``add a superscript to this note.'' This is not in line with our goal to em(define) music with Mudela. We hope that this will be fixed in a future version of the @@ -596,7 +602,7 @@ subscripts can be forced into up or down position respectively by entering an a caret (code(^)) or an underscore, code(_) instead of the dash: mudela(fragment,verbatim,center)( c'4-^ c'4^^ c'''4-^ c'''4_^ -) +)) Dynamic markings are another way to add a nuance to a note. They are entered by adding the name for the dynamic sign after the note. You @@ -615,14 +621,9 @@ 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 one that ends it. These are the spanners that are entered like +this: -LilyPond has a few spanners description( dit(The slur) The slur has the opening parenthesis as @@ -646,7 +647,7 @@ 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, +beams should not be present in a ``music'' language. Unfortunately, LilyPond is not smart enough to insert beams into music on its own. LilyPond does have code that guesses what the pattern should look @@ -691,6 +692,11 @@ within a note. ) +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. + sect(Commands) label(sec:commands) @@ -1026,7 +1032,7 @@ sound the same if it were written as a single chord on a single staff, i.e., COMMENT( )mudela(fragment)( - + )COMMENT( ) The Mudela construct for multiple staffs reflects the similarity @@ -1087,8 +1093,8 @@ command. The bass clef is made with a clef command: COMMENT( ) mudela(verbatim,fragment)( \type GrandStaff < - \type Staff = treblestaff e'4 - \type Staff = bassstaff { \clef "bass"; g4 } + \type Staff = treblestaff e'4 + \type Staff = bassstaff { \clef "bass"; g4 } >)COMMENT( ) @@ -1414,7 +1420,7 @@ This explains the following definition, which is a simplified Staff context: verb( \translator { - \type "Line_group_engraver_group"; + \type "Line_group_engraver_group"; \name Staff ; \consists "Bar_engraver"; @@ -1424,7 +1430,7 @@ verb( \consists "Time_signature_engraver"; \consists "Staff_symbol_engraver"; - defaultClef = treble; + defaultClef = treble; \accepts "Voice"; }) COMMENT( diff --git a/init/lily.scm b/init/lily.scm index 94a6810b2d..a0bc2888e7 100644 --- a/init/lily.scm +++ b/init/lily.scm @@ -42,112 +42,218 @@ (string-append (number->string (car c)) " ") (string-append (number->string (cadr c)) " "))) + + +(define + (font i) + (string-append + "font" + (make-string 1 (integer->char (+ (char->integer #\A) i))) + )) + + + +(define (scm-scm action-name) + 1) + +;;;;;;;; + + (define (empty) + "") + + (define (empty1 a) + "") + + (define (empty2 a b ) + "") + + +(define emptybar empty1) +(define setdynamic empty1) +(define settext empty1) +(define setnumber empty1) + + ;;;;;;;; TeX -;(define (tex action) -(define (beam-tex width slope thick) - (embedded-ps-tex ((ps-scm 'beam) width slope thick))) +(define (tex-scm action-name) -(define (bracket-tex h) - (embedded-ps-tex ((ps-scm 'bracket) h))) + (define (unknown) + "%\n\\unknown%\n") -(define (dashed-slur-tex thick dash l) - (embedded-ps-tex ((ps-scm 'dashed-slur) thick dash l))) + (define (beam width slope thick) + (embedded-ps ((ps-scm 'beam) width slope thick))) -(define (crescendo-tex w h cont) - (embedded-ps-tex ((ps-scm 'crescendo) w h cont))) + (define (bracket h) + (embedded-ps ((ps-scm 'bracket) h))) -(define (decrescendo-tex w h cont) - (embedded-ps-tex ((ps-scm 'decrescendo) w h cont))) + (define (dashed-slur thick dash l) + (embedded-ps ((ps-scm 'dashed-slur) thick dash l))) -(define (embedded-ps-tex s) - (string-append "\\embeddedps{" s "}")) + (define (crescendo w h cont) + (embedded-ps ((ps-scm 'crescendo) w h cont))) + (define (decrescendo w h cont) + (embedded-ps ((ps-scm 'decrescendo) w h cont))) -(define (end-output-tex) - "\n\\EndLilyPondOutput") + (define (embedded-ps s) + (string-append "\\embeddedps{" s "}")) -(define (empty-tex) - "%\n\\empty%\n") -(define (experimental-on-tex) "\\turnOnExperimentalFeatures") + (define (end-output) + "\n\\EndLilyPondOutput") + + (define (experimental-on) "\\turnOnExperimentalFeatures") -(define (extender o h) - ((invoke-output o "invoke-dim1") "extender" h)) + (define (extender o h) + ((invoke-output o "invoke-dim1") "extender" h)) -(define (font-switch-tex i) - (string-append - "\\" (font i) "\n")) + (define (font-switch i) + (string-append + "\\" (font i) "\n")) -(define (font-def-tex i s) - (string-append - "\\font" (font-switch-tex i) "=" s "\n")) + (define (font-def i s) + (string-append + "\\font" (font-switch i) "=" s "\n")) -(define (generalmeter-tex num den) - (string-append - "\\generalmeter{" (number->string (inexact->exact num)) "}{" (number->string (inexact->exact den)) "}")) + (define (generalmeter num den) + (string-append + "\\generalmeter{" (number->string (inexact->exact num)) "}{" (number->string (inexact->exact den)) "}")) -(define (header-end-tex) "\\turnOnPostScript") + (define (header-end) "\\turnOnPostScript") -(define (header-tex creator generate) - (string-append - "%created by: " creator generate "\n")) + (define (header creator generate) + (string-append + "%created by: " creator generate "\n")) -(define (invoke-char-tex s i) - (string-append - "\n\\" s "{" (inexact->string i 10) "}" )) + (define (invoke-char s i) + (string-append + "\n\\" s "{" (inexact->string i 10) "}" )) + (define (char i) + (string-append "\\show{" (inexact->string i 10) "}")) + + (define (invoke-dim1 s d) + (string-append + "\n\\" s "{" (number->dim d) "}")) -(define (invoke-dim1-tex s d) - (string-append - "\n\\" s "{" (number->dim-tex d) "}")) + (define (lily-def key val) + (string-append + "\\def\\" key "{" val "}\n")) -(define (lily-def-tex key val) - (string-append - "\\def\\" key "{" val "}\n")) + (define (number->dim x) + (string-append + (number->string (chop-decimal x)) "pt ")) -(define (number->dim-tex x) - (string-append - (number->string (chop-decimal x)) "pt ")) + (define (placebox x y s) + (string-append + "\\placebox{" + (number->dim y) "}{" (number->dim x) "}{" s "}")) -(define (placebox-tex x y s) - (string-append - "\\placebox{" - (number->dim-tex y) "}{" (number->dim-tex x) "}{" s "}")) + (define (pianobrace y) + (define step 1.0) + (define minht mudelapaperstaffheight) + (define maxht (* 6 minht)) + (string-append + "{\\bracefont " (char (/ (- (max y (- maxht step)) minht) step)) "}")) + + (define (rulesym h w) + (string-append + "\\vrule height " (number->dim (/ h 2)) + " depth " (number->dim (/ h 2)) + " width " (number->dim w) + ) + ) -(define (rulesym-tex h w) - (string-append - "\\vrule height " (number->dim-tex (/ h 2)) - " depth " (number->dim-tex (/ h 2)) - " width " (number->dim-tex w) - ) - ) + (define (slur l) + (embedded-ps ((ps-scm 'slur) l))) + + (define (start-line) + (string-append + "\\hbox{%\n") + ) -(define (slur-tex l) - (embedded-ps-tex ((ps-scm 'slur) l))) + (define (stem kern width height depth) + (string-append + "\\kern" (number->dim kern) + "\\vrule width " (number->dim width) + "depth " (number->dim depth) + "height " (number->dim height) " ")) -(define (start-line-tex) - (string-append - "\\hbox{%\n") - ) + (define (stop-line) + "}\\interscoreline") -(define (stem-tex kern width height depth) - (string-append - "\\kern" (number->dim-tex kern) - "\\vrule width " (number->dim-tex width) - "depth " (number->dim-tex depth) - "height " (number->dim-tex height) " ")) + (define (text f s) + (string-append "\\set" f "{" s "}")) -(define (stop-line-tex) - "}\\interscoreline") + (define (tuplet dx dy dir) + (embedded-ps ((ps-scm 'tuplet) dx dy dir))) -(define (text-tex f s) - (string-append "\\set" f "{" s "}")) + (define (volta w last) + (embedded-ps ((ps-scm 'volta) w last))) -(define (tuplet-tex dx dy dir) - (embedded-ps-tex ((ps-scm 'tuplet) dx dy dir))) + (define (maatstreep h) + (string-append "\\maatstreep{" (number->dim h) "}")) + + (cond ((eq? action-name 'all-definitions) + `(begin + (define beam ,beam) + (define tuplet ,tuplet) + (define bracket ,bracket) + (define crescendo ,crescendo) + (define volta ,volta) + (define slur ,slur) + (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) + (define generalmeter ,generalmeter) + (define header-end ,header-end) + (define lily-def ,lily-def) + (define header ,header) + (define invoke-char ,invoke-char) + (define invoke-dim1 ,invoke-dim1) + (define placebox ,placebox) + (define rulesym ,rulesym) + (define start-line ,start-line) + (define stem ,stem) + (define stop-line ,stop-line) + (define text ,text) + (define experimental-on ,experimental-on) + (define char ,char) + (define maatstreep ,maatstreep) + (define pianobrace ,pianobrace) + )) + + ((eq? action-name 'experimental-on) experimental-on) + ((eq? action-name 'beam) beam) + ((eq? action-name 'tuplet) tuplet) + ((eq? action-name 'bracket) bracket) + ((eq? action-name 'crescendo) crescendo) + ((eq? action-name 'volta) volta) + ((eq? action-name 'slur) slur) + ((eq? action-name 'dashed-slur) dashed-slur) + ((eq? action-name 'decrescendo) decrescendo) + ((eq? action-name 'empty) empty) + ((eq? action-name 'end-output) end-output) + ((eq? action-name 'font-def) font-def) + ((eq? action-name 'font-switch) font-switch) + ((eq? action-name 'generalmeter) generalmeter) + ((eq? action-name 'header-end) header-end) + ((eq? action-name 'lily-def) lily-def) + ((eq? action-name 'header) header) + ((eq? action-name 'invoke-char) invoke-char) + ((eq? action-name 'invoke-dim1) invoke-dim1) + ((eq? action-name 'placebox) placebox) + ((eq? action-name 'rulesym) rulesym) + ((eq? action-name 'start-line) start-line) + ((eq? action-name 'stem) stem) + ((eq? action-name 'stop-line) stop-line) + (else (error "unknown tag -- PS-TEX " action-name)) + ) -(define (volta-tex w last) - (embedded-ps-tex ((ps-scm 'volta) w last))) + ) ;;;;;;;;;;;; PS (define (ps-scm action-name) @@ -243,9 +349,6 @@ (define (text f s) (string-append "(" s ") set" f " ")) -(define - (unknown-tex) - "%\n\\unknown%\n") (define (volta w last) (string-append @@ -257,10 +360,13 @@ "draw_tuplet")) + (define (unknown) + "\n unknown\n") + ; dispatch on action-name (cond ((eq? action-name 'all-definitions) - `(eval + `(begin (define beam ,beam) (define tuplet ,tuplet) (define bracket ,bracket) @@ -299,217 +405,4 @@ ) -(define - (unknown-ps) - "\n unknown\n") - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; output definitions - -(define - (beam o width slope thick) - ((invoke-output o "beam") width slope thick)) - -(define - (bracket o h) - ((invoke-output o "bracket") h)) - -(define - (char o n) - ((invoke-output o "invoke-char") "show" n)) - -(define - (crescendo o w h cont) - ((invoke-output o "crescendo") w h cont)) - -(define - (dashed-slur o thick dash l) - ((invoke-output o "dashed-slur") thick dash l)) - -(define - (decrescendo o w h cont) - ((invoke-output o "decrescendo") w h cont)) - -(define - (doublebar o h) - ((invoke-output o "invoke-dim1") "doublebar" h)) - -(define - (empty o) - ((invoke-output o "empty"))) - -(define - (emptybar o h) (empty o)) - -(define - (end-output o) - ((invoke-output o "end-output"))) - -(define - (experimental-on o) - ((invoke-output o "experimental-on"))) - -(define - (fatdoublebar o h) - ((invoke-output o "invoke-dim1") "fatdoublebar" h)) - -(define - (finishbar o h) - ((invoke-output o "invoke-dim1") "finishbar" h)) - -(define - (font i) - (string-append - "font" - (make-string 1 (integer->char (+ (char->integer #\A) i))) - )) - -(define - (font-def o i s) - ((invoke-output o "font-def") i s)) - -(define - (font-switch o i) - ((invoke-output o "font-switch") i)) - -(define - (generalmeter o num den) - ((invoke-output o "generalmeter") num den)) - -(define - (header o creator generate) - ((invoke-output o "header") creator generate)) - -(define - (header-end o) - ((invoke-output o "header-end"))) - -(define - (invoke-output o s) - (eval-string (string-append s "-" o))) - -(define - (lily-def o key val) - ((invoke-output o "lily-def") key val)) - -(define - (maatstreep o h) - ((invoke-output o "invoke-dim1") "maatstreep" h)) - -(define - (pianobrace o i) - ((invoke-output o "invoke-char") "pianobrace" i)) - -(define - (placebox o x y b) - ((invoke-output o "placebox") x y (b o))) - -(define - (repeatbar o h) - ((invoke-output o "invoke-dim1") "repeatbar" h)) - -(define - (repeatbarstartrepeat o h) - ((invoke-output o "invoke-dim1") "repeatbarstartrepeat" h)) - -(define - (rulesym o x y) - ((invoke-output o "rulesym") x y)) - -(define - (setbold o s) - ((invoke-output o "text") "bold" s)) - -(define - (setdynamic o s) (empty o)) - -(define - (setfinger o s) - ((invoke-output o "text") "finger" s)) - -(define - (sethuge o s) - ((invoke-output o "text") "huge" s)) - -(define - (setitalic o s) - ((invoke-output o "text") "italic" s)) - -(define - (setlarge o s) - ((invoke-output o "text") "large" s)) - -(define - (setLarge o s) - ((invoke-output o "text") "Large" s)) - -(define - (setnumber o s) - ((invoke-output o "text") "number" s)) - -; urg, howto do all these sizes; -; what about: fontjj fontj font fonti fontii -(define - (setnumber-1 o s) - ((invoke-output o "text") "numberj" s)) - -(define - (settext o s) - ((invoke-output o "text") "text" s)) - -(define - (settypewriter o s) - ((invoke-output o "text") "typewriter" s)) - -(define - (slur o l) - ((invoke-output o "slur") l)) - -(define - (tuplet o dx dy dir) - ((invoke-output o "tuplet") dx dy dir)) - -(define - (stem o kern width height depth) - ((invoke-output o "stem") kern width height depth)) - - - -(define - (start-line o) - ((invoke-output o "start-line"))) - -(define - (startbar o h) - ((invoke-output o "invoke-dim1") "startbar" h)) - -(define - (startrepeat o h) - ((invoke-output o "invoke-dim1") "startrepeat" h)) - -(define - (stem o kern width height depth) - ((invoke-output o "stem") kern width height depth)) - -(define - (stop-line o) - ((invoke-output o "stop-line"))) - -(define - (stoprepeat o h) - ((invoke-output o "invoke-dim1") "stoprepeat" h)) - -(define - (tuplet-ps dx dy dir) - (string-append - (numbers->string (list dx dy (inexact->exact dir))) - "draw_tuplet")) - -(define - (unknown o) - ((invoke-output o "unknown"))) - -(define - (volta o w last) - ((invoke-output o "volta") w last)) diff --git a/lily/atom.cc b/lily/atom.cc index ae6092c165..be15086037 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -69,13 +69,6 @@ Atom::extent () const Atom::Atom () : dim_ (Interval (0,0),Interval (0,0)) { - /* - urg - We should probably make Atom an abstract base class to - derive Ps_atom and Tex_atom from. - But Atom is used as a simple type *everywhere*, - and we don't have virtual contructors. - */ str_ = "unknown\n"; origin_l_ = 0; } diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index becdf9b76b..fbfd95459d 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -64,7 +64,7 @@ Dynamic_engraver::do_process_requests() Text_def * td_p = new Text_def; td_p->align_dir_ = CENTER; String loud = absd->loudness_str (); - td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; // ugh + td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; // ugh td_p->style_str_ = "dynamic"; diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 5afbb1e6ce..e2f945b1c0 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -10,26 +10,22 @@ #define LILY_GUILE_HH #include "config.hh" +#include "string.hh" #include #include +SCM ly_symbol (String name); + SCM ly_append (SCM a, SCM b); SCM ly_eval (SCM a); SCM ly_func_o (char const* name); -SCM ly_lambda_o (); -SCM ly_list1 (SCM a); -SCM ly_quote (); SCM ly_quote_scm (SCM s); #include "array.hh" #include "scalar.hh" -SCM lambda_scm (String str, Array args_arr); -SCM lambda_scm (String str, Array args_arr); -SCM lambda_scm (String str, Array args_arr); - void read_lily_scm_file (String); diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index e88e6fa5c6..42c580768e 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -24,13 +24,17 @@ public: Paper_outputter (Paper_stream *); ~Paper_outputter (); + void output_int_def (String k, int v); + void output_Real_def (String k, Real v); + void output_String_def (String k, String v); + void output_scope (Scope*, String prefix); + void output_version (); void output_font_def (int i, String str); void output_font_switch (int i); void output_header (); void output_molecule (Molecule const *, Offset, char const *); void output_comment (String s); void output_scheme (SCM scm); - void output_string (String s); void start_line (); void stop_line (); void switch_to_font (String fontname); diff --git a/lily/include/protected-scm.hh b/lily/include/protected-scm.hh index 5fa1f568ce..f02ced787b 100644 --- a/lily/include/protected-scm.hh +++ b/lily/include/protected-scm.hh @@ -25,6 +25,7 @@ public: ~Protected_scm (); Protected_scm &operator = (Protected_scm const &); operator SCM (); + SCM to_SCM () const; }; #endif /* PROTECTED_SCM_HH */ diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 8599b9ba95..b729e90590 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -15,17 +15,6 @@ #include "simple-file-storage.hh" #include "file-path.hh" -SCM -ly_list1 (SCM a) -{ - return gh_list (a, SCM_UNDEFINED); -} - -SCM -ly_quote () -{ - return gh_eval_str ("'quote"); -} /* scm_m_quote doesn't use any env, but needs one for a good signature in GUILE. @@ -36,83 +25,20 @@ ly_quote () SCM ly_quote_scm (SCM s) { - // return scm_m_quote (s, SCM_UNDEFINED); return scm_cons2 (scm_i_quote, s, SCM_EOL); - -} - -SCM -ly_eval (SCM a) -{ - return gh_call1 (gh_eval_str ("eval"), a); -} - -SCM -ly_lambda_o () -{ - return gh_eval_str ("'(lambda (o))"); } -SCM -ly_func_o (char const* name) -{ - char buf[200]; // ugh. - snprintf (buf, 200, "'(%s o)", name); - return gh_eval_str (buf); -} - - -SCM -lambda_scm (String str, Array args_arr) -{ - if (str.empty_b ()) - { - str = "empty"; - args_arr.clear (); - } - SCM args_scm = SCM_EOL; - for (int i = args_arr.size () - 1; i >= 0; i--) - args_scm = gh_cons (gh_int2scm (args_arr[i]), args_scm); - SCM 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) -{ - if (str.empty_b ()) - { - str = "empty"; - args_arr.clear (); - } - SCM args_scm = SCM_EOL; - for (int i = args_arr.size (); i--; ) - args_scm = gh_cons (gh_str02scm (args_arr[i].ch_l ()), args_scm); - SCM scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o (str.ch_l ()), args_scm))); - return scm; -} +/* + See: libguile/symbols.c + SCM + scm_string_to_symbol(s) + +*/ SCM -lambda_scm (String str, Array args_arr) +ly_symbol (String name) { - if (str.empty_b ()) - { - str = "empty"; - args_arr.clear (); - } - SCM args_scm = SCM_EOL; - for (int i = args_arr.size (); i--; ) - args_scm = gh_cons (gh_double2scm (args_arr[i]), args_scm); - - SCM scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o (str.ch_l ()), args_scm))); - return scm; + return gh_car (scm_intern (name.ch_C(), name.length_i())); } /** diff --git a/lily/p-score.cc b/lily/p-score.cc index 94982bb100..2afdbc129c 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -45,18 +45,6 @@ Paper_score::Paper_score () Paper_score::~Paper_score () { -#if 0 - for (int i=0; i< line_l_arr_.size (); i++) - line_l_arr_[i]->unlink_all (); - - for (PCursor i(elem_p_list_.top()); i.ok(); i++) - { - - if (i->linked_b()) - i->unlink (); - assert (! i->linked_b ()); - } -#endif } void diff --git a/lily/paper-def.cc b/lily/paper-def.cc index e3fe90b19d..a98af9d389 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -224,77 +224,34 @@ Paper_def::reset_default_count() default_count_i_ = 0; } -//urg extern char const* lily_version_number_sz (); -void -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 = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o ("lily-def"), args_scm))); - p->output_scheme (scm); -} - -void -output_header (Paper_outputter* p, Scope *head) -{ - if (!head) - return; - - String id_str = "Lily was here"; - if (no_timestamps_global_b) - id_str += "."; - else - id_str += String (", ") + lily_version_number_sz (); - output_def (p, "LilyIdString", id_str); - - for (Dictionary_iter i (*head); i.ok (); i++) - { - if (!i.val ()->access_content_String (false)) - continue; - - String val = *i.val()->access_content_String (false); - output_def (p, "mudela" + i.key (), val); - } -} - -void -Paper_def::output_settings (Paper_outputter* p) const -{ - for (Dictionary_iter i (*scope_p_); i.ok (); i++) - output_def (p, String ("mudelapaper") + i.key (), i.val ()->str ()); - p->output_string (*scope_p_->elem (String (output_global_ch) + "setting")->access_content_String (false)); -} - Paper_outputter* Paper_def::paper_outputter_p (Paper_stream* os_p, Header* header_l, String origin_str) const { Paper_outputter* p = new Paper_outputter (os_p); - output_header (p, header_global_p); -#if 0 // for now; breaks -fscm output p->output_comment (_ ("outputting Score, defined at: ")); p->output_comment (origin_str); -#endif - - output_header (p, header_l); - - output_settings (p); - SCM scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o ("experimental-on"), SCM_EOL))); + p->output_version(); + if (header_global_p) + p->output_scope (header_global_p, "mudela"); + if (header_l) + p->output_scope (header_l, "mudela"); + if (scope_p_) + p->output_scope (scope_p_, "mudelapaper"); + + if (output_global_ch == String("tex")) + { + *p->outstream_l_ << *scope_p_->elem ("texsetting")->access_content_String (false); + } + + SCM scm = gh_list (ly_symbol ("experimental-on"), SCM_UNDEFINED); p->output_scheme (scm); - - scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o ("header-end"), SCM_EOL))); - + scm = gh_list (ly_symbol ("header-end"), SCM_UNDEFINED); p->output_scheme (scm); return p; @@ -308,7 +265,8 @@ Paper_def::paper_stream_p () const if (outname != "-") outname += String (".") + output_global_ch; *mlog << _f ("Paper output to %s...", - outname == "-" ? String ("") : outname ) << endl; + outname == "-" ? String ("") : outname) << endl; + target_str_global_array.push (outname); return new Paper_stream (outname); } diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 3f31fb306f..bfab233f07 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -9,6 +9,9 @@ #include #include + +#include "dictionary-iter.hh" +#include "virtual-methods.hh" #include "paper-outputter.hh" #include "paper-stream.hh" #include "molecule.hh" @@ -18,6 +21,8 @@ #include "debug.hh" #include "lookup.hh" #include "main.hh" +#include "scope.hh" +#include "identifier.hh" Paper_outputter::Paper_outputter (Paper_stream *s) { @@ -27,16 +32,16 @@ Paper_outputter::Paper_outputter (Paper_stream *s) Paper_outputter::~Paper_outputter () { - SCM scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o ("end-output"), SCM_EOL))); - + SCM scm = gh_list (ly_symbol ("end-output"), SCM_UNDEFINED); output_scheme (scm); } void Paper_outputter::output_header () { + String s = String ("(eval (") + output_global_ch + "-scm 'all-definitions))"; + gh_eval_str (s.ch_C()); + String creator; if (no_timestamps_global_b) creator = "GNU LilyPond\n"; @@ -54,8 +59,8 @@ Paper_outputter::output_header () } SCM args_scm = - gh_cons (gh_str02scm (creator.ch_l ()), - gh_cons (gh_str02scm (generate.ch_l ()), SCM_EOL)); + gh_list (gh_str02scm (creator.ch_l ()), + gh_str02scm (generate.ch_l ()), SCM_UNDEFINED); #ifndef NPRINT DOUT << "output_header\n"; @@ -65,10 +70,7 @@ Paper_outputter::output_header () } #endif - SCM scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o ("header"), args_scm))); - + SCM scm = gh_cons (ly_symbol ("header"), args_scm); output_scheme (scm); } @@ -84,37 +86,23 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) a_off += o; if (!i->lambda_) - { - // urg - i->lambda_ = gh_append2 (ly_lambda_o (), - ly_list1 (ly_func_o ("empty"))); - } - - switch_to_font (i->font_); + continue; -#ifndef NPRINT - if (check_debug && !monitor->silent_b ("Guile")) + if (check_debug) { - DOUT << i->str_ << "\n"; - gh_display (i->lambda_); gh_newline (); + output_comment (classname (i.ptr ()->origin_l_)); + } -#endif + + switch_to_font (i->font_); - SCM args_scm = - gh_cons (gh_double2scm (a_off.x ()), - gh_cons (gh_double2scm (a_off.y ()), - gh_cons (i->lambda_, SCM_EOL))); + SCM args_scm = gh_list (gh_double2scm (a_off.x ()), + gh_double2scm (a_off.y ()), + i->lambda_.to_SCM (), + SCM_UNDEFINED); -#ifndef NPRINT - if (check_debug && !monitor->silent_b ("Guile")) - { - gh_display (args_scm); gh_newline (); - } -#endif - SCM box_scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o ("placebox"), args_scm))); + SCM box_scm = gh_cons (ly_symbol ("placebox"), args_scm); output_scheme (box_scm); } @@ -123,8 +111,14 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) void Paper_outputter::output_comment (String str) { - // urg - *outstream_l_ << "% " << str << "\n"; + if (String (output_global_ch) == "scm") + { + *outstream_l_ << "; " << str << '\n'; + } + else + { + *outstream_l_ << "% " << str << "\n"; + } } @@ -136,41 +130,69 @@ Paper_outputter::output_scheme (SCM scm) if (String (output_global_ch) == "scm") { static SCM port = 0; + // urg if (!port) { int fd = 1; - ofstream * of = dynamic_cast (outstream_l_->os); + ofstream * of = dynamic_cast (outstream_l_->os); if (of) fd = of->rdbuf()->fd(); FILE *file = fdopen (fd, "a"); port = scm_standard_stream_to_port (file, "a", ""); scm_display (gh_str02scm ("(load 'lily.scm)\n"), port); - scm_display (gh_str02scm ("(define (of) 'ps)\n"), port); - scm_display (gh_str02scm ("(define (of) 'tex)\n"), port); } - scm_display (gh_str02scm ("(display ((eval "), port); + scm_display (gh_str02scm ("("), port); scm_write (scm, port); - scm_display (gh_str02scm (") (of)))\n"), port); - scm_newline (port); + scm_display (gh_str02scm (")\n"),port); scm_fflush (port); - - return; } else { - SCM str_scm = gh_call1 (ly_eval (scm), gh_eval_str (o.ch_l ())); - char* c = gh_scm2newstr (str_scm, NULL); + SCM result = scm_eval (scm); + char *c=gh_scm2newstr (result, NULL); + *outstream_l_ << c; free (c); } } + void -Paper_outputter::output_string (String str) +Paper_outputter::output_scope (Scope *scope, String prefix) { - // urg - *outstream_l_ << str; + for (Dictionary_iter i (*scope); i.ok (); i++) + { + if (dynamic_cast (i.val ())) + { + String val = *i.val()->access_content_String (false); + + output_String_def (prefix + i.key (), val); + } + else if(dynamic_cast (i.val ())) + { + Real val = *i.val ()->access_content_Real (false); + + output_Real_def (prefix + i.key (), val); + } + else if (dynamic_cast (i.val ())) + { + int val = *i.val ()->access_content_int (false); + + output_int_def (prefix + i.key (), val); + } + } +} + +void +Paper_outputter::output_version () +{ + String id_str = "Lily was here"; + if (no_timestamps_global_b) + id_str += "."; + else + id_str += String (", ") + get_version_str (); + output_String_def ( "LilyIdString", id_str); } void @@ -198,38 +220,65 @@ Paper_outputter::switch_to_font (String fontname) void Paper_outputter::start_line () { - SCM scm = - gh_append2 (ly_lambda_o (), - gh_list (ly_func_o ("start-line"), SCM_UNDEFINED));; - + SCM scm = gh_list (ly_symbol ("start-line"), SCM_UNDEFINED); output_scheme (scm); } -/* - 26 fonts ought to be enough for anyone. -*/ void Paper_outputter::output_font_def (int i, String str) { - //urg, broken with guile-1.3 - //return; - SCM scm = - 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))))); + SCM scm = gh_list (ly_symbol ("font-def"), + gh_int2scm (i), + gh_str02scm (str.ch_l ()), + SCM_UNDEFINED); output_scheme (scm); } +void +Paper_outputter::output_Real_def (String k, Real v) +{ + + SCM scm = gh_list (ly_symbol ("lily-def"), + gh_str02scm (k.ch_l ()), + gh_str02scm (to_str(v).ch_l ()), + SCM_UNDEFINED); + output_scheme (scm); + + gh_define (k.ch_l (), gh_double2scm (v)); +} + +void +Paper_outputter::output_String_def (String k, String v) +{ + + SCM scm = gh_list (ly_symbol ("lily-def"), + gh_str02scm (k.ch_l ()), + gh_str02scm (v.ch_l ()), + SCM_UNDEFINED); + output_scheme (scm); + + gh_define (k.ch_l (), gh_str02scm (v.ch_l ())); +} + +void +Paper_outputter::output_int_def (String k, int v) +{ + SCM scm = gh_list (ly_symbol ("lily-def"), + gh_str02scm (k.ch_l ()), + gh_str02scm (to_str (v).ch_l ()), + SCM_UNDEFINED); + output_scheme (scm); + + gh_define (k.ch_l (), gh_int2scm (v)); +} + void Paper_outputter::output_font_switch (int i) { - //urg, broken with guile-1.2, 1.3 - //return; - SCM scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o ("font-switch"), - gh_cons (gh_int2scm (i), SCM_EOL)))); + SCM scm = gh_list (ly_symbol ("font-switch"), + gh_int2scm (i), + SCM_UNDEFINED); output_scheme (scm); } @@ -237,10 +286,7 @@ Paper_outputter::output_font_switch (int i) void Paper_outputter::stop_line () { - SCM scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o ("stop-line"), SCM_EOL))); - + SCM scm = gh_list (ly_symbol ("stop-line"), SCM_UNDEFINED); output_scheme (scm); current_font_ = ""; diff --git a/lily/protected-scm.cc b/lily/protected-scm.cc index 0304d91f91..0cc85e14d5 100644 --- a/lily/protected-scm.cc +++ b/lily/protected-scm.cc @@ -50,3 +50,9 @@ Protected_scm::operator SCM () { return object_; } + +SCM +Protected_scm::to_SCM () const +{ + return object_; +} diff --git a/lily/stem.cc b/lily/stem.cc index 91277cf1b3..f23ca3b67a 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -285,7 +285,6 @@ Stem::brew_molecule_p () const Molecule *mol_p =new Molecule; Drul_array stem_y = yextent_drul_; Real dy = paper ()->internote_f (); - Real head_wid = 0; if (head_l_arr_.size ()) diff --git a/mutopia/Coriolan/coriolan-part-paper.ly b/mutopia/Coriolan/coriolan-part-paper.ly index 3499e9627c..9d24ed2e61 100644 --- a/mutopia/Coriolan/coriolan-part-paper.ly +++ b/mutopia/Coriolan/coriolan-part-paper.ly @@ -1,4 +1,8 @@ -\paper { +\paper { \translator { \OrchestralPartStaffContext } - \translator { \ScoreContext skipBars = 1; } + \translator { \ScoreContext + SkipBars = 1; + } + castingalgorithm = \Wordwrap; + } diff --git a/mutopia/Coriolan/corni-part.ly b/mutopia/Coriolan/corni-part.ly index f0d3b0ab50..305c4ac1da 100644 --- a/mutopia/Coriolan/corni-part.ly +++ b/mutopia/Coriolan/corni-part.ly @@ -17,3 +17,4 @@ copyright = "public domain"; \midi{ \tempo 4 = 160; } } + diff --git a/mutopia/Coriolan/corno-1.ly b/mutopia/Coriolan/corno-1.ly index 903812a0e7..e05d0c0ac3 100644 --- a/mutopia/Coriolan/corno-1.ly +++ b/mutopia/Coriolan/corno-1.ly @@ -16,7 +16,92 @@ corno1 = \notes \relative c { r2 r4 g4-.\f | R1*6 | r4 g-.\f r2 | R1*2 | % `a 2 r8 f\p_"\ \ \ cresc." f2 e4 | r8 f f2 e4 | - f4. e8 f4. e8 | f4. e8 f4. e8 | d,1\ff % ~ | - %35 + f4. e8 f4. e8 | f4. e8 f4. e8 | f1\ff % ~ | + f4 ( e f )e + e4. r8 e4. r8 | + e4. r8 e4. r8 | + e4. r8 d4. r8 | + g4. r8 f4. r8 + c2 \sf r2 + c2 \sf r2 + R1*2 + e1 \sf c1\sf g2. g4 \sf g2. g4 \sf g2. g4\sf g2. g4\sf g r4 r2 | + r1 g1 ~ g ~ g~ g~ g~ g~ g~ g~ g + g2\ff d'2 e1 + R1*14 + c2. \ff e4 + r4 e r e c2. e4 r4 e r e + f2. e4 e e e e f2. e4 e e e e | + r4 r8 c8 c2\sf + r4 r8 c8 c2\sf + r4 r8 c8 c2\sf + r4 r8 c8 c2\sf + c4 r4 c r | + e4 r e r + r2 e4 r + r2 e4 r | + R1*4 + e4\f r4 r2 r1 + e4\f r4 r2 + R1*3 + e4\f r8 e e4 r8 e | + e4 r8 e e4 r8 e | + e4 r8 e g4 r8 g | + g4 r8 g8 r2 + g1 ~ g | + g4. g8 g4 r8 g | + g4 r8 g8 g4 r8 g8 + g4\p r4 r2 + R1*16 + d4\f r4 r2 + g4 r r2 + g4 r8 g g4 r8 g | + g4 r8 g g4 r8 g | + f4\p r4 r2 | + R1*3 + f4 r e r + d r c r + g' r f r + e r e r + d r r2 | + r1 + d4-.\ff r4 r2 + R1*3 + f2\sf r2 f2 \sf r2 + R1*3 + e2\ff r2 e \sf r2 + R1*3 + d2.\ff r4 d2. r4 | + d2. r4 d2. r4 + e2. r4 e2. r4 + e2. r4 e2. r4 + e4 r4 r2 r1 + R1*11 + e2 d2 + R1*17 + r4 r8 e,8 e4. e8| + r4 r8 e8 e4. e8| + r4 r8 e8 e4. e8| + r4 r8 e8 e4. e8| + r4 r8 e8 e4. e8| + r4 r8 e8 e4. e8| + f2. e4 d e d e + f2. e4 d e d e + g2. f4 g f g f + g2. f4 g f g f + r4 r8 f f2 + r4 r8 f f2 + r4 r8 f f2 + r4 r8 f f2 + f2 e~ | e d~ | d1 ~ d1 + d4 r4 f r d r e r + r1 + r2 r4 r8 e\f e4 r4 r2 + r2 r4 r8 e8 e4 r r2 + R1*3 + + + + } diff --git a/ps/lily.ps b/ps/lily.ps index 6ea6920d23..d8cf6e5e42 100644 --- a/ps/lily.ps +++ b/ps/lily.ps @@ -1,5 +1,6 @@ %!PS-Adobe-1.0: lily.ps +% 2 setlanguagelevel % hmm. auto_resize_dicts doesn't help either. % round cappings 1 setlinecap diff --git a/tex/lily-ps-defs.tex b/tex/lily-ps-defs.tex index 92cf4e73b7..9f60b99b26 100644 --- a/tex/lily-ps-defs.tex +++ b/tex/lily-ps-defs.tex @@ -16,6 +16,7 @@ % transplant a TeX dimension into the PS output. \def\PSsetTeXdimen#1{\expandafter\special{! /#1 (\the\csname #1\endcsname) deftexdimen}} + {% \def\par{ }% %Ugh. Don't try this at home, kids! % neat file-include trick by Piet van Oostrum @@ -39,7 +40,7 @@ % stuff too early % \filedef\includelilyps{lily.ps}% - \expandafter\special{! \includelilyps} + \expandafter\special{! \includelilyps } }