From 33d197553c5e5ff58f74d666af6a1ae42021325c Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 21:46:24 +0000 Subject: [PATCH] lilypond-1.1.24 --- Documentation/man/lilypond.yo | 2 +- Documentation/ntweb/index.yo | 72 +- Documentation/tex/feta20.sty | 146 ++++ Documentation/tex/html-disclaimer.yo-urg | 21 +- Documentation/tex/lilypond-overview.doc | 169 +++- Documentation/tex/refman.yo | 30 +- Documentation/topdocs/INSTALL.yo | 2 - VERSION | 2 +- aclocal.m4 | 2 + buildscripts/set-lily.sh | 6 +- dstreamrc | 54 +- flower/hash.cc | 6 +- flower/include/dictionary-iter.hh | 45 +- flower/include/dictionary.hh | 200 +---- flower/include/fproto.hh | 15 +- flower/include/hash-table-iter.hh | 61 ++ flower/include/hash-table.hh | 215 +++++ flower/rational.cc | 17 +- input/bugs/auto-beam.ly | 21 + input/bugs/mats.ly | 78 ++ input/bugs/partial.ly | 16 + input/opus-130.ly | 54 +- input/star-spangled-banner.ly | 71 +- input/test/auto-beam.ly | 49 ++ input/test/bar-scripts.ly | 13 +- input/test/beam-interstaff.ly | 2 +- input/test/chords.ly | 2 + input/test/mark.ly | 7 +- input/test/notemode-chords.ly | 8 + input/test/rep.ly | 14 + input/twinkle.ly | 66 +- lib/binary-source-file.cc | 51 +- lib/include/binary-source-file.hh | 19 +- lib/include/proto.hh | 2 + lib/include/source-file.hh | 34 +- lib/source-file.cc | 45 + lib/warn.cc | 10 +- lily/afm.cc | 47 +- lily/all-font-metrics.cc | 77 ++ lily/atom.cc | 6 + lily/auto-beam-engraver.cc | 293 +++++++ lily/bar-engraver.cc | 45 +- lily/bar-number-engraver.cc | 73 +- lily/bar-script-engraver.cc | 100 +++ lily/bar.cc | 4 +- lily/beam-engraver.cc | 16 +- lily/chord-name-engraver.cc | 199 +++-- lily/clef-item.cc | 50 +- lily/dynamic-engraver.cc | 3 +- lily/extender-spanner.cc | 6 +- lily/g-staff-side.cc | 43 +- lily/identifier.cc | 5 - lily/include/afm.hh | 14 +- lily/include/all-fonts.hh | 6 +- lily/include/atom.hh | 1 + lily/include/auto-beam-engraver.hh | 45 + lily/include/bar-engraver.hh | 29 +- lily/include/bar-number-engraver.hh | 13 +- lily/include/bar-script-engraver.hh | 36 + lily/include/beam-engraver.hh | 8 +- lily/include/chord-name-engraver.hh | 4 + lily/include/clef-item.hh | 5 +- lily/include/dimension-cache.hh | 4 +- lily/include/font-metric.hh | 36 + lily/include/g-staff-side.hh | 8 +- lily/include/item.hh | 18 + lily/include/lily-guile.hh | 2 + lily/include/lily-proto.hh | 9 +- lily/include/lily-version.hh | 21 + lily/include/lookup.hh | 11 +- lily/include/main.hh | 2 +- lily/include/mark-engraver.hh | 16 +- lily/include/molecule.hh | 4 +- lily/include/multi-measure-rest-engraver.hh | 5 +- lily/include/musical-request.hh | 15 - lily/include/paper-def.hh | 6 +- lily/include/parseconstruct.hh | 1 - lily/include/piano-brace.hh | 2 +- lily/include/repeat-engraver.hh | 3 +- lily/include/scope.hh | 18 +- lily/include/score-element.hh | 1 + lily/include/span-bar.hh | 2 +- lily/include/staff-bracket.hh | 2 +- lily/include/staff-margin-engraver.hh | 11 +- lily/include/tfm.hh | 176 ++++ lily/include/tuplet-engraver.hh | 2 +- lily/include/tuplet-spanner.hh | 10 +- lily/include/volta-spanner.hh | 2 + lily/item.cc | 77 +- lily/key-item.cc | 12 +- lily/lily-guile.cc | 15 +- lily/lily-version.cc | 34 +- lily/local-key-item.cc | 4 +- lily/lookup.cc | 203 +++-- lily/lyric-engraver.cc | 8 +- lily/main.cc | 57 +- lily/mark-engraver.cc | 93 +- lily/molecule.cc | 24 +- lily/multi-measure-rest-engraver.cc | 14 +- lily/music-output-def.cc | 16 +- lily/musical-request.cc | 28 - lily/my-lily-lexer.cc | 10 +- lily/my-lily-parser.cc | 16 +- lily/paper-def.cc | 46 +- lily/paper-outputter.cc | 12 +- lily/parser.yy | 114 +-- lily/performance.cc | 6 +- lily/piano-brace.cc | 2 +- lily/repeat-engraver.cc | 93 +- lily/scope.cc | 61 +- lily/score-bar.cc | 11 + lily/score-element.cc | 5 + lily/score-priority-engraver.cc | 1 + lily/scores.cc | 3 +- lily/single-malt-grouping-item.cc | 7 +- lily/span-bar.cc | 9 +- lily/span-score-bar.cc | 10 - lily/staff-bracket.cc | 5 +- lily/staff-info.cc | 1 + lily/staff-margin-engraver.cc | 60 +- lily/staff-sym.cc | 2 - lily/super-element.cc | 2 + lily/text-engraver.cc | 8 + lily/text-item.cc | 6 +- lily/tfm.cc | 407 +++++++++ lily/timing-translator.cc | 1 - lily/tuplet-engraver.cc | 2 +- lily/tuplet-spanner.cc | 20 +- lily/volta-spanner.cc | 28 +- ly/GNUmakefile | 15 + ly/a4.ly | 4 + ly/accordion-defs.ly | 55 ++ ly/book-fragment.ly | 20 + ly/book-init.ly | 14 + ly/catalan.ly | 73 ++ ly/center-fragment.ly | 25 + ly/center.ly | 15 + ly/chord-modifiers.ly | 15 + ly/declarations.ly | 45 + ly/deutsch.ly | 93 ++ ly/dynamic.ly | 21 + ly/english.ly | 158 ++++ ly/engraver.ly | 293 +++++++ ly/fragment.ly | 25 + ly/init.fly | 14 + ly/init.ly | 8 + ly/italiano.ly | 49 ++ ly/midi.ly | 5 + ly/nederlands.ly | 100 +++ ly/norsk.ly | 183 ++++ ly/paper.ly | 9 + ly/paper11.ly | 18 + ly/paper13.ly | 17 + ly/paper16.ly | 35 + ly/paper20.ly | 34 + ly/params.ly | 115 +++ ly/part-paper.ly | 9 + ly/performer.ly | 68 ++ ly/property.ly | 274 ++++++ ly/script.ly | 65 ++ ly/svenska.ly | 86 ++ make/toplevel.make.in | 2 +- mi2mu/include/midi-parser.hh | 6 - mi2mu/midi-score-parser.cc | 1 - mi2mu/mudela-item.cc | 32 + mi2mu/mudela-score.cc | 16 + mutopia/Coriolan/violino-2.ly | 6 +- mutopia/D.Scarlatti/progress.ly | 809 ++++++++++++++++++ mutopia/D.Scarlatti/sonata-k1-l366.ly | 164 ++-- mutopia/D.Scarlatti/sonata-k2-l388.ly | 338 ++++++++ mutopia/D.Scarlatti/sonata-k4-l390.ly | 313 +++++++ mutopia/E.Satie/GNUmakefile | 10 + mutopia/E.Satie/gnossienne-4.ly | 160 ++++ mutopia/E.Satie/petite-ouverture-a-danser.ly | 165 ++++ mutopia/F.Schubert/AnSylvia.ly | 12 +- mutopia/GNUmakefile | 2 +- .../J.S.Bach/Petites-Preludes/preludes-1.ly | 181 ++-- .../J.S.Bach/Petites-Preludes/preludes-2.ly | 155 ++-- .../J.S.Bach/Petites-Preludes/preludes-3.lym4 | 68 +- .../J.S.Bach/Petites-Preludes/preludes-4.ly | 267 +++--- .../J.S.Bach/Petites-Preludes/preludes-5.ly | 233 +++-- .../J.S.Bach/Petites-Preludes/preludes-6.ly | 141 +-- .../Petites-Preludes/preludes-paper.ly | 15 +- .../Solo-Cello-Suites/allemande-cello.ly | 49 +- .../Solo-Cello-Suites/allemande-urtext.ly | 92 +- .../Solo-Cello-Suites/allemande-viola.ly | 35 +- .../Solo-Cello-Suites/courante-cello.ly | 37 +- .../Solo-Cello-Suites/courante-urtext.ly | 90 +- .../Solo-Cello-Suites/courante-viola.ly | 37 +- .../J.S.Bach/Solo-Cello-Suites/gigue-cello.ly | 34 +- .../Solo-Cello-Suites/gigue-urtext.ly | 75 +- .../J.S.Bach/Solo-Cello-Suites/gigue-viola.ly | 51 +- .../Solo-Cello-Suites/menuetto-cello.ly | 58 +- .../Solo-Cello-Suites/menuetto-urtext.ly | 129 +-- .../Solo-Cello-Suites/menuetto-viola.ly | 61 +- .../Solo-Cello-Suites/prelude-cello.ly | 5 +- .../Solo-Cello-Suites/prelude-urtext.ly | 111 +-- .../Solo-Cello-Suites/prelude-viola.ly | 5 +- .../Solo-Cello-Suites/sarabande-cello.ly | 24 +- .../Solo-Cello-Suites/sarabande-urtext.ly | 72 +- .../Solo-Cello-Suites/sarabande-viola.ly | 24 +- .../J.S.Bach/Solo-Cello-Suites/scs-paper.ly | 19 +- mutopia/J.S.Bach/wtk1-fugue2.ly | 250 +++--- mutopia/gallina.ly | 20 +- scm/lily.scm | 16 +- stepmake/aclocal.m4 | 2 + stepmake/bin/package-zip32.sh | 30 +- tex/lilyponddefs.tex | 9 +- 208 files changed, 8488 insertions(+), 2578 deletions(-) create mode 100644 Documentation/tex/feta20.sty create mode 100644 flower/include/hash-table-iter.hh create mode 100644 flower/include/hash-table.hh create mode 100644 input/bugs/auto-beam.ly create mode 100644 input/bugs/mats.ly create mode 100644 input/bugs/partial.ly create mode 100644 input/test/auto-beam.ly create mode 100644 input/test/notemode-chords.ly create mode 100644 input/test/rep.ly create mode 100644 lily/all-font-metrics.cc create mode 100644 lily/auto-beam-engraver.cc create mode 100644 lily/bar-script-engraver.cc create mode 100644 lily/include/auto-beam-engraver.hh create mode 100644 lily/include/bar-script-engraver.hh create mode 100644 lily/include/font-metric.hh create mode 100644 lily/include/lily-version.hh create mode 100644 lily/include/tfm.hh create mode 100644 lily/tfm.cc create mode 100644 ly/GNUmakefile create mode 100644 ly/a4.ly create mode 100644 ly/accordion-defs.ly create mode 100644 ly/book-fragment.ly create mode 100644 ly/book-init.ly create mode 100644 ly/catalan.ly create mode 100644 ly/center-fragment.ly create mode 100644 ly/center.ly create mode 100644 ly/chord-modifiers.ly create mode 100644 ly/declarations.ly create mode 100644 ly/deutsch.ly create mode 100644 ly/dynamic.ly create mode 100644 ly/english.ly create mode 100644 ly/engraver.ly create mode 100644 ly/fragment.ly create mode 100644 ly/init.fly create mode 100644 ly/init.ly create mode 100644 ly/italiano.ly create mode 100644 ly/midi.ly create mode 100644 ly/nederlands.ly create mode 100644 ly/norsk.ly create mode 100644 ly/paper.ly create mode 100644 ly/paper11.ly create mode 100644 ly/paper13.ly create mode 100644 ly/paper16.ly create mode 100644 ly/paper20.ly create mode 100644 ly/params.ly create mode 100644 ly/part-paper.ly create mode 100644 ly/performer.ly create mode 100644 ly/property.ly create mode 100644 ly/script.ly create mode 100644 ly/svenska.ly create mode 100644 mutopia/D.Scarlatti/progress.ly create mode 100644 mutopia/D.Scarlatti/sonata-k2-l388.ly create mode 100644 mutopia/D.Scarlatti/sonata-k4-l390.ly create mode 100644 mutopia/E.Satie/GNUmakefile create mode 100644 mutopia/E.Satie/gnossienne-4.ly create mode 100644 mutopia/E.Satie/petite-ouverture-a-danser.ly diff --git a/Documentation/man/lilypond.yo b/Documentation/man/lilypond.yo index 0268efdc9f..ddfdf4ad54 100644 --- a/Documentation/man/lilypond.yo +++ b/Documentation/man/lilypond.yo @@ -147,7 +147,7 @@ dit(GNU url(LilyPond)(http://www.cs.uu.nl/people/hanwen/lilypond/index.html)) GNU LilyPond is updated very frequently, the latest version is always available at: -lurl(ftp://pcnov095.win.tue.nl/pub/lilypond). This FTP site is mirrored +lurl(ftp://ftp.cs.uu.nl/pub/GNU/LilyPond). This FTP site is mirrored at a number of sites; consult the project web pages for information about mirrors. diff --git a/Documentation/ntweb/index.yo b/Documentation/ntweb/index.yo index 81d5f2bea3..a13977d5b1 100644 --- a/Documentation/ntweb/index.yo +++ b/Documentation/ntweb/index.yo @@ -1,6 +1,6 @@ mailto(daboys@bga.com) -article(LilyPond Windows NT 4.0 Distribution)(nemail(Jeffrey B. Reed)(daboys@bga.com))(label(contents)) -sect(Windows NT Binary Distribution) +article(LilyPond Windows NT 4.0/95 Distribution)(nemail(Jeffrey B. Reed)(daboys@bga.com))(label(contents)) +sect(Windows NT/95 Binary Distribution) subsect(Introduction) label(introduction) @@ -16,20 +16,29 @@ includefile(../BLURB.in) link(Back to top)(contents) clearpage() -I'm back from the dead! There have been many changes since my last -update. Please read information on batch files and update as needed. -The fonts have changed so you will also need to remove any cached -fonts. In addition please bring music sources up to date by using -convert-mudela utility. I used: +subsect(NEWS) label(news) -verb( -% bf(convert-mudela.py -e angels.ly) +I have made my first attempt at distributing lilypond as a self +extracting executable for Windows NT 4.0 and Windows 95. The +executable will extract the distribution in the directory specified by +the user and create em(lilypond-@TOPLEVEL_VERSION@\lily.bat). This +batch file initializes the LilyPond environment and fires up a Command +Prompt. From this Command Prompt you may run: + +itemize( + it()ly2dvi + it()convert-mudela + it()mudela-book + it()lilypond + it()mi2mu ) -Also please refer to LilyPond documentation for new and changed -features. +I have also converted the Manual Pages for the above tools to HTML for +easy browsing. This release has been tested on Windows NT 4.0sp3 and +Windows 95 and found to be operational. If you have any troubles and +or comments please do not hesitate to drop me a line +url(Jeffrey B. Reed)(mailto:daboys@bga.com). -subsect(NEWS) label(news) This is what the version @TOPLEVEL_VERSION@ brings: verb( @@ -52,9 +61,13 @@ professional quality music score. code(Python) is an interpreted, interactive, object-oriented programming language. It is often compared to code(Tcl), code(Perl), code(Scheme) or code(Java). +Gsview is used to display and print the music scores created by +LilyPond. + itemize( it()url(code(MiKTeX))(http://www.snafu.de/~cschenk/miktex/) it()url(code(Python))(http://www.python.org) + it()url(code(gsview))(http://www.cs.wisc.edu/~ghost/gsview/index.html) ) link(Back to top)(contents) @@ -64,9 +77,7 @@ clearpage() subsect(Download) label(download) itemize( - it() pre-guile version lurl(lilypond-1.0.17.jbr1.bin.zip) nl() - NOTE: LILYPONDPREFIX=em(LilyPond-dir) for this version - it()lurl(lilypond-@TOPLEVEL_VERSION@.bin.zip) + it()url(lilypond-@TOPLEVEL_VERSION@)(lily1123jbr1.exe) ) link(Back to top)(contents) @@ -77,24 +88,8 @@ subsect(Installation) label(installation) itemize( it()link(Download)(download) the distribution. - it()unzip - it()Set your path variable for lilypond and TeX - description( - dit(batch file) - In a batch file you can add the following entries: nl() - bf(set LILYPONDHOME=em(LilyPond-dir)) nl() - bf(set LILYPONDPREFIX=%LILYPONDHOME%\share\lilypond) nl() - bf(set path=%path%;%LILYPONDHOME%\bin;em(MiKTeX-dir)\miktex\bin) nl() - bf(set TEXINPUTS=%LILYPONDPREFIX%\tex;%LILYPONDPREFIX%\ps;;) nl() - bf(set MFINPUTS=%LILYPONDPREFIX%\mf;;) nl() -COMMENT( dit(Windows Environment) - In the Windows environment you can select - properties menu of the My Computer icon. Click on - the environment tag and add the following to the user - variables path entry. nl() - bf(em(LilyPond-dir)\bin;em(MiKTeX-dir)\miktex\bin)) - ) nl() - it() The first installation of LilyPond also requires these + it()run downloaded executable. nl() + it() The first installation of LilyPond also requires these additional steps: description( dit(LaTeX geometry package) @@ -132,10 +127,15 @@ subsect(Running LilyPond) label(running) itemize( it()Take a look at url(angels.ly)(angels.ly) it()Save angels.ly to your local disk - it()From a Command Prompt run: nl() - bf(ly2dvi.py angels.ly) nl() + it()Execute lilypond-@TOPLEVEL_VERSION@\lily.bat nl() +NOTE: If you get an em(out of environment memory error), simply increase +the environment memory by selecting +em(lilypond-@TOPLEVEL_VERSION@\lily.bat) Properties/Memory and increase +the available environment memory to 1024. + it() From a LilyPond Command Prompt run: nl() + bf(ly2dvi angels.ly) nl() bf(dvips angels.dvi) nl() - bf(cmd /c angels.ps) nl() + bf(start angels.ps) nl() ) link(Back to top)(contents) diff --git a/Documentation/tex/feta20.sty b/Documentation/tex/feta20.sty new file mode 100644 index 0000000000..0dbfcf90cc --- /dev/null +++ b/Documentation/tex/feta20.sty @@ -0,0 +1,146 @@ +% Creator: mf-to-table.py version 0.7 +% Automatically generated on +% Do not edit +% input from out/feta20.log +% name +% rests +\fetdef\wholerest{0} +\fetdef\halfrest{1} +\fetdef\outsidewholerest{2} +\fetdef\outsidehalfrest{3} +\fetdef\breverest{4} +\fetdef\longarest{5} +\fetdef\multirest{6} +\fetdef\quartrest{7} +\fetdef\eighthrest{8} +\fetdef\sixteenthrest{9} +\fetdef\thirtysecondrest{10} +\fetdef\sixtyfourthrest{11} +\fetdef\hundredtwentyeighthrest{12} + +% accidentals +\fetdef\sharp{13} +\fetdef\natural{14} +\fetdef\flat{15} +\fetdef\flatflat{16} +\fetdef\sharpsharp{17} +\fetdef\rightparen{18} +\fetdef\leftparen{19} + +% dots +\fetdef\dot{20} +\fetdef\repeatcolon{21} + +% balls +\fetdef\brevisball{22} +\fetdef\brevisledger{23} +\fetdef\longaball{24} +\fetdef\longaledger{25} +\fetdef\wholeball{26} +\fetdef\wholeledger{27} +\fetdef\halfball{28} +\fetdef\halfledger{29} +\fetdef\quartball{30} +\fetdef\quartledger{31} + +% scripts +\fetdef\ufermata{32} +\fetdef\dfermata{33} +\fetdef\thumb{34} +\fetdef\sforzatoaccent{35} +\fetdef\staccato{36} +\fetdef\ustaccatissimo{37} +\fetdef\dstaccatissimo{38} +\fetdef\tenuto{39} +\fetdef\umarcato{40} +\fetdef\dmarcato{41} +\fetdef\ouvert{42} +\fetdef\plusstop{43} +\fetdef\upbow{44} +\fetdef\downbow{45} +\fetdef\reverseturn{46} +\fetdef\turn{47} +\fetdef\trill{48} +\fetdef\upedalheel{49} +\fetdef\dpedalheel{50} +\fetdef\upedaltoe{51} +\fetdef\dpedaltoe{52} +\fetdef\flageolet{53} +\fetdef\trilelement{54} +\fetdef\prall{55} +\fetdef\mordent{56} +\fetdef\prallprall{57} +\fetdef\prallmordent{58} +\fetdef\upprall{59} +\fetdef\downprall{60} +\fetdef\accDiscant{61} +\fetdef\accDiscantF{62} +\fetdef\accDiscantEh{63} +\fetdef\accDiscantE{64} +\fetdef\accDiscantFE{65} +\fetdef\accDiscantFEh{66} +\fetdef\accDiscantEE{67} +\fetdef\accDiscantFEE{68} +\fetdef\accDiscantEEE{69} +\fetdef\accDiscantFEEE{70} +\fetdef\accDiscantS{71} +\fetdef\accDiscantFS{72} +\fetdef\accDiscantES{73} +\fetdef\accDiscantEhS{74} +\fetdef\accDiscantFES{75} +\fetdef\accDiscantFEhS{76} +\fetdef\accDiscantEES{77} +\fetdef\accDiscantFEES{78} +\fetdef\accDiscantEEES{79} +\fetdef\accDiscantFEEES{80} +\fetdef\accDiscantSS{81} +\fetdef\accDiscantESS{82} +\fetdef\accDiscantEESS{83} +\fetdef\accDiscantEEESS{84} +\fetdef\accFreebass{85} +\fetdef\accFreebassF{86} +\fetdef\accFreebassE{87} +\fetdef\accFreebassFE{88} +\fetdef\accStdbass{89} +\fetdef\accStdbassM{90} +\fetdef\accStdbassBp{91} +\fetdef\accStdbassT{92} +\fetdef\accStdbassTp{93} +\fetdef\accBayanbass{94} +\fetdef\accBayanbassT{95} +\fetdef\accBayanbassE{96} +\fetdef\accBayanbassTE{97} +\fetdef\accBayanbassEE{98} +\fetdef\accBayanbassTEE{99} +\fetdef\accSB{100} +\fetdef\accBB{101} +\fetdef\accOldEE{102} +\fetdef\accOldEES{103} + +% flags +\fetdef\eighthflag{104} +\fetdef\sixteenthflag{105} +\fetdef\thirtysecondflag{106} +\fetdef\sixtyfourthflag{107} +\fetdef\deighthflag{108} +\fetdef\dsixteenthflag{109} +\fetdef\dthirtysecondflag{110} +\fetdef\dsixtyfourthflag{111} + +% clefs +\fetdef\altoclef{112} +\fetdef\caltoclef{113} +\fetdef\bassclef{114} +\fetdef\cbassclef{115} +\fetdef\trebleclef{116} +\fetdef\ctrebleclef{117} + +% timesig +\fetdef\fourfourmeter{118} +\fetdef\allabreve{119} +\fetdef\oldfourfourmeter{120} +\fetdef\oldallabreve{121} +\fetdef\oldthreetwometer{122} +\fetdef\oldsixfourmeter{123} +\fetdef\oldninefourmeter{124} + diff --git a/Documentation/tex/html-disclaimer.yo-urg b/Documentation/tex/html-disclaimer.yo-urg index 2fa20c33aa..061f9d441e 100644 --- a/Documentation/tex/html-disclaimer.yo-urg +++ b/Documentation/tex/html-disclaimer.yo-urg @@ -1,15 +1,16 @@ COMMENT( I cannot be named .yo, because i'm not a complete document, yodl2x will break. ) + whenhtml( + nsubsect(Disclaimer) -This document is written in url(Yodl)(ftp://pcnov095.win.tue.nl/pub/yodl) -and should foremost produce nice LaTeX() output. -In other formats, such as html, some things will look a bit different, -while other things will be simply left out. -Therefore, the authoritive version of this document is the PostScript version, -produced via LaTeX(). -As you know, url(no gifs due to patent problems)(http://www.gnu.org/philosophy/gif.html), -but the png images should be viewable with any current browser -(jpeg is inappropriate for music images). -) + +This document is written in url(Yodl)(ftp://ftp.lilypond.org/pub/yodl) +and should foremost produce nice LaTeX() output. In other formats, +such as html, some things will look a bit different, while other +things will be simply left out. Therefore, the authoritive version of +this document is the PostScript version, produced via LaTeX(). As you +know, url(no gifs due to patent +problems)(http://www.gnu.org/philosophy/gif.html), but the PNG images +should be viewable with any current browser . ) diff --git a/Documentation/tex/lilypond-overview.doc b/Documentation/tex/lilypond-overview.doc index f5eea5a448..0ab7fdfe17 100644 --- a/Documentation/tex/lilypond-overview.doc +++ b/Documentation/tex/lilypond-overview.doc @@ -297,6 +297,11 @@ articulation. This stress pattern is called \emph{meter}. \subsection{Music notation} +Music notation is a system that tries to represent musical ideas +through printed symbols. Music notation has no precise definition, +but most conventions have described in reference manuals on music +notation\cite{read-notation}. + In music notation, sounds and silences are represented by symbols that are called note and rest respectively.\footnote{These names serve a double purpose: the same terms are used to denote the musical @@ -343,18 +348,176 @@ linewidth = -1.; \label{fig:noteshapes} \end{center} \end{figure} - Notes are printed in a grid of horizontal lines called \emph{staff} to -denote their pitch: each line represents the pitch of from the +denote their pitch: each line represents the pitch of from the +standard scale (c, d, e, f, g, a, b). The reference point is the +\emph{clef}, eg., the treble clef marks the location of the $g^1$ +pitch. The notes are printed in their time order, from left to right. + + +\begin{figure}[h] + \begin{center} + \begin{mudela} + \score { \notes { + a4 b c d e f g a \clef bass; + a4 b c d e f g a \clef alto; + a4 b c d e f g a \clef treble; + } + \paper { linewidth = 15.\cm; } + } + \end{mudela} + \caption{Pitches ranging from $a, b, c',\ldots a'$, in different + clefs. From left right the bass, alto and treble clef are + featured.} + \label{fig:pitches} + \end{center} +\end{figure} + +The chromatic alterations are indicated by printing a flat sign or a +sharp sign in front of the note head. If these chromatic alterations +occur systematically (if they are part of the tonality of the piece), +then this indicated with a \emph{key signature}. This is a list of +sharp/flat signs which is printed next to the clef. + +Articulation is notated by marking the note shapes wedges, hats and +dots all indicate specific articulations. If the notes are to be +bound fluently (legato), the note shapes are encompassed by a smooth +curve called \emph{slur}, + +\begin{figure}[h] + \begin{center} + \begin{mudela} + c'4-> c'4-. g'4 ( b'4 ) g''4 + \end{mudela} + \caption{Some articulations. From left to right: extra stress + (\emph{marcato}), short (staccato), slurred notes (legato).} + \label{fig:articulation} + \end{center} +\end{figure} + + + +Dynamics are notated in two ways: absolute dynamics are indicated by +letters: \textbf{f} (from Italian ``forte'') stands for loud, +\textbf{p} (from Italian ``piano'') means soft. Gradual changes in +loudness are notated by (de)crescendos. These are hairpin like shapes +below the staff. + +\begin{figure}[h] + \begin{center} + \begin{mudela} + g'4\pp \< g'4 \! g'4 \ff \> g'4 g' \! g'\ppp + \end{mudela} + \caption{Dynamics: start very soft (pp), grow to loud (ff) and + decrease to extremely soft (ppp)} + \label{fig:dynamics} + \end{center} +\end{figure} -\subsection{Music typography} +The meter is indicated by barlines: every start of the stress pattern +is preceded by a vertical line, the \emph{bar line}. The space +between two bar lines is called measure. It is therefore the unit of +the rhythmic pattern. +The time signature also indicates what kind of rhythmic pattern is +desired. The time signature takes the form of two numbers stacked +vertically. The top number is the number of beats in one measure, the +bottom number is the duration (relative to the whole note) of the note +that takes one beat. Example: 2/4 time signature means ``two beats +per measure, and a quarter note takes one beat'' +Chords are written by attaching multiple note heads to one stem. When +the composer wants to emphasize the horizontal relationships between +notes, the simultaneous notes can be written as voices (where every +note head has its own stem). A small example is given in +Figure~\ref{fig:simultaneous}. +\begin{figure}[h] + \begin{center} + \begin{mudela} + \relative c'' {\time 2/4; + \type Staff < \type Voice = VA{ + \stemdown + c4 d + b16 b b b b b b b } + \type Voice = VB { + \stemup e4 f g8 g4 g8 } > + } + \end{mudela} + \caption{Notes sounding together. Chord notation (left, before + the bar line) emphasizes vertical relations, voice notation + emphasizes horizontal relations. Separate voices needn't have + synchronous rhythms (third measure). + } + \label{fig:simultaneous} + \end{center} +\end{figure} + +Separate voices do not have to share one rhythmic pattern---this is +also demonstrated in Figure~\ref{fig:simultaneous}--- they are in a sense%vaag +independent. A different way to express this in notation, is by +printing each voice on a different staff. This is customary when +writing for piano (both left and right hand have a staff of their own) +and for ensemble (every instrument has a staff of its own). + + + +\subsection{Music typography} + +Music typography is the art of placing symbols in esthetically +pleasing configuration. Little is explicitly known about music +typography. There are only a few reference works +available\cite{ross,wanske}. Most of the knowledge of this art has +been transmitted verbally, and was subsequently lost. + +The motivation behind choices in typography is to represent the idea +as clearly as possible. Among others, this results in the following +guidelines: +\begin{itemize} +\item The printed score should use visual hints to accentuate the + musical content +\item The printed score should not contain distracting elements, such + as large empty regions or blotted regions. +\end{itemize} + +An example of the first guideline in action is the horizontal spacing. +The amount of space following a note should reflect the duration of +that note: short notes get a small amount of space, long notes larger +amounts. Such spacing constraints can be quite subtle, for the +``amount of space'' is only the impression that should be conveyed; there +has to be some correction for optical illusions. See +Figure~\ref{fig:spacing}. +\begin{figure}[h] + \begin{center} + \begin{mudela} + \relative c'' { \time 3/4; c16 c c c c8 c8 | f4 f, f' } + \end{mudela} + \caption{Spacing conveys information about duration. Sixteenth + notes at the left get less space than quarter notes in the + middle. Spacing is ``visual'', there should be more space + after the first note of the last measure, and less after second. } + \label{fig:spacing} + \end{center} +\end{figure} +Another clearly visible example of music typography is visible in +collisions. When chords or separate voices are printed, the notes +that start at the same time should be printed aligned (ie., with the +same $x$ position). If the pitches are close to each other, the note +heads would collide. To prevent this, some notes (or note heads) have +to be shifted horizontally. An example of this is given in Figure~\ref{fig:collision}. +\begin{figure}[h] + \begin{center} + \begin{mudela} + + \end{mudela} + \caption{Collisions} + \label{fig:collision} + \end{center} +\end{figure} \bibliographystyle{hw-plain} \bibliography{engraving,boeken,colorado,computer-notation,other-packages} diff --git a/Documentation/tex/refman.yo b/Documentation/tex/refman.yo index 6bf67ce169..6845476a00 100644 --- a/Documentation/tex/refman.yo +++ b/Documentation/tex/refman.yo @@ -165,7 +165,7 @@ keywords: code(\mm), code(\pt), code(\in), or code(\cm). Dimensions are converted immediately to a real which gives the dimension in points, so they can be mixed with reals, but the result is no longer of type dimension. The keywords that require a dimension -(code(\shape) and code(\symboltables)) will not accept this. +(code(\shape)). dit(pitch) A pitch is a string which is the name of a pitch. Example: code(a). @@ -224,8 +224,8 @@ will only be able to refer to identifiers whose names begin with a letter and are entirely alphanumeric. It is also impossible to refer to an identifier whose name is the same as the name of a keyword. The following words are keywords: -verb(absdynamic grouping mm relative symboltables -accepts header musicalpitch remove table +verb(absdynamic grouping mm relative +accepts header musicalpitch remove alternative in name repeat tempo bar include notenames scm time cadenza key notes scmfile times @@ -929,7 +929,7 @@ note, etc. The number of dots after the note is given by var(dotcount). dit(code(\font) var(string)) Internal keyword. Used within -code(\symboltables) to specify the font. +code(\paper) to specify the font. dit(code(\grouping) var(durationseq)code(;)) Sets the metric structure of the measure. Each argument specifies the duration of one metric unit. @@ -973,9 +973,9 @@ files like file(init.fly) that read the user file into the middle of another file. Using it in a user file will lead to an infinite loop. dit(code(\mark) var(unsigned)code(;) or code(\mark) var(string)code(;)) -Allowed in music only. Prints a mark over or under (?) the staff. -You must add code(Mark_engraver) to the Score context and it only -seems to work if the mark appears at the beginning of a line. +Allowed in music only. Prints a mark over or under (depending on the +code(markDirection) property) the staff. +You must add code(Mark_engraver) to the Score context. dit(code(\midi) var(statementlist)) Appears in a score block to indicate that musical output should be produced and to set output @@ -1094,13 +1094,6 @@ second parameter is set to 1 to start the mark and 2 to stop it. Users should use the abbreviations which are defined in the initialization file file(dynamic.ly). -dit(code(\symboltables)) Internal keyword. Used to create symbol -tables. See initialization files file(paper*.ly), file(feta*.ly), and -file(table*.ly). - -dit(code(\table)) Internal keyword. Used within code(\symboltables) -to specify the tables. See initialization files. - dit(code(\tempo) var(duration) = var(perminute)code(;)) Used within code(\midi) or within music to specify the tempo. For example, `code(\midi { \tempo 4 = 76;})' requests output with 76 quarter notes @@ -1301,6 +1294,13 @@ setting to 2 shows a number and a bracket if there is no beam; setting to 3 shows a number, and if there is no beam it adds a bracket; setting to 4 shows both a number and a bracket unconditionally. +dit(code(markScriptPadding)) Determines the extra space added between +the mark and the closest staff line or note. + +dit(code(markDirection)) Determines if marks should be printed above +or below the staff. Set to code(\up) to print marks above the staff; +set to code(\down) to print marks below the staff. + ) subsubsubsect(Staff properties) @@ -1566,7 +1566,7 @@ inside a code(\paper) block. description( dit(var(integer)) If an integer appears on the left side of an -assignment then a code(\symboltables) keyword must appear on the right +assignment then a code(\font) keyword must appear on the right side. This defines a music font at a particular size. See Voice property code(\fontsize). diff --git a/Documentation/topdocs/INSTALL.yo b/Documentation/topdocs/INSTALL.yo index d963065b21..f8298855ce 100644 --- a/Documentation/topdocs/INSTALL.yo +++ b/Documentation/topdocs/INSTALL.yo @@ -183,8 +183,6 @@ verb( Options to configure include: description( -dit(bf(--enable-guile)) - Link in GUILE (experimental) dit(bf(--enable-printing)) Enable debugging print routines (lilypond bf(-D) option) dit(bf(--enable-optimise)) diff --git a/VERSION b/VERSION index cc4957f34f..56d25e8daf 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 -PATCH_LEVEL=23 +PATCH_LEVEL=24 MY_PATCH_LEVEL= # use the above to send patches: MY_PATCH_LEVEL is always empty for a diff --git a/aclocal.m4 b/aclocal.m4 index 0e035cad95..cb1ebe6cc0 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2,6 +2,8 @@ dnl WARNING WARNING WARNING WARNING dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4 dnl WARNING WARNING WARNING WARNING dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4 +dnl WARNING WARNING WARNING WARNING +dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4 dnl aclocal.m4 -*-shell-script-*- dnl StepMake subroutines for configure.in diff --git a/buildscripts/set-lily.sh b/buildscripts/set-lily.sh index 6e698cdc85..f819163aa5 100644 --- a/buildscripts/set-lily.sh +++ b/buildscripts/set-lily.sh @@ -6,6 +6,7 @@ PACKAGE_NAME=LilyPond export PACKAGE_NAME prefix=$HOME/usr sources=$prefix/src + # # . ./stepmake/bin/package-zet.sh @@ -47,9 +48,8 @@ ln -sf $LILYPOND_SOURCEDIR/scripts/out/mudela-book $prefix/bin/mudela-book chmod 755 $LILYPOND_SOURCEDIR/buildscripts/ps-to-gifs.sh ln -sf $LILYPOND_SOURCEDIR/buildscripts/ps-to-gifs.sh $prefix/bin/ps-to-gifs ln -sf $LILYPOND_SOURCEDIR/mf/out/ afm -mkdir -p $prefix/share/lilypond -ln -sf $LILYPOND_SOURCEDIR/ $prefix/share/lilypond -rm $prefix/share/lilypond +mkdir -p $prefix/share/ +ln -sf $prefix/lilypond/ $sources/lilypond if [ -f ../.gdbinit ]; then diff --git a/dstreamrc b/dstreamrc index c7db1bd6ce..a13bedba99 100644 --- a/dstreamrc +++ b/dstreamrc @@ -3,7 +3,7 @@ # the debugging. # class name silence? -Dstream 1 +Dstream 0 # yydebug InitParser 1 @@ -27,14 +27,20 @@ Vector 1 # lily Absolute_dynamic_req 1 Atom 1 -Axis_group_administration 0 +Axis_group_administration 1 +Axis_group_spanner 1 +Auto_beam_engraver 0 +Audio_column 1 +Audio_element 1 +Audio_item 1 +Audio_note 1 Bar 1 Bar_req 1 -Beam 0 +Beam 1 Bezier 1 Bezier_bow 1 Bezier_bow_controls 1 -Bezier_controls 0 +Bezier_controls 1 Bow 1 Change_iterator 1 Change_translator 1 @@ -48,13 +54,14 @@ Collision 1 Column_info 1 Column_rod 1 Duration_identifier 1 -Engraver 0 -Engraver_group_engraver 0 +Engraver 1 +Engraver_group_engraver 1 General_script_def 1 Graphical_element 1 +Graphical_axis_group 1 Group_change_req 1 Guile 1 -Head_column 0 +Head_column 1 Horizontal_align_item 1 Horizontal_group_item 1 Idealspacing 1 @@ -62,40 +69,42 @@ Identifier 1 Ineq_constrained_qp 1 Input_translator 1 int_identifier 1 -Item 0 +Item 1 Key_item 1 Lookup 1 Line_spacer 1 Melodic_req 1 Midi_def 1 -Midistrings 0 +Midistrings 1 Mixed_qp 1 Music 1 Musical_pitch 1 Music_iterator 1 Music_output_def 1 -Note_column 0 +Note_column 1 Note_head 1 Note_performer 1 Note_req 1 -Paper_column 0 +Paper_column 1 Paper_score 1 Paper_def 1 +Partial_measure_req 1 +Performance 1 Performer 1 Performer_group_performer 1 Real_identifier 1 Request 1 Request_iterator 1 Rest_collision 1 -Rest_collision_engraver 0 +Rest_collision_engraver 1 Rest_req 1 -Rhythmic_head 0 +Rhythmic_head 1 Rhythmic_req 1 Scope 1 -Score 0 -Score_column 0 -Score_element 0 -Score_engraver 0 +Score 1 +Score_column 1 +Score_element 1 +Score_engraver 1 Score_performer 1 Script_column 1 Script_def 1 @@ -112,8 +121,10 @@ Skip_req 1 Staff_commands 1 Staff_symbol 1 Stem 1 -Stem_info 0 +Stem_info 1 Stem_req 1 +String_identifier 1 +Relative_octave_music 1 Symtable 1 Symtables 1 @@ -121,9 +132,10 @@ Text_def 1 Text_item 1 Text_req 1 Time_description 1 -Translation_property 0 -Translator 0 -Translator_group 0 +Time_signature_change_req 1 +Translation_property 1 +Translator 1 +Translator_group 1 Voice 1 Voice_iterator 1 Word_wrap 1 diff --git a/flower/hash.cc b/flower/hash.cc index b541681e87..c2fd954a8f 100644 --- a/flower/hash.cc +++ b/flower/hash.cc @@ -19,7 +19,7 @@ unsigned long prime_list (int idx) return my_prime_list [idx]; } -unsigned int hash (String s) +unsigned int string_hash (String s) { const char* str = s.ch_C (); unsigned int result = 0; @@ -37,7 +37,9 @@ unsigned int hash (unsigned int i) return i; } -unsigned int hash (int i) +unsigned int int_hash (int i) { return (unsigned) i; } + +unsigned int hash ( ); diff --git a/flower/include/dictionary-iter.hh b/flower/include/dictionary-iter.hh index 33531e584c..55176ae9f0 100644 --- a/flower/include/dictionary-iter.hh +++ b/flower/include/dictionary-iter.hh @@ -11,51 +11,8 @@ #define DICTIONARY_ITER_HH #include "dictionary.hh" +#include "hash-table-iter.hh" -template -class Hash_table_iter -{ - Hash_table *dict_l_; - int i; -public: - Hash_table_iter(Hash_table const &dict) - { - i =0; - dict_l_ =(Hash_table *) & dict; - next_used (); - } - - bool ok () - { - return i < dict_l_->fixed_p_->dict_arr_.size (); - } - - void next_used () - { - while (ok () && dict_l_->fixed_p_->dict_arr_[i].free_b_) - { - i ++; - } - } - void operator ++(int) - { - i++; - next_used (); - } - - K key () - { - return dict_l_->fixed_p_->dict_arr_[i].key_; - } - V val () - { - return dict_l_->fixed_p_->dict_arr_[i].value_; - } - V &val_ref () - { - return dict_l_->fixed_p_->dict_arr_[i].value_; - } -}; template class Dictionary_iter : public Hash_table_iter diff --git a/flower/include/dictionary.hh b/flower/include/dictionary.hh index c9b5775f1b..ceaaa496b3 100644 --- a/flower/include/dictionary.hh +++ b/flower/include/dictionary.hh @@ -13,27 +13,11 @@ #include "string.hh" #include "array.hh" -unsigned long prime_list (int idx); -template -struct Hash_table_entry -{ - K key_; - V value_; - bool free_b_; +#include "hash-table.hh" - Hash_table_entry() { - free_b_ = true; - } - Hash_table_entry (K s, V v) - { - key_ = s; - value_ = v; - free_b_ = false; - } -}; -unsigned int hash (String); -unsigned int hash (int); +unsigned int string_hash (String); + template struct Dict_initialiser @@ -42,188 +26,18 @@ struct Dict_initialiser V value_; }; -/** - A hash table of prime size. - - We use quadratic probing. - */ -template -class Fixed_size_hash_table -{ -public: - Array > dict_arr_; - int size_idx_; - Fixed_size_hash_table (int size_idx) - { - size_idx_ = size_idx; - int sz = prime_list(size_idx_); - dict_arr_.set_size (sz); - } - - /// find #s#, or find first empty entry corresponding to #s# - int lookup (K s) - { - int sz =dict_arr_.size (); - int i = hash (s) % sz; - int j = 0; - while (j <= sz/2) { - if (dict_arr_[i].free_b_) - return i; - - if (dict_arr_[i].key_ == s) - return i; - - j++; - i = (i + j*j) % sz; - } - - return -1; - } - - /// remove #s# from the hash table. - V remove (K s) - { - assert (false); // Untested routine. - int sz =dict_arr_.size (); - int i = hash (s) % sz; - int j = 0; - V retval; - while (j <= sz/2 && dict_arr_[i].key_ != s) - { - assert (!dict_arr_[i].free_b_); - - - j ++; - i = (i + j*j) % sz; - } - - j++; - int nexti = (i + j*j) % sz; - - while (j <= sz/2 && !dict_arr_[i].free_b_) - { - dict_arr_[i] = dict_arr_[nexti]; - j++; - i = nexti; - nexti = (nexti + j*j)%sz; - } - - return retval; - } -}; - -/** - Hash table with sliding sizes. - */ -template -class Hash_table -{ - Fixed_size_hash_table * fixed_p_; - - /// set size to next prime, and copy contents - void enlarge () - { - Fixed_size_hash_table *f = new Fixed_size_hash_table (fixed_p_->size_idx_ +1); - for (int i=0; i < fixed_p_->dict_arr_.size(); i++) - { - if (fixed_p_->dict_arr_[i].free_b_) - continue; - - K nm (fixed_p_->dict_arr_[i].key_); - int nl = f->lookup (nm); - - f->dict_arr_[nl] = Hash_table_entry (nm, fixed_p_->dict_arr_[i].value_); - } - delete fixed_p_; - fixed_p_ = f; - } -public: - Hash_table () - { - fixed_p_ = new Fixed_size_hash_table (0); - } - ~Hash_table () - { - delete fixed_p_; - } - void operator = (Hash_table const &src) - { - if (&src == this) - return; - - delete fixed_p_; - fixed_p_ = new Fixed_size_hash_table (*src.fixed_p_); - } - Hash_table (Hash_table const &src) - { - fixed_p_ = new Fixed_size_hash_table (*src.fixed_p_); - } - - void clear () - { - int i= fixed_p_->size_idx_; - delete fixed_p_; - fixed_p_ = new Fixed_size_hash_table (i); - } - bool elem_b (K s) const - { - int l = fixed_p_->lookup (s); - - return (l >= 0 && !fixed_p_->dict_arr_[l].free_b_) ; - } - - /** - Find and return element. If #s# is not in the table, create an entry in the table, and init - */ - V& elem (K s) - { - int l; - while ((l= fixed_p_->lookup (s)) <0) - { - enlarge (); - } - - - fixed_p_->dict_arr_[l].free_b_ = false; - fixed_p_->dict_arr_[l].key_ = s; - return fixed_p_->dict_arr_[l].value_; - } - V elem (K s) const - { - return const_elem (s); - } - V const_elem (K k) const - { - V retval; - if (elem_b (k)) - retval = ((Hash_table*)this)->elem (k); - return retval; - } - V& operator [] (K k) - { - return elem (k); - } - - V operator [] (K k) const - { - return const_elem (k); - } - - V remove (K s) - { - return fixed_p_->remove (s); - } - friend class Hash_table_iter; -}; template class Dictionary : public Hash_table { public: Dictionary () - {} + { + hash_func_ = string_hash; + } Dictionary (Dict_initialiser *p) { + hash_func_ = string_hash; for (Dict_initialiser *q = p; q->key_; q++) elem (q->key_) = q->value_; diff --git a/flower/include/fproto.hh b/flower/include/fproto.hh index d149d5f022..9983eef245 100644 --- a/flower/include/fproto.hh +++ b/flower/include/fproto.hh @@ -10,13 +10,6 @@ char const * flower_version_sz(); -// what the F*** is "int" ? -// deprecate int, long, etc., use i32, i64, remember: linux-16/linux-64 ? -/// (i32) -typedef int i32; -/// (i64) -typedef long long I64; - template struct Link_array; template struct Array; template struct sstack; @@ -70,6 +63,14 @@ struct Text_stream; struct Data_file; struct Text_db; struct Scalar; + +typedef unsigned char U8; +typedef short I16; +typedef unsigned short U16; +typedef unsigned U32; +typedef int I32; +typedef long long I64; + typedef unsigned char Byte; diff --git a/flower/include/hash-table-iter.hh b/flower/include/hash-table-iter.hh new file mode 100644 index 0000000000..61b4a34973 --- /dev/null +++ b/flower/include/hash-table-iter.hh @@ -0,0 +1,61 @@ +/* + hash-table-iter.hh -- declare Hash_table_iter + + source file of the Flower Library + + (c) 1999 Han-Wen Nienhuys + + */ + +#ifndef HASH_TABLE_ITER_HH +#define HASH_TABLE_ITER_HH +#include "hash-table.hh" + +template +class Hash_table_iter +{ + Hash_table *dict_l_; + int i; +public: + Hash_table_iter(Hash_table const &dict) + { + i = 0; + dict_l_ =(Hash_table *) & dict; + next_used (); + } + + bool ok () const + { + return i < dict_l_->fixed_p_->dict_arr_.size (); + } + + void next_used () + { + while (ok () && dict_l_->fixed_p_->dict_arr_[i].free_b_) + { + i ++; + } + } + void operator ++(int) + { + i++; + next_used (); + } + + K key () const + { + return dict_l_->fixed_p_->dict_arr_[i].key_; + } + V val () const + { + return dict_l_->fixed_p_->dict_arr_[i].value_; + } + V &val_ref () + { + return dict_l_->fixed_p_->dict_arr_[i].value_; + } +}; + + +#endif /* HASH_TABLE_ITER_HH */ + diff --git a/flower/include/hash-table.hh b/flower/include/hash-table.hh new file mode 100644 index 0000000000..ef497f1c75 --- /dev/null +++ b/flower/include/hash-table.hh @@ -0,0 +1,215 @@ +/* + hash-table.hh -- declare Hash_table_entry, Hash_table + + source file of the Flower Library + + (c) 1999 Han-Wen Nienhuys + + */ + +#ifndef HASH_TABLE_HH +#define HASH_TABLE_HH + +unsigned int int_hash (int); +unsigned long prime_list (int idx); +template +struct Hash_table_entry +{ + K key_; + V value_; + bool free_b_; + + Hash_table_entry() { + free_b_ = true; + } + Hash_table_entry (K s, V v) + { + key_ = s; + value_ = v; + free_b_ = false; + } +}; + +/** + A hash table of prime size. + + We use quadratic probing. + */ +template +class Fixed_size_hash_table +{ +public: + Array > dict_arr_; + int size_idx_; + Fixed_size_hash_table (int size_idx) + { + size_idx_ = size_idx; + int sz = prime_list(size_idx_); + dict_arr_.set_size (sz); + } + + /// find #s#, or find first empty entry corresponding to #s# + int lookup (K s, unsigned int initial_hash) + { + int sz =dict_arr_.size (); + int i = initial_hash % sz; + int j = 0; + while (j <= sz/2) { + if (dict_arr_[i].free_b_) + return i; + + if (dict_arr_[i].key_ == s) + return i; + + j++; + i = (i + j*j) % sz; + } + + return -1; + } + + /// remove #s# from the hash table. + V remove (K s, unsigned int initial_hash) + { + assert (false); // Untested routine. + int sz =dict_arr_.size (); + int i = initial_hash % sz; + int j = 0; + V retval; + while (j <= sz/2 && dict_arr_[i].key_ != s) + { + assert (!dict_arr_[i].free_b_); + + + j ++; + i = (i + j*j) % sz; + } + + j++; + int nexti = (i + j*j) % sz; + + while (j <= sz/2 && !dict_arr_[i].free_b_) + { + dict_arr_[i] = dict_arr_[nexti]; + j++; + i = nexti; + nexti = (nexti + j*j)%sz; + } + + return retval; + } +}; + +/** + Hash table with sliding sizes. + */ +template +class Hash_table +{ + Fixed_size_hash_table * fixed_p_; + /// set size to next prime, and copy contents + void enlarge () + { + Fixed_size_hash_table *f = new Fixed_size_hash_table (fixed_p_->size_idx_ +1); + + for (int i=0; i < fixed_p_->dict_arr_.size(); i++) + { + if (fixed_p_->dict_arr_[i].free_b_) + continue; + + K nm (fixed_p_->dict_arr_[i].key_); + unsigned int h = (*hash_func_)(nm); + int nl = f->lookup (nm, h); + + f->dict_arr_[nl] = Hash_table_entry (nm, fixed_p_->dict_arr_[i].value_); + } + delete fixed_p_; + fixed_p_ = f; + } +public: + Hash_table () + { + hash_func_ = 0; + fixed_p_ = new Fixed_size_hash_table (0); + } + ~Hash_table () + { + delete fixed_p_; + } + void operator = (Hash_table const &src) + { + if (&src == this) + return; + + delete fixed_p_; + fixed_p_ = new Fixed_size_hash_table (*src.fixed_p_); + hash_func_ = src.hash_func_; + } + Hash_table (Hash_table const &src) + { + fixed_p_ = new Fixed_size_hash_table (*src.fixed_p_); + hash_func_ = src.hash_func_; + } + + void clear () + { + int i= fixed_p_->size_idx_; + delete fixed_p_; + fixed_p_ = new Fixed_size_hash_table (i); + } + bool elem_b (K s) const + { + int l = fixed_p_->lookup (s, (*hash_func_)(s)); + + return (l >= 0 && !fixed_p_->dict_arr_[l].free_b_) ; + } + + /** + Find and return element. If #s# is not in the table, create an entry in the table, and init + */ + V& elem (K s) + { + int l; + unsigned int h = (*hash_func_)(s); + while ((l= fixed_p_->lookup (s,h)) <0) + { + enlarge (); + } + + fixed_p_->dict_arr_[l].free_b_ = false; + fixed_p_->dict_arr_[l].key_ = s; + return fixed_p_->dict_arr_[l].value_; + } + V elem (K s) const + { + return const_elem (s); + } + V const_elem (K k) const + { + V retval; + if (elem_b (k)) + retval = ((Hash_table*)this)->elem (k); + return retval; + } + V& operator [] (K k) + { + return elem (k); + } + + V operator [] (K k) const + { + return const_elem (k); + } + + V remove (K s) + { + return fixed_p_->remove (s, (*hash_func_)(s)); + } + friend class Hash_table_iter; +public: + unsigned int (*hash_func_)(K); +}; + + +#endif /* HASH_TABLE_HH */ + diff --git a/flower/rational.cc b/flower/rational.cc index cf99657acb..e99402dbb8 100644 --- a/flower/rational.cc +++ b/flower/rational.cc @@ -179,16 +179,21 @@ Rational::Rational(double x) const int FACT = 1 << 20; /* - FIXME + Thanks to Afie for this too simple idea. + + do not blindly substitute by libg++ code, since that uses + arbitrary-size integers. The rationals would overflow too + easily. + */ - SHOULD TEST THIS - - suck me gently with a vacuum cleaner. Thanks to Afie for this wierd idea. - */ num_ = (unsigned int) (mantissa * FACT); den_ = (unsigned int) FACT; + normalise (); + if (expt < 0) + den_ <<= -expt; + else + num_ <<= expt; normalise (); - num_ <<= expt; } else { diff --git a/input/bugs/auto-beam.ly b/input/bugs/auto-beam.ly new file mode 100644 index 0000000000..622efcc3b7 --- /dev/null +++ b/input/bugs/auto-beam.ly @@ -0,0 +1,21 @@ +\score{ + \notes \relative c''{ + \time 2/4; + c8 + \repeat 2 { % \bar "|:" iknoort-i ook... + c8 c8 + } + c8 + } + \paper{ + \translator{ + \VoiceContext + % add experimental auto-beaming + \consists Auto_beam_engraver; + beamAuto = 1.; + beamAutoEnd8 = "1/4"; + beamAutoEnd16 = "1/4"; + beamAutoEnd32 = "1/4"; + } + } +} diff --git a/input/bugs/mats.ly b/input/bugs/mats.ly new file mode 100644 index 0000000000..6409937008 --- /dev/null +++ b/input/bugs/mats.ly @@ -0,0 +1,78 @@ + +corI=\notes\relative c'' { +\key c; + +[g8. \f ( a16 ] ) g2 | +[g8. ( a16 ] ) g2_"dim." | +c2. \p ( | +) g2 g4 ( | +) c2. ( | +) g4 [g8. ( a16 ] ) g4 | +c2. \p ( | +) g2 g4 | +c2 \< ( ~ [ \! c8 \> \! ) g ] | +g2 \p r4 | +g \mf ( d' c~ | +c ) b r | +R2. | +} + +corII=\notes\relative c'' { +\key c; +\time 3/4; + +R2.*19 | +r4 r [g8^"solo" \p (\< \! ) e'] | +g2 \> ( [e8. ) \! c16 ] | % grace note e8 () g2 +g2 r 4 | +r r \times 2/3 {[e'8 \p ( g, ) g' ]} | +g4 \> () \! e r | +r r \times 2/3 {[g8 \p ( e ) g ]} | +d4 \> () \! g r | +r r [g,16 ( \p d' e d ] | +) g,4 r r | +R2. | +r4 r c \p ( | +) g r r | +g [g8. ( a16 ] ) g4 | +R2. | +r4 r [g8^""^"solo" \mf \< () \! e' ] | +g2 \> [ \! e8. ( c16 ] | +) g2 r4 | +R2. | +r4 r \times 2/3 {[e'8 \f ( g, ) g'] } | +g4 () e r | +r r \times 2/3 {[g8 \f ( e ) g] } +d4 () g r | +r r [d16 \f ( g, e' d ] | +[g, d' e ) d ] g,4 r | +r d'2 \f \> ( | % grace note g8 d2 +[g,8. a16 g8. a16 \! g8. ) a16 ] | +g4 r r | +} + +trpI=\notes\relative c'' { +\key c; +\time 3/4; + +R2.*30 | +} + +\score{ < + \type StaffGroup = brass < + \type Staff = cor < + \type Voice = corI { \stemup \corI } + \type Voice = corII { \stemdown \corII } + > + \type Staff = trp < + \type Voice = trpI { \stemup \trpI } + > + > +> + \paper { + \translator {\OrchestralScoreContext + % The following line causes a SIGSEGV + \consists "Multi_measure_rest_engraver"; + } + } +} diff --git a/input/bugs/partial.ly b/input/bugs/partial.ly new file mode 100644 index 0000000000..af915328a6 --- /dev/null +++ b/input/bugs/partial.ly @@ -0,0 +1,16 @@ +\score{ + \notes \relative c''{ + \time 4/4; + c4 c c c + \partial 4*3; + c c c + \repeat 2 { + \partial 4; + c + c c c c + \partial 4*3; + c c c + } + } + \paper{ } +} diff --git a/input/opus-130.ly b/input/opus-130.ly index 7ce7cf7a9a..0bb12e66c0 100644 --- a/input/opus-130.ly +++ b/input/opus-130.ly @@ -10,61 +10,65 @@ copyright = "public domain"; % \version "1.0.14"; -global = \notes { - \key g; - \time 3/8; - \skip 4.*8; -% 1.1.9 broken -% \bar ":|"; -} - tempi = \notes { \property Voice.textstyle = "large" s8^"Allegro assai" } dynamics = \notes { - \type Voice=i s8\p\< \!s8.\> \!s16 | s4.\p | s8\< s8. \!s16 | s4.\p | s8\p\< \!s8.\> \!s16 | s4.\p | s8\< s8. \!s16 | s4.\p | } +global = \notes { + \key g; + \time 3/8; + < + \dynamics + \repeat 2 { s4.*8 } + > +} + violinei = \notes\relative c''{ - \type Voice=i - [d8(b)d16] r | g,4. | [a16(b c8)e16] r | g,8~fis4 | - [d''8(b)d16] r | g,4. | [a16(b c8)fis,16] r | fis8~g4 | + d8(b)d16 r | g,4. | a16(b c8)e16 r | g,8~fis4 | + d''8(b)d16 r | g,4. | a16(b c8)fis,16 r | fis8~g4 } violineii = \notes\relative c'{ - \type Voice=i - [b8(d)b] | [e(g,)e'] | [e(c)a'] | [a(c)a] | + b8(d)b | e(g,)e' | e(c)a' | a(c)a | % copy from violinei: 5-8 - [d8(b)d16] r | g,4. | [a16( b c8)fis,16] r | fis8~g4 | + d8(b)d16 r | g,4. | a16( b c8)fis,16 r | fis8~g4 } viola = \notes\relative c'{ - \type Voice=i \clef "alto"; - [g8(b)g] | [b(e,)b'] | [c,(a')c,] | [c'(d,)c'] | [b(d)b] | - [e(g,)e'] | [e(e,<)a' c,>] | <[a(c,> )b,] | + g8(b)g | b(e,)b' | c,(a')c, | c'(d,)c' | b(d)b | + e(g,)e' | e(e,<)a' c,> | < a(c,> )b, } cello = \notes\relative c'{ - \type Voice=i \clef "bass"; - g4 r8 | e'4 r8 | c4 r8 | d4 r8 | [g,,8 b g] | [b(e,)b'] | - [c,(a')d,] | [d'(d,)g] | + g4 r8 | e'4 r8 | c4 r8 | d4 r8 | g,,8 b g | b(e,)b' | + c,(a')d, | d'(d,)g } \score{ \type StaffGroup < - \type Staff = i < \tempi \global \dynamics \violinei > - \type Staff = ii < \global \dynamics \violineii > - \type Staff = iii < \global \dynamics \viola > - \type Staff = iv < \global \dynamics \cello > +% broken, 1.1.23 +% \type Staff = i < \tempi \global \violinei > + \type Staff = i < \global \violinei > + \type Staff = ii < \global \violineii > + \type Staff = iii < \global \viola > + \type Staff = iv < \global \cello > > \paper{ \translator { \OrchestralScoreContext } + \translator { + \VoiceContext + \consists Auto_beam_engraver; + beamAuto = 1.; + beamAutoEnd = "3/8"; + } } \midi{ \tempo 4 = 160; } } diff --git a/input/star-spangled-banner.ly b/input/star-spangled-banner.ly index f3312161d4..d05c396cfa 100644 --- a/input/star-spangled-banner.ly +++ b/input/star-spangled-banner.ly @@ -14,46 +14,46 @@ copyright="public domain"; } $staff1_voice_1 = \notes { - [a8.()fis16] - \repeat 2 { d4 fis4 a4 d'2 [fis'8. e'16] d'4 fis4 gis4 a2 [a8 a8] - fis'4. e'8 d'4 cis'2 [b8. cis'16] d'4 d'4 a4 } - \alternative { { fis4 d4 [a8. fis16] } { fis4 d4 [fis'8. fis'16] } } - fis'4 g'4 a'4 a'2 [g'8 fis'8] e'4 fis'4 - g'4 g'2 g'4 fis'4. e'8 d'4 cis'2 [b8. cis'16] d'4 fis4 gis4 a2 a4 - d'4 d'4 [d'8()cis'8] b4 b4 b4 e'4 [g'8 ()fis'8] [e'8()d'8] - d'4~cis'4 [a8. a16] d'4.~e'8 [fis'8 g'8] a'2 [d'8 e'8] fis'4. g'8 + a8.()fis16 + \repeat 2 { d4 fis4 a4 d'2 fis'8. e'16 d'4 fis4 gis4 a2 a8 a8 + fis'4. e'8 d'4 cis'2 b8. cis'16 d'4 d'4 a4 } + \alternative { { fis4 d4 a8. fis16 } { fis4 d4 fis'8. fis'16 } } + fis'4 g'4 a'4 a'2 g'8 fis'8 e'4 fis'4 + g'4 g'2 g'4 fis'4. e'8 d'4 cis'2 b8. cis'16 d'4 fis4 gis4 a2 a4 + d'4 d'4 d'8()cis'8 b4 b4 b4 e'4 g'8 ()fis'8 e'8()d'8 + d'4~cis'4 a8. a16 d'4.~e'8 fis'8 g'8 a'2 d'8 e'8 fis'4. g'8 e'4 d'2 s4 } $staff1_voice_2 = \notes { - [a8.()fis16] - \repeat 2 { a,4 d4 e4 d4~fis4 [fis8. fis16] fis4 d4 d4 cis2 - [e8 e8] a4. a8 a4 a2 [a8. a16] a4 a4 a4 } - \alternative { { fis4 d4 [a8. fis16] } { fis4 d4 r4 } } - a4 a4 d'4 d'2 [a8 a8] cis'4 cis'4 cis'4 cis'2 a4 a4. a8 a4 a2 - [a8. a16] d4 d4 d4 cis2 e4 fis4 e4 d4 d4 d4 dis4 g4 [g8()dis8] e4 e2 - [e8. e16] d4.~a8 [a8 a8] a2 [g8 g8] a4. a8 g4 fis2 s4 + a8.()fis16 + \repeat 2 { a,4 d4 e4 d4~fis4 fis8. fis16 fis4 d4 d4 cis2 + e8 e8 a4. a8 a4 a2 a8. a16 a4 a4 a4 } + \alternative { { fis4 d4 a8. fis16 } { fis4 d4 r4 } } + a4 a4 d'4 d'2 a8 a8 cis'4 cis'4 cis'4 cis'2 a4 a4. a8 a4 a2 + a8. a16 d4 d4 d4 cis2 e4 fis4 e4 d4 d4 d4 dis4 g4 g8()dis8 e4 e2 + e8. e16 d4.~a8 a8 a8 a2 g8 g8 a4. a8 g4 fis2 s4 } $staff2_voice_1 = \notes { r4 - \repeat 2 { fis4 a4 a4 b2 [cis'8. cis'16] b4 b4 b4 a2 [cis'8 cis'8] - d'4. cis'8 d'4 e'2 [e'8. e'16] d'4 d'4 a4 } - \alternative { { fis4 d4 r4 } { fis4 d4 r4 } } - d4 e4 fis4 fis'2 [e'8 d'8] e'4 e'4 e'4 e'2 cis'4 d'4. cis'8 d'4 e'2 - [e'8. e'16] a4 a4 e4 e2 cis'4 a4 a4 a4 g4 g4 b4 b4 b4 b4 a2 - [cis'8. cis'16] a4.~cis'8 [d'8 d'8] d'2 [d'8 d'8] d'4. d'8 cis'4 + \repeat 2 { fis4 a4 a4 b2 cis'8. cis'16 b4 b4 b4 a2 cis'8 cis'8 + d'4. cis'8 d'4 e'2 e'8. e'16 d'4 d'4 a4 } + \alternative { { fis4 d4 r4 } { fis4 d4 r4 } } + d4 e4 fis4 fis'2 e'8 d'8 e'4 e'4 e'4 e'2 cis'4 d'4. cis'8 d'4 e'2 + e'8. e'16 a4 a4 e4 e2 cis'4 a4 a4 a4 g4 g4 b4 b4 b4 b4 a2 + cis'8. cis'16 a4.~cis'8 d'8 d'8 d'2 d'8 d'8 d'4. d'8 cis'4 a2 s4 } $staff2_voice_2 = \notes { r4 - \repeat 2 { d4 d4 cis4 b,2 [ais,8. ais,16] b,4 b,4 e4 a,2 [a8 a8] - d4. e8 [fis8 g8] a2 [g8. g16] fis4 fis4 a4 } + \repeat 2 { d4 d4 cis4 b,2 ais,8. ais,16 b,4 b,4 e4 a,2 a8 a8 + d4. e8 fis8 g8 a2 g8. g16 fis4 fis4 a4 } \alternative { { fis4 d4 r4 } { fis4 d4 r4 } } - d4 d4 d4 d2 [d8 d8] a4 a4 a4 a2 a,4 d4. e8 [fis8 g8] a2 [g8. g16] - fis4 d4 e4 a,2 a4 d4 e4 fis4 g4 g4 fis4 e4 [e8()fis8] [g8()gis8] a2 - [g8. g16] fis4.~a,8 [d8 e8] fis2 [b8 b8] a4. a8 a,4 d2 s4 + d4 d4 d4 d2 d8 d8 a4 a4 a4 a2 a,4 d4. e8 fis8 g8 a2 g8. g16 + fis4 d4 e4 a,2 a4 d4 e4 fis4 g4 g4 fis4 e4 e8()fis8 g8()gis8 a2 + g8. g16 fis4.~a,8 d8 e8 fis2 b8 b8 a4. a8 a,4 d2 s4 } $text = \lyrics{ @@ -62,9 +62,8 @@ $text = \lyrics{ { say. can you see,2 by8. the16 dawn's4 ear- ly light2 What8 so8 proud-4. ly8 we4 hailed,2 At8. the16 twi-4 light's last gleam- ing. Whose8. broad16 } - % urg, lyric chords broken: 1.1.22 -% { stripes4 and bright stars,2 through8. the16 per-4 il- ous fight,2 -% O'er8 the8 ram-4. parts8 we4 watched,2 were8. so16 gal-4 lant- ly } + { stripes4 and bright stars,2 through8. the16 per-4 il- ous fight,2 + O'er8 the8 ram-4. parts8 we4 watched,2 were8. so16 gal-4 lant- ly } > stream-4 ing. And8. the16 rock-4 ets' red glare,2 the8 bombs8 burst-4 ing in air,2 gave4 proof4. through8 the4 night2 that8. @@ -99,6 +98,7 @@ global = \notes { \type Staff=staffB < \global \clef bass; + \property Staff.voltaVisibility = "0" {\voiceone \$staff2_voice_1 } {\voicetwo \$staff2_voice_2 } > @@ -108,11 +108,18 @@ global = \notes { textheight = 230.\mm; linewidth= 180.\mm; \translator { - \GrandStaffContext - \accepts "Lyrics"; + \GrandStaffContext + \accepts "Lyrics"; } \translator { - \BarNumberingStaffContext + \BarNumberingStaffContext + } + \translator{ + \VoiceContext + \consists Auto_beam_engraver; + beamAuto = 1.; + beamAutoEnd8 = "1/4"; + beamAutoEnd16 = "1/4"; } } } diff --git a/input/test/auto-beam.ly b/input/test/auto-beam.ly new file mode 100644 index 0000000000..02e7711dba --- /dev/null +++ b/input/test/auto-beam.ly @@ -0,0 +1,49 @@ +%{ + Currently (1.1.22.jcn5), the auto-beam engraver will only engrave + sensible beams (hopefully), which means that it will give up the + whole beam if: + * a rest is encountered + * another beam (entered manually) is encountered + * there's a 'gap' in the beam note's durations + + There's no smart algorithm, beginning a beam is considered when + + now / beamAutoBegin = 0 + + the beam will be ended when + + * now / beamAutoEnd = 0 +%} + +\score{ + \notes \relative c''{ + \time 2/4; + % one beam per measure + c8 c c c + c16 c c c c c c c + % from here on two beams per measure + \property Voice.beamAutoEnd = "1/4"; + c8 c c c + % manually override autobeam with weird beaming + c8 [c c] c + c8 c c r + c8 c c4 + r8 c c c + % no autobeaming + \property Voice.beamAuto = "0" + c8 c c c + } + \paper{ + \translator{ + \VoiceContext + % add experimental auto-beaming + \consists Auto_beam_engraver; + % switch it on (perhaps a bit double, but we want to be able + % to switch it off conveniently + beamAuto = 1.; + % consider starting beam at every 4 note + % beamAutoBegin = "1/4"; + beamAutoEnd = "1/2"; + } + } +} diff --git a/input/test/bar-scripts.ly b/input/test/bar-scripts.ly index 90d842fd08..d618a2073f 100644 --- a/input/test/bar-scripts.ly +++ b/input/test/bar-scripts.ly @@ -1,7 +1,5 @@ - - -\version "1.0.14"; + \version "1.0.14"; onestaff = \type Staff = foo\notes { \property Staff.instr = instr @@ -18,10 +16,9 @@ grstaff = \notes \type GrandStaff < \type Staff = bufl { c1 c2 } > -scpaper = \paper {\translator {\OrchestralScoreContext}} - +scpaper = \paper {\translator {\OrchestralScoreContext}} +stpaper = \paper{ \translator {\BarNumberingStaffContext }} -stpaper =\paper{ \BarNumberingStaffContext } scscore = \score { \grstaff \paper { \scpaper }} @@ -31,5 +28,5 @@ stscore = \score { \onestaff \paper { \stpaper }} -\score {\stscore} -%\score {\scscore} +%\score {\stscore} +\score {\scscore} diff --git a/input/test/beam-interstaff.ly b/input/test/beam-interstaff.ly index d09e796c21..69cc8dde4e 100644 --- a/input/test/beam-interstaff.ly +++ b/input/test/beam-interstaff.ly @@ -26,6 +26,6 @@ minVerticalAlign = 3.0*\staffheight; maxVerticalAlign = 3.0*\staffheight; } - linewidth=-1.; +% linewidth=-1.; } } diff --git a/input/test/chords.ly b/input/test/chords.ly index 84f1511fa1..1133280d3f 100644 --- a/input/test/chords.ly +++ b/input/test/chords.ly @@ -19,6 +19,8 @@ scales = \notes \transpose c'' \chords{ % c1-m c-min c4-dim c-aug c-sus c-maj c1-6 c4-7 c-9 c-11 c-13 + c1-7^5 c-13^5^7^9^11 + % c1-7^5 c-13^5 c1 g d a e b fis c1 f bes es as des ges } diff --git a/input/test/mark.ly b/input/test/mark.ly index 30bd288f24..160e6c05fe 100644 --- a/input/test/mark.ly +++ b/input/test/mark.ly @@ -20,6 +20,11 @@ two = \notes\relative c{ \score{ < \global \one \two > \paper { - \translator { \OrchestralPartStaffContext } + \translator { \OrchestralPartStaffContext + markScriptPadding = "4.0"; + markHangOn = "Bar"; + markHangDepth = "1"; +% markDirection = \diown; + } } } diff --git a/input/test/notemode-chords.ly b/input/test/notemode-chords.ly new file mode 100644 index 0000000000..6ccc59d69d --- /dev/null +++ b/input/test/notemode-chords.ly @@ -0,0 +1,8 @@ +\version "1.0.15"; + +\score{ + \notes \transpose c''{ + @c1@ @c-7@ @c-7^5@-1-3 + } + +} diff --git a/input/test/rep.ly b/input/test/rep.ly new file mode 100644 index 0000000000..2b79795ecc --- /dev/null +++ b/input/test/rep.ly @@ -0,0 +1,14 @@ +\score{ + < + \type Staff \notes\relative c'{ + c4 d e f + \repeat 2 { g a b c } +% \alternative { { c b a g } { f e d c } } c c c c + \alternative { { c b a g } { f e d c } { c d e f } } + g g g g + \repeat 2 { c c c c } + \repeat 2 { c c c c } + g g g g + } + > +} diff --git a/input/twinkle.ly b/input/twinkle.ly index a49a5ff398..82a509a8a1 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -1,10 +1,9 @@ \header{ -filename = "twinkle.ly"; -title = "Twinkle Twinkle Little Star"; - -composer = "Traditional"; -enteredby = "HWN & JCN"; -copyright = "public domain"; +filename = "twinkle.ly"; +title = "Twinkle Twinkle Little Star"; +composer = "Traditional"; +enteredby = "hwn and jcn"; +copyright = "public domain"; } %{ @@ -17,7 +16,7 @@ traditional song in various languages. %} %{ -Tested Features: lyrics, interleaving lyrics and staffs +Tested Features: lyrics, interleaving lyrics and staffs, repeats %} \version "1.0.14"; @@ -55,11 +54,6 @@ global = \notes { tekst = \lyrics{ Al-4 tijd is Kort- jak- je ziek,2 midden4 in_de week maar s,_zon- dags niet.2 -% ugly hack: insertion of empty syllables creates columns on extra -% moments. The net result is more spacing. -% -% probably not necessary anymore -% midden8 _8 in_de8 _8 week4 maar s,_zon- dags niet.2 s,_Zon-4 dags gaat ze naar de kerk,2 met4 een boek vol zil- ver werk.2 Al-4 tijd is Kort- jak- je ziek,2 @@ -121,45 +115,17 @@ textiii = \lyrics{ How4 I won- der what you are!2 } -$top_lyrics = \type Lyrics = top < - \tekst -> - -$treble_staff = \type Staff = treble < - \global - \melody -> - -$bass_staff = \type Staff = bass < - \global - \accompany -> - -$middle_lyrics = \type Lyrics = middle < - \texte -> - -$bottom_lyrics = \type Lyrics = bottom < -% \global - \texti - \textii - \textiii -> - -$grand_staff = \type GrandStaff < - \$treble_staff - \$middle_lyrics - \$bass_staff -> - \score{ - \repeat 2 { < - \$treble_staff - \$middle_lyrics - \$top_lyrics - \$grand_staff - \$bottom_lyrics - > } + < + \type Staff=i \repeat 2 < \global\melody > + \type Lyrics=top \repeat 2 {} \alternative < \tekst \texte > + \type GrandStaff < + \type Staff=ii \repeat 2 < \global\melody > + \type Staff=iii \repeat 2 < \global\accompany > + > + \type Lyrics=bottom \repeat 3 {} + \alternative < \texti \textii \textiii > + > \paper{ gourlay_maxmeasures = 14.0; } diff --git a/lib/binary-source-file.cc b/lib/binary-source-file.cc index 9bcf0e5f70..951f3a746e 100644 --- a/lib/binary-source-file.cc +++ b/lib/binary-source-file.cc @@ -27,20 +27,20 @@ Binary_source_file::~Binary_source_file () } String -Binary_source_file::error_str (char const* pos_ch_c_l) const +Binary_source_file::error_str (char const* pos_ch_C) const { assert (this); - if (!in_b (pos_ch_c_l)) + if (!in_b (pos_ch_C)) return ""; - char const* begin_ch_c_l = pos_ch_c_l - 8 >? ch_C (); - char const* end_ch_c_l = pos_ch_c_l + 7 ? ch_C (); + char const* end_ch_C = pos_ch_C + 7 ch_C (); } + +void +Source_file::set_pos (char const * pos_ch_C) +{ + if (in_b (pos_ch_C)) + pos_ch_C_ = pos_ch_C; + else + error (error_str (pos_ch_C) + "invalid pos"); +} + +char const* +Source_file::seek_ch_C (int n) +{ + char const* new_ch_C = ch_C () + n; + if (n < 0) + new_ch_C += length_i (); + if (in_b (new_ch_C)) + pos_ch_C_ = new_ch_C; + else + error (error_str (new_ch_C) + "seek past eof"); + + return pos_ch_C_; +} + +char const* +Source_file::forward_ch_C (int n) +{ + char const* old_pos_C = pos_ch_C_; + char const* new_ch_C = pos_ch_C_ + n; + if (in_b (new_ch_C)) + pos_ch_C_ = new_ch_C; + else + error (error_str (new_ch_C) + "forward past eof"); + + return old_pos_C; +} + +String +Source_file::get_str (int n) +{ + String str ((Byte const*)forward_ch_C (n), n); + return str; +} diff --git a/lib/warn.cc b/lib/warn.cc index afc6f7b9ce..ecb97a5f75 100644 --- a/lib/warn.cc +++ b/lib/warn.cc @@ -4,26 +4,26 @@ void error (String s) { - cerr << _ ("error: ") << s << '\n'; + cerr << _ ("error: ") << s << '\n'; - exit (1); + exit (1); } void non_fatal_error (String s) { - cerr << _ ("error: ") << s << '\n'; + cerr << _ ("error: ") << s << '\n'; } void warning (String m) { - cerr << _ ("warning: ") <=0) + { + return char_metrics_[code]; + } + else if (warn ) + { + warning (_f ("can't find character number %d", a)); + } + return dummy_static_char_metric; +} diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc new file mode 100644 index 0000000000..e01062ba33 --- /dev/null +++ b/lily/all-font-metrics.cc @@ -0,0 +1,77 @@ +#include "pointer.hh" +#include "main.hh" +#include "all-fonts.hh" +#include "debug.hh" +#include "warn.hh" +#include "afm.hh" +#include "tfm.hh" + +const char * default_font_sz_ = "cmr10"; + + + +All_font_metrics::All_font_metrics (String path) +{ + search_path_.parse_path (path); +} + + +Adobe_font_metric * +All_font_metrics::find_afm (String name) +{ + if (!afm_p_dict_.elem_b (name)) + { + String path = name + ".afm"; + path = search_path_.find (path); + if (path.empty_b ()) + return 0; + + *mlog << "[" << path; + Adobe_font_metric + * afm_p = new Adobe_font_metric (read_afm_file (path)); + *mlog << "]" << flush ; + + afm_p_dict_[name] = afm_p; + } + return afm_p_dict_[name]; +} + +Tex_font_metric * +All_font_metrics::find_tfm (String name) +{ + if (!tfm_p_dict_.elem_b (name)) + { + String path = name + ".tfm"; + path = search_path_.find (path); + if (path.empty_b ()) + return 0; + + *mlog << "[" << path; + Tex_font_metric * tfm_p = new Tex_font_metric; + tfm_p->read_file (path); + *mlog << "]" << flush ; + + tfm_p_dict_[name] = tfm_p; + } + return tfm_p_dict_[name]; +} + + +Font_metric * +All_font_metrics::find_font (String name) +{ + Font_metric * f= find_afm (name); + if (f) + return f; + + f = find_tfm (name); + if (f) + return f; + + f = find_tfm (default_font_sz_); + if (f) + return f; + String s = _f("Can't find default font `%s\', giving up.", default_font_sz_); + s += String ("\n") + _f ("search path = %s", search_path_.str ()); + error (s); +} diff --git a/lily/atom.cc b/lily/atom.cc index e237f75b70..0d71f4e240 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -64,6 +64,12 @@ Atom::extent () const return b; } +Interval +Atom::extent (Axis a) const +{ + return dim_[a] + off_[a]; +} + Atom::Atom () diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc new file mode 100644 index 0000000000..78e0848227 --- /dev/null +++ b/lily/auto-beam-engraver.cc @@ -0,0 +1,293 @@ +/* + auto-beam-engraver.cc -- implement Auto_beam_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1999 Jan Nieuwenhuizen + + */ + +#include "auto-beam-engraver.hh" +#include "musical-request.hh" +#include "bar.hh" +#include "beam.hh" +#include "grouping.hh" +#include "rest.hh" +#include "stem.hh" +#include "debug.hh" +#include "time-description.hh" + +ADD_THIS_TRANSLATOR (Auto_beam_engraver); + +Auto_beam_engraver::Auto_beam_engraver () +{ + beam_p_ = 0; + finished_beam_p_ = 0; + finished_grouping_p_ = 0; + grouping_p_ = 0; +} + +/* + should move this to rational, but may reject now + */ +Rational +str2rat (String str) +{ + int num; + int den = 1; + if (int i = str.index_i ('/') != -1) + { + den = str.cut_str (i + 1, str.length_i ()).value_i (); + str = str.left_str (i); + } + num = str.value_i (); + return Rational (num, den); +} + +void +Auto_beam_engraver::do_process_requests () +{ + Time_description const *time = get_staff_info().time_C_; + + Scalar begin = get_property ("beamAutoBegin", 0); + Moment begin_mom = str2rat (begin); + + Scalar end = get_property ("beamAutoEnd", 0); + Moment end_mom = str2rat (end); + + if (mult_i_) + { + Scalar end_mult = get_property (String ("beamAutoEnd") + + to_str (1 << (mult_i_ + 2)), 0); + if (end_mult.length_i ()) + end_mom = str2rat (end_mult); + else if (end_mom / Moment (mult_i_, 1) > Moment (4)) + end_mom /= Moment (mult_i_); + } + + Real f; + if (end_mom) + f = fmod (time->whole_in_measure_, end_mom); + else + f = Moment (1); + + // enge floots + Real epsilon_f = Moment (1, 512); + if (beam_p_ && (abs (f) < epsilon_f)) + end_beam (); + + /* + Allow already started autobeam to end + */ + Scalar on = get_property ("beamAuto", 0); + if (!on.to_bool ()) + return; + + if (begin_mom) + f = fmod (time->whole_in_measure_, begin_mom); + if (!beam_p_ && (!begin_mom || (abs (f) < epsilon_f))) + begin_beam (); +} + + +void +Auto_beam_engraver::begin_beam () +{ + DOUT << String ("starting autobeam at: ") + now_moment ().str () + "\n"; + beam_p_ = new Beam; + grouping_p_ = new Rhythmic_grouping; + + /* urg, copied from Beam_engraver */ + Scalar prop = get_property ("beamslopedamping", 0); + if (prop.isnum_b ()) + beam_p_->damping_i_ = prop; + + prop = get_property ("beamquantisation", 0); + if (prop.isnum_b ()) + beam_p_->quantisation_ = (Beam::Quantisation)(int)prop; + + // must set minVerticalAlign = = maxVerticalAlign to get sane results + // see input/test/beam-interstaff.ly + prop = get_property ("minVerticalAlign", 0); + if (prop.isnum_b ()) + beam_p_->vertical_align_drul_[MIN] = prop; + + prop = get_property ("maxVerticalAlign", 0); + if (prop.isnum_b ()) + beam_p_->vertical_align_drul_[MAX] = prop; + + announce_element (Score_element_info (beam_p_, 0)); +} + +void +Auto_beam_engraver::end_beam () +{ + DOUT << String ("ending autobeam at: ") + now_moment ().str () + "\n"; + if (beam_p_->stems_.size () < 2) + { + DOUT << "junking autombeam: less than two stems\n"; + junk_beam (); + } + else + { + finished_beam_p_ = beam_p_; + finished_grouping_p_ = grouping_p_; + beam_p_ = 0; + grouping_p_ = 0; + mult_i_ = 0; + } +} + +void +Auto_beam_engraver::typeset_beam () +{ + if (finished_beam_p_) + { + Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_; + rg_C->extend (finished_grouping_p_->interval()); + finished_beam_p_->set_grouping (*rg_C, *finished_grouping_p_); + typeset_element (finished_beam_p_); + finished_beam_p_ = 0; + + delete finished_grouping_p_; + finished_grouping_p_= 0; + } +} + +void +Auto_beam_engraver::do_post_move_processing () +{ +} + +void +Auto_beam_engraver::do_pre_move_processing () +{ + typeset_beam (); +} + +void +Auto_beam_engraver::do_removal_processing () +{ + typeset_beam (); + if (beam_p_) + { + DOUT << "Unfinished beam\n"; + junk_beam (); + } +} + +void +Auto_beam_engraver::acknowledge_element (Score_element_info info) +{ + if (Beam *b = dynamic_cast (info.elem_l_)) + { + if (beam_p_) + { + DOUT << "junking autobeam: beam encountered\n"; + junk_beam (); + } + } + if (Bar *b = dynamic_cast (info.elem_l_)) + { + if (beam_p_) + { + DOUT << "junking autobeam: bar encountered\n"; + junk_beam (); + } + } + + if (beam_p_) + { + Rhythmic_req *rhythmic_req = dynamic_cast (info.req_l_); + if (!rhythmic_req) + return; + + if (dynamic_cast (info.elem_l_)) + { + DOUT << "junking autobeam: rest encountered\n"; + end_beam (); + return; + } + + Stem* stem_l = dynamic_cast (info.elem_l_); + if (!stem_l) + return; + + if (stem_l->beam_l_ && (stem_l->beam_l_ != beam_p_)) + { + DOUT << "junking autobeam: beamed stem encountered\n"; + junk_beam (); + return; + } + + + /* + now that we have last_add_mom_, perhaps we can (should) do away + with these individual junk_beams + */ + if (rhythmic_req->duration_.durlog_i_<= 2) + { + DOUT << "ending autobeam: stem doesn't fit in beam\n"; + end_beam (); + return; + } + + Moment start = get_staff_info().time_C_->whole_in_measure_; + if (!grouping_p_->child_fit_b (start)) + { + DOUT << "ending autobeam: stem doesn't fit in group\n"; + end_beam (); + } + else + { + grouping_p_->add_child (start, rhythmic_req->duration ()); + stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_; + beam_p_->add_stem (stem_l); + Moment now = now_moment (); + last_add_mom_ = now; + extend_mom_ = extend_mom_ >? now + rhythmic_req->duration (); + mult_i_ = mult_i_ >? (rhythmic_req->duration_.durlog_i_ - 2); + } + } +} + +void +Auto_beam_engraver::junk_beam () +{ + assert (beam_p_); + for (int i=0; i < beam_p_->stems_.size (); i++) + { + Stem* s = beam_p_->stems_[i]; + s->beams_i_drul_[LEFT] = 0; + s->beams_i_drul_[RIGHT] = 0; + s->mult_i_ = 0; + s->beam_l_ = 0; + } + + beam_p_->unlink (); + beam_p_ = 0; + delete grouping_p_; + grouping_p_ = 0; + mult_i_ = 0; +} + +void +Auto_beam_engraver::process_acknowledged () +{ + if (beam_p_) + { + Moment now = now_moment (); + if ((extend_mom_ < now) + || ((extend_mom_ == now) && (last_add_mom_ != now ))) + { + DOUT << String ("junking autobeam: no stem added since: ") + + last_add_mom_.str () + "\n"; + end_beam (); + } + else if (!beam_p_->stems_.size ()) + { + DOUT << "junking started autobeam: no stems\n"; + junk_beam (); + } + } +} diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index 62b5f70ffd..57436ae70f 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -19,7 +19,6 @@ Bar_engraver::Bar_engraver() { bar_p_ =0; - bar_l_ =0; do_post_move_processing(); } @@ -32,7 +31,6 @@ Bar_engraver::do_try_music (Music*r_l) return false; bar_req_l_ = b; - return true; } @@ -45,8 +43,8 @@ Bar_engraver::acknowledge_element (Score_element_info i) { if (Bar *b = dynamic_cast (i.elem_l_)) { - bar_l_ = b; - // auto_create_bar_b_ = false; + // only bar-engraver should create bars + assert (0); } } @@ -67,6 +65,16 @@ Bar_engraver::create_bar () } } +void +Bar_engraver::request_bar (String type_str) +{ + create_bar (); + if (((type_str == "|:") && (bar_p_->type_str_ == ":|")) + || ((type_str == ":|") && (bar_p_->type_str_ == "|:"))) + bar_p_->type_str_ = ":|:"; + else + bar_p_->type_str_ = type_str; +} void Bar_engraver::do_creation_processing () @@ -93,11 +101,14 @@ Bar_engraver::do_process_requests() Time_description const *time = get_staff_info().time_C_; if (bar_req_l_) { - if (!bar_p_) - create_bar (); - + create_bar (); bar_p_->type_str_ = bar_req_l_->type_str_; } + else if (!now_moment ()) + { + create_bar (); + bar_p_->type_str_ = ""; + } else { Scalar always = get_property ("barAlways", 0); @@ -110,16 +121,7 @@ Bar_engraver::do_process_requests() } } - /* - hmm, perhaps it's Better to create empty bars if you want none - displayed, and keep bars for breakpoints ? - */ -#if 0 - if ((time && time->whole_in_measure_) - && !always.to_bool () - && !bar_p_ && !bar_l_) -#endif - if (!bar_p_ && !bar_l_) + if (!bar_p_) { Break_req r; r.penalty_i_ = Break_req::DISALLOW; @@ -131,15 +133,6 @@ Bar_engraver::do_process_requests() void Bar_engraver::do_pre_move_processing() { - if (bar_l_) - { - bar_l_ = 0; - if (bar_p_) - { - bar_p_->unlink (); - bar_p_ = 0; - } - } if (bar_p_) { typeset_element (bar_p_); diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 2d0412f427..7adc8dcdea 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -8,74 +8,33 @@ #include "bar-number-engraver.hh" -#include "script.hh" -#include "text-def.hh" -#include "paper-def.hh" -#include "command-request.hh" -#include "bar.hh" -#include "span-bar.hh" -#include "stem.hh" #include "time-description.hh" +#include "timing-engraver.hh" +#include "engraver-group.hh" +#include "g-text-item.hh" Bar_number_engraver::Bar_number_engraver() { - script_p_ =0; + axis_ = Y_AXIS; + type_ = "barNumber"; + visibility_lambda_ + = gh_eval_str ("(lambda (d) (if (= d 1) '(#f . #f) '(#t . #t)))"); } void -Bar_number_engraver::acknowledge_element (Score_element_info i) +Bar_number_engraver::do_process_requests () { - Bar *b =dynamic_cast (i.elem_l_); - if (script_p_ || !b) - return; + Translator *tr = daddy_grav_l ()->get_simple_translator ("Timing_engraver"); + Timing_translator *timer = dynamic_cast(tr); + Time_description *time = &timer->time_; - /* Only put numbers on bars that are at our own level (don't put - numbers over the staffs of a GrandStaff, only over the GrandStaff - itself */ - if (i.origin_grav_l_arr_.size() != 1) - return; - - Time_description const * time = get_staff_info().time_C_; - if (!time || time->cadenza_b_) - return; - - script_p_ = new Script; - Text_def *td_p = new Text_def; - td_p->text_str_ = to_str (time->bars_i_); - - td_p->align_dir_ = LEFT; - - script_p_->dir_ = UP; - script_p_->axis_ = Y_AXIS; - script_p_->specs_p_ = td_p->clone (); - script_p_->breakable_b_ = true; - - Scalar pri = get_property ("barNumberBreakPriority", 0); - if (pri.length_i () && pri.isnum_b ()) + if (!time->whole_in_measure_ && !time->cadenza_b_ && now_moment () > Moment (0)) { - script_p_->break_priority_i_ = int (pri); + create_items (0); + + text_p_->text_str_ = to_str (time->bars_i_); + text_p_->style_str_ = "roman"; } - else - script_p_->break_priority_i_ = b->break_priority_i_; - - Scalar padding = get_property ("barScriptPadding", 0); - if (padding.length_i() && padding.isnum_b ()) - { - script_p_->padding_f_ = Real(padding); - } - - announce_element (Score_element_info (script_p_,0)); } -void -Bar_number_engraver::do_pre_move_processing() -{ - if (script_p_) - { - typeset_element (script_p_); - script_p_ =0; - } -} - - ADD_THIS_TRANSLATOR(Bar_number_engraver); diff --git a/lily/bar-script-engraver.cc b/lily/bar-script-engraver.cc new file mode 100644 index 0000000000..51cbfec3b9 --- /dev/null +++ b/lily/bar-script-engraver.cc @@ -0,0 +1,100 @@ +/* + bar-script-engraver.cc -- implement Bar_script_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#include "bar-script-engraver.hh" +#include "bar.hh" +#include "g-staff-side.hh" +#include "g-text-item.hh" +#include "lily-guile.hh" + +Bar_script_engraver::Bar_script_engraver () +{ + axis_ = Y_AXIS; + staff_side_p_ = 0; + text_p_ =0; + visibility_lambda_ + = gh_eval_str ("(lambda (d) (if (= d -1) '(#t . #t) '(#f . #f)))"); +} + +void +Bar_script_engraver::acknowledge_element (Score_element_info i) +{ + Axis other_axis = Axis((axis_ + 1)%2); + + if (staff_side_p_ && !staff_side_p_->dim_cache_[other_axis].parent_l_) + { + Bar * bar_l = dynamic_cast (i.elem_l_); + if (!bar_l) + return; + + /* Only put numbers on bars that are at our own level (don't put + numbers over the staffs of a GrandStaff, only over the GrandStaff + itself */ + if (i.origin_grav_l_arr_.size () == 1) + { + staff_side_p_->dim_cache_[other_axis].parent_l_ = &bar_l->dim_cache_[other_axis]; + staff_side_p_->add_support (i.elem_l_); + } + } +} + +void +Bar_script_engraver::do_pre_move_processing () +{ + if (text_p_) + { + text_p_->breakable_b_ = true; // ugh + typeset_element (text_p_); + text_p_ =0; + } + + if (staff_side_p_) + { + staff_side_p_->breakable_b_ = true; // ugh + typeset_element (staff_side_p_); + staff_side_p_ = 0; + } +} + + +void +Bar_script_engraver::create_items (Request *rq) +{ + if (staff_side_p_ || text_p_) + return; + + staff_side_p_ = new G_staff_side_item; + staff_side_p_->axis_ = axis_; + + text_p_ = new G_text_item; + + Scalar prop = get_property (type_ + "Direction", 0); + if (prop.isnum_b ()) + { + staff_side_p_->dir_ = (Direction) (int) prop; + } + else + { + staff_side_p_->dir_ = UP; + } + + staff_side_p_->set_victim(text_p_); + + Scalar padding = get_property (type_ + "ScriptPadding", 0); + if (padding.length_i() && padding.isnum_b ()) + { + staff_side_p_->padding_f_ = Real(padding); + } + + staff_side_p_->visibility_lambda_ = visibility_lambda_; + text_p_->visibility_lambda_ = visibility_lambda_; + + announce_element (Score_element_info (text_p_, rq)); + announce_element (Score_element_info (staff_side_p_, rq)); +} diff --git a/lily/bar.cc b/lily/bar.cc index 58e4ab9ed6..824e2316a1 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -14,7 +14,6 @@ #include "debug.hh" - Bar::Bar () { breakable_b_ = true; @@ -33,9 +32,8 @@ Molecule* Bar::do_brew_molecule_p () const { Paper_def *p = paper (); - Atom s = lookup_l ()->bar (type_str_, p->get_var ("barsize")); + Molecule *output = new Molecule (lookup_l ()->bar (type_str_, p->get_var ("barsize"))); - Molecule*output = new Molecule (Atom (s)); return output; } diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index ebd09d3dff..ac7a02a26b 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -33,7 +33,7 @@ Beam_engraver::do_try_music (Music *m) if (d == STOP && !beam_p_) { - m->warning ("No Beam to end"); + m->warning (_ ("No Beam to end")); return false; } reqs_drul_[d ] = c; @@ -49,7 +49,7 @@ Beam_engraver::do_process_requests () if (reqs_drul_[STOP]) { if (!beam_p_) - reqs_drul_[STOP]->warning (_("No beam to stop")); + reqs_drul_[STOP]->warning (_("No beam to end")); finished_beam_p_ = beam_p_; finished_grouping_p_ = grouping_p_; @@ -61,7 +61,7 @@ Beam_engraver::do_process_requests () { if (beam_p_) { - reqs_drul_[START]->warning ("Already have a Beam"); + reqs_drul_[START]->warning (_ ("Already have a Beam")); return; } @@ -126,7 +126,7 @@ Beam_engraver::do_removal_processing () typeset_beam (); if (beam_p_) { - warning ("Unfinished beam"); + warning (_ ("Unfinished beam")); finished_beam_p_ = beam_p_; finished_grouping_p_ = grouping_p_; typeset_beam (); @@ -146,9 +146,9 @@ Beam_engraver::acknowledge_element (Score_element_info info) Rhythmic_req *rhythmic_req = dynamic_cast (info.req_l_); if (!rhythmic_req) { - String s=_("Stem must have Rhythmic structure."); + String s = _ ("Stem must have Rhythmic structure."); if (info.req_l_) - info.req_l_->warning(s); + info.req_l_->warning (s); else ::warning (s); @@ -159,7 +159,7 @@ Beam_engraver::acknowledge_element (Score_element_info info) if (rhythmic_req->duration_.durlog_i_<= 2) { rhythmic_req->warning (_ ("stem doesn't fit in beam")); - reqs_drul_[LEFT]->warning (_("beam was started here")); + reqs_drul_[LEFT]->warning (_ ("beam was started here")); return; } @@ -170,7 +170,7 @@ Beam_engraver::acknowledge_element (Score_element_info info) if (!grouping_p_->child_fit_b (start)) { - String s (_("please fix me") + ": " + String s (_ ("please fix me") + ": " + _f ("stem at %s doesn't fit in beam", now_moment ().str ())); if (info.req_l_) diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 79190f393b..df90680dc4 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -8,7 +8,6 @@ #include "chord-name-engraver.hh" #include "musical-request.hh" -#include "text-item.hh" #include "paper-def.hh" #include "lookup.hh" #include "paper-def.hh" @@ -40,11 +39,72 @@ Chord_name_engraver::do_try_music (Music* m) return false; } -/* - UGH. + /* + find tonic: after longest line of triads + */ +int +Chord_name_engraver::find_tonic_i () const +{ + int tonic_i = 0; + int longest_i = 0; + for (int i = 0; i < pitch_arr_.size (); i++) + for (int j = 0; j < pitch_arr_.size (); j++) + { + int gap = pitch_arr_[(i + j + 1) % pitch_arr_.size ()].notename_i_ + - pitch_arr_[(i + j) % pitch_arr_.size ()].notename_i_; + while (gap < 0) + gap += 7; + gap %= 7; + if (gap != 2) + { + if (j > longest_i) + { + longest_i = j; + tonic_i = i; + } + break; + } + } + + int biggest_i = 0; + if (!longest_i) + for (int i = 0; i < pitch_arr_.size (); i++) + { + int gap = pitch_arr_[i].notename_i_ + - pitch_arr_[(i - 1 + pitch_arr_.size ()) + % pitch_arr_.size ()].notename_i_; + while (gap < 0) + gap += 7; + gap %= 7; + if (gap > biggest_i) + { + biggest_i = gap; + tonic_i = i; + } + } + return tonic_i; +} + +Array +Chord_name_engraver::rebuild_pitch_arr (int tonic_i) const +{ + Musical_pitch last (0, 0, -5); + Array pitches; + for (int i = 0; i < pitch_arr_.size (); i++) + { + Musical_pitch p = pitch_arr_[(tonic_i + i) % pitch_arr_.size ()]; + if (p < last) + { + p.octave_i_ = last.octave_i_; + if (p < last) + p.octave_i_++; + } + pitches.push (p); + last = p; + } + return pitches; +} - Split this routine into neat packets - */ void Chord_name_engraver::do_process_requests () { @@ -65,74 +125,44 @@ Chord_name_engraver::do_process_requests () */ - - /* - find tonic: after longest line of triads - */ - int tonic_i = 0; + Musical_pitch inversion = pitch_arr_[0]; Scalar chord_inversions = get_property ("chordInversion", 0); if (chord_inversions.to_bool ()) { - int longest_i = 0; - for (int i = 0; i < pitch_arr_.size (); i++) - for (int j = 0; j < pitch_arr_.size (); j++) - { - int gap = pitch_arr_[(i + j + 1) % pitch_arr_.size ()].notename_i_ - - pitch_arr_[(i + j) % pitch_arr_.size ()].notename_i_; - while (gap < 0) - gap += 7; - gap %= 7; - if (gap != 2) - { - if (j > longest_i) - { - longest_i = j; - tonic_i = i; - } - break; - } - } - - int biggest_i = 0; - if (!longest_i) - for (int i = 0; i < pitch_arr_.size (); i++) - { - int gap = pitch_arr_[i].notename_i_ - - pitch_arr_[(i - 1 + pitch_arr_.size ()) - % pitch_arr_.size ()].notename_i_; - while (gap < 0) - gap += 7; - gap %= 7; - if (gap > biggest_i) - { - biggest_i = gap; - tonic_i = i; - } - } + tonic_i = find_tonic_i (); + if (tonic_i) + pitch_arr_ = rebuild_pitch_arr (tonic_i); } + - Musical_pitch inversion = pitch_arr_[0]; - if (tonic_i) + G_text_item* item_p = new G_text_item; + + item_p->text_str_ = banter_str (pitch_arr_, tonic_i, inversion); + + Scalar style = get_property ("textstyle", 0); + if (style.length_i ()) + item_p->style_str_ = style; + + text_p_arr_.push (item_p); + announce_element (Score_element_info (item_p, 0)); +} + +void +Chord_name_engraver::do_pre_move_processing () +{ + for (int i=0; i < text_p_arr_.size (); i++) { - Musical_pitch last (0, 0, -5); - Array pitches; - for (int i = 0; i < pitch_arr_.size (); i++) - { - Musical_pitch p = pitch_arr_[(tonic_i + i) % pitch_arr_.size ()]; - if (p < last) - { - p.octave_i_ = last.octave_i_; - if (p < last) - p.octave_i_++; - } - pitches.push (p); - last = p; - } - pitch_arr_ = pitches; + typeset_element (text_p_arr_[i]); } + text_p_arr_.clear (); + pitch_arr_.clear (); +} - Musical_pitch tonic = pitch_arr_[0]; +String +Chord_name_engraver::banter_str (Array pitch_arr, int tonic_i, Musical_pitch inversion) const +{ + Musical_pitch tonic = pitch_arr[0]; Array scale; scale.push (Musical_pitch (0)); // c @@ -155,16 +185,25 @@ Chord_name_engraver::do_process_requests () + acc[tonic.accidental_i_ + 2]; String add_str; + String sub_str; String sep_str; - for (int i=1; i < pitch_arr_.size (); i++) + int last_trap = 1; + for (int i=1; i < pitch_arr.size (); i++) { - Musical_pitch p = pitch_arr_[i]; - int trap = p.notename_i_ - tonic.notename_i_ + Musical_pitch p = pitch_arr[i]; + int trap = p.notename_i_ - tonic.notename_i_ + (p.octave_i_ - tonic.octave_i_) * 7 + 1; + while (trap - last_trap > 2) + { + last_trap += 2; + sub_str += sep_str + "no" + to_str (last_trap); + sep_str = "/"; + } + last_trap = trap; int accidental = p.accidental_i_ - scale[(trap - 1) % 7].accidental_i_; if ((trap == 3) && (accidental == -1)) tonic_str += "m"; // hmm - else if (accidental || (!(trap % 2) || ((i + 1 == pitch_arr_.size ()) && (trap > 5)))) + else if (accidental || (!(trap % 2) || ((i + 1 == pitch_arr.size ()) && (trap > 5)))) { add_str += sep_str; if ((trap == 7) && (accidental == 1)) @@ -187,27 +226,7 @@ Chord_name_engraver::do_process_requests () + acc[tonic.accidental_i_ + 2]; } - - G_text_item* item_p = new G_text_item; - - item_p->text_str_ = tonic_str + "$^{" + add_str + "}$" + inversion_str; - Scalar style = get_property ("textstyle", 0); - if (style.length_i ()) - item_p->style_str_ = style; - - text_p_arr_.push (item_p); - announce_element (Score_element_info (item_p, 0)); + String str = tonic_str + "$^{" + add_str + sub_str + "}$" + inversion_str; + return str; } - -void -Chord_name_engraver::do_pre_move_processing () -{ - for (int i=0; i < text_p_arr_.size (); i++) - { - typeset_element (text_p_arr_[i]); - } - text_p_arr_.clear (); - pitch_arr_.clear (); -} - diff --git a/lily/clef-item.cc b/lily/clef-item.cc index e65cd80676..a41cb38f27 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -13,11 +13,14 @@ #include "paper-def.hh" #include "lookup.hh" #include "clef-engraver.hh" -#include "text-item.hh" +#include "g-text-item.hh" +#include "p-score.hh" void Clef_item::do_pre_processing() { + dim_cache_[Y_AXIS].translate (paper()->internote_f () * y_position_i_); + bool b= (break_status_dir() != RIGHT); change_b_ = b; @@ -39,13 +42,30 @@ Clef_item::Clef_item() octave_dir_ = CENTER; symbol_ = "treble"; y_position_i_ = -2; - - // Ugh: This should be const, I guess. - octave_marker_td_p_.set_p (new Text_def());// UGH! - octave_marker_td_p_->text_str_ = "8"; - octave_marker_td_p_->style_str_ = "italic"; } +void +Clef_item::do_add_processing () +{ + if (!break_status_dir_ // broken stuff takes care of their own texts + && octave_dir_) + { + G_text_item *g = new G_text_item; + pscore_l_->typeset_element (g); + + g->text_str_ = "8"; + g->style_str_ = "italic"; + g->dim_cache_[Y_AXIS].parent_l_ = &dim_cache_[Y_AXIS]; + g->dim_cache_[X_AXIS].parent_l_ = &dim_cache_[X_AXIS]; + add_dependency (g); // just to be sure. + + Real r = do_height ()[octave_dir_] + g->extent (Y_AXIS)[-octave_dir_]; + g->dim_cache_[Y_AXIS].set_offset (r); + } + +} + + @@ -55,26 +75,12 @@ Clef_item::do_brew_molecule_p() const String t = symbol_; if (change_b_) t += "_change"; + // Atom s = lookup_l ()-> text ("roman", to_str (break_status_dir ())); + Atom s = lookup_l ()->clef (t); Molecule*output = new Molecule (Atom (s)); - output->translate_axis (paper()->internote_f () * y_position_i_, Y_AXIS); - if (octave_dir_) { - Molecule octave_marker = Molecule(octave_marker_td_p_->get_atom(paper(), - CENTER)); - Real offset = output->extent()[Y_AXIS][octave_dir_] - - octave_marker.extent()[Y_AXIS][- octave_dir_]; - if (octave_dir_ == DOWN) - offset += octave_marker.extent()[Y_AXIS][UP] * 0.35 ; - octave_marker.translate_axis (offset, Y_AXIS); - output->add_molecule (octave_marker); - } return output; } - -#include "pointer.tcc" -template class P; // ugh - - diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index dd36db400b..2a28d15410 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -9,7 +9,6 @@ #include "crescendo.hh" #include "dynamic-engraver.hh" #include "musical-request.hh" -#include "text-item.hh" #include "lookup.hh" #include "paper-def.hh" #include "score-column.hh" @@ -96,7 +95,7 @@ Dynamic_engraver::do_process_requests() String loud = absd->loudness_str (); text_p_ = new G_text_item; - text_p_->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; + text_p_->text_str_ = "dyn" + loud; // ugh Scalar prop = get_property ("dynamicStyle", 0); text_p_->style_str_ = prop.length_i () ? prop : "dynamic"; diff --git a/lily/extender-spanner.cc b/lily/extender-spanner.cc index 2ca52271e6..7c727b128c 100644 --- a/lily/extender-spanner.cc +++ b/lily/extender-spanner.cc @@ -14,7 +14,6 @@ #include "p-col.hh" #include "paper-def.hh" #include "extender-spanner.hh" -#include "text-item.hh" #include "text-def.hh" Extender_spanner::Extender_spanner () @@ -92,9 +91,8 @@ Extender_spanner::do_post_processing () Direction d = LEFT; do { - Item* t = item_l_drul_[d] ? item_l_drul_[d] : item_l_drul_[(Direction)-d]; - - dy_f_drul_[d] += t->extent (Y_AXIS).length () / 2; + Item* t = item_l_drul_[d] + ? item_l_drul_[d] : item_l_drul_[(Direction)-d]; if (d == LEFT) dx_f_drul_[d] += t->extent (X_AXIS).length (); else diff --git a/lily/g-staff-side.cc b/lily/g-staff-side.cc index 9b166c6927..72f952d89f 100644 --- a/lily/g-staff-side.cc +++ b/lily/g-staff-side.cc @@ -9,11 +9,23 @@ #include "g-staff-side.hh" +G_staff_side_item::G_staff_side_item () +{ + dir_ = CENTER; + to_position_l_ = 0; + transparent_b_ = true; + padding_f_ = 0; +} + + void G_staff_side_item::do_pre_processing () { if (!dir_) set_default_direction (); + + if (axis_ == X_AXIS) + position_self (); } void @@ -22,12 +34,6 @@ G_staff_side_item::set_default_direction () dir_ = DOWN; } -G_staff_side_item::G_staff_side_item () -{ - dir_ = CENTER; - to_position_l_ = 0; - transparent_b_ = true; -} void G_staff_side_item::set_victim (Score_element *e) @@ -54,28 +60,33 @@ G_staff_side_item::do_substitute_dependency (Score_element*o, Score_element*n) support_l_arr_.unordered_substitute (o,n); } - void -G_staff_side_item::do_post_processing () +G_staff_side_item::position_self () { if (!support_l_arr_.size ()) return ; Dimension_cache *common = common_group (typecast_array (support_l_arr_, (Graphical_element*)0), - Y_AXIS); + axis_); Interval dim; for (int i=0; i < support_l_arr_.size (); i++) { Score_element * e = support_l_arr_ [i]; - Real coord = e->relative_coordinate (common, Y_AXIS); - dim.unite (coord + e->extent (Y_AXIS)); + Real coord = e->relative_coordinate (common, axis_); + dim.unite (coord + e->extent (axis_)); } - if (!support_l_arr_.size ()) - dim = Interval (0,0); - Interval sym_dim = to_position_l_->extent (Y_AXIS); - Real off = dim_cache_[Y_AXIS].relative_coordinate (common); + Interval sym_dim = to_position_l_->extent (axis_); + Real off = dim_cache_[axis_].relative_coordinate (common) - padding_f_ * dir_; - dim_cache_[Y_AXIS].set_offset (dim[dir_] - sym_dim[-dir_] - off); + dim_cache_[axis_].set_offset (dim[dir_] - sym_dim[-dir_] - off); } + +void +G_staff_side_item::do_post_processing () +{ + if (axis_ == Y_AXIS) + position_self (); +} + diff --git a/lily/identifier.cc b/lily/identifier.cc index b9e422a366..7fd434274c 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -13,7 +13,6 @@ #include "identifier.hh" #include "my-lily-lexer.hh" #include "debug.hh" -#include "symtable.hh" #include "script-def.hh" #include "request.hh" #include "translator.hh" @@ -85,7 +84,6 @@ Class ## _identifier::do_print () const { \ DEFAULT_PRINT(General_script_def); DEFAULT_PRINT(Translator); -DEFAULT_PRINT(Symtables); DEFAULT_PRINT(Music); DEFAULT_PRINT(Request); DEFAULT_PRINT(Score); @@ -103,7 +101,6 @@ Class ## _identifier::do_str () const { \ DUMMY_STR(Notename_table); DUMMY_STR(General_script_def); DUMMY_STR(Translator); -DUMMY_STR(Symtables); DUMMY_STR(Music); DUMMY_STR(Request); DUMMY_STR(Score); @@ -175,7 +172,6 @@ IMPLEMENT_ID_CLASS(int); IMPLEMENT_ID_CLASS(Real); IMPLEMENT_ID_CLASS(String); IMPLEMENT_ID_CLASS(General_script_def); -IMPLEMENT_ID_CLASS(Symtables); IMPLEMENT_ID_CLASS(Music); IMPLEMENT_ID_CLASS(Score); IMPLEMENT_ID_CLASS(Request); @@ -191,7 +187,6 @@ DEFAULT_ACCESSOR(Duration); DEFAULT_ACCESSOR(int); DEFAULT_ACCESSOR(Real); DEFAULT_ACCESSOR(String); -DEFAULT_ACCESSOR(Symtables); DEFAULT_ACCESSOR(Score); DEFAULT_ACCESSOR(Midi_def); DEFAULT_ACCESSOR(Paper_def); diff --git a/lily/include/afm.hh b/lily/include/afm.hh index 3be52df478..fea4592ad5 100644 --- a/lily/include/afm.hh +++ b/lily/include/afm.hh @@ -14,8 +14,9 @@ #include "box.hh" #include "array.hh" #include "dictionary.hh" +#include "font-metric.hh" -struct Adobe_font_char_metric { +struct Adobe_font_char_metric : Character_metric { int C_; Real WX_; String N_; @@ -27,9 +28,11 @@ struct Adobe_font_char_metric { String str () const; Adobe_font_char_metric (); + + Box dimensions () const; }; -struct Adobe_font_metric { +struct Adobe_font_metric : Font_metric { String FontName_; String FullName_; String FamilyName_; @@ -46,11 +49,14 @@ struct Adobe_font_metric { Array ascii_to_metric_idx_; Dictionary name_to_metric_dict_; - Adobe_font_char_metric find_char (String name, bool warn=true) const; - Adobe_font_char_metric find_ascii (int ascii) const; + Adobe_font_char_metric const &find_char (String name, bool warn=true) const; + Adobe_font_char_metric const &find_ascii (int ascii,bool warn) const; String str () const; Adobe_font_metric (); void read_char_metrics (Data_file &input); + + + Character_metric *get_char (int, bool) const; }; Adobe_font_metric read_afm_file (String fn); diff --git a/lily/include/all-fonts.hh b/lily/include/all-fonts.hh index da9f91e48c..f9203954bb 100644 --- a/lily/include/all-fonts.hh +++ b/lily/include/all-fonts.hh @@ -13,6 +13,7 @@ #include "dictionary.hh" #include "file-path.hh" #include "lily-proto.hh" +#include "font-metric.hh" /** Interface to all .afm files living in the filesystem. @@ -20,10 +21,13 @@ class All_font_metrics { Dictionary afm_p_dict_; + Dictionary tfm_p_dict_; File_path search_path_; public: - Adobe_font_metric *find_font (String name); + Adobe_font_metric *find_afm (String name); + Tex_font_metric *find_tfm (String); + Font_metric *find_font (String name); All_font_metrics (String search_path); }; diff --git a/lily/include/atom.hh b/lily/include/atom.hh index 1fd7ef262c..22c5d15a0c 100644 --- a/lily/include/atom.hh +++ b/lily/include/atom.hh @@ -36,6 +36,7 @@ public: void translate_axis (Real r,Axis a); /// how big is #this#? Box extent() const; + Interval extent (Axis)const; void print() const; bool check_infinity_b () const; bool empty() const; diff --git a/lily/include/auto-beam-engraver.hh b/lily/include/auto-beam-engraver.hh new file mode 100644 index 0000000000..76d060b148 --- /dev/null +++ b/lily/include/auto-beam-engraver.hh @@ -0,0 +1,45 @@ +/* + auto-beam-engraver.hh -- declare Auto_beam_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1999 Jan Nieuwenhuizen + + */ + +#ifndef AUTO_BEAM_ENGRAVER_HH +#define AUTO_BEAM_ENGRAVER_HH + +#include "engraver.hh" + +class Auto_beam_engraver : public Engraver +{ +public: + Auto_beam_engraver (); + VIRTUAL_COPY_CONS (Translator); + +protected: + virtual void do_pre_move_processing (); + virtual void do_post_move_processing (); + virtual void do_removal_processing (); + virtual void acknowledge_element (Score_element_info); + virtual void do_process_requests (); + virtual void process_acknowledged (); + +private: + void begin_beam (); + void end_beam (); + void junk_beam (); + void typeset_beam (); + + int mult_i_; + Beam *finished_beam_p_; + Beam *beam_p_; + Moment last_add_mom_; + Moment extend_mom_; + Rhythmic_grouping*grouping_p_; + Rhythmic_grouping*finished_grouping_p_; +}; + +#endif /* AUTO_BEAM_ENGRAVER_HH */ + diff --git a/lily/include/bar-engraver.hh b/lily/include/bar-engraver.hh index 7d52fafe67..a626178f84 100644 --- a/lily/include/bar-engraver.hh +++ b/lily/include/bar-engraver.hh @@ -7,26 +7,22 @@ */ -#ifndef BARGRAV_HH -#define BARGRAV_HH +#ifndef BAR_ENGRAVER_HH +#define BAR_ENGRAVER_HH + #include "engraver.hh" /** generate bars. Either user ("|:"), or default (new measure) */ -class Bar_engraver : public Engraver { - Bar_req * bar_req_l_; - Bar * bar_p_; - Bar * bar_l_; - bool auto_create_bar_b_; - - void create_bar (); +class Bar_engraver : public Engraver +{ public: - VIRTUAL_COPY_CONS(Translator); Bar_engraver(); + VIRTUAL_COPY_CONS(Translator); - - + void request_bar (String type_str); + protected: virtual void acknowledge_element (Score_element_info i); virtual void do_creation_processing (); @@ -35,6 +31,13 @@ protected: virtual void do_process_requests(); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); + +private: + void create_bar (); + + Bar_req * bar_req_l_; + Bar * bar_p_; + bool auto_create_bar_b_; }; -#endif // BARGRAV_HH +#endif // BAR_ENGRAVER_HH diff --git a/lily/include/bar-number-engraver.hh b/lily/include/bar-number-engraver.hh index 0497ff76d0..013dc43702 100644 --- a/lily/include/bar-number-engraver.hh +++ b/lily/include/bar-number-engraver.hh @@ -10,20 +10,13 @@ #ifndef BAR_NUMBER_GRAV_HH #define BAR_NUMBER_GRAV_HH -#include "engraver.hh" +#include "bar-script-engraver.hh" -/** - catch bars, and put a number over them. - */ -class Bar_number_engraver : public Engraver { - Script * script_p_; +class Bar_number_engraver : public Bar_script_engraver { protected: - - void acknowledge_element (Score_element_info); - void do_pre_move_processing(); + void do_process_requests (); public: VIRTUAL_COPY_CONS(Translator); Bar_number_engraver(); - }; #endif // BAR_NUMBER_GRAV_HH diff --git a/lily/include/bar-script-engraver.hh b/lily/include/bar-script-engraver.hh new file mode 100644 index 0000000000..cfd2b7c266 --- /dev/null +++ b/lily/include/bar-script-engraver.hh @@ -0,0 +1,36 @@ +/* + bar-script-engraver.hh -- declare Bar_script_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#ifndef BAR_SCRIPT_ENGRAVER_HH +#define BAR_SCRIPT_ENGRAVER_HH +#include "engraver.hh" +#include "protected-scm.hh" + +/** + put stuff over or next to bars + */ +class Bar_script_engraver : public Engraver +{ +protected: + G_staff_side_item* staff_side_p_; + G_text_item* text_p_; + Protected_scm visibility_lambda_; + String type_; + Axis axis_; + +protected: + Bar_script_engraver (); + virtual void do_pre_move_processing (); + virtual void acknowledge_element (Score_element_info); + void create_items(Request*); +}; + + +#endif /* BAR_SCRIPT_ENGRAVER_HH */ + diff --git a/lily/include/beam-engraver.hh b/lily/include/beam-engraver.hh index 834467858f..898e8b048d 100644 --- a/lily/include/beam-engraver.hh +++ b/lily/include/beam-engraver.hh @@ -1,5 +1,5 @@ /* - cbeam-engraver.hh -- declare Beam_engraver + beam-engraver.hh -- declare Beam_engraver source file of the GNU LilyPond music typesetter @@ -7,8 +7,8 @@ */ -#ifndef CBEAM_ENGRAVER_HH -#define CBEAM_ENGRAVER_HH +#ifndef BEAM_ENGRAVER_HH +#define BEAM_ENGRAVER_HH #include "engraver.hh" #include "drul-array.hh" @@ -35,5 +35,5 @@ public: VIRTUAL_COPY_CONS (Translator); }; -#endif /* CBEAM_ENGRAVER_HH */ +#endif /* BEAM_ENGRAVER_HH */ diff --git a/lily/include/chord-name-engraver.hh b/lily/include/chord-name-engraver.hh index fb45ae53d2..72b221fe1e 100644 --- a/lily/include/chord-name-engraver.hh +++ b/lily/include/chord-name-engraver.hh @@ -30,6 +30,10 @@ public: private: Array pitch_arr_; Link_array text_p_arr_; + + String banter_str (Array pitch_arr, int tonic_i, Musical_pitch inversion) const; + int find_tonic_i () const; + Array rebuild_pitch_arr (int tonic_i) const; }; #endif // CHORD_NAME_ENGRAVER_HH diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index c634382a80..9855313bce 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -18,6 +18,7 @@ class Clef_item : public Item { protected: virtual void do_pre_processing(); virtual Molecule* do_brew_molecule_p() const; + virtual void do_add_processing (); public: String symbol_; @@ -32,10 +33,6 @@ public: /// should we print an octave symbol (8), and where? (up=1, down=-1)? Direction octave_dir_; - /// text def to put above/below clef? - P octave_marker_td_p_; - - VIRTUAL_COPY_CONS(Score_element); Clef_item(); }; diff --git a/lily/include/dimension-cache.hh b/lily/include/dimension-cache.hh index e15bc9b5b1..6e153eea14 100644 --- a/lily/include/dimension-cache.hh +++ b/lily/include/dimension-cache.hh @@ -41,14 +41,14 @@ public: Dimension_cache * parent_l_; Link_array dependencies_l_arr_; - + Graphical_element *element_l () { return elt_l_; } Real absolute_coordinate () const; void invalidate (); void invalidate_dependencies (); Dimension_cache(Dimension_cache const&); Dimension_cache (); - void set_group_l (Graphical_axis_group*); + Real relative_coordinate (Dimension_cache *d) const; Dimension_cache*common_group (Dimension_cache const* s) const; Dimension_cache*common_group (Link_array caches) const; diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh new file mode 100644 index 0000000000..2878cfc38b --- /dev/null +++ b/lily/include/font-metric.hh @@ -0,0 +1,36 @@ +/* + font-metric.hh -- declare Font_metric + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#ifndef FONT_METRIC_HH +#define FONT_METRIC_HH + +#include "box.hh" +/* + sigh. + + signature -> Internal compiler error +*/ + +struct Character_metric +{ + virtual Box dimensions () const=0; + virtual ~Character_metric () {} +}; + +struct Font_metric +{ + virtual Character_metric *get_char (int ascii, bool warn) const=0; + virtual ~Font_metric () {} +}; + + + + +#endif /* FONT_METRIC_HH */ + diff --git a/lily/include/g-staff-side.hh b/lily/include/g-staff-side.hh index c39dcd9f3f..47be75ff6e 100644 --- a/lily/include/g-staff-side.hh +++ b/lily/include/g-staff-side.hh @@ -12,17 +12,15 @@ #include "item.hh" -/* - DO NOT USE AS BREAKABLE ITEM! - - (-> core dump!) - */ class G_staff_side_item : public Item { + void position_self (); public: Score_element * to_position_l_; Direction dir_; Link_array support_l_arr_; + Real padding_f_; + Axis axis_; G_staff_side_item (); void set_victim (Score_element*); diff --git a/lily/include/item.hh b/lily/include/item.hh index 80b39df71c..b077193928 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -13,6 +13,7 @@ #include "string.hh" #include "score-element.hh" #include "drul-array.hh" +#include "protected-scm.hh" /** A horizontally fixed size element of the score. @@ -25,11 +26,26 @@ */ class Item : public virtual Score_element { + void do_break (); + void try_visibility_lambda (); + public: Link_array attached_span_l_arr_; Drul_array broken_to_drul_; Item *unbroken_original_l_; + /** + + visibility_lambda :: int -> (bool . bool) + + @in + break direction + + @out + (transparent, empty) cons + + */ + Protected_scm visibility_lambda_; /// should be put in a breakable col. bool breakable_b_; Direction break_status_dir_; @@ -57,6 +73,8 @@ protected: virtual void do_print() const; virtual bool linked_b() const; + virtual void handle_prebroken_dependents (); + void copy_breakable_items(); }; diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 105b3ba493..bc9f969f73 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -16,12 +16,14 @@ #include SCM ly_symbol (String name); +String symbol_to_string (SCM); SCM ly_set_scm (String name , SCM val); SCM ly_append (SCM a, SCM b); SCM ly_eval (SCM a); SCM ly_func_o (char const* name); SCM ly_quote_scm (SCM s); +void ly_display_scm (SCM s); #include "array.hh" diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index b44dab4223..a066878859 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -15,8 +15,6 @@ struct Abbreviation; struct Abbreviation_beam; struct Abbreviation_beam_req; struct Abbreviation_beam_engraver; -struct G_staff_side_item; -struct G_text_item; struct Abbreviation_req; struct Adobe_font_metric; struct Adobe_font_char_metric; @@ -31,6 +29,7 @@ struct Audio_note; struct Audio_note_off; struct Audio_staff; struct Audio_tempo; +struct Auto_beam_engraver; struct Axis_group_element; struct Axis_group; struct Bar; @@ -81,6 +80,8 @@ struct Engraver; struct Engraver_group_engraver; struct Extender; struct Extender_req; +struct G_staff_side_item; +struct G_text_item; struct General_script_def; struct Graphical_element; @@ -173,7 +174,7 @@ struct Performer; struct Plet; struct Plet_engraver; struct Plet_req; -struct Plet_spanner; +struct Tuplet_spanner; struct Piano_brace; struct Performer; struct Performer_group_performer; @@ -232,6 +233,8 @@ struct Symtables; struct Super_element; struct Translation_property; struct Tempo_req; +struct Tex_font_metric; +struct Tex_font_char_metric; struct Text_def; struct Text_gob; struct Text_item ; diff --git a/lily/include/lily-version.hh b/lily/include/lily-version.hh new file mode 100644 index 0000000000..e0b69bfe9b --- /dev/null +++ b/lily/include/lily-version.hh @@ -0,0 +1,21 @@ +/* + lily-version.hh -- declare version strings + + source file of the GNU LilyPond music typesetter + + (c) 1999 Jan Nieuwenhuizen + + */ + +#ifndef LILY_VERSION_HH +#define LILY_VERSION_HH + +#include "string.hh" + +String version_str (); +String gnu_lilypond_str (); +String gnu_lilypond_version_str (); + +#endif // LILY_VERSION_HH + + diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 9526c07cc4..78a0126786 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -15,8 +15,6 @@ #include "fproto.hh" #include "scalar.hh" #include "direction.hh" -#include "curve.hh" -#include "symtable.hh" #include "box.hh" /** handy interface to symbol table @@ -26,25 +24,21 @@ class Lookup public: Lookup (); Lookup (Lookup const&); - Lookup (Symtables const&); - ~Lookup (); + Atom simple_bar (String s, Real w) const; Molecule accidental (int, bool cautionary) const; - void add (String, Symtable*); Atom afm_find (String, bool warn=true) const; Atom ball (int) const; - Atom bar (String, Real height) const; + Molecule bar (String, Real height) const; Atom beam (Real, Real, Real) const; Atom clef (String) const; Atom dashed_slur (Array controls, Real thick, Real dash) const; Atom dots () const; - Atom dynamic (String) const; Atom extender (Real) const; Atom fill (Box b) const; Atom flag (int, Direction) const; Atom hairpin (Real width, bool decresc, bool continued) const; Atom plet (Real dy, Real dx, Direction dir) const; - void print () const; Atom rest (int, bool outside) const; Atom rule_symbol (Real height, Real width) const; Atom script (String idx) const; @@ -59,7 +53,6 @@ public: Atom time_signature (Array) const; Paper_def * paper_l_; - Symtables *symtables_p_; String font_name_; Adobe_font_metric * afm_l_; diff --git a/lily/include/main.hh b/lily/include/main.hh index 2b63cb1604..bcad25c6a0 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -7,6 +7,7 @@ */ #ifndef MAIN_HH #define MAIN_HH + #include "lily-proto.hh" void debug_init(); @@ -16,7 +17,6 @@ void clear_scores(); void add_score (Score* s); void set_default_output (String s); String find_file (String); -String get_version_str(); void call_constructors (); extern Sources* source_global_l; diff --git a/lily/include/mark-engraver.hh b/lily/include/mark-engraver.hh index f498b34f5c..d78c4286c6 100644 --- a/lily/include/mark-engraver.hh +++ b/lily/include/mark-engraver.hh @@ -10,31 +10,21 @@ #ifndef MARK_ENGRAVER_HH #define MARK_ENGRAVER_HH -#include "engraver.hh" - -class G_staff_side_item; -class G_text_item; +#include "bar-script-engraver.hh" /** */ -class Mark_engraver : public Engraver +class Mark_engraver : public Bar_script_engraver { public: Mark_engraver (); - VIRTUAL_COPY_CONS(Translator); - - protected: virtual bool do_try_music (Music *req_l); virtual void do_process_requests (); - virtual void do_pre_move_processing (); - virtual void acknowledge_element (Score_element_info); - + virtual void do_post_move_processing (); private: Mark_req * mark_req_l_; - G_staff_side_item* staff_side_p_; - G_text_item* text_p_; }; #endif // MARK_ENGRAVER_HH diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index 7907be0ae4..757a26ac34 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -23,7 +23,7 @@ struct Molecule { Molecule() { } Molecule (Atom const &a); - void add_at_edge (Axis a, Direction d, const Molecule &m); + void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding); void add_molecule (Molecule const &m); void translate (Offset); @@ -31,7 +31,7 @@ struct Molecule { void add_atom (Atom const & a) ; /// how big is #this#? Box extent() const; - + Interval extent (Axis) const; Molecule (const Molecule&s); void print() const; diff --git a/lily/include/multi-measure-rest-engraver.hh b/lily/include/multi-measure-rest-engraver.hh index b9d47c9158..e4e7c3fb31 100644 --- a/lily/include/multi-measure-rest-engraver.hh +++ b/lily/include/multi-measure-rest-engraver.hh @@ -29,10 +29,7 @@ protected: virtual void do_post_move_processing (); private: - Moment rest_stop_mom_; -// Moment rest_item_creation_mom_; - Moment rest_start_mom_; - + Drul_array rest_moments_; int start_measure_i_; Multi_measure_rest_req* multi_measure_req_l_; diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index b3b5b2959b..f42a50cfa0 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -66,21 +66,6 @@ public: REQUESTMETHODS(Spacing_req); }; -/// Put a text above or below (?) this staff. -class Text_req : public virtual Musical_req { -public: - /// preferred position (above/below) - Direction dir_; - /// the characteristics of the text - Text_def *tdef_p_; - - Text_req (int d, Text_def*); - ~Text_req(); - Text_req (Text_req const&); - - REQUESTMETHODS(Text_req); -}; - /** a syllable or lyric is a string with rhythm. */ class Lyric_req : public Rhythmic_req { diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 898c2b6082..df73bea785 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -10,7 +10,7 @@ #ifndef PAPER_DEF_HH #define PAPER_DEF_HH #include "lily-proto.hh" - +#include "lily-guile.hh" #include "real.hh" #include "moment.hh" @@ -47,8 +47,8 @@ public: Array shape_int_a_; - - Real get_var (String) const; + Real get_realvar (SCM symbol) const; + Real get_var (String id) const; void reinit (); Paper_def (); void set_lookup (int, Lookup*); diff --git a/lily/include/parseconstruct.hh b/lily/include/parseconstruct.hh index 7a85104846..ff329dd1a3 100644 --- a/lily/include/parseconstruct.hh +++ b/lily/include/parseconstruct.hh @@ -12,7 +12,6 @@ String * get_scriptdef (char c); Request* get_script_req (char); Request*get_script_req (int d , Script_def*def); -Request*get_text_req (int d , Text_def*def); Request*get_grouping_req (Array i_arr); #endif // PARSECONSTRUCT_HH diff --git a/lily/include/piano-brace.hh b/lily/include/piano-brace.hh index afc7b43e68..c16ed213ec 100644 --- a/lily/include/piano-brace.hh +++ b/lily/include/piano-brace.hh @@ -25,7 +25,7 @@ public: protected: virtual Interval do_width() const; virtual void do_post_processing(); - virtual Atom get_bar_sym (Real) const; + virtual Molecule get_bar_sym (Real) const; }; diff --git a/lily/include/repeat-engraver.hh b/lily/include/repeat-engraver.hh index e3d6f9ef3a..cef330a718 100644 --- a/lily/include/repeat-engraver.hh +++ b/lily/include/repeat-engraver.hh @@ -31,7 +31,8 @@ protected: private: Link_array repeated_music_arr_; Link_array alternative_music_arr_; - Link_array bar_p_arr_; + // Link_array bar_p_arr_; + Array bar_b_arr_; Link_array volta_p_arr_; Array stop_mom_arr_; Array alternative_start_mom_arr_; diff --git a/lily/include/scope.hh b/lily/include/scope.hh index f9980f2db8..bf3e3e6318 100644 --- a/lily/include/scope.hh +++ b/lily/include/scope.hh @@ -12,13 +12,29 @@ #include "dictionary.hh" #include "lily-proto.hh" +#include "lily-guile.hh" +#include "dictionary-iter.hh" +#include "protected-scm.hh" -class Scope : public Dictionary { +class Scope : private Hash_table { public: void print () const; + bool elem_b (String ) const; + bool elem_b (SCM s) const; + Identifier *&elem (String); + Identifier *&elem (SCM s); Scope (); + Scope (Scope const &); ~Scope (); + friend class Scope_iter; +}; + +class Scope_iter : public Hash_table_iter { +public: + Scope_iter(Scope const&); + String key () const; + SCM scm_key () const; }; #endif /* SCOPE_HH */ diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index c36e446816..919333c9a6 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -106,6 +106,7 @@ protected: virtual void do_break_processing (); virtual void handle_broken_dependencies (); virtual void handle_prebroken_dependencies (); + virtual void handle_prebroken_dependents (); virtual Link_array get_extra_dependencies () const; virtual void do_unlink (); virtual void do_junk_links (); diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index 22a710d7f5..410b527a1b 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -31,7 +31,7 @@ protected: virtual void do_substitute_dependency (Score_element*,Score_element*); virtual Molecule * do_brew_molecule_p() const; - virtual Atom get_bar_sym (Real dy) const; + virtual Molecule get_bar_sym (Real dy) const; }; #endif // SPAN_BAR_HH diff --git a/lily/include/staff-bracket.hh b/lily/include/staff-bracket.hh index f63a113141..3360ac32cd 100644 --- a/lily/include/staff-bracket.hh +++ b/lily/include/staff-bracket.hh @@ -20,7 +20,7 @@ public: protected: virtual Interval do_width() const; virtual void do_post_processing(); - virtual Atom get_bar_sym (Real) const; + virtual Molecule get_bar_sym (Real) const; }; diff --git a/lily/include/staff-margin-engraver.hh b/lily/include/staff-margin-engraver.hh index 2ad18843d8..240b44f794 100644 --- a/lily/include/staff-margin-engraver.hh +++ b/lily/include/staff-margin-engraver.hh @@ -10,25 +10,18 @@ #ifndef STAFF_MARGIN_ENGRAVER_HH #define STAFF_MARGIN_ENGRAVER_HH -#include "engraver.hh" +#include "bar-script-engraver.hh" /** put (instrument) text to left of line */ -class Staff_margin_engraver : public Engraver +class Staff_margin_engraver : public Bar_script_engraver { public: VIRTUAL_COPY_CONS(Translator); - - Staff_margin_engraver (); - protected: void acknowledge_element (Score_element_info); - void do_pre_move_processing (); - -private: - Script * script_p_; }; #endif // STAFF_MARGIN_ENGRAVER_HH diff --git a/lily/include/tfm.hh b/lily/include/tfm.hh new file mode 100644 index 0000000000..182fded427 --- /dev/null +++ b/lily/include/tfm.hh @@ -0,0 +1,176 @@ +/* + tfm.hh -- declare Tex_font_metric + + source file of the GNU LilyPond music typesetter + + (c) 1999 Jan Nieuwenhuizen + + + revamped code from GNU Fontutils-0.6 + + */ + +#ifndef TFM_HH +#define TFM_HH + +#include "string.hh" +#include "array.hh" +#include "lily-proto.hh" +#include "font-metric.hh" + +/* The type. */ +typedef long Fix; + +/* A character code. Perhaps someday we will allow for 16-bit + character codes, but for now we are restricted to 256 characters per + font (like TeX and PostScript). */ +typedef unsigned char Char_code; + +/* Used in file formats. */ +typedef int Byte_count; + +/* The restriction to 256 characters in a TFM file is part of the file + format, so this number should only be changed in the (very unlikely) + event that the file format changes. */ +#define TFM_SIZE 256 + +/* Fontwide information. All real values are in printer's points: + 72.27 points = 1 inch. */ + +/* TFM_MIN_DESIGNSIZE <= designsize < TFM_MAX_DESIGNSIZE. */ +#define TFM_MIN_DESIGNSIZE 1.0 +#define TFM_MAX_DESIGNSIZE 2048 + +/* The maximum number of global font parameters we allow. */ +#define TFM_MAX_FONTDIMENS 30 + +/* The maximum length of a codingscheme string. */ +#define TFM_MAX_CODINGSCHEME_LENGTH 39 + +/* Define symbolic names for the numbers of the parameters we + recognize. Some numbers have more than one name. */ +#define TFM_SLANT_PARAMETER 1 +#define TFM_SPACE_PARAMETER 2 +#define TFM_STRETCH_PARAMETER 3 +#define TFM_SHRINK_PARAMETER 4 +#define TFM_XHEIGHT_PARAMETER 5 +#define TFM_QUAD_PARAMETER 6 +#define TFM_EXTRASPACE_PARAMETER 7 +#define TFM_NUM1_PARAMETER 8 +#define TFM_NUM2_PARAMETER 9 +#define TFM_NUM3_PARAMETER 10 +#define TFM_DENOM1_PARAMETER 11 +#define TFM_DENOM2_PARAMETER 12 +#define TFM_SUP1_PARAMETER 13 +#define TFM_SUP2_PARAMETER 14 +#define TFM_SUP3_PARAMETER 15 +#define TFM_SUB1_PARAMETER 16 +#define TFM_SUB2_PARAMETER 17 +#define TFM_SUPDROP_PARAMETER 18 +#define TFM_SUBDROP_PARAMETER 19 +#define TFM_DELIM1_PARAMETER 20 +#define TFM_DELIM2_PARAMETER 21 +#define TFM_AXISHEIGHT_PARAMETER 22 +#define TFM_DEFAULTRULETHICKNESS_PARAMETER 8 +#define TFM_BIGOPSPACING1_PARAMETER 9 +#define TFM_BIGOPSPACING2_PARAMETER 10 +#define TFM_BIGOPSPACING3_PARAMETER 11 +#define TFM_BIGOPSPACING4_PARAMETER 12 +#define TFM_BIGOPSPACING5_PARAMETER 13 + +/* These are not in any of the standard TeX fonts, but the information + is useful nevertheless. */ +#define TFM_LEADINGHEIGHT_PARAMETER 23 +#define TFM_LEADINGDEPTH_PARAMETER 24 +#define TFM_FONTSIZE_PARAMETER 25 +#define TFM_VERSION_PARAMETER 26 + +struct Tfm_header +{ + Byte_count char_info_pos; + Byte_count width_pos; + Byte_count height_pos; + Byte_count depth_pos; + Byte_count italic_correction_pos; + Byte_count lig_kern_pos; + Byte_count kern_pos; + unsigned param_word_count; +}; + +struct Tfm_info +{ + Char_code first_charcode, last_charcode; + U32 checksum; + Real design_size; + String coding_scheme; + unsigned parameter_count; + // Real parameters [Tex_font_metric::MAX_FONTDIMENS]; + Real parameters [TFM_MAX_FONTDIMENS]; +}; + +/* When typesetting, the current character + `character' leads to + `ligature'. The TFM format was extended in 1990 to allow for more + complicated ligatures than this, but we do not make those + distinctions. */ +struct Tfm_ligature +{ + Char_code character; + Char_code ligature; +}; + +/* Similarly for kerns. */ +struct Tfm_kern +{ + Char_code character; + Real kern; +}; + +struct Tex_font_char_metric : Character_metric +{ + bool exists_b_; + Char_code code_; + Real width_, height_, depth_, italic_correction_; + Fix width_fix_, height_fix_, depth_fix_, italic_correction_fix_; + Array kern_arr_; + Array ligature_arr_; + + String str () const; + Tex_font_char_metric (); + + Box dimensions () const; +}; + + +class Tex_font_metric : public Font_metric +{ +public: + Character_metric *get_char (int, bool) const; + + Tex_font_metric (); + Tex_font_char_metric const &find_ascii (int ascii, bool warn=true) const; + String str () const; + + /// the reader + Tfm_info info_; + Tfm_header header_; + void clear (int n); + void read_file (String name); + + Array char_metrics_; + Array ascii_to_metric_idx_; + +private: + Real get_U32_fix_f (Binary_source_file* input); + Real get_U32_fix_scaled_f (Binary_source_file* input); + String get_bcpl_str (Binary_source_file* input); + void read_header (Binary_source_file* input); + void read_params (Binary_source_file* input); + void read_char_metrics (Binary_source_file* input); + Tex_font_char_metric read_char_metric (Binary_source_file* input, Char_code code); + Tex_font_char_metric read_char (Binary_source_file* input); + void read_lig_kern_program (Binary_source_file* input, Array* ligature_arr_p, Array * kern_arr_p); +}; + + +#endif /* TFM_HH */ + diff --git a/lily/include/tuplet-engraver.hh b/lily/include/tuplet-engraver.hh index b76f12e440..f376092f76 100644 --- a/lily/include/tuplet-engraver.hh +++ b/lily/include/tuplet-engraver.hh @@ -22,7 +22,7 @@ public: protected: Link_array compressed_music_arr_; Array stop_moments_; - Link_array started_span_p_arr_; + Link_array started_span_p_arr_; virtual void do_removal_processing (); diff --git a/lily/include/tuplet-spanner.hh b/lily/include/tuplet-spanner.hh index 356e4a51e0..4310faac2c 100644 --- a/lily/include/tuplet-spanner.hh +++ b/lily/include/tuplet-spanner.hh @@ -4,18 +4,18 @@ (c) 1997--1998 Jan Nieuwenhuizen */ -#ifndef PLET_SPANNER_HH -#define PLET_SPANNER_HH +#ifndef Tuplet_spanner_HH +#define Tuplet_spanner_HH #include "text-def.hh" #include "pointer.hh" #include "directional-spanner.hh" /** supportable plet: triplets, eentweetjes, ottava, etc. */ -class Plet_spanner : public Directional_spanner +class Tuplet_spanner : public Directional_spanner { public: - Plet_spanner (); + Tuplet_spanner (); void add_column (Note_column*); void set_beam (Beam*); @@ -36,5 +36,5 @@ protected: virtual void do_substitute_dependency (Score_element*,Score_element*); }; -#endif // PLET_SPANNER_HH +#endif // Tuplet_spanner_HH diff --git a/lily/include/volta-spanner.hh b/lily/include/volta-spanner.hh index cf8c1b32d5..eca97a8252 100644 --- a/lily/include/volta-spanner.hh +++ b/lily/include/volta-spanner.hh @@ -26,12 +26,14 @@ public: Link_array column_arr_; Link_array note_column_arr_; bool last_b_; + bool visible_b_; protected: virtual Molecule* do_brew_molecule_p () const; VIRTUAL_COPY_CONS (Score_element); virtual void do_add_processing (); + virtual Interval do_height () const; virtual void do_post_processing (); virtual void do_substitute_dependency (Score_element*,Score_element*); }; diff --git a/lily/item.cc b/lily/item.cc index 7ae4f06b53..2ba9b27045 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -21,8 +21,6 @@ Item::Item () broken_to_drul_[LEFT] = broken_to_drul_[RIGHT]=0; } - - void Item::do_print() const { @@ -42,7 +40,7 @@ Item::hpos_f() const Line_of_score * Item::line_l() const { - Graphical_element *g =parent_l (X_AXIS); + Graphical_element *g = parent_l (X_AXIS); if (!g) return 0; return dynamic_cast (g)-> line_l (); @@ -63,36 +61,63 @@ Item::copy_breakable_items() Direction i=LEFT; do { - Item * item_p = dynamic_cast(clone()); + Score_element * dolly = clone(); + Item * item_p = dynamic_cast(dolly); item_p->break_status_dir_ = i; pscore_l_->typeset_element (item_p); - item_p->handle_prebroken_dependencies(); new_copies[i] =item_p; } while (flip(&i) != LEFT); broken_to_drul_= new_copies; + + do + { + broken_to_drul_[i]->handle_prebroken_dependencies(); + broken_to_drul_[i]->try_visibility_lambda(); + } + while (flip(&i) != LEFT); + try_visibility_lambda (); } void -Item::do_breakable_col_processing() +Item::try_visibility_lambda () { - if (!breakable_b_) - return; - - if (!column_l ()->breakable_b_) - return; + if (visibility_lambda_) + { + SCM args = scm_listify (gh_int2scm (break_status_dir_), SCM_UNDEFINED); + SCM result = gh_apply (visibility_lambda_, args); + int trans = gh_scm2bool (gh_car (result)); + int empty = gh_scm2bool (gh_cdr (result)); + + if (empty) + set_empty (true); + if (trans) + transparent_b_ = true; + } +} +void +Item::do_break () +{ copy_breakable_items(); handle_prebroken_dependencies(); - + /* Otherwise the broken items won't be pre_process()'ed. */ add_dependency (broken_to_drul_[LEFT]); - add_dependency (broken_to_drul_[RIGHT]); + add_dependency (broken_to_drul_[RIGHT]); + } +void +Item::do_breakable_col_processing() +{ + if (breakable_b_) + do_break (); + +} Item* Item::find_prebroken_piece (Line_of_score*l) const { @@ -176,8 +201,34 @@ Item::Item (Item const &s) unbroken_original_l_ = &s; /* do not copy attached_span_l_arr_ */ breakable_b_ = s.breakable_b_; + visibility_lambda_ = s.visibility_lambda_; broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] =0; break_status_dir_ = s.break_status_dir_; break_priority_i_ = s.break_priority_i_; } + +void +Item::handle_prebroken_dependents () +{ + Dimension_cache * dim = dim_cache_[X_AXIS].parent_l_; + if (!dim) + return; + + Item * parent = dynamic_cast (dim->element_l ()); + if (parent && parent->broken_to_drul_[LEFT]) + { + if(!(broken_to_drul_[LEFT] || broken_to_drul_[RIGHT])) + do_break (); + + Direction d = LEFT; + do + { + broken_to_drul_[d]->dim_cache_[X_AXIS].parent_l_ = + &parent->broken_to_drul_[d]->dim_cache_[X_AXIS]; + parent->broken_to_drul_[d]->add_dependency (broken_to_drul_[d]); + } + while ((flip (&d))!=LEFT); + } +} + diff --git a/lily/key-item.cc b/lily/key-item.cc index 268d847686..152148dac9 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -73,7 +73,9 @@ Key_item::calculate_position(int p, int a) const } /* - TODO space the `natural' signs wider + TODO + - space the `natural' signs wider + - dehair this */ Molecule* Key_item::do_brew_molecule_p() const @@ -97,7 +99,7 @@ Key_item::do_brew_molecule_p() const { Molecule m =lookup_l ()->accidental (0,false); m.translate_axis (calculate_position(old_pitch_arr_[i], old_acc_arr_[i]) * inter, Y_AXIS); - output->add_at_edge (X_AXIS, RIGHT, m); + output->add_at_edge (X_AXIS, RIGHT, m,0); } } @@ -109,14 +111,14 @@ Key_item::do_brew_molecule_p() const Interval x(0, inter); Interval y(0,0); - output->add_at_edge (X_AXIS, RIGHT, lookup_l()->fill (Box(x,y))); + output->add_at_edge (X_AXIS, RIGHT, lookup_l()->fill (Box(x,y)),0); } for (int i =0; i < pitch_arr_.size(); i++) { Molecule m =lookup_l ()->accidental (acc_arr_[i],false); m.translate_axis (calculate_position(pitch_arr_[i], acc_arr_[i]) * inter, Y_AXIS); - output->add_at_edge (X_AXIS, RIGHT, m); + output->add_at_edge (X_AXIS, RIGHT, m, 0); } if (pitch_arr_.size()) { @@ -124,7 +126,7 @@ Key_item::do_brew_molecule_p() const Interval (0, paper()->note_width ()), Interval (0,0)))); - output->add_at_edge (X_AXIS, RIGHT, m); + output->add_at_edge (X_AXIS, RIGHT, m,0 ); } return output; } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 26e32488b8..265a14578a 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -42,8 +42,14 @@ ly_symbol (String name) return gh_car (scm_intern (name.ch_C(), name.length_i())); } +String +symbol_to_string (SCM s) +{ + return String((Byte*)SCM_CHARS (s), (int) SCM_LENGTH(s)); +} + SCM -ly_set_scm (String name , SCM val) +ly_set_scm (String name, SCM val) { return scm_sysintern (name.ch_C(), val); @@ -75,3 +81,10 @@ read_lily_scm_file (String fn) *mlog << ']' << flush; } + +void +ly_display_scm (SCM s) +{ + gh_display (s); + gh_newline (); +} diff --git a/lily/lily-version.cc b/lily/lily-version.cc index 18696cbd31..5dcfcdcac5 100644 --- a/lily/lily-version.cc +++ b/lily/lily-version.cc @@ -1,21 +1,35 @@ -#include +/* + lily-version.cc -- implement version strings + + source file of the GNU LilyPond music typesetter + + (c) 1999 Jan Nieuwenhuizen +*/ #include "config.hh" #include "version.hh" +#include "lily-version.hh" -#define VERSION_SZ MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL "." MY_PATCH_LEVEL - -static char *s = "GNU LilyPond " VERSION_SZ ; +#define VERSION MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL "." MY_PATCH_LEVEL +String +version_str () +{ + String str = VERSION; + return str; +} -char const * -lily_version_number_sz() +String +gnu_lilypond_str () { - return VERSION_SZ; + String str = "GNU LilyPond"; + return str; } -char const * -lily_version_sz() +String +gnu_lilypond_version_str () { - return s; + String str = gnu_lilypond_str () + " " + version_str (); + return str; } + diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 43177a7322..92c6e2300a 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -74,7 +74,7 @@ Local_key_item::do_brew_molecule_p() const accidental_pitch_arr_[i].cautionary_b_)); m.translate_axis (dy, Y_AXIS); - octave_mol_p->add_at_edge (X_AXIS, RIGHT, m); + octave_mol_p->add_at_edge (X_AXIS, RIGHT, m, 0); } if (octave_mol_p) @@ -89,7 +89,7 @@ Local_key_item::do_brew_molecule_p() const { Box b(Interval (0, paper()->internote_f ()), Interval (0,0)); Molecule m (lookup_l ()->fill (b)); - output->add_at_edge (X_AXIS, RIGHT, m); + output->add_at_edge (X_AXIS, RIGHT, m, 0); } Interval x_int; diff --git a/lily/lookup.cc b/lily/lookup.cc index 35367f5e0e..757cf25535 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -15,7 +15,6 @@ #include "lookup.hh" #include "debug.hh" #include "dimensions.hh" -#include "symtable.hh" #include "scalar.hh" #include "paper-def.hh" #include "string-convert.hh" @@ -24,6 +23,8 @@ #include "lily-guile.hh" #include "all-fonts.hh" #include "afm.hh" +#include "scope.hh" +#include "molecule.hh" SCM array_to_list (SCM *a , int l) @@ -40,30 +41,17 @@ array_to_list (SCM *a , int l) Lookup::Lookup () { paper_l_ = 0; - symtables_p_ = new Symtables; afm_l_ = 0; } Lookup::Lookup (Lookup const& s) { font_name_ = s.font_name_; - paper_l_ = s.paper_l_; - symtables_p_ = new Symtables (*s.symtables_p_); + paper_l_ = 0; afm_l_ = 0; } -Lookup::Lookup (Symtables const& s) -{ - font_name_ = s.font_name_; - paper_l_ = 0; - symtables_p_ = new Symtables (s); - afm_l_ = 0; -} -Lookup::~Lookup () -{ - delete symtables_p_; -} Molecule Lookup::accidental (int j, bool cautionary) const @@ -71,28 +59,21 @@ Lookup::accidental (int j, bool cautionary) const Molecule m(afm_find (String ("accidentals") + String ("-") + to_str (j))); if (cautionary) { - m.add_at_edge(X_AXIS, LEFT, - Molecule(afm_find (String ("accidentals") + String ("-(")))) -; - m.add_at_edge(X_AXIS, RIGHT, - Molecule(afm_find (String ("accidentals") + String ("-)")))) -; + Atom open = afm_find (String ("accidentals") + String ("-(")); + Atom close = afm_find (String ("accidentals") + String ("-)")); + m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0); + m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0); } return m; } -void -Lookup::add (String s, Symtable*p) -{ - symtables_p_->add (s, p); -} Atom Lookup::afm_find (String s, bool warn) const { if (!afm_l_) - ((Lookup*)this)->afm_l_ = all_fonts_global_p->find_font (font_name_); + ((Lookup*)this)->afm_l_ = all_fonts_global_p->find_afm (font_name_); Adobe_font_char_metric m = afm_l_->find_char (s, warn); @@ -108,7 +89,6 @@ Lookup::afm_find (String s, bool warn) const a.lambda_ = gh_list (ly_symbol ("char"), gh_int2scm (m.code ()), SCM_UNDEFINED); - a.str_ = "afm_find: " + s; a.font_ = font_name_; return a; } @@ -123,22 +103,94 @@ Lookup::ball (int j) const } Atom -Lookup::bar (String str, Real h) const +Lookup::simple_bar (String type, Real h) const { - - Atom a = (*symtables_p_) ("bars")->lookup (str); - + SCM thick = ly_symbol ("barthick_" + type); + Real w = 0.1 PT; + if (paper_l_->scope_p_->elem_b (thick)) + { + w = paper_l_->get_realvar (thick); + } - a.lambda_ = gh_list (ly_symbol (a.str_.ch_C()), - gh_double2scm (h), + Atom a; + a.lambda_ = gh_list (ly_symbol ("filledbox"), + gh_double2scm (0), + gh_double2scm (w), + gh_double2scm (h/2), + gh_double2scm (h/2), SCM_UNDEFINED); - - a.dim_.y () = Interval (-h/2, h/2); - a.font_ = font_name_; + a.dim_[X_AXIS] = Interval(0,w); + a.dim_[Y_AXIS] = Interval (-h/2, h/2); return a; } + +Molecule +Lookup::bar (String str, Real h) const +{ + Real kern = paper_l_->get_var ("bar_kern"); + Real thinkern = paper_l_->get_var ("bar_thinkern"); + Atom thin = simple_bar ("thin", h); + Atom thick = simple_bar ("thick", h); + Atom colon = afm_find ("dots-repeatcolon"); + + Molecule m; + + if (str == "") + { + return fill (Box (Interval(0,0),Interval (-h/2, h/2))); + } + else if (str == "|") + { + return thin; + } + else if (str == "|.") + { + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin,kern); + } + else if (str == ".|") + { + m.add_at_edge (X_AXIS, RIGHT, thick, kern); + m.add_at_edge (X_AXIS, RIGHT, thin, 0); + } + else if (str == ":|") + { + m.add_at_edge (X_AXIS, LEFT, thick, 0); + m.add_at_edge (X_AXIS, LEFT, thin, kern); + m.add_at_edge (X_AXIS, LEFT, colon, kern); + } + else if (str == "|:") + { + m.add_at_edge (X_AXIS, RIGHT, thick,0); + m.add_at_edge (X_AXIS, RIGHT, thin,kern); + m.add_at_edge (X_AXIS, RIGHT, colon,kern); + } + else if (str == ":|:") + { + m.add_at_edge (X_AXIS, LEFT, thick,kern/2); + m.add_at_edge (X_AXIS, LEFT, thin,kern); + m.add_at_edge (X_AXIS, LEFT, colon,kern); + m.add_at_edge (X_AXIS, RIGHT, thick,kern); + m.add_at_edge (X_AXIS, RIGHT, thin,kern); + m.add_at_edge (X_AXIS, RIGHT, colon,kern); + } + else if (str == "||") + { + m.add_at_edge (X_AXIS, RIGHT, thin,0); + m.add_at_edge (X_AXIS, RIGHT, thin,thinkern); + } + + else if (str == ".|.") + { + m.add_at_edge (X_AXIS, RIGHT, thick, 0); + m.add_at_edge (X_AXIS, RIGHT, thick, kern); + } + + return m; +} + Atom Lookup::beam (Real slope, Real width, Real thick) const { @@ -198,7 +250,6 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const ly_quote_scm (array_to_list (sc, 4)), SCM_UNDEFINED); - a.str_ = "dashed_slur"; return a; } @@ -208,20 +259,18 @@ Lookup::dots () const return afm_find (String ("dots") + String ("-") + String ("dot")); } -Atom -Lookup::dynamic (String st) const -{ - return (*symtables_p_) ("dynamics")->lookup (st); -} Atom Lookup::extender (Real width) const { - Atom a = (*symtables_p_) ("param")->lookup ("extender"); - a.lambda_ = gh_list (ly_symbol (a.str_), + Atom a; + a.lambda_ = gh_list (ly_symbol ("extender"), gh_double2scm (width), SCM_UNDEFINED); - a.str_ = "extender"; + + a.dim_[X_AXIS] = Interval (0, width); + a.dim_[Y_AXIS] = Interval (0,0); + a.font_ = font_name_; return a; } @@ -242,16 +291,6 @@ Lookup::flag (int j, Direction d) const return a; } -void -Lookup::print () const -{ -#ifndef NPRINT - DOUT << "Lookup {\n"; - symtables_p_->print (); - DOUT << "}\n"; -#endif -} - Atom Lookup::rest (int j, bool o) const { @@ -314,9 +353,9 @@ Lookup::stem (Real y1, Real y2) const Real stem_width = paper_l_->get_var ("stemthickness"); - a.lambda_ = gh_list (ly_symbol ("stem"), - gh_double2scm(-stem_width /2), - gh_double2scm(stem_width), + a.lambda_ = gh_list (ly_symbol ("filledbox"), + gh_double2scm(stem_width /2), + gh_double2scm(stem_width/2), gh_double2scm(y2), gh_double2scm(-y1), SCM_UNDEFINED); @@ -340,6 +379,10 @@ static Dict_initialiser cmr_init[] = { {"finger", "feta-nummer"}, {"italic", "cmti"}, {"roman", "cmr"}, + {"large", "cmbx"}, + {"Large", "cmbx"}, + {"mark", "feta-nummer"}, + {"nummer", "feta-nummer"}, {0,0} }; @@ -348,21 +391,23 @@ static Dictionary cmr_dict (cmr_init); Atom Lookup::text (String style, String text) const { - Atom a = (*symtables_p_) ("style")->lookup (style); - - a.lambda_ = gh_list(ly_symbol (a.str_), + Atom a; + a.lambda_ = gh_list(ly_symbol ("set" + style), gh_str02scm (text.ch_C()), SCM_UNDEFINED); - - Real font_w = a.dim_.x ().length (); - Real font_h = a.dim_.y ().length (); + Real font_h = paper_l_->get_var ("font_normal"); + if (paper_l_->scope_p_->elem_b ("font_" + style)) + { + font_h = paper_l_->get_var ("font_" + style); + } + if (cmr_dict.elem_b (style)) { style = String (cmr_dict [style]) + to_str ((int)font_h); // ugh } Real w = 0; - Adobe_font_metric* afm_l = all_fonts_global_p->find_font (style); + Font_metric* afm_l = all_fonts_global_p->find_font (style); DOUT << "\nChars: "; for (int i = 0; i < text.length_i (); i++) @@ -372,16 +417,11 @@ Lookup::text (String style, String text) const ; else { - int c = text[i]; - int code = afm_l->ascii_to_metric_idx_[c]; - if (code >=0) - { - Adobe_font_char_metric m = afm_l->char_metrics_[code]; - w += m.B_.x ().length (); - DOUT << to_str (m.B_.x ().length ()) << " "; - } + Character_metric *c = afm_l->get_char (text[i],false); + w += c->dimensions()[X_AXIS].length (); } } + DOUT << "\n" << to_str (w) << "\n"; a.dim_.x () = Interval (0, w); a.font_ = font_name_; @@ -389,14 +429,21 @@ Lookup::text (String style, String text) const } +/* + TODO: should return a molecule with 2 stacked nums. + */ Atom Lookup::time_signature (Array a) const { - Atom s ((*symtables_p_) ("param")->lookup ("time_signature")); - s.lambda_ = gh_list (ly_symbol (s.str_), + Atom s; + s.lambda_ = gh_list (ly_symbol ("generalmeter"), gh_int2scm (a[0]), gh_int2scm (a[1]), SCM_UNDEFINED); + + Real r = paper_l_->interline_f () ; + s.dim_[Y_AXIS] = Interval (-2*r, 2*r); + s.dim_[X_AXIS] = Interval (0, 2*r); return s; } @@ -409,6 +456,7 @@ Lookup::vbrace (Real &y) const SCM_UNDEFINED ); a.dim_[Y_AXIS] = Interval (-y/2,y/2); + a.dim_[X_AXIS] = Interval (0,0); a.font_ = font_name_; return a; } @@ -475,7 +523,6 @@ Lookup::vbracket (Real &y) const a.lambda_ = gh_list (ly_symbol ("bracket"), gh_double2scm (y), SCM_UNDEFINED); - a.str_ = "vbracket"; a.dim_[Y_AXIS] = Interval (-y/2,y/2); a.dim_[X_AXIS] = Interval (0,4 PT); return a; @@ -489,7 +536,7 @@ Lookup::volta (Real w, bool last_b) const gh_double2scm (w), gh_int2scm (last_b), SCM_UNDEFINED); - a.str_ = "volta"; + Real interline_f = paper_l_->interline_f (); a.dim_[Y_AXIS] = Interval (-interline_f, interline_f); diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index c5447ad97e..b2942c91fc 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -8,15 +8,9 @@ */ #include "musical-request.hh" -#include "text-item.hh" -#include "paper-def.hh" -#include "lookup.hh" -#include "paper-def.hh" #include "main.hh" #include "dimensions.hh" #include "g-text-item.hh" - - #include "engraver.hh" #include "array.hh" #include "lily-proto.hh" @@ -71,6 +65,8 @@ Lyric_engraver::do_process_requests() Scalar style = get_property ("textstyle", 0); if (style.length_i ()) item_p->style_str_ = style; + // urg, when/how can one get the height of this thing? + item_p->translate (Offset (0, - i * 12 PT)); text_p_arr_.push (item_p); announce_element (Score_element_info (item_p, request_l)); diff --git a/lily/main.cc b/lily/main.cc index b5ca928061..64c5f17575 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -11,6 +11,7 @@ #include #include #include "lily-guile.hh" +#include "lily-version.hh" #include "all-fonts.hh" #include "proto.hh" @@ -128,8 +129,8 @@ usage () " -V, --ignore-version ignore mudela version\n" ); cout << _ ( - " -w, --warranty show warranty and copyright\n" - ); + " -w, --warranty show warranty and copyright\n" + ); cout << '\n'; cout << _ ("GNU LilyPond was compiled with the following settings:"); cout << '\n'; @@ -143,9 +144,9 @@ usage () #ifdef STRING_UTILS_INLINED "STRING_UTILS_INLINED " #endif - "datadir=" DIR_DATADIR - "\n" - "localedir=" DIR_LOCALEDIR + "datadir=" DIR_DATADIR + "\n" + "localedir=" DIR_LOCALEDIR "\n"; @@ -157,8 +158,8 @@ about () { cout << '\n'; cout << - #include "BLURB.hh" - cout << '\n'; +#include "BLURB.hh" + cout << '\n'; cout << _ ("GNU LilyPond is Free software, see --warranty"); cout << '\n'; cout << '\n'; @@ -181,25 +182,25 @@ notice () cout << " " + _ ("Jan Nieuwenhuizen ") + "\n"; cout << '\n'; cout << _ ( - " This program is free software; you can redistribute it and/or\n" - "modify it under the terms of the GNU General Public License version 2\n" - "as published by the Free Software Foundation.\n" - "\n" - " This program is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" - "General Public License for more details.\n" - "\n" - " You should have received a copy (refer to the file COPYING) of the\n" - "GNU General Public License along with this program; if not, write to\n" - "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n" - "USA.\n"); + " This program is free software; you can redistribute it and/or\n" + "modify it under the terms of the GNU General Public License version 2\n" + "as published by the Free Software Foundation.\n" + "\n" + " This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" + "General Public License for more details.\n" + "\n" + " You should have received a copy (refer to the file COPYING) of the\n" + "GNU General Public License along with this program; if not, write to\n" + "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n" + "USA.\n"); } void identify () { - *mlog << get_version_str () << endl; + *mlog << gnu_lilypond_version_str () << endl; } void @@ -234,12 +235,12 @@ setup_paths () global_path.parse_path (env_sz); - char *suffixes[] = {"ly", "afm", "scm", "init", 0}; + char *suffixes[] = {"ly", "afm", "scm", "tfm", 0}; for (char **s = suffixes; *s; s++){ - if (!prefix_directory.empty_b()) - global_path.add (prefix_directory + to_str ('/') + String (*s)); - else - global_path.add (String (DIR_DATADIR) + to_str ('/') + String(*s)); + if (!prefix_directory.empty_b()) + global_path.add (prefix_directory + to_str ('/') + String (*s)); + else + global_path.add (String (DIR_DATADIR) + to_str ('/') + String(*s)); } } @@ -247,6 +248,7 @@ setup_paths () void main_prog (int argc, char **argv) { + call_constructors (); default_outname_base_global = "lelie"; all_fonts_global_p = new All_font_metrics (global_path.str ()); @@ -296,13 +298,12 @@ main_prog (int argc, char **argv) exit( exit_status_i_); } + int main (int argc, char **argv) { identify (); - call_constructors (); debug_init (); // should be first - setup_paths (); oparser_global_p = new Getopt_long(argc, argv,theopts); diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 891215abe5..f824634208 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -5,29 +5,28 @@ (c) 1998 Jan Nieuwenhuizen */ - -#include "mark-engraver.hh" -#include "text-def.hh" -#include "script.hh" -#include "paper-def.hh" #include "command-request.hh" -#include "time-description.hh" +#include "mark-engraver.hh" #include "engraver-group.hh" -#include "staff-sym.hh" #include "g-text-item.hh" -#include "g-staff-side.hh" -#include "stem.hh" -#include "rhythmic-head.hh" + ADD_THIS_TRANSLATOR (Mark_engraver); Mark_engraver::Mark_engraver () { mark_req_l_ = 0; - staff_side_p_ = 0; - text_p_ = 0; + axis_ = Y_AXIS; + type_ = "mark"; } +void +Mark_engraver::do_post_move_processing () +{ + mark_req_l_ = 0; +} + + bool Mark_engraver::do_try_music (Music* r_l) { @@ -41,72 +40,12 @@ Mark_engraver::do_try_music (Music* r_l) void Mark_engraver::do_process_requests () -{ - if (!mark_req_l_ || staff_side_p_) - return; - - staff_side_p_ = new G_staff_side_item; - - text_p_ = new G_text_item; - - text_p_->text_str_ = mark_req_l_->str_; - // text_p_->align_dir_ = CENTER; - - text_p_->style_str_ = text_p_->text_str_.index_any_i ("0123456789") >= 0 - ? "mark" : "Large"; - - Scalar prop = get_property ("markdir", 0); - if (prop.isnum_b ()) - { - staff_side_p_->dir_ = (Direction) (int) prop; - } - else - { - staff_side_p_->dir_ = UP; - } - - staff_side_p_->set_victim(text_p_); - - // Scalar padding = get_property ("markScriptPadding", 0); - // if (padding.length_i() && padding.isnum_b ()) - // { - // script_p_->padding_f_ = Real(padding); - // } - // Scalar break_priority = get_property ("markBreakPriority", 0); - // if (break_priority.length_i() && break_priority.isnum_b ()) - // { - // staff_side_p_->break_priority_i_ = int(break_priority); - // } - - - announce_element (Score_element_info (text_p_, mark_req_l_)); - announce_element (Score_element_info (staff_side_p_, mark_req_l_)); -} - -void -Mark_engraver::do_pre_move_processing () -{ - if (staff_side_p_) - { - Staff_symbol* s_l = get_staff_info().staff_sym_l_; - staff_side_p_->add_support (s_l); - typeset_element (text_p_); - typeset_element (staff_side_p_); - text_p_ = 0; - staff_side_p_ = 0; - mark_req_l_ = 0; - } -} - -void -Mark_engraver::acknowledge_element (Score_element_info i) { - if (staff_side_p_) + if (mark_req_l_) { - if (dynamic_cast (i.elem_l_) || - dynamic_cast (i.elem_l_)) - { - staff_side_p_->add_support (i.elem_l_); - } + create_items (mark_req_l_); + text_p_->text_str_ = mark_req_l_->str_; + text_p_->style_str_ = text_p_->text_str_.index_any_i ("0123456789") >= 0 + ? "mark" : "Large"; } } diff --git a/lily/molecule.cc b/lily/molecule.cc index def5674fcf..4e0bb33766 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -21,6 +21,15 @@ Molecule::extent() const return b; } +Interval +Molecule::extent(Axis a) const +{ + Interval i; + for (iter_top (atoms_,c); c.ok(); c++) + i.unite (c->extent(a)); + return i; +} + void Molecule::translate (Offset o) { @@ -46,16 +55,15 @@ Molecule::add_molecule (Molecule const &m) void -Molecule::add_at_edge (Axis a, Direction d, Molecule const &m) +Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding) { - if (!atoms_.size()) - { - add_molecule (m); - return; - } - Real offset = extent ()[a][d] - m.extent ()[a][-d]; + Real my_extent= atoms_.size() + ? extent ()[a][d] + : 0.0; + + Real offset = my_extent - m.extent ()[a][-d]; Molecule toadd (m); - toadd.translate_axis (offset, a); + toadd.translate_axis (offset + d * padding, a); add_molecule (toadd); } diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 6f3ba9597a..8dd071d6d5 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -24,8 +24,8 @@ ADD_THIS_TRANSLATOR (Multi_measure_rest_engraver); Multi_measure_rest_engraver::Multi_measure_rest_engraver () { start_measure_i_ = 0; - rest_stop_mom_ =0; - // rest_item_creation_mom_ = 0; + rest_moments_[START] = + rest_moments_[STOP] =0; multi_measure_req_l_ = 0; mmrest_p_ = 0; } @@ -49,13 +49,13 @@ Multi_measure_rest_engraver::do_try_music (Music* req_l) { if (multi_measure_req_l_) if (!multi_measure_req_l_->equal_b (mr) - || rest_start_mom_ != now_moment ()) + || rest_moments_[START] != now_moment ()) return false; multi_measure_req_l_ = mr; - rest_start_mom_ = now_moment (); + rest_moments_[START] = now_moment (); - rest_stop_mom_ = rest_start_mom_ + multi_measure_req_l_->duration_.length (); + rest_moments_[STOP] = rest_moments_[START] + multi_measure_req_l_->duration_.length (); return true; } return false; @@ -78,7 +78,7 @@ Multi_measure_rest_engraver::do_pre_move_processing () { Moment now (now_moment ()); Time_description const *time = get_staff_info().time_C_; - if (mmrest_p_ && (now >= rest_start_mom_) + if (mmrest_p_ && (now >= rest_moments_[START]) && !time->whole_in_measure_ && (mmrest_p_->column_arr_.size () >= 2)) { @@ -107,7 +107,7 @@ Multi_measure_rest_engraver::do_post_move_processing () mmrest_p_ = 0; } - if (now >= rest_stop_mom_) + if (now >= rest_moments_[STOP]) { multi_measure_req_l_ = 0; mmrest_p_ = 0; diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index 83d97ab59b..4622d11526 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -13,6 +13,7 @@ #include "dictionary-iter.hh" #include "identifier.hh" #include "main.hh" +#include "lily-guile.hh" int Music_output_def::get_next_default_count () const @@ -39,7 +40,7 @@ Music_output_def::Music_output_def (Music_output_def const &s) scope_p_ = new Scope (*s.scope_p_); translator_p_dict_p_ = new Scope (*s.translator_p_dict_p_); - for (Dictionary_iter i (*translator_p_dict_p_); i.ok (); i++) + for (Scope_iter i (*translator_p_dict_p_); i.ok (); i++) { Translator * t = i.val ()->access_content_Translator (false); t-> output_def_l_ = this; @@ -53,7 +54,7 @@ Music_output_def::assign_translator (Translator*tp) if (translator_p_dict_p_->elem_b (s)) delete translator_p_dict_p_->elem (s); - (*translator_p_dict_p_)[s] = new Translator_identifier (tp, 0); + translator_p_dict_p_->elem (s) = new Translator_identifier (tp, 0); tp ->output_def_l_ = this; } @@ -61,10 +62,10 @@ Translator* Music_output_def::find_translator_l (String name) const { if (translator_p_dict_p_->elem_b (name)) - return (*translator_p_dict_p_)[name]->access_content_Translator (false); + return translator_p_dict_p_->elem (name)->access_content_Translator (false); if (global_translator_dict_p->elem_b (name)) - return (*global_translator_dict_p)[name]; + return global_translator_dict_p->elem(name); return 0; } @@ -95,9 +96,12 @@ Music_output_def::print () const String Music_output_def::get_default_output () const { - if (safe_global_b || !scope_p_->elem_b ("output")) + static SCM output_sym; + if (!output_sym) + output_sym = scm_protect_object (ly_symbol ("output")); + if (safe_global_b || !scope_p_->elem_b (output_sym)) return ""; - Identifier * id = (*scope_p_) ["output"]; + Identifier * id = scope_p_->elem (output_sym); String *p = id->access_content_String (false); return p ? *p : String (""); diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 1e531211eb..540bc6b6a0 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -305,34 +305,6 @@ Script_req::~Script_req () delete scriptdef_p_; } - -Text_req::~Text_req () -{ - delete tdef_p_; - tdef_p_ = 0; -} - -Text_req::Text_req (Text_req const& src) -{ - tdef_p_ = new Text_def (*src.tdef_p_); - dir_ = src.dir_; -} - -Text_req::Text_req (int dir_i, Text_def* tdef_p) -{ - dir_ = Direction (dir_i); - tdef_p_ = tdef_p; -} - -void -Text_req::do_print () const -{ -#ifndef NPRINT - DOUT << " dir " << dir_; - tdef_p_->print (); -#endif -} - void Skip_req::do_print () const { diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 059ab68ddd..d7acdd9f79 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -62,9 +62,7 @@ static Keyword_ent the_key_tab[]={ {"script", SCRIPT}, {"shape", SHAPE}, {"skip", SKIP}, - {"table", TABLE}, {"spandynamic", SPANDYNAMIC}, - {"symboltables", SYMBOLTABLES}, {"tempo", TEMPO}, {"translator", TRANSLATOR}, {"type", TYPE}, @@ -93,9 +91,11 @@ My_lily_lexer::lookup_keyword (String s) Identifier* My_lily_lexer::lookup_identifier (String s) { + SCM sym = ly_symbol (s.ch_C()); + for (int i = scope_l_arr_.size (); i--; ) - if (scope_l_arr_[i]->elem_b (s)) - return (*scope_l_arr_[i])[s]; + if (scope_l_arr_[i]->elem_b (sym)) + return scope_l_arr_[i]->elem(sym); return 0; } @@ -136,7 +136,7 @@ My_lily_lexer::set_identifier (String name_str, Identifier* i, bool ) warning ( _f ("Identifier name is a keyword (`%s')", name_str)); } - (*scope_l_arr_.top ())[name_str] = i; + scope_l_arr_.top ()->elem (name_str) = i; } My_lily_lexer::~My_lily_lexer() diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index 5f733ef6db..d29b14ff5f 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -165,7 +165,7 @@ My_lily_parser::get_chord (Musical_pitch tonic, Array* add_arr_p, for (int i = 0; i < sub_arr_p->size (); i++) { Musical_pitch p = tonic; - Musical_pitch q = (*add_arr_p)[i]; + Musical_pitch q = (*sub_arr_p)[i]; // duh, c7 should mean if (q.notename_i_ == 6) q.accidental_i_--; @@ -257,11 +257,19 @@ My_lily_parser::get_chord (Musical_pitch tonic, Array* add_arr_p, int j = 0; for (; j < sub_arr_p->size (); j++) if (p == (*sub_arr_p)[j]) - break; + { + sub_arr_p->del (j); + j = -1; + break; + } if (j == sub_arr_p->size ()) pitch_arr.push (p); } + for (int i = 0; i < sub_arr_p->size (); i++) + warning (_f ("invalid subtraction: not part of chord: %s", + (*sub_arr_p)[i].str ())); + if (inversion_p) { int i = 0; @@ -270,7 +278,8 @@ My_lily_parser::get_chord (Musical_pitch tonic, Array* add_arr_p, && (pitch_arr[i].accidental_i_ == inversion_p->accidental_i_)) break; if (i == pitch_arr.size ()) - warning (_ ("invalid inversion pitch (not part of chord)")); + warning (_f ("invalid inversion pitch: not part of chord: %s", + inversion_p->str ())); else { Array pitches; @@ -333,7 +342,6 @@ My_lily_parser::get_parens_request (int t) reqs.push (new Tie_req); break; - /* fall through */ case '[': case ']': { diff --git a/lily/paper-def.cc b/lily/paper-def.cc index e347d9d964..626881eea5 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -22,9 +22,17 @@ #include "paper-outputter.hh" #include "paper-stream.hh" + +#define SCMVAR(s) { static SCM sym; \ + if (!sym)\ + sym = scm_protect_object (ly_symbol (#s));\ + return get_realvar (sym); } + + Paper_def::Paper_def () { lookup_p_tab_p_ = new Hash_table; + lookup_p_tab_p_->hash_func_ = int_hash; } @@ -42,6 +50,8 @@ Paper_def::Paper_def (Paper_def const&s) : Music_output_def (s) { lookup_p_tab_p_ = new Hash_table; + lookup_p_tab_p_->hash_func_ = int_hash; + for (Hash_table_iter ai(*s.lookup_p_tab_p_); ai.ok (); ai++) { Lookup * l = new Lookup (*ai.val ()); @@ -52,13 +62,19 @@ Paper_def::Paper_def (Paper_def const&s) Real Paper_def::get_var (String s) const +{ + return get_realvar (ly_symbol (s)); +} + +Real +Paper_def::get_realvar (SCM s) const { if (!scope_p_->elem_b (s)) - error (_f ("unknown paper variable: `%s\'", s)); + error (_f ("unknown paper variable: `%s\'", symbol_to_string (s))); Real * p = scope_p_->elem (s)->access_content_Real (false); if (!p) { - error (_ ("not a real variable")); + error (_("not a real variable")); return 0.0; } @@ -83,13 +99,13 @@ Paper_def::line_dimensions_int (int n) const Real Paper_def::beam_thickness_f () const { - return get_var ("beam_thickness"); +SCMVAR(beam_thickness); } Real Paper_def::linewidth_f () const { - return get_var ("linewidth"); +SCMVAR(linewidth); } Real @@ -131,49 +147,50 @@ Paper_def::set_lookup (int i, Lookup*l) (*lookup_p_tab_p_)[i] = l; } + Real Paper_def::interline_f () const { - return get_var ("interline"); + SCMVAR(interline) } Real Paper_def::rule_thickness () const { - return get_var ("rulethickness"); + SCMVAR(rulethickness); } Real Paper_def::staffline_f () const { - return get_var ("rulethickness"); + SCMVAR(rulethickness) } Real Paper_def::staffheight_f () const { - return get_var ("staffheight"); + SCMVAR(staffheight) } Real Paper_def::interbeam_f (int multiplicity_i) const { if (multiplicity_i <= 3) - return get_var ("interbeam"); + SCMVAR(interbeam) else - return get_var ("interbeam4"); + SCMVAR(interbeam4) } Real Paper_def::internote_f () const { - return get_var ("interline") /2.0 ; + return interline_f () /2.0 ; } Real Paper_def::note_width () const { - return get_var ("notewidth"); +SCMVAR(notewidth) } void @@ -185,8 +202,7 @@ Paper_def::print () const for (Hash_table_iter ai(*lookup_p_tab_p_); ai.ok (); ai++) { - DOUT << "Lookup: " << ai.key () ; - ai.val ()->print (); + DOUT << "Lookup: " << ai.key () << " = " << ai.val ()->font_name_ << '\n'; } DOUT << "}\n"; @@ -215,8 +231,6 @@ Paper_def::reset_default_count() default_count_i_ = 0; } -extern char const* lily_version_number_sz (); - Paper_outputter* Paper_def::paper_outputter_p (Paper_stream* os_p, Header* header_l, String origin_str) const { diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index b023ea14ea..8ad55ac3a1 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -23,6 +23,7 @@ #include "main.hh" #include "scope.hh" #include "identifier.hh" +#include "lily-version.hh" Paper_outputter::Paper_outputter (Paper_stream *s) { @@ -50,12 +51,13 @@ Paper_outputter::output_header () String creator; if (no_timestamps_global_b) - creator = "GNU LilyPond\n"; + creator = gnu_lilypond_str (); else - creator = get_version_str (); + creator = gnu_lilypond_version_str (); + String generate; if (no_timestamps_global_b) - generate = "."; + generate = ".\n"; else { generate = _ (", at "); @@ -167,7 +169,7 @@ Paper_outputter::output_scheme (SCM scm) void Paper_outputter::output_scope (Scope *scope, String prefix) { - for (Dictionary_iter i (*scope); i.ok (); i++) + for (Scope_iter i (*scope); i.ok (); i++) { if (dynamic_cast (i.val ())) { @@ -197,7 +199,7 @@ Paper_outputter::output_version () if (no_timestamps_global_b) id_str += "."; else - id_str += String (", ") + get_version_str (); + id_str += String (", ") + version_str (); output_String_def ( "LilyIdString", id_str); } diff --git a/lily/parser.yy b/lily/parser.yy index 405d9c1e30..50e13b4fa3 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -15,7 +15,6 @@ #include "scalar.hh" #include "translation-property.hh" #include "script-def.hh" -#include "symtable.hh" #include "lookup.hh" #include "misc.hh" #include "my-lily-lexer.hh" @@ -47,7 +46,7 @@ // mmm Mudela_version oldest_version ("1.0.14"); -Mudela_version version ("1.0.14"); +Mudela_version version ("1.0.15"); // needed for bison.simple's malloc() and free() @@ -94,8 +93,6 @@ Paper_def* current_paper = 0; Array *pitch_arr; Array * strvec; Array *intvec; - Atom * symbol; - Box *box; Notename_table *chordmodifiertab; Duration *duration; General_script_def * script; @@ -118,8 +115,6 @@ Paper_def* current_paper = 0; Scalar *scalar; Simultaneous_music *chord; String *string; - Symtable * symtable; - Symtables* symtables; Tempo_req *tempo; Text_def * textdef; Translator* trans; @@ -189,8 +184,6 @@ yylex (YYSTYPE *s, void * v_l) %token SHAPE %token SKIP %token SPANDYNAMIC -%token SYMBOLTABLES -%token TABLE %token TEMPO %token TIME_T %token TIMES @@ -229,7 +222,6 @@ yylex (YYSTYPE *s, void * v_l) %type output_def %type mudela_header mudela_header_body -%type box %type open_request_parens close_request_parens %type sub_quotes sup_quotes %type simple_element request_chord command_element Simple_music Composite_music @@ -241,9 +233,7 @@ yylex (YYSTYPE *s, void * v_l) %type identifier_init simple_identifier_init block_identifier %type steno_duration notemode_duration %type entered_notemode_duration explicit_duration -%type dinterval %type intastint_list int_list -%type symtables symtables_body %type explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch %type steno_tonic_pitch @@ -271,14 +261,11 @@ yylex (YYSTYPE *s, void * v_l) %type