From 527c0b20b21fc980270d426caf64ed0e1c776d77 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 22 Nov 1998 20:43:39 +0100 Subject: [PATCH] patch::: 1.1.8.hwn1 pl 8.hwn1 - tutorial fixes. --- Generated by hanwen@cs.uu.nl using package-diff 0.62, From = lilypond-1.1.8, To = lilypond-1.1.8.hwn1 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.1.8.hwn1.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure and possibly make outdirs. --state 1.1.8 1.1.8.hwn1 ++state --- Documentation/tex/tutorial.yo | 318 +++++++++++------------ NEWS | 10 +- TODO | 9 +- VERSION | 2 +- init/lily.scm | 458 +++++++++++++--------------------- init/table16.ly | 7 +- init/table20.ly | 7 +- lily/atom.cc | 7 - lily/include/lily-guile.hh | 3 + lily/include/protected-scm.hh | 1 + lily/lily-guile.cc | 35 +-- lily/lookup.cc | 88 +++---- lily/paper-def.cc | 21 +- lily/paper-outputter.cc | 117 ++++----- lily/protected-scm.cc | 6 + ps/lily.ps | 1 + tex/lily-ps-defs.tex | 3 +- 17 files changed, 479 insertions(+), 614 deletions(-) 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/NEWS b/NEWS index 7a96658e8c..7dcddaa33b 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,12 @@ -pl8.tca1 +--- ../lilypond-1.1.8/NEWS Sun Nov 22 20:16:26 1998 +++ b/NEWS Sun Nov 22 20:43:39 1998 +@@ -1,3 +1,6 @@ +pl 8.hwn1 + - tutorial fixes. + + pl 8 + + pl7.jcn3pl8.tca1 - changes to mudela-book. Junked fragment and floating options, added eps option. Options should not stay as long that you get comfortable with them. ;) diff --git a/TODO b/TODO index 52d614df1a..8a2255c065 100644 --- a/TODO +++ b/TODO @@ -6,9 +6,7 @@ done, or is an idea that I want to think about Most of the items are marked in the code as well, with full explanation. grep for TODO and ugh/ugr/urg - BUGS: - * gallina barlines. * latex bla.tex broken (titles / \lilyfooter stuff?) @@ -34,9 +32,9 @@ BUGS: * space after bars? * [/3 c8 c16 c c c]/1 - + * fix singleStaffBracket - + * repeat bars: need distance after ":|" and before "|:" * The time signature warnings still remain, will be fixed later. @@ -67,6 +65,9 @@ BUGS: portato= \script { "portato" 0 -1 0 1 0 } STUFF + * uniformise recent feta contributions. + + * check out legal/(c) matters for scores. * move option processing out of gh_enter diff --git a/VERSION b/VERSION index f5b0cf0783..2a172de0de 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=8 -MY_PATCH_LEVEL=tca1 +MY_PATCH_LEVEL=hwn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/init/lily.scm b/init/lily.scm index 94a6810b2d..4b741da3d1 100644 --- a/init/lily.scm +++ b/init/lily.scm @@ -42,112 +42,203 @@ (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 (emptybar h) + (string-append "")) + + ;;;;;;;; TeX -;(define (tex action) -(define (beam-tex width slope thick) - (embedded-ps-tex ((ps-scm 'beam) width slope thick))) -(define (bracket-tex h) - (embedded-ps-tex ((ps-scm 'bracket) h))) -(define (dashed-slur-tex thick dash l) - (embedded-ps-tex ((ps-scm 'dashed-slur) thick dash l))) +(define (tex-scm action-name) -(define (crescendo-tex w h cont) - (embedded-ps-tex ((ps-scm 'crescendo) w h cont))) + (define (unknown) + "%\n\\unknown%\n") -(define (decrescendo-tex w h cont) - (embedded-ps-tex ((ps-scm 'decrescendo) w h cont))) -(define (embedded-ps-tex s) - (string-append "\\embeddedps{" s "}")) + (define (beam width slope thick) + (embedded-ps ((ps-scm 'beam) width slope thick))) + (define (bracket h) + (embedded-ps ((ps-scm 'bracket) h))) -(define (end-output-tex) - "\n\\EndLilyPondOutput") + (define (dashed-slur thick dash l) + (embedded-ps ((ps-scm 'dashed-slur) thick dash l))) -(define (empty-tex) - "%\n\\empty%\n") + (define (crescendo w h cont) + (embedded-ps ((ps-scm 'crescendo) w h cont))) -(define (experimental-on-tex) "\\turnOnExperimentalFeatures") + (define (decrescendo w h cont) + (embedded-ps ((ps-scm 'decrescendo) w h cont))) -(define (extender o h) - ((invoke-output o "invoke-dim1") "extender" h)) + (define (embedded-ps s) + (string-append "\\embeddedps{" s "}")) -(define (font-switch-tex i) - (string-append - "\\" (font i) "\n")) -(define (font-def-tex i s) - (string-append - "\\font" (font-switch-tex i) "=" s "\n")) + (define (end-output) + "\n\\EndLilyPondOutput") -(define (generalmeter-tex num den) - (string-append - "\\generalmeter{" (number->string (inexact->exact num)) "}{" (number->string (inexact->exact den)) "}")) + (define (empty) + "%\n\\empty%\n") -(define (header-end-tex) "\\turnOnPostScript") + (define (experimental-on) "\\turnOnExperimentalFeatures") -(define (header-tex creator generate) - (string-append - "%created by: " creator generate "\n")) + (define (extender o h) + ((invoke-output o "invoke-dim1") "extender" h)) -(define (invoke-char-tex s i) - (string-append - "\n\\" s "{" (inexact->string i 10) "}" )) + (define (font-switch i) + (string-append + "\\" (font i) "\n")) -(define (invoke-dim1-tex s d) - (string-append - "\n\\" s "{" (number->dim-tex d) "}")) + (define (font-def i s) + (string-append + "\\font" (font-switch i) "=" s "\n")) -(define (lily-def-tex key val) - (string-append - "\\def\\" key "{" val "}\n")) + (define (generalmeter num den) + (string-append + "\\generalmeter{" (number->string (inexact->exact num)) "}{" (number->string (inexact->exact den)) "}")) -(define (number->dim-tex x) - (string-append - (number->string (chop-decimal x)) "pt ")) + (define (header-end) "\\turnOnPostScript") -(define (placebox-tex x y s) - (string-append - "\\placebox{" - (number->dim-tex y) "}{" (number->dim-tex x) "}{" s "}")) + (define (header creator generate) + (string-append + "%created by: " creator generate "\n")) -(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 (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 (slur-tex l) - (embedded-ps-tex ((ps-scm 'slur) l))) + (define (lily-def key val) + (string-append + "\\def\\" key "{" val "}\n")) -(define (start-line-tex) - (string-append - "\\hbox{%\n") - ) + (define (number->dim x) + (string-append + (number->string (chop-decimal x)) "pt ")) -(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 (placebox x y s) + (string-append + "\\placebox{" + (number->dim y) "}{" (number->dim x) "}{" s "}")) + + (define (rulesym h w) + (string-append + "\\vrule height " (number->dim (/ h 2)) + " depth " (number->dim (/ h 2)) + " width " (number->dim w) + ) + ) + + (define (slur l) + (embedded-ps ((ps-scm 'slur) l))) -(define (stop-line-tex) - "}\\interscoreline") + (define (start-line) + (string-append + "\\hbox{%\n") + ) -(define (text-tex f s) - (string-append "\\set" f "{" s "}")) + (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 (tuplet-tex dx dy dir) - (embedded-ps-tex ((ps-scm 'tuplet) dx dy dir))) + (define (stop-line) + "}\\interscoreline") + + (define (text f s) + (string-append "\\set" f "{" s "}")) + + (define (tuplet dx dy dir) + (embedded-ps ((ps-scm 'tuplet) dx dy dir))) + + (define (volta w last) + (embedded-ps ((ps-scm 'volta) w last))) + + (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) + )) + + ((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 +334,6 @@ (define (text f s) (string-append "(" s ") set" f " ")) -(define - (unknown-tex) - "%\n\\unknown%\n") (define (volta w last) (string-append @@ -257,10 +345,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) @@ -306,210 +397,3 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; 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/init/table16.ly b/init/table16.ly index d0c76c1c8b..56a746aad8 100644 --- a/init/table16.ly +++ b/init/table16.ly @@ -44,7 +44,7 @@ table_sixteen= "bars" = \table { "empty" "emptybar" 0 - "" "" 0 0.0\pt 0.0\pt 0.0\pt 16.0\pt + "" "emptybar" 0 0.0\pt 0.0\pt 0.0\pt 16.0\pt "|" "maatstreep" 1 0.0\pt 0.64\pt 0.0\pt 16.0\pt "||" "doublebar" 1 0.0\pt 4.0\pt 0.0\pt 16.0\pt "|." "finishbar" 1 -4.0\pt 0.0\pt 0.0\pt 16.0\pt @@ -56,11 +56,6 @@ table_sixteen= } - "meters" = \table { - "C" "fourfourmeter" 0 0.0\pt 10.0\pt -5.0\pt 5.0\pt - "C2" "allabreve" 0 0.0\pt 10.0\pt -5.0\pt 5.0\pt - } - % dims ignored for this table "param" = \table { "brace" "pianobrace" 1 0.0\pt 0.0\pt 32.0\pt 80.0\pt diff --git a/init/table20.ly b/init/table20.ly index f9f46746a7..718dd5bbec 100644 --- a/init/table20.ly +++ b/init/table20.ly @@ -49,7 +49,7 @@ table_twenty = "bars" = \table { "empty" "emptybar" 0 - "" "" 0 0.0\pt 0.0\pt 0.0\pt 16.0\pt + "" "emptybar" 0 0.0\pt 0.0\pt 0.0\pt 16.0\pt "|" "maatstreep" 1 0.0\pt 0.64\pt 0.0\pt 20.0\pt "||" "doublebar" 1 0.0\pt 5.0\pt 0.0\pt 20.0\pt "|." "finishbar" 1 -5.0\pt 0.0\pt 0.0\pt 20.0\pt @@ -60,11 +60,6 @@ table_twenty = ":|:" "repeatbarstartrepeat" 0 0.0\pt 20.0\pt 0.0\pt 20.0\pt } - "meters" = \table { - "C" "fourfourmeter" 0 0.0\pt 10.0\pt -5.0\pt 5.0\pt - "C2" "allabreve" 0 0.0\pt 10.0\pt -5.0\pt 5.0\pt - } - % dims ignored for this table "param" = \table { "bracket" "staffbracket" 1 0.0\pt 0.0\pt 20.0\pt 160.0\pt 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/include/lily-guile.hh b/lily/include/lily-guile.hh index 5afbb1e6ce..ea7344b841 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -10,10 +10,13 @@ #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); 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..0205684901 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -21,11 +21,6 @@ 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. @@ -61,6 +56,18 @@ ly_func_o (char const* name) return gh_eval_str (buf); } +/* + See: libguile/symbols.c + + SCM + scm_string_to_symbol(s) + +*/ +SCM +ly_symbol (String name) +{ + return gh_car (scm_intern (name.ch_C(), name.length_i())); +} SCM lambda_scm (String str, Array args_arr) @@ -73,10 +80,8 @@ lambda_scm (String str, Array args_arr) 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; + args_scm = gh_cons (ly_symbol (str.ch_l ()), args_scm); + return args_scm; } // scm_top_level_env(SCM_CDR(scm_top_level_lookup_closure_var))) @@ -91,10 +96,8 @@ lambda_scm (String str, Array args_arr) 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; + args_scm = gh_cons (ly_symbol (str.ch_l ()), args_scm); + return args_scm; } SCM @@ -109,10 +112,8 @@ lambda_scm (String str, Array args_arr) 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; + args_scm = gh_cons (ly_symbol (str.ch_l ()), args_scm); + return args_scm; } /** diff --git a/lily/lookup.cc b/lily/lookup.cc index 1c3d1c7145..fcaf8fc60f 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -99,7 +99,11 @@ Lookup::afm_find (String s, bool warn) const a.dim_[Y_AXIS] *= 1 / 1000.0; Array arr; arr.push (m.code ()); - a.lambda_ = (lambda_scm ("char", arr)); + + + a.lambda_ = gh_list (ly_symbol ("char"), + gh_int2scm (m.code ()), + SCM_UNDEFINED); a.str_ = "afm_find: " + s; a.font_ = font_; return a; @@ -120,8 +124,13 @@ Lookup::bar (String str, Real h) const Array arr; arr.push (h); Atom a = (*symtables_p_) ("bars")->lookup (str); - a.lambda_ = (lambda_scm (a.str_, arr)); - a.str_ = "bar"; + + + a.lambda_ = gh_list (ly_symbol (a.str_.ch_C()), + gh_double2scm (h), + SCM_UNDEFINED); + + a.dim_.y () = Interval (-h/2, h/2); a.font_ = font_; return a; @@ -156,7 +165,8 @@ Lookup::clef (String st) const SCM offset2scm (Offset o) { - return gh_list (gh_double2scm (o[X_AXIS]), gh_double2scm(o[Y_AXIS]), SCM_UNDEFINED); + return gh_list (gh_double2scm (o[X_AXIS]), gh_double2scm(o[Y_AXIS]), + SCM_UNDEFINED); } Atom @@ -181,11 +191,11 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const // (lambda (o) (dashed-slur o thick dash '(stuff)) a.lambda_ = - 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)); + gh_list (ly_symbol ("dashed-slur"), + gh_double2scm (thick), + gh_double2scm (dash), + gh_list (sc[1], sc[2], sc[3], sc[0], SCM_UNDEFINED), + SCM_UNDEFINED); a.str_ = "dashed_slur"; return a; @@ -251,12 +261,11 @@ Lookup::rest (int j, bool o) const Atom Lookup::rule_symbol (Real height, Real width) const { - Atom a = (*symtables_p_) ("param")->lookup ("rule"); - Array arr; - arr.push (height); - arr.push (width); - a.lambda_ = (lambda_scm (a.str_, arr)); - a.str_ = "rule_symbol"; + Atom a; + a.lambda_ = gh_list (ly_symbol ("rulesym"), + gh_double2scm (height), + gh_double2scm (width), + SCM_UNDEFINED); a.dim_.x () = Interval (0, width); a.dim_.y () = Interval (0, height); return a; @@ -305,13 +314,14 @@ Lookup::stem (Real y1, Real y2) const Array arr; Real stem_width = paper_l_->get_var ("stemthickness"); - arr.push (-stem_width /2); - arr.push (stem_width); - arr.push (y2); - arr.push (-y1); - a.lambda_ = (lambda_scm ("stem", arr)); - a.str_ = "stem"; + gh_list (ly_symbol ("stem"), + gh_double2scm(-stem_width /2), + gh_double2scm(stem_width), + gh_double2scm(y2), + gh_double2scm(-y1), + SCM_UNDEFINED); + a.font_ = font_; return a; } @@ -455,7 +465,7 @@ Lookup::hairpin (Real width, bool decresc, bool continued) const arr.push (height); arr.push (continued ? height/2 : 0); String hairpin = String (decresc ? "de" : "") + "crescendo\n"; - a.lambda_ = (lambda_scm (hairpin, arr)); + a.lambda_ = lambda_scm (hairpin, arr); a.str_ = "hairpin"; a.dim_.x () = Interval (0, width); a.dim_.y () = Interval (-2*height, 2*height); @@ -476,11 +486,21 @@ Lookup::plet (Real dy , Real dx, Direction dir) const return a; } +SCM +array_to_list (SCM *a , int l) +{ + SCM list = SCM_EOL; + for (int i= l; i--; ) + { + list = gh_cons (a[i], list); + } + return list; +} + Atom Lookup::slur (Array controls) const { assert (controls.size () == 8); - Real dx = controls[3].x () - controls[0].x (); Real dy = controls[3].y () - controls[0].y (); Atom a; @@ -492,25 +512,9 @@ Lookup::slur (Array controls) const scontrols[i] = offset2scm (controls[indices[i]]); - a.lambda_ = - gh_append2 (ly_lambda_o (), - gh_list (gh_append2 (ly_func_o ("slur"), - gh_list (ly_quote_scm (gh_list (scontrols[0], - scontrols[1], - scontrols[2], - scontrols[3], - scontrols[4], - scontrols[5], - scontrols[6], - scontrols[7], - SCM_UNDEFINED)), - SCM_UNDEFINED) - ), - SCM_UNDEFINED) - ); - - - a.str_ = "slur"; + a.lambda_ =gh_list (ly_symbol ("slur"), + array_to_list (scontrols, 8), + SCM_UNDEFINED); a.dim_[X_AXIS] = Interval (0, dx); a.dim_[Y_AXIS] = Interval (0 ? dy); diff --git a/lily/paper-def.cc b/lily/paper-def.cc index e3fe90b19d..9d6fc3dd8f 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -230,12 +230,10 @@ 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); + SCM args_scm = gh_list (ly_symbol ("lily-def"), + gh_str02scm (key.ch_l ()), + gh_str02scm (val.ch_l ()), SCM_UNDEFINED); + p->output_scheme (args_scm); } void @@ -285,16 +283,9 @@ Paper_def::paper_outputter_p (Paper_stream* os_p, Header* header_l, String origi output_settings (p); - SCM scm = - gh_append2 (ly_lambda_o (), - ly_list1 (gh_append2 (ly_func_o ("experimental-on"), SCM_EOL))); - + 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; diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 3f31fb306f..c0c183ec4e 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -9,6 +9,8 @@ #include #include + +#include "virtual-methods.hh" #include "paper-outputter.hh" #include "paper-stream.hh" #include "molecule.hh" @@ -27,16 +29,17 @@ 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 +57,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 +68,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 +84,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 +109,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,32 +128,29 @@ 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); } @@ -198,38 +187,27 @@ 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_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 +215,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/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 } } -- 2.39.2