From 9ec565822b6b41cdec6e91b36e78f5ae3aa66e3e Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:46:47 +0000 Subject: [PATCH] lilypond-0.0.72pre --- .dstreamrc | 2 +- .version | 2 +- ANNOUNCE | 2 +- Documentation/INSTALL.pod | 12 +- Documentation/lilygut.pod | 51 ++--- Documentation/other-packages.pod | 26 +-- NEWS | 22 ++- TODO | 9 +- bin/convert-mudela | 11 +- bin/release | 13 +- configure.in | 1 + flower/.version | 2 +- flower/NEWS | 5 + flower/flower-debug.cc | 3 +- init/engraver.ini | 59 ++++++ init/paper.ini | 23 +++ init/paper16.ini | 16 ++ init/symbol.ini | 6 +- init/table16.ini | 163 +++++++++++++++ input/cadenza.ly | 7 +- input/collisions.ly | 6 +- input/header.ly | 2 +- input/kortjakje.ly | 5 +- input/multi.ly | 2 +- input/scales.ly | 38 ++-- input/scsii-menuetto.ly | 8 +- input/slurs.ly | 2 +- input/standchen.ly | 16 +- input/toccata-fuga-E.ly | 2 +- input/twinkle.ly | 4 +- input/wohltemperirt.ly | 4 +- lily/Stable.make | 2 +- lily/bar-grav.cc | 70 +++++++ lily/beam.cc | 33 +++- lily/break.cc | 2 +- lily/clef-grav.cc | 128 ++++++++++++ lily/clef-item.cc | 4 +- lily/collision-grav.cc | 40 ++++ lily/crescendo.cc | 1 + lily/dynamic-grav.cc | 142 +++++++++++++ lily/engraver-group.cc | 297 ++++++++++++++++++++++++++++ lily/engraver.cc | 137 +++++++++++++ lily/global-gravs.cc | 49 +++++ lily/global-translator.cc | 69 +++++++ lily/head-grav.cc | 69 +++++++ lily/identifier.cc | 16 +- lily/include/acceptor.hh | 18 +- lily/include/bar-align-grav.hh | 13 ++ lily/include/bar-grav.hh | 32 +++ lily/include/clef-grav.hh | 41 ++++ lily/include/clef-item.hh | 2 +- lily/include/collision-grav.hh | 25 +++ lily/include/dynamic-grav.hh | 36 ++++ lily/include/engraver-group.hh | 90 +++++++++ lily/include/engraver.hh | 158 +++++++++++++++ lily/include/global-translator.hh | 38 ++++ lily/include/head-grav.hh | 26 +++ lily/include/identifier.hh | 7 +- lily/include/input-engraver.hh | 42 ++++ lily/include/key-grav.hh | 37 ++++ lily/include/key-item.hh | 2 +- lily/include/lily-proto.hh | 44 ++--- lily/include/local-key-grav.hh | 30 +++ lily/include/lookup.hh | 3 +- lily/include/lyric-engraver.hh | 26 +++ lily/include/meter-grav.hh | 36 ++++ lily/include/midi-walker.hh | 109 +++++----- lily/include/music-iterator.hh | 8 +- lily/include/note-column-grav.hh | 37 ++++ lily/include/paper-def.hh | 28 +-- lily/include/rest-collision-grav.hh | 27 +++ lily/include/score-align-grav.hh | 28 +++ lily/include/score-column.hh | 2 +- lily/include/score-elem-info.hh | 2 +- lily/include/score-grav.hh | 60 ++++++ lily/include/score-halign-grav.hh | 23 +++ lily/include/score.hh | 5 +- lily/include/script-grav.hh | 32 +++ lily/include/slur-grav.hh | 33 ++++ lily/include/staff-gravs.hh | 37 ++++ lily/include/staff-info.hh | 2 +- lily/include/staff-sym-grav.hh | 30 +++ lily/include/stem-beam-grav.hh | 40 ++++ lily/include/swallow-grav.hh | 26 +++ lily/include/text-grav.hh | 29 +++ lily/include/tie-grav.hh | 40 ++++ lily/include/translator.hh | 40 ++++ lily/include/voice-gravs.hh | 26 +++ lily/include/voice-group-gravs.hh | 33 ++++ lily/input-engraver.cc | 117 +++++++++++ lily/key-grav.cc | 116 +++++++++++ lily/key-item.cc | 12 +- lily/lexer.l | 6 +- lily/local-key-grav.cc | 107 ++++++++++ lily/lookup.cc | 29 +-- lily/lyric-engraver.cc | 54 +++++ lily/meter-grav.cc | 126 ++++++++++++ lily/music-iterator.cc | 38 ++-- lily/my-lily-lexer.cc | 2 +- lily/note-column-grav.cc | 125 ++++++++++++ lily/paper-def.cc | 77 +++++--- lily/parser.y | 51 ++--- lily/rest-collision-grav.cc | 62 ++++++ lily/score-align-grav.cc | 45 +++++ lily/score-align-gravs.cc | 33 ++++ lily/score-grav.cc | 216 ++++++++++++++++++++ lily/score-halign-grav.cc | 50 +++++ lily/score.cc | 32 ++- lily/script-grav.cc | 89 +++++++++ lily/slur-grav.cc | 104 ++++++++++ lily/staff-gravs.cc | 82 ++++++++ lily/staff-sym-grav.cc | 50 +++++ lily/stem-beam-grav.cc | 175 ++++++++++++++++ lily/swallow-grav.cc | 19 ++ lily/template3.cc | 4 +- lily/template6.cc | 4 +- lily/tex-slur.cc | 18 +- lily/text-grav.cc | 75 +++++++ lily/tie-grav.cc | 124 ++++++++++++ lily/translator.cc | 16 ++ lily/voice-gravs.cc | 27 +++ lily/voice-group-gravs.cc | 62 ++++++ make/Configure_variables.make.in | 1 + make/Targets.make | 5 +- make/Variables.make | 2 +- mf/README | 3 +- mf/musixgen.mf | 11 +- mf/xgreggen.mf | 4 +- 128 files changed, 4786 insertions(+), 373 deletions(-) create mode 100644 init/engraver.ini create mode 100644 init/paper.ini create mode 100644 init/paper16.ini create mode 100644 init/table16.ini create mode 100644 lily/bar-grav.cc create mode 100644 lily/clef-grav.cc create mode 100644 lily/collision-grav.cc create mode 100644 lily/dynamic-grav.cc create mode 100644 lily/engraver-group.cc create mode 100644 lily/engraver.cc create mode 100644 lily/global-gravs.cc create mode 100644 lily/global-translator.cc create mode 100644 lily/head-grav.cc create mode 100644 lily/include/bar-align-grav.hh create mode 100644 lily/include/bar-grav.hh create mode 100644 lily/include/clef-grav.hh create mode 100644 lily/include/collision-grav.hh create mode 100644 lily/include/dynamic-grav.hh create mode 100644 lily/include/engraver-group.hh create mode 100644 lily/include/engraver.hh create mode 100644 lily/include/global-translator.hh create mode 100644 lily/include/head-grav.hh create mode 100644 lily/include/input-engraver.hh create mode 100644 lily/include/key-grav.hh create mode 100644 lily/include/local-key-grav.hh create mode 100644 lily/include/lyric-engraver.hh create mode 100644 lily/include/meter-grav.hh create mode 100644 lily/include/note-column-grav.hh create mode 100644 lily/include/rest-collision-grav.hh create mode 100644 lily/include/score-align-grav.hh create mode 100644 lily/include/score-grav.hh create mode 100644 lily/include/score-halign-grav.hh create mode 100644 lily/include/script-grav.hh create mode 100644 lily/include/slur-grav.hh create mode 100644 lily/include/staff-gravs.hh create mode 100644 lily/include/staff-sym-grav.hh create mode 100644 lily/include/stem-beam-grav.hh create mode 100644 lily/include/swallow-grav.hh create mode 100644 lily/include/text-grav.hh create mode 100644 lily/include/tie-grav.hh create mode 100644 lily/include/translator.hh create mode 100644 lily/include/voice-gravs.hh create mode 100644 lily/include/voice-group-gravs.hh create mode 100644 lily/input-engraver.cc create mode 100644 lily/key-grav.cc create mode 100644 lily/local-key-grav.cc create mode 100644 lily/lyric-engraver.cc create mode 100644 lily/meter-grav.cc create mode 100644 lily/note-column-grav.cc create mode 100644 lily/rest-collision-grav.cc create mode 100644 lily/score-align-grav.cc create mode 100644 lily/score-align-gravs.cc create mode 100644 lily/score-grav.cc create mode 100644 lily/score-halign-grav.cc create mode 100644 lily/script-grav.cc create mode 100644 lily/slur-grav.cc create mode 100644 lily/staff-gravs.cc create mode 100644 lily/staff-sym-grav.cc create mode 100644 lily/stem-beam-grav.cc create mode 100644 lily/swallow-grav.cc create mode 100644 lily/text-grav.cc create mode 100644 lily/tie-grav.cc create mode 100644 lily/translator.cc create mode 100644 lily/voice-gravs.cc create mode 100644 lily/voice-group-gravs.cc diff --git a/.dstreamrc b/.dstreamrc index 8087569c36..0d6086e1ea 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -15,7 +15,7 @@ Idealspacing 0 # yydebug InitParser 1 Parser 1 -InitDeclarations 1 +InitDeclarations 0 Declarations 1 # FlexLexer debug InitLexer 1 diff --git a/.version b/.version index e8b651c3d1..7be2ab2cec 100644 --- a/.version +++ b/.version @@ -1,6 +1,6 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 0 -TOPLEVEL_PATCH_LEVEL = 71 +TOPLEVEL_PATCH_LEVEL = 72 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf diff --git a/ANNOUNCE b/ANNOUNCE index 3c1450f607..96ae973635 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -121,7 +121,7 @@ dynamics (both absolute and hairpin style) clef changes, meter changes, cadenza-mode, key changes, repeat bars [Kudos to the FSF, all linux hackers, and --of course-- especially -GrandMaster Linus T, for the OS-kernel and The Announce :-] +GrandMaster Linus T, for The Kernel and The Announce :-] Han-Wen Nienhuys Jan Nieuwenhuizen diff --git a/Documentation/INSTALL.pod b/Documentation/INSTALL.pod index 23a464b0a4..2fc99a0933 100644 --- a/Documentation/INSTALL.pod +++ b/Documentation/INSTALL.pod @@ -209,7 +209,7 @@ TeX =item * The MusixTeX fonts. (I use those found in MusixTeX T.59). Beware, the -clef symbol has changed position in recent versions of MusixTeX) +clef symbol has changed position in the Egler version, aka. OpusTeX) =back @@ -222,11 +222,13 @@ quality. If you're not discouraged; this is what I type in my xterm: This is what the output looks like over here: - hw:~/musix/spacer$ GNU LilyPond 0.0.60 #8/FlowerLib 1.1.14 #2 - Parsing ... [./input/kortjakje.ly[lots of stuff]] - Setting up requests...Processing requests ...[8][16][24][25] + hw:~/musix/spacer$ lilypond input/kortjakje.ly + GNU LilyPond 0.0.71 #20/FlowerLib 1.1.20 #0 + Parsing ... [/home/hw/share/lilypond/init//symbol.ini <..snip..> + .. .ini]][input/kortjakje.ly] + Creating elements ... Preprocessing elements... - Calculating column positions ... [3][7][12][16][20][25] + Calculating column positions ... [3][8][13][17][21][25] Postprocessing elements... TeX output to lelie.tex ... diff --git a/Documentation/lilygut.pod b/Documentation/lilygut.pod index 52f787c2f7..ef3249ec8a 100644 --- a/Documentation/lilygut.pod +++ b/Documentation/lilygut.pod @@ -36,8 +36,9 @@ to Requests are processed and used to create elements (like balls, stems, slurs etc). This is done by a hierarchy of "brokers" (called -Register), which swallow requests, broadcast them and couple different -elements. +Translators: the ones for paper output are Engravers, for MIDI +Performers), which swallow requests, broadcast them and couple +different elements. In this step data-structures for the next steps are created and filled with data: PScore, PCol. @@ -158,7 +159,7 @@ from the start of its note. Voice group is a (time-dependent) collection of voices which share some characteristics (slurs, stems) at some time. -=head1 Request_register +=head1 Request_engraver In the previous section the idea of Request has been explained, but this only solves one half of the problem. The other half is @@ -176,18 +177,18 @@ should be merged. The slurs OTOH are specific for each voice, so they should not be shared. The judge in this "allocation" problem is Staff (actually, it's child -C). It uses the C to do most of the +C). It uses the C to do most of the work. For each request C queries so-called -Cs if they want to accept a request eg, the -C will accept Cs, and turn down -Cs. If C cannot find a register that wants +Cs if they want to accept a request eg, the +C will accept Cs, and turn down +Cs. If C cannot find a engraver that wants the request, it is junked (with a warning message). -After all requests have been either assigned, or junked, the Register +After all requests have been either assigned, or junked, the Engraver will process the requests (which usually means creating an C or -C). If a C creates something, it tells +C). If a C creates something, it tells C. If all requests have been processed, then each -Register is notified of any created Staff_element. +Engraver is notified of any created Staff_element. =head2 example: @@ -198,15 +199,15 @@ produces: note_request (duration 1/4) stem_request (duration 1/4) -note_request will be taken by a C, stem_request -will be taken by a C. C creates -a C, C creates a C. Both announce -this to the Staff. Staff will tell C about the +note_request will be taken by a C, stem_request +will be taken by a C. C creates +a C, C creates a C. Both announce +this to the Staff. Staff will tell C about the C, which will add the C to the C it just created. To decide on merging, C has grouped several -registers. There are a few groups: +engravers. There are a few groups: =over 4 @@ -214,26 +215,26 @@ registers. There are a few groups: Staff wide, contains - Local_key_register - Bar_register - Key_register - Meter_register - Clef_register + Local_key_engraver + Bar_engraver + Key_engraver + Meter_engraver + Clef_engraver =item * Voice group, contains - Stem_beam_register - Script_register - Text_register + Stem_beam_engraver + Script_engraver + Text_engraver =item * Voice, contains - Slur_register - Notehead_register + Slur_engraver + Notehead_engraver =back diff --git a/Documentation/other-packages.pod b/Documentation/other-packages.pod index 55ecd4c6df..c52c1dbb00 100644 --- a/Documentation/other-packages.pod +++ b/Documentation/other-packages.pod @@ -17,27 +17,23 @@ Rosegarden, http://www.math.bath.ac.uk/~masjpf/rose.html A Notation editor/Sequencer for X (win95 port underway). Outputs musictex. -Common Notation, ftp://ccrma-ftp.stanford.edu/pub/Lisp +Common Notation, http://www-ccrma.stanford.edu/ccrma/Software/cmn/cmn.html A versatile lisp package. Part of the Common Music system. Input is in Lisp. -Vivace, http:// +Vivace, http://www.calband.berkeley.edu/~gmeeker/vivace -A amateurish notation program for TclTk and X +A amateurish notation program for TclTk and X. MPP, http://www.stack.nl/~hanwen/mpp-english.html A preprocessor to MusixTeX by Jan Nieuwenhuizen and Han-Wen Nienhuys. It is outdated by its successor, LilyPond. -Music, http:// +Music, http://www.cs.nott.ac.uk/Departement/Staff/ef/printing.html A TROFF preprocessor by Eric Foxley -MusicEase, ftp://ftp.secret.com/ad-ftp - -Described in Computer vol 29(6) - MusE A-R Music Engraving, by A-R Editions, Inc. Professional engraving on @@ -46,7 +42,7 @@ Sun boxen. Mup, http://www.arkkra.com/ A program which creates PS from a script input. Although it comes with -C source code, it is Shareware ($ 29). +C source code, it is Shareware. PMX, http://www.gmd.de/Misc/Music/ @@ -63,7 +59,7 @@ ABC2MTeX, http://www.gmd.de/Misc/Music/ A preprocessor to MusixTeX by Chris Walshaw for way of transcribing folk and traditional music. -SceX +SceX http://www.ncc.up.pt/~mig/SceX.html A preprocessor to MusixTeX by Miguel Filgueiras. Source in prolog available on request. (?) @@ -78,10 +74,14 @@ Schofer & Andrea Steinbach. With some fonts Calliope, http://www.cl.cam.ac.uk/users/wfc/ -A NeXT package by William F Clocksin. Requires Adobe fonts +A NeXT package by William F Clocksin. Requires Adobe fonts. =head2 Proprietary +MusicEase, http://mesa.colorado.edu/~grader/musicez.html + +Described in Computer vol 29(6). Shareware + LIME, http://datura.cerl.uiuc.edu/ Sibelius, http://www.acorn.co.uk/developers/sibelius @@ -92,9 +92,9 @@ Score Personal Composer -Mozart, +Mozart, http://www.mozart.co.uk/ -A shareware windows package, +A shareware windows package Capella diff --git a/NEWS b/NEWS index 78e451c794..71128cd93f 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,22 @@ +july 2 +pl 72pre + - paper{} syntax: var = 1.0\pt;, with an Assoc array + - sketch of MIDI Performer classes. + - bf: memleak in parser + - naming: Acceptor -> Translator + - input: bf collisions.ly, scales.ly + - bf: [r8 c8] + - naming: Register -> Engraver + - force \\ on identifiers + - doco updates + - musixtex T73 fonts + +pl 70.mb + - bf: find syntax in Variables.make +***** +july 1 pl 71pre + - nested \melodic and \lyric constructs - init id's, Input_register aliases. - bf: notehead x-swap - bf: auto-keys. @@ -14,6 +32,8 @@ pl 71pre ****** june 30 + + pl 70pre - bf: text Script - bf: Script::dir_i_ checks. @@ -190,7 +210,7 @@ pl 63 - accumulate \kern in TeX output. - bf: try to prevent long lines; TeX breaks on them. - naming: Pointer->Link, IPointer->Pointer - - undocced fix (MB) + - bf: \plet didn't work (MB) - GMP manifesto. pl 61.jcn4 diff --git a/TODO b/TODO index 1b65c99ac0..cd3a973460 100644 --- a/TODO +++ b/TODO @@ -71,7 +71,7 @@ PROJECTS - separate visual from rhythmic info even more - beams over bars - * Redo MIDI output to use Registers: (Difficult) + * Redo MIDI output to use Translators - remember more horizontal info than melodics: - tempo change - repeat @@ -88,7 +88,7 @@ PROJECTS read AFM/TFM directly, for text too) * lines: - - Ledger lines, should be separate item: Ledger_lines, Ledger_lines_reg + - Ledger lines, should be separate item: Ledger_lines, Ledger_lines - set different line sizes / thicknesses - stem down too far right - beam stem showthrough, inter beam sizes (french vs german style) @@ -323,7 +323,8 @@ IDEAS * use an embedded language: Python for: - Score_elems - - Registers + - Engraver + - Translators - Complex mudela? * y -dims in internote? @@ -361,3 +362,5 @@ IDEAS * move towards incremental algorithms. + + * design meta-language like TeX and Metafont diff --git a/bin/convert-mudela b/bin/convert-mudela index 744059c67c..000f5059cb 100644 --- a/bin/convert-mudela +++ b/bin/convert-mudela @@ -87,7 +87,7 @@ sub convert_0_0_57_to_0_0_58 s/\[ *([^\[\]]*)\] *([1-9]*) *\/ *([1-9]*)/[$2\/$3 $1]1\/1/g; } -sub convert_0_0_58_to_0_0_58 +sub convert_0_0_58_to_0_0_59 { die "Not smart enough to convert 0.0.58 to 0.0.59\n"; } @@ -99,6 +99,12 @@ sub convert_0_0_59_to_0_0_60 s/(\\tempo [0-9: ]+)/$1;/; } +sub convert_0_0_60_to_0_0_61 +{ + s/(\\unitspace|\\geometric|\\width)/$1=/g; + +} + ############################################################### sub last_conversion @@ -137,7 +143,8 @@ my %minor_conversions = ("0.0.50" => \&no_conv, "0.0.57" => \&convert_0_0_56_to_0_0_57, "0.0.58" => \&convert_0_0_57_to_0_0_58, "0.0.59" => \&convert_0_0_58_to_0_0_59, - "0.0.60" => \&convert_0_0_59_to_0_0_60 + "0.0.60" => \&convert_0_0_59_to_0_0_60, + "0.0.61" => \&convert_0_0_60_to_0_0_61 ); diff --git a/bin/release b/bin/release index 58de89b692..0cd180d68b 100755 --- a/bin/release +++ b/bin/release @@ -11,12 +11,13 @@ fi function setversion() { eval `sed -n 's/^\([A-Z_]*\) *= *\(.*\)$/\1=\2/p' .version` + MJ=$TOPLEVEL_MAJOR_VERSION MI=$TOPLEVEL_MINOR_VERSION PA=$TOPLEVEL_PATCH_LEVEL MP=$TOPLEVEL_MY_PATCH_LEVEL NEWVER=$MJ.$MI.$PA$MP -if [ -z $MP -o x$MP = xpre ] +if [ x$MP = x -o x$MP = xpre ] then LASTVER=$MJ.$MI.`expr $PA - 1` @@ -35,7 +36,11 @@ echo heredir=`pwd` releasedir=`pwd`/../releases patchdir=`pwd`/../patches -make dist; +MAKE=${MAKE:-"make"} +TAR=${TAR:-"tar"} + + +$MAKE dist; setversion LILYVER=$NEWVER @@ -63,6 +68,6 @@ ln $patchdir//$patch . if [ ! -z "$RPMS" ]; then RPMS="lilypond-$LILYVER-1.i386.rpm lilypond-$LILYVER-1.src.rpm" fi -tar cf updeet $tarball $patch $RPMS -tar tfv updeet +$TAR cf updeet $tarball $patch $RPMS +$TAR tfv updeet diff --git a/configure.in b/configure.in index 9cffeaeae8..5fbb758a3e 100644 --- a/configure.in +++ b/configure.in @@ -158,6 +158,7 @@ CXXFLAGS=${CXXFLAGS:-""} # we don't want -g -O junk AC_PROG_CXX AC_PROG_RANLIB AC_PROG_INSTALL +AC_CHECK_PROGS(TAR, tar, error) AC_CHECK_PROGS(FIND, find, error) dnl should check out -print diff --git a/flower/.version b/flower/.version index 7a6f85cea4..4575a2e82a 100644 --- a/flower/.version +++ b/flower/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 20 +PATCH_LEVEL = 21 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/NEWS b/flower/NEWS index a642a93eba..40740f0bb1 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,4 +1,9 @@ version 1.1: + +pl 21: +pl 20.mb + - bf: Warning about NPRINT only if debugging requested. + pl 20 - List::junk_links() pl 19 diff --git a/flower/flower-debug.cc b/flower/flower-debug.cc index 702304e71f..7e0e519f57 100644 --- a/flower/flower-debug.cc +++ b/flower/flower-debug.cc @@ -13,7 +13,8 @@ Dstream *flower_dstream = &default_flower_stream; void set_flower_debug(Dstream&ds, bool b) { #ifdef NPRINT - cout << "Debug printout disabled, see the installation guide." << endl; + if (b) + cout << "Debug printout disabled, see the installation guide." << endl; #endif flower_check_debug = b; flower_dstream = &ds; diff --git a/init/engraver.ini b/init/engraver.ini new file mode 100644 index 0000000000..086e378ae1 --- /dev/null +++ b/init/engraver.ini @@ -0,0 +1,59 @@ +% +% setup for Request->Element conversion. Guru-only +% + +\requestengraver { + "Score_engraver" + \alias "Score"; +% \consists "Score_bar_engraver"; + \consists "Bar_align_engraver"; + \consists "Clef_align_engraver"; + \consists "Key_align_engraver"; + \consists "Meter_align_engraver"; + \consists "Score_horizontal_align_engraver"; + + \contains\requestengraver { + "Staff_engravers" + \alias "Staff"; + \consists "Bar_engraver"; + \consists "Clef_engraver"; + \consists "Key_engraver"; + \consists "Meter_engraver"; + \consists "Local_key_engraver"; + \consists "Staff_sym_engraver"; + \consists "Collision_engraver"; + \consists "Rest_collision_engraver"; + \contains \requestengraver { + "Voice_group_engravers" + \alias "Voice_group"; + \consists "Dynamic_engraver"; + \consists "Stem_beam_engraver"; + \consists "Script_engraver"; + \consists "Note_column_engraver"; + \consists "Slur_engraver"; + \contains \requestengraver { + "Voice_engravers" + \alias "Voice"; + \consists "Note_head_engraver" ; + \consists "Tie_engraver"; + } + } + } + + \contains\requestengraver { + "Staff_engravers" + \alias "Lyric"; + \contains\requestengraver{ + "Voice_group_engravers" + \alias "Voice_group"; + \contains\requestengraver{ + "Voice_engravers" + \consists "Lyric_engraver"; + \consists "Swallow_engraver"; + } + } + } +} + + + diff --git a/init/paper.ini b/init/paper.ini new file mode 100644 index 0000000000..1c15975a9e --- /dev/null +++ b/init/paper.ini @@ -0,0 +1,23 @@ + + [todo] + * runtime + +%{ "french" style: interbeam = intenote; + "german" style: interbeam = 2/3 * interline +%} + as lily's style is currently german, we'll hardcode german style + */ + // it seems that "interline" means _between_ lines +// return ball(4).dim.y.length() * 2 / 3; + return ball(4).dim.y.length() * 2 / 3 + 0.4; //ugh +} +\include "table_sixteen.ini" + +default_paper = paper { + linewidth = 15 \cm; + rule_thickness = 0.4\pt; + interline = 4\pt; + notewidth = 4\pt; + interbeam = 7\pt; + \symboltables { \table_sixteen } +} diff --git a/init/paper16.ini b/init/paper16.ini new file mode 100644 index 0000000000..7854e3850a --- /dev/null +++ b/init/paper16.ini @@ -0,0 +1,16 @@ + +\include "table16.ini" + +default_paper = \paper { + linewidth = 15.0 \cm; + rule_thickness = 0.4\pt; + interline = 4.\pt; + notewidth = 4.0\pt; + wholewidth = 5.\pt; + unitspace = 30.\pt; + + % + interbeam = 2.667\pt; + geometric = 1.414; + \symboltables { \table_sixteen } +} diff --git a/init/symbol.ini b/init/symbol.ini index df9c040652..bb067af6b2 100644 --- a/init/symbol.ini +++ b/init/symbol.ini @@ -1,9 +1,9 @@ -\version "0.0.60"; +\version "0.0.61"; -\include "register.ini" +\include "engraver.ini" \include "dynamic.ini" \include "dutch.ini" % do not include init/ path \include "script.ini" -\include "table_sixteen.ini" +\include "paper16.ini" diff --git a/init/table16.ini b/init/table16.ini new file mode 100644 index 0000000000..62abd29e37 --- /dev/null +++ b/init/table16.ini @@ -0,0 +1,163 @@ +% +% spacing info for LilyPond. Do not edit this if you're not a guru. +% It has a lot of hard-wired stringconstants +% + + +table_sixteen= +\symboltables { + + \texid "\input lilyponddefs \musixsixteendefs" + + % index TeXstring, xmin xmax ymin ymax + + "scripts" = \table { + "fermata" "\fermata" 0.0\pt 0.0\pt 0.0\pt 6.0\pt + "-fermata" "\ifermata" 0.0\pt 0.0\pt -6.0\pt 0.0\pt + "portato" "\portato" 0.0\pt 4.0\pt 0.0\pt 2.0\pt + "-portato" "\iportato" 0.0\pt 4.0\pt -2.0\pt 0.0\pt + "tenuto" "\tenuto" 0.0\pt 4.0\pt -1.0\pt 1.0\pt + "-tenuto" "\itenuto" 0.0\pt 4.0\pt -1.0\pt 1.0\pt + "sforzato" "\sforzato" -0.8\pt 4.0\pt -1.92\pt 1.92\pt + "marcato" "\marcato" 0.0\pt 4.0\pt 0.0\pt 4.0\pt + "-marcato" "\imarcato" 0.0\pt 4.0\pt -4.0\pt 0.0\pt + "staccato" "\staccato" 0.0\pt 0.0\pt -1.1\pt 1.1\pt + "staccatissimo" "\staccatissimo" 0.0\pt 0.0\pt 0.0\pt 1.0\pt + "-staccatissimo" "\istaccatissimo" 0.0\pt 0.0\pt 0.0\pt 1.0\pt + "upbow" "\upbow" -1.0\pt 6.0\pt 0.0\pt 5.0\pt + "downbow" "\downbow" 0.0\pt 5.0\pt 0.0\pt 7.5\pt + "back" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt + "-front" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt + "heel" "\heel" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "toe" "\toe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "bheel" "\bheel" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "btoe" "\btoe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "fheel" "\fheel" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "ftoe" "\ftoe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt + "-back" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt + "front" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt + } + + "style" = \table { + "roman" "\settext{%}" 0.0\pt 5.0\pt 0.0\pt 8.0\pt + "italic" "\setitalic{%}" 0.0\pt 0.0\pt 0.0\pt 8.0\pt + "dynamic" "\setdynamic{%}" 0.0\pt 0.0\pt 0.0\pt 8.0\pt + } + "dynamics" = \table { + + "mf" "\dynmf" + "fff" "\dynfff" + "ff" "\dynff" + "f" "\dynf" + "mp" "\dynmp" + "p" "\dynp" + "pp" "\dynpp" + "ppp" "\dynppp" + + } + "align" = \table { + "-1" "\leftalign{%}" + "0" "\centeralign{%}" + "1" "\rightalign{%}" + } + + "clefs" = \table { + "violin" "\violinclef" 0.0\pt 12.8\pt -10.0\pt 18.0\pt + "bass" "\bassclef" 0.0\pt 12.8\pt 0.0\pt 16.0\pt + "alto" "\altoclef" 0.0\pt 12.8\pt 0.0\pt 16.0\pt + "tenor" "\altoclef" 0.0\pt 12.8\pt 0.0\pt 16.0\pt + "violin_change" "\cviolinclef" 0.0\pt 11.2\pt -12.0\pt 12.0\pt + "bass_change" "\cbassclef" 0.0\pt 11.2\pt 0.0\pt 16.0\pt + "alto_change" "\caltoclef" 0.0\pt 11.2\pt 0.0\pt 16.0\pt + "tenor_change" "\caltoclef" 0.0\pt 11.2\pt 0.0\pt 16.0\pt + } + + "balls" = \table { + "1" "\wholeball" 0.0\pt 6.0\pt -2.0\pt 2.0\pt + "2" "\halfball" 0.0\pt 5.0\pt -2.0\pt 2.0\pt + "4" "\quartball" 0.0\pt 5.0\pt -2.0\pt 2.0\pt + } + + "slur" = \table { + "whole" "\slurchar%{%}" + "half" "\hslurchar%{%}" + } + "accidentals" = \table { + "-2" "\flatflat" 0.0\pt 8.16\pt -2.5\pt 7.5\pt + "-1" "\flat" 0.0\pt 4.8\pt -2.5\pt 7.5\pt + "0" "\natural" 0.0\pt 4.8\pt -7.5\pt 7.5\pt + "1" "\sharp" 0.0\pt 3.6\pt -7.5\pt 7.5\pt + "2" "\sharpsharp" 0.0\pt 4.8\pt -2.5\pt 7.5\pt + } + + "streepjes" = \table { + "toplines" "\toplines{%}" -1.0\pt 7.0\pt 0.0\pt 0.0\pt + "botlines" "\botlines{%}" -1.0\pt 7.0\pt 0.0\pt 0.0\pt + } + + "bars" = \table { + "empty" "\emptybar" + "|" "\maatstreep" 0.0\pt 0.64\pt -8.0\pt 8.0\pt + "||" "\doublebar" 0.0\pt 4.0\pt -8.0\pt 8.0\pt + "|." "\finishbar" -4.0\pt 0.0\pt -8.0\pt 8.0\pt + ":|" "\repeatbar" -4.0\pt 0.0\pt -8.0\pt 8.0\pt + "|:" "\startrepeat" 0.0\pt 4.0\pt -8.0\pt 8.0\pt + ":|:" "\repeatbarstartrepeat" 0.0\pt 16.0\pt -8.0\pt 8.0\pt + + } + + "rests" = \table { + "1o" "\outsidewholerest" 0.0\pt 6.0\pt 0.0\pt 2.0\pt + "1" "\wholerest" 0.0\pt 6.0\pt 0.0\pt 2.0\pt + "2" "\halfrest" 0.0\pt 6.0\pt -2.0\pt 0.0\pt + "2o" "\outsidehalfrest" 0.0\pt 6.0\pt -2.0\pt 0.0\pt + "4" "\quartrest" -5.0\pt 2.0\pt -5.0\pt 5.0\pt + "8" "\eighthrest" 0.0\pt 5.0\pt 0.0\pt 8.0\pt + "16" "\sixteenthrest" 0.0\pt 6.0\pt 0.0\pt 12.0\pt + "32" "\thirtysecondrest" 0.0\pt 6.0\pt 0.0\pt 16.0\pt + "64" "\sixtyfourthrest" 0.0\pt 6.0\pt 0.0\pt 16.0\pt + "128" "\hundredtwentyeighthrest" 0.0\pt 6.0\pt 0.0\pt 16.0\pt + } + + "meters" = \table { + "C" "\fourfourmeter" 0.0\pt 10.0\pt -5.0\pt 5.0\pt + "C2" "\allabreve" 0.0\pt 10.0\pt -5.0\pt 5.0\pt + } + + % dims ignored for this table + "param" = \table { + "meter" "\generalmeter{%}{%}" 0.0\pt 10.0\pt -5.0\pt 5.0\pt + "linestaf" "\linestafsym{%}{%}" + "stem" "\stem{%}{%}" + "fill" "\hbox{}" + % ugh. 8pt + "crescendosym" "\crescendosym{%}" 0.0\pt 0.0\pt -3.0\pt 3.0\pt + "decrescendosym" "\decrescendosym{%}" 0.0\pt 0.0\pt -3.0\pt 3.0\pt + } + + "dots" = \table { + "1" "\lsingledot" 0.0\pt 2.0\pt -1.0\pt 1.0\pt + "2" "\ldoubledot" 0.0\pt 5.0\pt -1.0\pt 1.0\pt + "3" "\ltripledot" 0.0\pt 8.0\pt -1.0\pt 1.0\pt + } + + "flags" = \table { + "8" "\eighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "16" "\sixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "32" "\thirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "64" "\sixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "128" "\hundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-8" "\deighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-16" "\dsixteenthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-32" "\dthirtysecondflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-64" "\dsixtyfourthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + "-128" "\dhundredtwentyeighthflag" 0.0\pt 4.0\pt 0.0\pt 0.0\pt + } + + "beamslopes" = \table { + "slope" "\beamslope{%}{%}" + "horizontal" "\rulesym{%}{%}" + } + +} + diff --git a/input/cadenza.ly b/input/cadenza.ly index 3bdc51e5a3..90f7c45c8f 100644 --- a/input/cadenza.ly +++ b/input/cadenza.ly @@ -10,7 +10,7 @@ EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; cad = \melodic { @@ -59,7 +59,8 @@ cad = \melodic { \melodic{ \cad } \paper { - \unitspace 14.0\mm; - \geometric 1.4;} + unitspace= 14.0\mm; + geometric= 1.4; + } % \midi { \tempo 4:90 } } diff --git a/input/collisions.ly b/input/collisions.ly index de6805fed9..fa1c3f71c0 100644 --- a/input/collisions.ly +++ b/input/collisions.ly @@ -10,7 +10,7 @@ Tested Features:test the Collision resolution EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; @@ -52,7 +52,7 @@ rests = \melodic } { \stem -1; [c8 d e f] [g a b c'] - r r r r r r r r r + r r r r r r r r } > @@ -66,7 +66,7 @@ restsII = \melodic { { \stem 1; r r r r r r r r r r r r } { \stem -1; c d e f g a b c' d' e' f' g' } > - r8 + r8 r4 < \multi2; r8 r8 > < \multi2; r8 r8 r8 > < \multi2; r8 r8 r8 r8 > diff --git a/input/header.ly b/input/header.ly index e983bcb8df..f7ab263e0a 100644 --- a/input/header.ly +++ b/input/header.ly @@ -10,4 +10,4 @@ Tested Features: EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; diff --git a/input/kortjakje.ly b/input/kortjakje.ly index 91e733abe3..16099a6ec9 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -10,7 +10,7 @@ Tested Features: example file with comments EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; % the % is a comment. @@ -63,8 +63,5 @@ begeleiding = \melodic{ \melodie \begeleiding > - \paper{ - \unitspace 2.5\cm; % a whole note takes 2.5 \cm ideally. - } } diff --git a/input/multi.ly b/input/multi.ly index caafc66d16..275db41102 100644 --- a/input/multi.ly +++ b/input/multi.ly @@ -12,7 +12,7 @@ EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; \score{ \melodic diff --git a/input/scales.ly b/input/scales.ly index 7f7b935fcb..c1f32c13bc 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -2,7 +2,7 @@ % scales with accents. % -\version "0.0.60"; +\version "0.0.61"; blah = \melodic { \meter 6/8; \octave 'c ; @@ -14,21 +14,31 @@ blah = \melodic { \octave c' ; \transpose d { e f } \octave c'' ; - c d - \duration 8 ; + c4. d %ugr - |[6/9 a \< a a a a a a \! a a \ff \> ]1/1 + |[6/9 a8 \< a a a a a a \! a a \ff \> ]1/1 | \octave c' ; - |[6/9 a a a a a a a a \! a ]1/1 + |[6/9 a a a a a a a a \! a ]1/1 | \octave c'' ; + + [6/9'c->-.-\fermata \< 'g->-.-\fermata + d->-.-\fermata a->-.-\fermata + e'->-.-\fermata b'-. f''-. c'''->-.-\fermata + \! g'''->-.-\fermata \> ]1/1 - ['c->-.-\fermata \< 'g->-.-\fermata d->-.-\fermata a->-.-\fermata - e'->-.-\fermata b'-. f''-. c'''->-.-\fermata \! g'''->-.-\fermata \> ]6/9 - [6/9 g'''->-.-\fermata c'''->-.-\fermata f''->-.-\fermata b'->-.-\fermata e'->-.-\fermata a->-.-\fermata d->-.-\fermata 'g->-.-\fermata \! 'c->-.-\fermata ]1/1 + [6/9 g'''->-.-\fermata c'''->-.-\fermata + f''->-.-\fermata b'->-.-\fermata e'->-.-\fermata + a->-.-\fermata d->-.-\fermata 'g->-.-\fermata \! + 'c->-.-\fermata ]1/1 \octave c; - ['c->-.-\fermata \< 'g->-.-\fermata d->-.-\fermata a->-.-\fermata - e'->-.-\fermata b'-. f''-. c'''->-.-\fermata \! g'''->-.-\fermata \> ]6/9 - [6/9 g'''->-.-\fermata c'''->-.-\fermata f''->-.-\fermata b'->-.-\fermata e'->-.-\fermata a->-.-\fermata d->-.-\fermata 'g->-.-\fermata \! 'c->-.-\fermata ]1/1 + [6/9'c->-.-\fermata \< 'g->-.-\fermata d->-.-\fermata + a->-.-\fermata + e'->-.-\fermata b'-. f''-. + c'''->-.-\fermata \! g'''->-.-\fermata \> ]1/1 + [6/9 g'''->-.-\fermata c'''->-.-\fermata + f''->-.-\fermata b'->-.-\fermata e'->-.-\fermata + a->-.-\fermata d->-.-\fermata + 'g->-.-\fermata \! 'c->-.-\fermata ]1/1 \octave c' ; \octave c' ; [2/3 c g d' ]1/1 @@ -42,7 +52,7 @@ blah = \melodic { [2/3 g' c' f ]1/1 [2/3 g' c' f ]1/1 \meter 4/4; - + c1 \duration 8; r8-"text" r8^. r8_. r8 r8 r8 r8 r8 @@ -66,7 +76,7 @@ c1 \score{ \melodic {\blah} \paper{ - \unitspace 1.5 \cm; - \geometric 1.4; + unitspace= 1.5 \cm; + geometric= 1.4; } } diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly index 1af7644ba5..8f4b5daa77 100644 --- a/input/scsii-menuetto.ly +++ b/input/scsii-menuetto.ly @@ -13,7 +13,7 @@ EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; %% Stuff from MPP version % \lefttitle{Menuetto} @@ -103,9 +103,9 @@ IImenuetto = \melodic{ \score{ \melodic { \IImenuetto } \paper{ - \width 195.0\mm; - \unitspace 9.0\mm ;% to get lily to use only three lines - \geometric 1.40; + width= 195.0\mm; + unitspace= 9.0\mm ;% to get lily to use only three lines + geometric= 1.40; \output "scsii-menuetto.out"; } \midi{ diff --git a/input/slurs.ly b/input/slurs.ly index 8da7292ed5..29ad8cf5c0 100644 --- a/input/slurs.ly +++ b/input/slurs.ly @@ -11,7 +11,7 @@ EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; \score{ \melodic{\octave c'; diff --git a/input/standchen.ly b/input/standchen.ly index a4dd55c3fd..516a503309 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -13,7 +13,7 @@ EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; commands = \melodic{ \skip 2.*4; @@ -29,7 +29,7 @@ commands = \melodic{ melodie = \melodic{ \meter 3/4; - \clef\violin; + \clef "violin"; \key bes; \octave c'; \duration 8; @@ -184,7 +184,7 @@ melodie = \melodic{ begeleiding = \melodic{ \meter 3/4; - \clef\bass; + \clef"bass"; \key bes; \octave c'; \duration 2; @@ -466,19 +466,19 @@ tekstII = \lyric{ \score{ < \multi 3; - { \id "Lyric" "1"; tekstI } % ugh - { \id "Lyric" "2"; tekstII } + { \id "Lyric" "1"; \tekstI } % ugh + { \id "Lyric" "2"; \tekstII } \melodic < \melodie \commands > \melodic <\begeleiding \commands > > \paper{ - \width 195.\mm; + width= 195.\mm; % on two pages... - \unitspace 9.\mm; - \geometric 1.2; + unitspace= 9.\mm; + geometric= 1.2; \output "standchen.out"; } \midi{ diff --git a/input/toccata-fuga-E.ly b/input/toccata-fuga-E.ly index f34df19761..b912fb5f0b 100644 --- a/input/toccata-fuga-E.ly +++ b/input/toccata-fuga-E.ly @@ -20,7 +20,7 @@ EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; toccata_commands = \melodic{ \meter 4/4; diff --git a/input/twinkle.ly b/input/twinkle.ly index fb986f1ae4..e3f0619b63 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -14,7 +14,7 @@ Tested Features: lyrics EndMudelaHeader %} -\version "0.0.60"; +\version "0.0.61"; melody = \melodic{ \clef\violin; @@ -124,7 +124,7 @@ textiii = \lyric{ \melodic < \global \accompany > > \paper{ - \unitspace 2.5\cm; + unitspace= 2.5\cm; } \midi{ \tempo 4:120 ; diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly index ff2f0a6ef9..89970f8776 100644 --- a/input/wohltemperirt.ly +++ b/input/wohltemperirt.ly @@ -1,7 +1,7 @@ %{ title: Das Wohltemperirte Clavier I, Fuga II (c-minor) description: following Henle's Urtext - composer(s): JS Bach + composer(s): J.S. Bach entered-by: HWN and Werner Lemberg copyright: Public Domain @@ -9,7 +9,7 @@ %} -\version "0.0.60"; +\version "0.0.61"; % should add \need{dutch.ini} for % correct parsing of note names diff --git a/lily/Stable.make b/lily/Stable.make index 3d50ce8261..71e49f46c8 100644 --- a/lily/Stable.make +++ b/lily/Stable.make @@ -7,4 +7,4 @@ stablecc=atom.cc command-request.cc musical-request.cc bar.cc boxes.cc \ paper-def.cc parser.cc lexer.cc qlp.cc qlpsolve.cc\ template1.cc template2.cc template3.cc template4.cc\ template5.cc template6.cc version.cc tex-stream.cc tex.cc\ - identifier.cc note.cc voice-regs.cc\ + identifier.cc note.cc voice-gravs.cc\ diff --git a/lily/bar-grav.cc b/lily/bar-grav.cc new file mode 100644 index 0000000000..4282803b05 --- /dev/null +++ b/lily/bar-grav.cc @@ -0,0 +1,70 @@ +/* + bar-reg.cc -- implement Bar_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "bar-grav.hh" +#include "bar.hh" +#include "command-request.hh" +#include "time-description.hh" + +Bar_engraver::Bar_engraver() +{ + do_post_move_processing(); +} + +bool +Bar_engraver::do_try_request(Request*r_l) +{ + Command_req* c_l = r_l->command(); + if (!c_l|| !c_l->bar()) + return false; + Bar_req * b= c_l->bar(); + if (bar_req_l_ && bar_req_l_->compare(*b)) + return false; + + bar_req_l_ = b; + + return true; +} + +void +Bar_engraver::do_process_requests() +{ + if (bar_req_l_ ) { + bar_p_ = new Bar; + bar_p_->type_str_=bar_req_l_->type_str_; + } else if (!get_staff_info().time_C_->whole_in_measure_) { + bar_p_ = new Bar; + } + + if (bar_p_){ + announce_element(Score_elem_info(bar_p_, bar_req_l_) ); + } +} + + +void +Bar_engraver::do_pre_move_processing() +{ + if (bar_p_) { + typeset_breakable_item(bar_p_); + bar_p_ =0; + } +} + +void +Bar_engraver::do_post_move_processing() +{ + bar_req_l_ = 0; + bar_p_ =0; +} + +IMPLEMENT_STATIC_NAME(Bar_engraver); +IMPLEMENT_IS_TYPE_B1(Bar_engraver,Request_engraver); +ADD_THIS_ENGRAVER(Bar_engraver); + + diff --git a/lily/beam.cc b/lily/beam.cc index 9902998235..9e9f30eaff 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -1,7 +1,7 @@ /* beam.cc -- implement Beam - source file of the GNU GNU LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys @@ -69,7 +69,6 @@ Stem_info::Stem_info(Stem const *s) // huh? why do i need the / 2 // Real interbeam_f = s->paper()->interbeam_f(); Real interbeam_f = s->paper()->interbeam_f() / 2; - Real interline_f = s->paper()->interline_f(); /* well eh, huh? idealy_f_ = dir_i_ * s->stem_start_f() + beams_i_ * interbeam_f; @@ -169,14 +168,23 @@ Beam::solve_slope() Stem_info info(i); sinfo.push(info); } - Real leftx = sinfo[0].x; - Least_squares l; - for (int i=0; i < sinfo.size(); i++) { - sinfo[i].x -= leftx; - l.input.push(Offset(sinfo[i].x, sinfo[i].idealy_f_)); - } + if (! sinfo.size() ) + slope = left_pos = 0; + else if (sinfo.size() == 1) { + slope = 0; + left_pos = sinfo[0].idealy_f_; + } else { + + Real leftx = sinfo[0].x; + Least_squares l; + for (int i=0; i < sinfo.size(); i++) { + sinfo[i].x -= leftx; + l.input.push(Offset(sinfo[i].x, sinfo[i].idealy_f_)); + } - l.minimise(slope, left_pos); + l.minimise(slope, left_pos); + } + Real dy = 0.0; for (int i=0; i < sinfo.size(); i++) { Real y = sinfo[i].x * slope + left_pos; @@ -189,7 +197,12 @@ Beam::solve_slope() left_pos *= dir_i_; slope *= dir_i_; - slope = 0.6 * tanh(slope); // damping + + /* + This neat trick is by Werner Lemberg, damped = tanh(slope) corresponds + with some tables in [Wanske] + */ + slope = 0.6 * tanh(slope); // ugh Real sl = slope*paper()->internote_f(); diff --git a/lily/break.cc b/lily/break.cc index 1513046a91..0f0aabe681 100644 --- a/lily/break.cc +++ b/lily/break.cc @@ -74,7 +74,7 @@ Break_algorithm::solve_line(Line_of_cols curline) const Break_algorithm::Break_algorithm(PScore&s) :pscore_(s) { - linelength = s.paper_l_->linewidth; + linelength = s.paper_l_->linewidth_f(); } bool diff --git a/lily/clef-grav.cc b/lily/clef-grav.cc new file mode 100644 index 0000000000..ab5177674a --- /dev/null +++ b/lily/clef-grav.cc @@ -0,0 +1,128 @@ +/* + clef.cc -- implement Clef_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys , + Mats Bengtsson +*/ + +#include "bar.hh" +#include "clef-grav.hh" +#include "clef-item.hh" +#include "debug.hh" +#include "command-request.hh" +#include "time-description.hh" + +Clef_engraver::Clef_engraver() +{ + clef_p_ = 0; + clef_req_l_ =0; + + set_type("violin"); +} + +bool +Clef_engraver::set_type(String s) +{ + clef_type_str_ = s; + if (clef_type_str_ == "violin") { + c0_position_i_= -2; + } else if (clef_type_str_ == "alto") { + c0_position_i_= 4; + } else if (clef_type_str_ == "tenor") { + c0_position_i_= 6; + } else if (clef_type_str_ == "bass") { + c0_position_i_= 10; + } else + return false; + + return true; +} + +void +Clef_engraver::fill_staff_info(Staff_info &i) +{ + i.c0_position_i_l_ = &c0_position_i_; +} + +void +Clef_engraver::read_req(Clef_change_req*c_l) +{ + if (!set_type(c_l->clef_str_)) + c_l->error("unknown clef type "); +} +void +Clef_engraver::acknowledge_element(Score_elem_info info) +{ + if (info.elem_l_->name() == Bar::static_name() ) { + create_clef(); + if ( !clef_req_l_ ) + clef_p_->default_b_ = true; + } +} + +void +Clef_engraver::do_creation_processing() +{ + create_clef(); + clef_p_->default_b_ = false; +} + +bool +Clef_engraver::do_try_request(Request * r_l) +{ + Command_req* creq_l= r_l->command(); + if (!creq_l || !creq_l->clefchange()) + return false; + + clef_req_l_ = creq_l->clefchange(); + + read_req(clef_req_l_); + return true; +} + +void +Clef_engraver::create_clef() +{ + if (!clef_p_) { + clef_p_ = new Clef_item; + announce_element(Score_elem_info(clef_p_,clef_req_l_)); + } + clef_p_->read(*this); +} + +void +Clef_engraver::do_process_requests() +{ + if (clef_req_l_) { + create_clef(); + clef_p_->default_b_ = false; + } +} + +void +Clef_engraver::do_pre_move_processing() +{ + if (!clef_p_) + return; + typeset_breakable_item(clef_p_); + clef_p_ = 0; +} + +void +Clef_engraver::do_post_move_processing() +{ + clef_req_l_ = 0; +} + +void +Clef_engraver::do_removal_processing() +{ + delete clef_p_; + clef_p_ =0; +} + +IMPLEMENT_STATIC_NAME(Clef_engraver); +IMPLEMENT_IS_TYPE_B1(Clef_engraver,Request_engraver); +ADD_THIS_ENGRAVER(Clef_engraver); diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 626cfe64be..7e399f37c3 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -11,7 +11,7 @@ #include "molecule.hh" #include "paper-def.hh" #include "lookup.hh" -#include "clef-reg.hh" +#include "clef-grav.hh" void @@ -46,7 +46,7 @@ Clef_item::read(String t) y_off = 6; } void -Clef_item::read(Clef_register const &k) +Clef_item::read(Clef_engraver const &k) { read(k.clef_type_str_); } diff --git a/lily/collision-grav.cc b/lily/collision-grav.cc new file mode 100644 index 0000000000..428924d891 --- /dev/null +++ b/lily/collision-grav.cc @@ -0,0 +1,40 @@ +/* + collision-reg.cc -- implement Collision_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "note-column.hh" +#include "collision-grav.hh" +#include "collision.hh" + +void +Collision_engraver::acknowledge_element(Score_elem_info i) +{ + if (!(i.elem_l_->name() == Note_column::static_name())) + return; + + if (!col_p_) + col_p_ = new Collision; + + col_p_->add((Note_column*)i.elem_l_->item()); +} + +void +Collision_engraver::do_pre_move_processing() +{ + if (col_p_) { + typeset_element(col_p_); + col_p_ =0; + } +} +Collision_engraver::Collision_engraver() +{ + col_p_ =0; +} + +IMPLEMENT_STATIC_NAME(Collision_engraver); +IMPLEMENT_IS_TYPE_B1(Collision_engraver,Request_engraver); +ADD_THIS_ENGRAVER(Collision_engraver); diff --git a/lily/crescendo.cc b/lily/crescendo.cc index d3731bed19..995e45b476 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -18,6 +18,7 @@ Crescendo::Crescendo() grow_dir_i_ =0; dir_i_ = -1 ; left_dyn_b_ = right_dyn_b_ =false; + inside_staff_b_ = false; } Molecule* diff --git a/lily/dynamic-grav.cc b/lily/dynamic-grav.cc new file mode 100644 index 0000000000..716abae463 --- /dev/null +++ b/lily/dynamic-grav.cc @@ -0,0 +1,142 @@ +/* + dynamic-reg.cc -- implement Dynamic_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ +#include "debug.hh" +#include "crescendo.hh" +#include "dynamic-grav.hh" +#include "musical-request.hh" +#include "text-item.hh" +#include "lookup.hh" +#include "paper-def.hh" +#include "score-column.hh" +#include "staff-sym.hh" +#include "note-column.hh" + +Dynamic_engraver::Dynamic_engraver() +{ + dir_i_ =0; + do_post_move_processing(); + dynamic_p_ =0; + to_end_cresc_p_ = cresc_p_ = 0; + cresc_req_l_ = 0; +} + +void +Dynamic_engraver::do_post_move_processing() +{ + dynamic_req_l_arr_.set_size(0); +} + +bool +Dynamic_engraver::do_try_request(Request * r) +{ + Musical_req * m = r->musical(); + if (!m || !m->dynamic()) + return false; + dynamic_req_l_arr_.push(m->dynamic()); + return true; +} +void +Dynamic_engraver::do_process_requests() +{ + Crescendo* new_cresc_p=0; + for (int i=0; i < dynamic_req_l_arr_.size(); i++) { + Dynamic_req *dreq_l = dynamic_req_l_arr_[i]; + if (dreq_l->absdynamic()) { + Text_def * td_p = new Text_def; + td_p->align_i_ = 0; + String loud =Dynamic_req::loudness_str( + dreq_l->absdynamic()->loudness_); + + td_p->text_str_ = paper()->lookup_l()->dynamic(loud).tex; + td_p->style_str_ = "dynamic"; + + assert (!dynamic_p_) ; // TODO + + dynamic_p_ = new Text_item(td_p); + announce_element(Score_elem_info(dynamic_p_, dreq_l)); + } else if (dreq_l->span_dynamic()) { + + Span_dynamic_req* span_l = dreq_l->span_dynamic(); + if (span_l->spantype == Span_req::STOP) { + if (!cresc_p_) { + span_l->warning("Can't find cresc to end " ); + } else { + assert(!to_end_cresc_p_); + to_end_cresc_p_ =cresc_p_; + cresc_p_ = 0; + } + } else if (span_l->spantype == Span_req::START) { + cresc_req_l_ = span_l; + assert(!new_cresc_p); + new_cresc_p = new Crescendo; + new_cresc_p->grow_dir_i_ = span_l->dynamic_dir_i_; + announce_element(Score_elem_info(new_cresc_p, span_l)); + } + } + } + + if ( new_cresc_p ) { + cresc_p_ = new_cresc_p; + cresc_p_->left_col_l_ = get_staff_info().musical_l()->pcol_l_; + if (dynamic_p_) { + cresc_p_->left_dyn_b_ = true; + } + } +} + +void +Dynamic_engraver::do_pre_move_processing() +{ + Staff_symbol* s_l = get_staff_info().staff_sym_l_; + if (dynamic_p_) { + dynamic_p_->set_staffsym(s_l); + typeset_element(dynamic_p_); + dynamic_p_ = 0; + } + if ( to_end_cresc_p_) { + if (dynamic_p_) + to_end_cresc_p_->right_dyn_b_=true; + + to_end_cresc_p_->right_col_l_ = get_staff_info().musical_l()->pcol_l_; + to_end_cresc_p_->set_staffsym(s_l); + typeset_element(to_end_cresc_p_); + to_end_cresc_p_ = 0; + } +} + +void +Dynamic_engraver::set_feature(Feature i) +{ + if (i.type_ == "vdir") + dir_i_ = i.value_; +} + +IMPLEMENT_STATIC_NAME(Dynamic_engraver); +IMPLEMENT_IS_TYPE_B1(Dynamic_engraver,Request_engraver); +ADD_THIS_ENGRAVER(Dynamic_engraver); + +Dynamic_engraver::~Dynamic_engraver() +{ + delete dynamic_p_; + delete to_end_cresc_p_; + if (cresc_p_) { + cresc_req_l_->warning("unended crescendo"); + } + delete cresc_p_; +} +void +Dynamic_engraver::acknowledge_element(Score_elem_info i) +{ + if (i.elem_l_->name() == Note_column::static_name()) { + if (dynamic_p_) dynamic_p_->add_support(i.elem_l_); + if (to_end_cresc_p_) + to_end_cresc_p_->add_support(i.elem_l_); + if (cresc_p_) + cresc_p_->add_support(i.elem_l_); + } +} diff --git a/lily/engraver-group.cc b/lily/engraver-group.cc new file mode 100644 index 0000000000..bcfa32a034 --- /dev/null +++ b/lily/engraver-group.cc @@ -0,0 +1,297 @@ +/* + engravergroup.cc -- implement Engraver_group_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "proto.hh" +#include "plist.hh" +#include "engraver-group.hh" +#include "engraver.hh" +#include "debug.hh" +#include "p-score.hh" +#include "score-elem.hh" +#include "input-engraver.hh" + +Engraver_group_engraver::~Engraver_group_engraver() +{ + assert(removable_b()); +} + +void +Engraver_group_engraver::check_removal() +{ + for (int i =0; i < group_l_arr_.size(); ) { + group_l_arr_[i]->check_removal(); + if (group_l_arr_[i]->removable_b()) + terminate_engraver(group_l_arr_[i]); + else + i++; + } + +} + +bool +Engraver_group_engraver::removable_b()const +{ + return !iterator_count_&& !group_l_arr_.size() ; +} + +Engraver_group_engraver::Engraver_group_engraver() +{ + igrav_l_ =0; +} + +void +Engraver_group_engraver::set_feature(Feature d) +{ + iter_top(grav_list_, i); + while (i.ok()) { + // this construction to ensure clean deletion + Request_engraver *grav_l = i++; + grav_l->set_feature(d); + } +} + +void +Engraver_group_engraver::sync_features() +{ + iter_top(grav_list_, i); + while (i.ok()) { + + Request_engraver *grav_l = i++; + grav_l->sync_features(); + } +} + +void +Engraver_group_engraver::do_pre_move_processing() +{ + iter_top(grav_list_, i); + while (i.ok()) { + + Request_engraver *grav_l = i++; + grav_l->pre_move_processing(); + } +} + +void +Engraver_group_engraver::do_process_requests() +{ + iter_top(grav_list_, i); + while (i.ok()) { + + Request_engraver *grav_l = i++; + grav_l->process_requests(); + } +} + + +void +Engraver_group_engraver::do_post_move_processing() +{ + iter_top(grav_list_, i); + while (i.ok()) { + // this construction to ensure clean deletion + Request_engraver *grav_l = i++; + grav_l->post_move_processing(); + } +} + + +bool +Engraver_group_engraver::contains_b(Request_engraver* grav_l)const +{ + bool parent_b = Request_engraver::contains_b(grav_l); + + if (parent_b) + return true; + for (iter_top(grav_list_, j); j.ok(); j++) + if (j->contains_b(grav_l)) + return true; + return false; +} + + + +bool +Engraver_group_engraver::do_try_request(Request*req_l) +{ + bool hebbes_b =false; + for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++) + hebbes_b =nongroup_l_arr_[i]->try_request(req_l); + if (!hebbes_b) + hebbes_b = daddy_grav_l_->try_request(req_l); + return hebbes_b ; +} + +void +Engraver_group_engraver::add(Request_engraver *grav_p) +{ + grav_list_.bottom().add(grav_p); + grav_p->daddy_grav_l_ = this; + + if (grav_p->is_type_b(Engraver_group_engraver::static_name())) { + group_l_arr_.push((Engraver_group_engraver*)grav_p); + } else { + nongroup_l_arr_ .push(grav_p); + } +} + + +Request_engraver * +Engraver_group_engraver::remove_engraver_p(Request_engraver*grav_l) +{ + group_l_arr_.substitute((Engraver_group_engraver*)grav_l,0); + nongroup_l_arr_.substitute(grav_l,0); + iterator(grav_list_) grav_cur= grav_list_.find(grav_l); + + return grav_cur.remove_p(); +} + +void +Engraver_group_engraver::terminate_engraver(Request_engraver*r_l) +{ + mtor << "Removing " << r_l->name() << " at " << get_staff_info().when() << "\n"; + r_l->do_removal_processing(); + Request_engraver * grav_p =remove_engraver_p(r_l); + + delete grav_p; +} + +IMPLEMENT_IS_TYPE_B2(Engraver_group_engraver,Request_engraver, Translator); +IMPLEMENT_STATIC_NAME(Engraver_group_engraver); +ADD_THIS_ENGRAVER(Engraver_group_engraver); + +void +Engraver_group_engraver::do_print()const +{ +#ifndef NPRINT + mtor << "ID: " << id_str_ << "\n"; + for (iter_top(grav_list_, i); i.ok(); i++) + i->print(); +#endif +} + + +Engraver_group_engraver* +Engraver_group_engraver::find_engraver_l(String n, String id) +{ + if (name() == n && id_str_ == id) + return this; + Engraver_group_engraver * r = 0; + for (int i =0; !r && i< group_l_arr_.size(); i++) { + r = group_l_arr_[i]->find_engraver_l(n,id); + } + + return r; +} + +Translator* +Engraver_group_engraver::find_get_translator_l(String n,String id) +{ + Translator * ret=0; + Input_engraver * igrav_l= igrav_l_-> recursive_find ( n ); + if (igrav_l ) { + ret = find_engraver_l(n,id); + if (!ret) { + Engraver_group_engraver * group = + igrav_l-> get_group_engraver_p(); + + add(group); + ret = group; + + if (group->igrav_l_->is_name_b( n ) ) + ret ->id_str_ = id; + else + return ret->find_get_translator_l(n,id); + + } + } else if (daddy_grav_l_) + ret =daddy_grav_l_->find_get_translator_l(n,id); + else { + warning("Can't find or create `" + n + "' called `" + id + "'\n"); + ret =0; + } + return ret; +} + +int +Engraver_group_engraver::depth_i()const +{ + return daddy_grav_l_->depth_i() + 1; +} + +Translator* +Engraver_group_engraver::ancestor_l(int l) +{ + if (!l || !daddy_grav_l_) + return this; + + return daddy_grav_l_->ancestor_l(l-1); +} + +void +Engraver_group_engraver::announce_element(Score_elem_info info) +{ + announce_info_arr_.push(info); + Request_engraver::announce_element(info); +} + +void +Engraver_group_engraver::do_announces() +{ + for (int i=0; i < group_l_arr_.size(); i++) { + group_l_arr_[i]->do_announces(); + } + + Request dummy_req; + + for (int j =0; j < announce_info_arr_.size(); j++){ + Score_elem_info info = announce_info_arr_[j]; + + if (!info.req_l_) + info.req_l_ = &dummy_req; + for (int i=0; i < nongroup_l_arr_.size(); i++) { + if (nongroup_l_arr_[i] != info.origin_grav_l_arr_[0]) + nongroup_l_arr_[i]->acknowledge_element(info); + } + } + announce_info_arr_.set_size(0); +} + + +void +Engraver_group_engraver::do_removal_processing() +{ + for (iter( grav_list_.top(), i); i.ok(); i++) + i->do_removal_processing(); +} + +Staff_info +Engraver_group_engraver::get_staff_info()const +{ + Staff_info inf = Request_engraver::get_staff_info(); + + for (int i=0; i < nongroup_l_arr_.size(); i++) + nongroup_l_arr_[i]->fill_staff_info(inf); + + return inf; +} + +Translator* +Engraver_group_engraver::get_default_interpreter() +{ + if ( interpreter_l() ) + return daddy_grav_l_->get_default_interpreter(); + + Engraver_group_engraver *grav_p= igrav_l_-> + get_default_igrav_l()->get_group_engraver_p(); + add(grav_p ); + if (grav_p->interpreter_l()) + return grav_p; + else + return grav_p->get_default_interpreter(); +} diff --git a/lily/engraver.cc b/lily/engraver.cc new file mode 100644 index 0000000000..78fa6ca623 --- /dev/null +++ b/lily/engraver.cc @@ -0,0 +1,137 @@ +/* + engraver.cc -- implement Request_engraver + + Sourcefile of GNU LilyPond musictypesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "music-list.hh" +#include "musical-request.hh" +#include "engraver.hh" +#include "engraver-group.hh" +#include "debug.hh" + +void +Request_engraver::post_move_processing() +{ + + if (status < CREATION_INITED) { + do_creation_processing(); + status = CREATION_INITED; + } + if (status >= MOVE_INITED) + return; + + do_post_move_processing(); + status = MOVE_INITED; +} + +bool +Request_engraver::try_request(Request * r) +{ + if (status < MOVE_INITED) + post_move_processing(); + + return do_try_request(r); +} + +void +Request_engraver::process_requests() +{ + if (status < PROCESSED_REQS) + post_move_processing(); + else if (status >= PROCESSED_REQS) + return; + + status = PROCESSED_REQS; + do_process_requests(); +} + +void +Request_engraver::pre_move_processing() +{ + do_pre_move_processing(); + status = CREATION_INITED; +} + +void +Request_engraver::fill_staff_info(Staff_info&) +{ + +} + +Scalar +Request_engraver::get_feature(String t) +{ + return daddy_grav_l_->get_feature(t); +} + +bool +Request_engraver::do_try_request(Request*) +{ + return false; +} + +Request_engraver::Request_engraver() +{ + status = VIRGIN; + daddy_grav_l_ = 0; +} + +void +Request_engraver::announce_element(Score_elem_info i) +{ + i.origin_grav_l_arr_.push(this); + daddy_grav_l_->announce_element(i); +} + +void +Request_engraver::typeset_element(Score_elem*p) +{ + daddy_grav_l_->typeset_element(p); +} + +Paper_def* +Request_engraver::paper()const +{ + return daddy_grav_l_->paper(); +} + +void +Request_engraver::typeset_breakable_item(Item * nobreak_p) +{ + daddy_grav_l_->typeset_breakable_item(nobreak_p); +} + +bool +Request_engraver::contains_b(Request_engraver *grav_l)const +{ + return this == grav_l; +} + +Staff_info +Request_engraver::get_staff_info() const +{ + return daddy_grav_l_->get_staff_info(); +} + +void +Request_engraver::print() const +{ +#ifndef NPRINT + mtor << "\n" << name() << " {"; + do_print(); + mtor << "}"; +#endif +} + +IMPLEMENT_STATIC_NAME(Request_engraver); +IMPLEMENT_IS_TYPE_B(Request_engraver); + +void +Request_engraver::do_print()const +{ +} + + diff --git a/lily/global-gravs.cc b/lily/global-gravs.cc new file mode 100644 index 0000000000..6dcc07b791 --- /dev/null +++ b/lily/global-gravs.cc @@ -0,0 +1,49 @@ +/* + global-gravs.cc -- implement + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "proto.hh" +#include "plist.hh" +#include "input-engraver.hh" +#include "debug.hh" +#include "engraver.hh" + +struct Request_engraver_table_entry { + String name_str_; + Grav_ctor ctor_l_; + Request_engraver_table_entry(String s, Grav_ctor f) { + name_str_ =s; + ctor_l_ = f; + } + Request_engraver_table_entry() + { + ctor_l_ =0; + } +}; + +static Array *grav_table=0; + +void +add_request_engraver(String s, Grav_ctor f) +{ + if (!grav_table) + grav_table = new Array; + + grav_table->push(Request_engraver_table_entry(s, f)); +} + + +Request_engraver* +get_engraver_p(String s) +{ + for (int i=0; i < grav_table->size(); i++) { + if ((*grav_table)[i].name_str_ == s) + return (*(*grav_table)[i].ctor_l_)(); + } + error("Unknown engraver `" + s +"\'"); + return 0; +} diff --git a/lily/global-translator.cc b/lily/global-translator.cc new file mode 100644 index 0000000000..62cbb284e4 --- /dev/null +++ b/lily/global-translator.cc @@ -0,0 +1,69 @@ +/* + global-translator.cc -- implement + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "music.hh" +#include "global-translator.hh" +#include "score.hh" +#include "score-column.hh" + +Global_translator::Global_translator() +{ + score_l_ = 0; + last_mom_ = 0; +} + +Translator* +Global_translator::ancestor_l(int) +{ + return this; +} + +void +Global_translator::add_moment_to_process(Moment m) +{ + if (m > last_mom_) + return; + + for (int i=0; i < extra_mom_pq_.size(); i++) + if (extra_mom_pq_[i] == m) + return; + extra_mom_pq_.insert(m); +} + +int +Global_translator::depth_i()const +{ + return 0; +} + +void +Global_translator::set_score(Score *s) +{ + score_l_ = s; + last_mom_ = score_l_->music_p_->time_int().max(); +} + +void +Global_translator::modify_next(Moment &w) +{ + while (extra_mom_pq_.size() && + extra_mom_pq_.front() <= w) + + w =extra_mom_pq_.get(); +} + +int +Global_translator::moments_left_i()const +{ + return extra_mom_pq_.size(); +} + +void +Global_translator::prepare(Moment) +{ +} diff --git a/lily/head-grav.cc b/lily/head-grav.cc new file mode 100644 index 0000000000..bc70563126 --- /dev/null +++ b/lily/head-grav.cc @@ -0,0 +1,69 @@ +/* + headreg.cc -- part of GNU LilyPond + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "note-head.hh" +#include "head-grav.hh" +#include "paper-def.hh" +#include "musical-request.hh" + +Note_head_engraver::Note_head_engraver() +{ + note_p_ = 0; + do_post_move_processing(); +} + +bool +Note_head_engraver::do_try_request(Request *req_l) +{ + if (note_req_l_) + return false; + + if (req_l->musical() && (req_l->musical()->note() || req_l->musical()->rest())) + note_req_l_=req_l->musical()->rhythmic(); + else + return false; + + return true; +} + +void +Note_head_engraver::do_process_requests() +{ + if (!note_req_l_) + return; + + Note_head*n_p = new Note_head(8); // ugh + note_p_ = n_p; + n_p->set_rhythmic(note_req_l_->rhythmic()); + + if (note_req_l_->note()) { + n_p->position_i_ = note_req_l_->note()->height() + + *get_staff_info().c0_position_i_l_; + } else if (note_req_l_->rest()) { + n_p->rest_b_ = true; + } + + Score_elem_info itinf(note_p_,note_req_l_); + announce_element(itinf); +} + +void +Note_head_engraver::do_pre_move_processing() +{ + if (note_p_) { + typeset_element(note_p_); + note_p_ = 0; + } +} +void +Note_head_engraver::do_post_move_processing() +{ + note_req_l_ = 0; +} + +IMPLEMENT_STATIC_NAME(Note_head_engraver); +IMPLEMENT_IS_TYPE_B1(Note_head_engraver,Request_engraver); +ADD_THIS_ENGRAVER(Note_head_engraver); diff --git a/lily/identifier.cc b/lily/identifier.cc index 7e1e43e45f..60831cef13 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -7,17 +7,17 @@ */ #include - +#include "paper-def.hh" #include "score.hh" #include "identifier.hh" #include "my-lily-lexer.hh" #include "debug.hh" -#include "input-register.hh" +#include "input-engraver.hh" #include "symtable.hh" #include "lookup.hh" #include "script-def.hh" #include "request.hh" -#include "input-register.hh" +#include "input-engraver.hh" IMPLEMENT_STATIC_NAME(Identifier); IMPLEMENT_IS_TYPE_B(Identifier); @@ -65,8 +65,8 @@ DEFAULT_PRINT(Symtables_id, Symtables, symtables); DEFAULT_PRINT(Music_id,Music , music); DEFAULT_PRINT(Request_id, Request, request); DEFAULT_PRINT(Score_id, Score, score); -DEFAULT_PRINT(Input_regs_id, Input_register, iregs); - +DEFAULT_PRINT(Input_gravs_id, Input_engraver, igravs); +DEFAULT_PRINT(Paper_def_id,Paper_def, paperdef); void Real_id::do_print() const { @@ -110,7 +110,8 @@ implement_id_class(Symtables_id, Symtables, symtables); implement_id_class(Music_id, Music, music); implement_id_class(Score_id, Score, score); implement_id_class(Request_id, Request, request); -implement_id_class(Input_regs_id, Input_register, iregs); +implement_id_class(Input_gravs_id, Input_engraver, igravs); +implement_id_class(Paper_def_id, Paper_def, paperdef); Identifier::Identifier(Identifier const&) { @@ -125,4 +126,5 @@ default_accessor(Symtables_id, Symtables, symtables); virtual_accessor(Music_id, Music, music); default_accessor(Score_id, Score, score); virtual_accessor(Request_id, Request, request); -default_accessor(Input_regs_id, Input_register, iregs); +default_accessor(Input_gravs_id, Input_engraver, igravs); +default_accessor(Paper_def_id, Paper_def, paperdef); diff --git a/lily/include/acceptor.hh b/lily/include/acceptor.hh index f298951081..aabbcf5337 100644 --- a/lily/include/acceptor.hh +++ b/lily/include/acceptor.hh @@ -1,5 +1,5 @@ /* - acceptor.hh -- declare Acceptor + acceptor.hh -- declare Translator source file of the GNU LilyPond music typesetter @@ -15,7 +15,7 @@ #include "interpreter.hh" #include "virtual-methods.hh" -class Acceptor { +class Translator { public: String id_str_; @@ -23,17 +23,17 @@ public: virtual Interpreter * interpreter_l() { return 0; } - /// Score_register = 0, Staff_registers = 1, etc) + /// Score_engraver = 0, Staff_engravers = 1, etc) virtual int depth_i()const=0; - virtual Acceptor *find_get_acceptor_l(String name, String id)=0; - virtual Acceptor *ancestor_l(int l=1)=0; - virtual ~Acceptor(){} + virtual Translator *find_get_translator_l(String name, String id)=0; + virtual Translator *ancestor_l(int l=1)=0; + virtual ~Translator(){} NAME_MEMBERS(); - Acceptor(); - virtual Acceptor *get_default_interpreter()=0; + Translator(); + virtual Translator *get_default_interpreter()=0; }; -class Interpreter : public virtual Acceptor { +class Interpreter : public virtual Translator { public: virtual bool interpret_request_b(Request*) { return false;} }; diff --git a/lily/include/bar-align-grav.hh b/lily/include/bar-align-grav.hh new file mode 100644 index 0000000000..7da9dfaf3d --- /dev/null +++ b/lily/include/bar-align-grav.hh @@ -0,0 +1,13 @@ +/* + bar-align-grav.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef BAR_ALIGN_GRAV_HH +#define BAR_ALIGN_GRAV_HH + +#endif // BAR_ALIGN_GRAV_HH diff --git a/lily/include/bar-grav.hh b/lily/include/bar-grav.hh new file mode 100644 index 0000000000..173d15e201 --- /dev/null +++ b/lily/include/bar-grav.hh @@ -0,0 +1,32 @@ +/* + bar-grav.hh -- declare Bar_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef BARGRAV_HH +#define BARGRAV_HH +#include "engraver.hh" + +/** + generate bars. Either user ("|:"), or default (new measure) + */ +class Bar_engraver : public Request_engraver { + Bar_req * bar_req_l_; + Bar * bar_p_; +public: + Bar_engraver(); + NAME_MEMBERS(); + + +protected: + virtual bool do_try_request(Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); +}; + +#endif // BARGRAV_HH diff --git a/lily/include/clef-grav.hh b/lily/include/clef-grav.hh new file mode 100644 index 0000000000..5346c0b6e3 --- /dev/null +++ b/lily/include/clef-grav.hh @@ -0,0 +1,41 @@ +/* + clef.hh -- part of GNU LilyPond + + (c) 1996,97 Han-Wen Nienhuys +*/ + +#ifndef CLEF_HH +#define CLEF_HH + +#include "scalar.hh" +#include "varray.hh" +#include "engraver.hh" + +/// where is c-0 in the staff? +class Clef_engraver : public Request_engraver { + Clef_item *clef_p_; + Clef_change_req * clef_req_l_; + void create_clef(); + void read_req(Clef_change_req*); + bool set_type(String); +protected: + virtual void do_process_requests(); + virtual void fill_staff_info(Staff_info&); + virtual void do_pre_move_processing(); + virtual void do_removal_processing(); + virtual void do_creation_processing(); + virtual void do_post_move_processing(); + virtual bool do_try_request(Request*); + virtual void acknowledge_element(Score_elem_info); +public: + int c0_position_i_; + String clef_type_str_; + + /* ************** */ + + Clef_engraver(); + NAME_MEMBERS(); + +}; +#endif // CLEF_HH + diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index a3c9053b34..162cf813eb 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -30,7 +30,7 @@ public: NAME_MEMBERS(); SCORE_ELEM_CLONE(Clef_item); Clef_item(); - void read(Clef_register const&); + void read(Clef_engraver const&); void read(String); }; diff --git a/lily/include/collision-grav.hh b/lily/include/collision-grav.hh new file mode 100644 index 0000000000..0b46db58c3 --- /dev/null +++ b/lily/include/collision-grav.hh @@ -0,0 +1,25 @@ +/* + collision-grav.hh -- declare Collision_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef COLLISION_GRAV_HH +#define COLLISION_GRAV_HH + +#include "engraver.hh" + +class Collision_engraver : public Request_engraver { + Collision* col_p_; + +protected: + virtual void acknowledge_element(Score_elem_info); + virtual void do_pre_move_processing(); +public: + Collision_engraver(); + NAME_MEMBERS(); +}; +#endif // COLLISION_GRAV_HH diff --git a/lily/include/dynamic-grav.hh b/lily/include/dynamic-grav.hh new file mode 100644 index 0000000000..791b2f129e --- /dev/null +++ b/lily/include/dynamic-grav.hh @@ -0,0 +1,36 @@ +/* + dynamic-grav.hh -- declare Dynamic_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef DYNAMIC_GRAV_HH +#define DYNAMIC_GRAV_HH + +#include "engraver.hh" + +class Dynamic_engraver : public Request_engraver { + int dir_i_; + Text_item * dynamic_p_; + Crescendo * to_end_cresc_p_; + Crescendo * cresc_p_; + Span_dynamic_req * cresc_req_l_; + Array dynamic_req_l_arr_; + /* ************** */ +public: + Dynamic_engraver(); + ~Dynamic_engraver(); + NAME_MEMBERS(); +protected: + virtual void acknowledge_element(Score_elem_info); + virtual bool do_try_request(Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); + virtual void set_feature(Feature); +}; + +#endif // DYNAMIC_GRAV_HH diff --git a/lily/include/engraver-group.hh b/lily/include/engraver-group.hh new file mode 100644 index 0000000000..fc76fd7bd5 --- /dev/null +++ b/lily/include/engraver-group.hh @@ -0,0 +1,90 @@ +/* + engravergroup.hh -- declare Engraver_group_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef ENGRAVERGROUP_HH +#define ENGRAVERGROUP_HH + +#include "parray.hh" +#include "plist.hh" +#include "score-elem-info.hh" +#include "engraver.hh" +#include "translator.hh" + + +/** + Group a number of engravers. Usually delegates everything to its contents. + Postfix: group + */ +class Engraver_group_engraver : public Request_engraver, public virtual Translator { +protected: + + Pointer_list grav_list_; + Link_array group_l_arr_; + Link_array nongroup_l_arr_; + + Array announce_info_arr_; + + virtual void do_print()const; + + virtual bool removable_b()const; + +public: + Input_engraver * igrav_l_; + void check_removal(); + Engraver_group_engraver(); + ~Engraver_group_engraver(); + + + + /** + Junk #grav_l#. + Pre: + #grav_l# is in #grav_list_# + */ + virtual void terminate_engraver(Request_engraver * grav_l); + + NAME_MEMBERS(); + + /** + Remove #grav_l# from the list, and return it. + */ + virtual Request_engraver * remove_engraver_p(Request_engraver*grav_l); + virtual void set_feature(Feature i); + virtual void sync_features() ; + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); + + virtual void do_removal_processing(); + virtual bool do_try_request(Request*); + virtual void do_process_requests(); + + virtual Staff_info get_staff_info()const; + + virtual Engraver_group_engraver * find_engraver_l(String name,String id); + virtual void do_announces(); + virtual void announce_element(Score_elem_info); + + + virtual void add(Request_engraver* grav_p); + + virtual bool contains_b(Request_engraver*)const; + + virtual Translator* find_get_translator_l(String name, String id); + virtual Translator * get_default_interpreter(); + /** + Go up in the tree. default: choose next parent + */ + Translator * ancestor_l(int l=1); + int depth_i() const; + +}; + +#endif // ENGRAVERGROUP_HH + + diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh new file mode 100644 index 0000000000..320bdd3256 --- /dev/null +++ b/lily/include/engraver.hh @@ -0,0 +1,158 @@ +/* + engraver.hh -- declare Request_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1996, 1997 Han-Wen Nienhuys +*/ + + +#ifndef ENGRAVER_HH +#define ENGRAVER_HH + +#include "lily-proto.hh" +#include "varray.hh" +#include "request.hh" +#include "score-elem-info.hh" +#include "staff-info.hh" + + + + +/** + a struct which processes requests, and creates the #Score_elem#s. + It may use derived classes. Hungarian postfix: grav + + */ + +class Request_engraver { + + friend class Engraver_group_engraver; + /** + You cannot copy a Request_engraver + */ + Request_engraver(const Request_engraver&){} + + enum { + VIRGIN, + CREATION_INITED, + MOVE_INITED, + ACCEPTED_REQS, + PROCESSED_REQS, + ACKED_REQS, + MOVE_DONE + } status; + +protected: + + + /// utility + virtual Paper_def * paper() const; + + + /// make items/spanners with the requests you got + virtual void do_process_requests(){} + + /** typeset any items/spanners. Default: do nothing + */ + virtual void do_pre_move_processing(){} + /** reset any appropriate data. Default: do nothing + */ + virtual void do_post_move_processing(){} + + + virtual void do_creation_processing () {} + virtual void do_removal_processing() {} + + /** + typeset a "command" item. Default: pass on to daddy. + If the column is not breakable, #pre_p# and #post_p# are junked + */ + virtual void typeset_breakable_item(Item * nobreak_p); + /** + Invoke walker method to typeset element. Default: pass on to daddy. + */ + virtual void typeset_element(Score_elem*elem_p); + + /** + take note of item/spanner + put item in spanner. Adjust local key; etc. + + Default: ignore the info + */ + virtual void acknowledge_element(Score_elem_info) {} + /** + Announce element. Default: pass on to daddy. Utility + */ + virtual void announce_element(Score_elem_info); + /** + Set Feature of the engraver(s). Default: ignore Feature. + */ + virtual void set_feature(Feature){} + /** + ask daddy for a feature + */ + virtual Scalar get_feature(String type_str); + /** + Does this equal or contain a certain engraver? + */ + + virtual void sync_features() {} + + virtual bool contains_b(Request_engraver*grav_l)const; + /** + Get information on the staff. Default: ask daddy. + */ + virtual Staff_info get_staff_info()const; + virtual void fill_staff_info(Staff_info&); + + + virtual void do_print()const; + /* + @see{try_request} + Default: always return false + */ + virtual bool do_try_request(Request *req_l); +public: + void pre_move_processing(); + void process_requests(); + /** + try to fit the request in this engraver + + @return + false: not noted, not taken. + + true: request swallowed. Don't try to put the request elsewhere. + + */ + bool try_request(Request*); + + void post_move_processing(); + + Engraver_group_engraver * daddy_grav_l_; + + Request_engraver(); + virtual ~Request_engraver(){} + NAME_MEMBERS(); + void print() const; +}; + +/** + A macro to automate administration of engravers. + */ +#define ADD_THIS_ENGRAVER(c) \ +struct c ## init { \ + static Request_engraver * globalctor (){ \ + return new c; \ + } \ + c ## init () { \ + add_request_engraver(c::static_name(), globalctor); \ + \ + } \ +} _ ## c ## init; + +typedef Request_engraver*(*Grav_ctor)(void); +void add_request_engraver(String s, Grav_ctor f); + +#endif // ENGRAVER_HH + diff --git a/lily/include/global-translator.hh b/lily/include/global-translator.hh new file mode 100644 index 0000000000..ce34cfb527 --- /dev/null +++ b/lily/include/global-translator.hh @@ -0,0 +1,38 @@ +/* + global-acceptor.hh -- declare Global_acceptor + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef GLOBAL_ACCEPTOR_HH +#define GLOBAL_ACCEPTOR_HH + +#include "acceptor.hh" +#include "pqueue.hh" + +class Global_translator : public virtual Translator { + PQueue extra_mom_pq_; + Moment last_mom_; +public: + Score *score_l_; + Global_translator(); + int moments_left_i()const; + void modify_next(Moment&); + void add_moment_to_process(Moment); + + virtual void set_score(Score*); + virtual void prepare(Moment); + virtual void process() {} + virtual void finish() {} + +protected: + virtual int depth_i() const; + virtual Translator *ancestor_l(int); +}; + + + +#endif // Global_translator_HH diff --git a/lily/include/head-grav.hh b/lily/include/head-grav.hh new file mode 100644 index 0000000000..07f7210925 --- /dev/null +++ b/lily/include/head-grav.hh @@ -0,0 +1,26 @@ +/* + head-grav.hh -- part of GNU LilyPond + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef HEADGRAV_HH +#define HEADGRAV_HH +#include "engraver.hh" + +struct Note_head_engraver : Request_engraver { + Note_head* note_p_; + Rhythmic_req * note_req_l_; + + /* *************** */ + Note_head_engraver(); + virtual bool do_try_request(Request *req_l) ; + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); + NAME_MEMBERS(); +}; + + +#endif // HEADGRAV_HH diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index bd45068ab4..1fca04eee3 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -31,9 +31,10 @@ struct Identifier : public Input { NAME_MEMBERS(); void error(String); IDACCESSOR(Music, music) - IDACCESSOR(Input_register, iregs) + IDACCESSOR(Input_engraver, igravs) IDACCESSOR(General_script_def, script) IDACCESSOR(Symtables, symtables) + IDACCESSOR(Paper_def, paperdef) IDACCESSOR(Lookup,lookup) IDACCESSOR(Real,real) IDACCESSOR(Request, request) @@ -65,6 +66,6 @@ declare_id_class(Music_id, Music, music); declare_id_class(Int_id, int, intid); declare_id_class(Score_id, Score, score); declare_id_class(Request_id, Request, request); -declare_id_class(Input_regs_id, Input_register, iregs); - +declare_id_class(Input_gravs_id, Input_engraver, igravs); +declare_id_class(Paper_def_id,Paper_def, paperdef); #endif // IDENTIFIER_ diff --git a/lily/include/input-engraver.hh b/lily/include/input-engraver.hh new file mode 100644 index 0000000000..5894a1db64 --- /dev/null +++ b/lily/include/input-engraver.hh @@ -0,0 +1,42 @@ +/* + input-engraver.hh -- declare Input_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef INPUT_ENGRAVER_HH +#define INPUT_ENGRAVER_HH + +#include "plist.hh" +#include "string.hh" +#include "lily-proto.hh" +#include "input.hh" +#include "string.hh" +#include "varray.hh" + +struct Input_engraver : Input { + Pointer_list contains_igrav_p_list_; + Array consists_str_arr_; + Array alias_str_arr_; + String name_str_; + + void add(Input_engraver *); + bool is_name_b(String); + bool accept_req_b(); + bool accepts_b(String); + void print() const; + Engraver_group_engraver * get_group_engraver_p(); + Input_engraver * get_default_igrav_l(); + Input_engraver * recursive_find(String nm); + Input_engraver * find_igrav_l(String nm); +}; + + +void add_global_input_engraver(Input_engraver* igrav_p); +Input_engraver*lookup_grav(String); +Request_engraver*get_engraver_p(String s); + +#endif // INPUT_ENGRAVER_HH diff --git a/lily/include/key-grav.hh b/lily/include/key-grav.hh new file mode 100644 index 0000000000..8f9b9ecdf1 --- /dev/null +++ b/lily/include/key-grav.hh @@ -0,0 +1,37 @@ +/* + key-grav.hh -- declare Key_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef KEYGRAV_HH +#define KEYGRAV_HH + +#include "engraver.hh" +#include "key.hh" + +struct Key_engraver : Request_engraver { + Key key_; + Key_change_req * keyreq_l_; + Key_item * kit_p_; + Array accidental_idx_arr_; + bool default_key_b_; + bool change_key_b_; + + virtual bool do_try_request(Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); + virtual void acknowledge_element(Score_elem_info); + Key_engraver(); + NAME_MEMBERS(); +private: + void create_key(); + + void read_req(Key_change_req * r); +}; + +#endif // KEYGRAV_HH diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index 0d8505d425..759e6d1123 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -25,7 +25,7 @@ struct Key_item : Item { Key_item(int cposition); void add(int pitch, int acc); - void read(const Key_register&); + void read(const Key_engraver&); void set_c_position(int); virtual void do_pre_processing(); Molecule* brew_molecule_p()const; diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 5a2a934578..321ea3382c 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -12,10 +12,10 @@ struct My_lily_lexer; struct Absolute_dynamic_req; -struct Acceptor; +struct Translator; struct Atom; struct Bar; -struct Bar_register; +struct Bar_engraver; struct Bar_req; struct Barcheck_req; struct Beam; @@ -30,12 +30,12 @@ struct Change_reg; struct Chord; struct Clef_change_req; struct Clef_item; -struct Clef_register; +struct Clef_engraver; struct Col_hpositions; struct Chord; struct Colinfo; struct Collision; -struct Collision_register; +struct Collision_engraver; struct Command_req; struct Command_script_req; struct Complex_music; @@ -50,7 +50,7 @@ struct Element_group; struct Element_group_item; struct Feature; struct General_script_def; -struct Global_acceptor; +struct Global_translator; struct Group_change_req; struct Group_feature_req; struct Horizontal_align_item; @@ -61,13 +61,13 @@ struct Idealspacing; struct Identifier; struct Interpreter; struct Input_file; -struct Input_register; +struct Input_engraver; struct Input_score; struct Item; struct Key; struct Key_change_req; struct Key_item; -struct Key_register; +struct Key_engraver; struct Keyword; struct Keyword_table; struct Lily_stream; @@ -76,7 +76,7 @@ struct Line_of_staff; struct Linestaff; struct Local_key; struct Local_key_item; -struct Local_key_register; +struct Local_key_engraver; struct Lookup; struct Lyric_item; struct Lyric_req; @@ -84,7 +84,7 @@ struct Measure_grouping_req; struct Melodic_req; struct Meter; struct Meter_change_req; -struct Meter_register; +struct Meter_engraver; struct Midi_def; struct Midi_duration; struct Midi_header; @@ -104,10 +104,10 @@ struct Music; struct Music_list; struct My_lily_parser; struct Note_column; -struct Note_column_register; +struct Note_column_engraver; struct Note_req; struct Note_head; -struct Note_head_register; +struct Note_head_engraver; struct Notename_table; struct Offset; struct Output; @@ -119,13 +119,13 @@ struct Plet; struct Pulk_voice; struct Pulk_voices; struct Rational; -struct Register_group_register; +struct Engraver_group_engraver; struct Request; struct Request_column; -struct Request_register; +struct Request_engraver; struct Rest; struct Rest_collision; -struct Rest_collision_register; +struct Rest_collision_engraver; struct Rest_column; struct Rest_req; struct Rhythmic_grouping; @@ -138,12 +138,12 @@ struct Score_elem_info; struct Script; struct Script_column; struct Script_def; -struct Script_register; +struct Script_engraver; struct Script_req; struct Simple_music; struct Skip_req; struct Slur; -struct Slur_register; +struct Slur_engraver; struct Slur_req; struct Spacing_req ; struct Span_dynamic_req; @@ -152,7 +152,7 @@ struct Spanner; struct Staff_side; struct Staff_symbol; struct Stem; -struct Stem_beam_register; +struct Stem_beam_engraver; struct Stem_req; struct String; struct Subtle_req; @@ -165,10 +165,10 @@ struct Tex_stream; struct Text_def; struct Text_gob; struct Text_item ; -struct Text_register; +struct Text_engraver; struct Text_req; struct Tie; -struct Tie_register; +struct Tie_engraver; struct Tie_req; struct Time_description; struct Timing_req; @@ -178,10 +178,10 @@ struct Vertical_group; struct Voice; struct Voice_element; -struct Voice_group_registers; +struct Voice_group_engravers; struct Voice_list; -struct Voice_registers; +struct Voice_engravers; struct Voicegroup; -struct Walker_registers; +struct Walker_engravers; typedef Rational Moment; #endif // LILY_PROTO_HH diff --git a/lily/include/local-key-grav.hh b/lily/include/local-key-grav.hh new file mode 100644 index 0000000000..6ed5d78ac5 --- /dev/null +++ b/lily/include/local-key-grav.hh @@ -0,0 +1,30 @@ +/* + local-key-grav.hh -- declare Local_key_engraver + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef LOCALKEYGRAV_HH +#define LOCALKEYGRAV_HH + +#include "engraver.hh" +#include "key.hh" +#include "parray.hh" + +struct Local_key_engraver : Request_engraver { + Key local_key_; + Key const *key_C_; + Array mel_l_arr_; + Array support_l_arr_; + Link_array forced_l_arr_; + Link_array tied_l_arr_; + /* *************** */ + virtual void do_process_requests(); + virtual void acknowledge_element(Score_elem_info); + virtual void do_pre_move_processing(); + Local_key_engraver(); + NAME_MEMBERS(); +}; + +#endif // LOCALKEYGRAV_HH diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 4b1479090a..aff20862d7 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -15,13 +15,12 @@ /// intuitive interface to symbol table struct Lookup { + Paper_def * paper_l_; Symtables *symtables_; String texsetting; /* *************** */ void add(String, Symtable*); void print()const; - Real internote_f()const; - Real interbeam_f()const; Symbol linestaff(int n, Real w)const; Symbol fill(Box b)const; diff --git a/lily/include/lyric-engraver.hh b/lily/include/lyric-engraver.hh new file mode 100644 index 0000000000..8771d4b3cd --- /dev/null +++ b/lily/include/lyric-engraver.hh @@ -0,0 +1,26 @@ +/* + lyric-engraver.hh -- declare Lyric_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef LYRIC_ENGRAVER_HH +#define LYRIC_ENGRAVER_HH +#include "engraver.hh" +#include "varray.hh" + +#include "lily-proto.hh" + +class Lyric_engraver : public Request_engraver { + Array lreq_arr_; + virtual bool do_try_request(Request*); + virtual void do_process_requests(); + virtual void do_post_move_processing(); +public: + NAME_MEMBERS(); + Lyric_engraver(); +}; +#endif // LYRIC_ENGRAVER_HH diff --git a/lily/include/meter-grav.hh b/lily/include/meter-grav.hh new file mode 100644 index 0000000000..38fe040450 --- /dev/null +++ b/lily/include/meter-grav.hh @@ -0,0 +1,36 @@ +/* + meter-grav.hh -- declare Meter_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef METERGRAV_HH +#define METERGRAV_HH +#include "engraver.hh" +#include "time-description.hh" +#include "grouping.hh" + +/** + generate meters. + */ +class Meter_engraver : public Request_engraver { +public: + Time_description time_; + Rhythmic_grouping default_grouping_; + + Meter_change_req * meter_req_l_; + Meter * meter_p_; + + virtual void fill_staff_info(Staff_info&); + virtual bool do_try_request(Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_creation_processing(); + virtual void do_post_move_processing(); + Meter_engraver(); + NAME_MEMBERS(); +}; +#endif // METERGRAV_HH diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index dea2478d24..d99b6efe67 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -12,69 +12,88 @@ #if 0 -// sketch. . . -class Midi_register { -}; - -class Midi_group_reg : public Midi_register, public Acceptor { +/* + sketch. . . + + It would be totally cool to share code with the Engraver hierarchy, + but this is very tough i think. + + */ +class Performer { + Performer_group_performer * daddy_perf_l_; + virtual bool try_request(Request*r) + { + return daddy_perf_l_->try_request(r); + } + virtual void play_event( Midi_item i ) { daddy_perf_l_->play_event (i ); } }; -class Midi_staff_reg : public Midi_group_reg { -}; - - -class Midi_note_reg : public Midi_register { +class Performer_group_performer : public Performer, public Translator { + Pointer_list perf_p_list_; -}; - -class Midi_voice_reg : public Midi_group_reg, public Interpreter { + Link_array group_l_arr_; + Link_array nongroup_l_arr_; + + bool try_request(Request*r) + { + bool hebbes_b =false; + for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++) + hebbes_b =nongroup_l_arr_[i]->try_request(req_l); + if (!hebbes_b) + hebbes_b = daddy_grav_l_->try_request(req_l); + return hebbes_b ; + } }; -class Midi_score_reg: public Midi_group_reg, public Global_acceptor { +class Staff_performer : public Performer_group_performer +{ + int midi_track_i_; + String instrument_str() { + return Translator::id_str_; + } + virtual void play_event ( Midi_item i) + { + i.track_i_ = midi_track_i_; + Performer::play_event(i); + } }; +class Voice_performer_group_performer : public Performer_group_performer { -#include "grouping.hh" -#include "staff-walker.hh" -#include "pcursor.hh" -#include "pqueue.hh" - - -struct Note_event : PQueue_ent -{ - bool ignore_b_; - Note_event() { - ignore_b_ = false; - } }; -int compare(Note_event const&, Note_event const&); +class Note_performer : public Performer { + Melodic_req * current_l_; + Moment switch_off_at_,switch_on_at_; -/** - a simple walker which collects midi stuff, and then outputs. - Should derive from Staff_walker - */ -class Midi_walker : public PCursor + virtual void process_request() { + if (when() == switch_off_at_ ) + play_event( Note_event(current_l_->pitch() )) +}; + +class Voice_performer : + public Performer_group_performer, public Interpreter { - Midi_track *track_l_; - PQueue< Note_event > stop_notes; - - Moment last_moment_; +}; - /* *************** */ - void do_stop_notes(Moment); - void do_start_note(Note_req *note_l); - void output_event(Midi_item&, Moment); -public: - - Midi_walker(Staff*, Midi_track*); - void do_process_requests(); - ~Midi_walker(); +class Score_performer: + public Performer_group_performer, public Global_translator +{ + Midi_file * file_p_; + Moment prev_; + virtual void play_event(Midi_item i) + { + file_p_->output (i); + } + virtual void prepare(Moment m){ + file_p_->move ( m -prev_ ); + } }; + #endif #endif // MIDIWALKER_HH diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index d2326a6e53..c4fc80655c 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -22,11 +22,11 @@ protected: public: Music_iterator *daddy_iter_l_; NAME_MEMBERS(); - Acceptor *report_to_l_; + Translator *report_to_l_; - static Music_iterator* static_get_iterator_p(Music*,Acceptor*); + static Music_iterator* static_get_iterator_p(Music*,Translator*); Music_iterator* get_iterator_p(Music*)const; - void set_acceptor(Acceptor*); + void set_translator(Translator*); Music_iterator(); virtual void next(Moment until); virtual Moment next_moment()const; @@ -34,7 +34,7 @@ public: virtual ~Music_iterator(); virtual void construct_children(); void print()const; - virtual Acceptor * get_req_acceptor_l(); + virtual Translator * get_req_translator_l(); }; // duh. diff --git a/lily/include/note-column-grav.hh b/lily/include/note-column-grav.hh new file mode 100644 index 0000000000..141fe4b93f --- /dev/null +++ b/lily/include/note-column-grav.hh @@ -0,0 +1,37 @@ +/* + note-column-grav.hh -- declare Note_column_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef NOTE_COLUMN_GRAV_HH +#define NOTE_COLUMN_GRAV_HH + +#include "engraver.hh" + +class Note_column_engraver :public Request_engraver { + Rest_column * rest_col_l(); + Note_column * note_col_l(); + + Array< Script * > script_l_arr_; + Stem * stem_l_; + Note_column *ncol_p_; + Rest_column *restcol_p_; + bool h_shift_b_; + int dir_i_; + + /* *************** */ + bool acceptable_elem_b(Score_elem const*)const; +protected: + virtual void set_feature(Feature); + virtual void acknowledge_element(Score_elem_info); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); +public: + Note_column_engraver(); + NAME_MEMBERS(); +}; +#endif // NOTE_COLUMN_GRAV_HH diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 21423cf5bc..98c9e11acd 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -10,6 +10,7 @@ #ifndef PAPER_DEF_HH #define PAPER_DEF_HH #include "lily-proto.hh" + #include "real.hh" #include "string.hh" #include "moment.hh" @@ -27,25 +28,24 @@ add support for multiple fontsizes split into "Input_paper_def" and Paper_def + add support for other len->wid conversions. - + + Input_engraver should be in here. */ class Paper_def { Lookup *lookup_p_; -public: - String outfile; - - Real linewidth; + Assoc *real_vars_p_; - /// how much space does a whole note take (ideally?) - Real whole_width; - - /// ideal = geometric_ ^ log2(duration) - Real geometric_; +public: + String outfile_str_; + /* *************** */ + void set_var(String, Real); + Real get_var (String)const; void reinit(); - Paper_def(Lookup*); + Paper_def(); void set(Lookup*); ~Paper_def(); Paper_def(Paper_def const&); @@ -60,17 +60,19 @@ public: /// thickness of the standard line Real rule_thickness()const; - + Real whole_width()const; + Real linewidth_f()const; /// height of the staff Real standard_height()const; /// width of a quaver ball Real note_width() const; void print() const; + Lookup const * lookup_l(); // TODO naming /** convert a duration to an idealspacing - influence using the geometric_ and whole_width parameters. + influence using the geometric_ and parameters. */ Real duration_to_dist(Moment); }; diff --git a/lily/include/rest-collision-grav.hh b/lily/include/rest-collision-grav.hh new file mode 100644 index 0000000000..2d67a1bde0 --- /dev/null +++ b/lily/include/rest-collision-grav.hh @@ -0,0 +1,27 @@ +/* + rest-collision-grav.hh -- declare Rest_collision_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef REST_COLLISION_GRAV_HH +#define REST_COLLISION_GRAV_HH + +#include "varray.hh" +#include "engraver.hh" + +class Rest_collision_engraver : public Request_engraver { + Rest_collision* rest_collision_p_; + Array< Collision *> collision_l_arr_; +protected: + virtual void acknowledge_element(Score_elem_info); + virtual void do_print() const; + virtual void do_pre_move_processing(); +public: + Rest_collision_engraver(); + NAME_MEMBERS(); +}; +#endif // REST_COLLISION_GRAV_HH diff --git a/lily/include/score-align-grav.hh b/lily/include/score-align-grav.hh new file mode 100644 index 0000000000..72777e2dae --- /dev/null +++ b/lily/include/score-align-grav.hh @@ -0,0 +1,28 @@ +/* + score-align-grav.hh -- declare Score_align_reg + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef SCORE_ALIGN_GRAV_HH +#define SCORE_ALIGN_GRAV_HH + +#include "engraver.hh" + +class Score_align_engraver: public Request_engraver +{ + Horizontal_group_item * align_p_; +public: + + const char* type_ch_C_; + int priority_i_; + Score_align_engraver(); + NAME_MEMBERS(); +protected: + virtual void acknowledge_element(Score_elem_info); + virtual void do_pre_move_processing(); +}; +#endif // SCORE_ALIGN_GRAV_HH diff --git a/lily/include/score-column.hh b/lily/include/score-column.hh index fb7f108729..b8daacd176 100644 --- a/lily/include/score-column.hh +++ b/lily/include/score-column.hh @@ -27,7 +27,7 @@ class Score_column { friend class Score; - friend class Score_register; + friend class Score_engraver; bool musical_b_; Moment when_; diff --git a/lily/include/score-elem-info.hh b/lily/include/score-elem-info.hh index b4d4fb748a..871634214f 100644 --- a/lily/include/score-elem-info.hh +++ b/lily/include/score-elem-info.hh @@ -19,7 +19,7 @@ struct Score_elem_info { Score_elem * elem_l_; Request*req_l_; Voice const * voice_l_; - Array origin_reg_l_arr_; + Array origin_grav_l_arr_; /* *** */ Score_elem_info(Score_elem*, Request*); diff --git a/lily/include/score-grav.hh b/lily/include/score-grav.hh new file mode 100644 index 0000000000..92b659a377 --- /dev/null +++ b/lily/include/score-grav.hh @@ -0,0 +1,60 @@ +/* + score-grav.hh -- declare Score_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef SCORE_GRAV_HH +#define SCORE_GRAV_HH + +#include "engraver-group.hh" +#include "global-translator.hh" + +class Score_engraver : + public Engraver_group_engraver, public Global_translator +{ + Line_of_score * scoreline_l_; + + + Array nobreak_item_p_arr_; + Link_array musical_item_p_arr_; + + Score_column* command_column_l_; + Score_column* musical_column_l_; + + friend class Score; + void set_cols(Score_column*,Score_column*); + void typeset_all(); + +public: + NAME_MEMBERS(); + + Score_engraver(); + +protected: + /* Global_translator interface */ + virtual void set_score(Score * score_l); + virtual void prepare(Moment); + virtual void finish(); + virtual void process(); + virtual int depth_i() const { return Global_translator::depth_i();} + virtual Translator* ancestor_l(int l) { return Global_translator::ancestor_l(l);} + +protected: + /* Engraver_group_engraver interface */ + virtual Staff_info get_staff_info()const; + virtual bool do_try_request(Request*); + virtual void do_creation_processing(); + virtual void do_removal_processing(); + virtual void announce_element(Score_elem_info); + virtual void typeset_breakable_item(Item * nobreak_p); + virtual void do_announces(); + virtual void typeset_element(Score_elem*elem_p); + virtual Paper_def * paper() const; + virtual void do_pre_move_processing(); +}; + +#endif // SCORE_GRAV_HH diff --git a/lily/include/score-halign-grav.hh b/lily/include/score-halign-grav.hh new file mode 100644 index 0000000000..fef509157a --- /dev/null +++ b/lily/include/score-halign-grav.hh @@ -0,0 +1,23 @@ +/* + score-halign-grav.hh -- declare Score_horizontal_align_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef SCORE_HALIGN_GRAV_HH +#define SCORE_HALIGN_GRAV_HH +#include "engraver.hh" +class Score_horizontal_align_engraver : public Request_engraver { + + Break_align_item * halign_p_; +public: + NAME_MEMBERS(); + Score_horizontal_align_engraver(); +protected: + virtual void acknowledge_element(Score_elem_info); + virtual void do_pre_move_processing(); +}; +#endif // SCORE_HALIGN_GRAV_HH diff --git a/lily/include/score.hh b/lily/include/score.hh index 56e29b8513..b11118f17f 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -58,13 +58,10 @@ public: /// find a column. PCursor find_col(Moment,bool); - /// when does the last *musical* element finish? - Moment last() const; - Score(Score const&); private: - void run_acceptor(Global_acceptor*); + void run_translator(Global_translator*); void paper_output(); /// do midi stuff void midi(); diff --git a/lily/include/script-grav.hh b/lily/include/script-grav.hh new file mode 100644 index 0000000000..fc8f02980d --- /dev/null +++ b/lily/include/script-grav.hh @@ -0,0 +1,32 @@ +/* + script-grav.hh -- part of GNU LilyPond + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef SCRIPTGRAV_HH +#define SCRIPTGRAV_HH + +#include "engraver.hh" + + +class Script_engraver : public Request_engraver { + Array