From 2862b1027f316a2f0444fa92e441ee28acf7a463 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 1 Sep 1997 01:22:51 +0200 Subject: [PATCH] release: 0.1.11 --- .dstreamrc | 8 +- AUTHORS.text | 16 +- DEDICATION | 2 +- Documentation/AUTHORS.pod | 11 +- Documentation/Makefile | 2 +- Documentation/Rules.make | 2 +- Documentation/Vocab-British | 21 - Documentation/Vocab-French | 237 ---------- Documentation/Vocab-German | 8 - Documentation/gnu-music.pod | 117 ++--- Documentation/index.pod | 1 + Documentation/links.pod | 4 +- Documentation/mudela-course.doc | 12 +- Documentation/vocabulary-data | 244 ++++++++++ Documentation/vocabulary-forms.el | 21 + INSTALL.text | 12 +- NEWS | 28 ++ README | 27 +- TODO | 66 ++- VERSION | 4 +- bin/make-website.in | 10 +- flower/VERSION | 2 +- flower/choleski.cc | 8 +- flower/diagonal-storage.cc | 20 +- flower/directed-graph.cc | 6 +- flower/full-storage.cc | 2 +- flower/include/assoc-iter.hh | 2 +- flower/include/choleski.hh | 6 +- flower/include/cursor.hh | 6 +- flower/include/cursor.icc | 6 +- flower/include/diagonal-storage.hh | 8 +- flower/include/directed-graph.hh | 2 +- flower/include/full-storage.hh | 8 +- flower/include/full-storage.icc | 4 +- flower/include/interval.hh | 4 +- flower/include/interval.tcc | 11 +- flower/include/lgetopt.hh | 4 +- flower/include/list.icc | 4 +- flower/include/list.tcc | 2 +- flower/include/matrix-storage.hh | 4 +- flower/include/matrix.hh | 6 +- flower/include/parray.hh | 2 +- flower/include/path.hh | 2 +- flower/include/plist.icc | 13 +- flower/include/plist.tcc | 27 +- flower/include/pointer.tcc | 2 +- flower/include/string-data.hh | 2 +- flower/include/string-data.icc | 2 +- flower/include/string-handle.hh | 2 +- flower/include/virtual-methods.hh | 2 +- flower/lgetopt.cc | 4 +- flower/matrix-storage.cc | 2 +- flower/matrix.cc | 6 +- flower/path.cc | 2 +- init/engraver.ly | 9 +- input/fugue1.ly | 208 +++++++++ input/prelude1.ly | 190 ++++++++ input/rhythm.ly | 18 +- input/standchen-16.ly | 20 - input/standchen-16.tex | 2 +- input/standchen-20.ly | 22 - input/standchen-20.tex | 2 +- input/{standchen-part.ly => standchen.ly} | 32 +- input/wohltemperirt.ly | 6 +- lib/binary-source-file.cc | 34 +- lib/duration-convert.cc | 416 +++++++++--------- lib/duration.cc | 10 +- lib/file-storage.cc | 101 ----- lib/includable-lexer.cc | 81 ++-- lib/include/duration.hh | 2 +- lib/include/file-storage.hh | 12 +- lib/include/includable-lexer.hh | 2 +- lib/include/input.hh | 8 +- lib/include/plet.hh | 4 +- lib/include/source-file.hh | 14 +- lib/input.cc | 16 +- lib/mapped-file-storage.cc | 101 +++++ lib/plet.cc | 6 +- lib/simple-file-storage.cc | 51 ++- lib/source-file.cc | 72 +-- lib/source.cc | 48 +- lib/template.cc | 4 +- ...indhoos-suck-suck-suck-thank-you-cygnus.cc | 24 +- lily/VERSION | 4 +- lily/audio-item.cc | 4 +- lily/audio-score.cc | 33 +- lily/audio-staff.cc | 2 +- lily/axis-group-item.cc | 27 +- lily/axis-group-spanner.cc | 132 +++--- lily/axis-group.cc | 20 +- lily/bar-column-grav.cc | 2 +- lily/bar-column.cc | 2 +- lily/bar-grav.cc | 28 +- lily/bar-number-grav.cc | 34 +- lily/bar.cc | 4 +- lily/beam-grav.cc | 130 ++++++ lily/beam.cc | 312 ++++++------- lily/bow.cc | 16 +- lily/break.cc | 64 +-- lily/chord-iterator.cc | 88 ++++ lily/clef-grav.cc | 2 +- lily/clef-item.cc | 16 +- lily/col-info.cc | 8 +- lily/colhpos.cc | 4 +- lily/collision.cc | 6 +- lily/command-request.cc | 90 ++-- lily/crescendo.cc | 28 +- lily/dimen.cc | 10 +- lily/directional-spanner.cc | 6 +- lily/dynamic-grav.cc | 128 +++--- lily/elem-group-item.cc | 2 +- lily/elem-group.cc | 21 +- lily/engraver-group.cc | 146 +++--- lily/engraver.cc | 11 +- lily/general-script-def.cc | 25 +- lily/global-translator.cc | 21 +- lily/gourlay-breaking.cc | 30 +- lily/grouping.cc | 12 +- lily/head-column.cc | 22 +- lily/horizontal-align-item.cc | 94 ++-- lily/identifier.cc | 6 +- lily/include/audio-score.hh | 28 +- lily/include/axis-group-item.hh | 17 +- lily/include/axis-group-spanner.hh | 16 +- lily/include/axis-group.hh | 41 +- lily/include/bar-number-grav.hh | 11 +- lily/include/bar.hh | 16 +- lily/include/beam-grav.hh | 36 ++ lily/include/beam.hh | 44 +- lily/include/bow.hh | 14 +- lily/include/boxes.hh | 4 +- lily/include/break-caching.hh | 2 +- lily/include/break.hh | 18 +- lily/include/chord-iterator.hh | 33 ++ lily/include/clef-item.hh | 2 +- lily/include/col-info.hh | 6 +- lily/include/colhpos.hh | 6 +- lily/include/command-request.hh | 14 +- lily/include/crescendo.hh | 21 +- lily/include/direction.hh | 26 ++ lily/include/directional-spanner.hh | 2 +- lily/include/drul-array.hh | 34 ++ lily/include/dynamic-grav.hh | 2 +- lily/include/elem-group-item.hh | 15 +- lily/include/elem-group.hh | 4 +- lily/include/engraver-group.hh | 10 +- lily/include/engraver.hh | 6 +- lily/include/general-script-def.hh | 18 +- lily/include/global-translator.hh | 34 +- lily/include/gourlay-breaking.hh | 2 +- lily/include/grouping.hh | 2 +- lily/include/head-column.hh | 38 +- lily/include/header.hh | 2 +- lily/include/horizontal-align-item.hh | 7 +- lily/include/horizontal-group-item.hh | 23 +- lily/include/idealspacing.hh | 2 +- lily/include/identifier.hh | 6 +- lily/include/ineq-constrained-qp.hh | 4 +- lily/include/item.hh | 49 ++- lily/include/key-item.hh | 2 +- lily/include/key.hh | 2 +- lily/include/lily-proto.hh | 4 +- lily/include/line-spacer.hh | 4 +- lily/include/linespace.hh | 10 +- lily/include/local-key-item.hh | 2 +- lily/include/lookup.hh | 48 +- lily/include/meter-grav.hh | 21 +- lily/include/midi-def.hh | 48 +- lily/include/music-iterator.hh | 96 +--- lily/include/music-list.hh | 4 +- lily/include/music-output-def.hh | 29 ++ lily/include/music-output.hh | 35 ++ lily/include/music.hh | 2 +- lily/include/musical-request.hh | 198 ++++----- lily/include/my-lily-parser.hh | 4 +- lily/include/note-column-grav.hh | 4 +- lily/include/note-column.hh | 13 +- lily/include/note-head.hh | 6 +- lily/include/offset.hh | 54 +-- lily/include/p-col.hh | 107 ++--- lily/include/p-score.hh | 105 ++--- lily/include/paper-def.hh | 100 ++--- lily/include/performer-group-performer.hh | 2 +- lily/include/qlpsolve.hh | 2 +- lily/include/request-iterator.hh | 32 ++ lily/include/request.hh | 7 +- lily/include/score-column.hh | 7 +- lily/include/score-elem.hh | 233 +++++----- lily/include/score-grav.hh | 60 ++- lily/include/score-performer.hh | 36 +- lily/include/score.hh | 70 +-- lily/include/scoreline.hh | 34 +- lily/include/script-def.hh | 46 +- lily/include/script.hh | 4 +- lily/include/slur-grav.hh | 2 +- lily/include/span-bar-grav.hh | 2 +- lily/include/span-bar.hh | 4 +- lily/include/span-score-bar-grav.hh | 2 +- lily/include/span-score-bar.hh | 2 +- lily/include/spanner-elem-group.hh | 25 -- lily/include/spanner.hh | 52 ++- lily/include/spring-spacer.hh | 10 +- lily/include/staff-info.hh | 4 +- lily/include/staff-side.hh | 7 +- lily/include/staff-sym.hh | 21 +- lily/include/stem-beam-grav.hh | 40 -- lily/include/stem-grav.hh | 33 ++ lily/include/stem.hh | 110 ++--- lily/include/super-elem.hh | 2 +- lily/include/symbol.hh | 2 +- lily/include/symtable.hh | 6 +- lily/include/text-def.hh | 4 +- lily/include/text-grav.hh | 2 +- lily/include/text-item.hh | 4 +- lily/include/text-spanner.hh | 2 +- lily/include/tie-grav.hh | 2 +- lily/include/tie.hh | 6 +- lily/include/time-description.hh | 8 +- lily/include/timing-grav.hh | 30 +- lily/include/translator.hh | 34 +- lily/include/vertical-align-elem.hh | 2 +- lily/include/vertical-group-spanner.hh | 13 +- lily/include/voice-group-gravs.hh | 2 +- lily/include/voice-iterator.hh | 38 ++ lily/include/word-wrap.hh | 2 +- lily/ineq-constrained-qp.cc | 4 +- lily/input-translator.cc | 6 +- lily/item.cc | 117 +++-- lily/key-grav.cc | 2 +- lily/key-item.cc | 4 +- lily/key-performer.cc | 12 +- lily/keyword.cc | 2 +- lily/lexer.l | 4 + lily/line-group-grav.cc | 7 +- lily/line-spacer.cc | 2 +- lily/local-key-grav.cc | 92 ++-- lily/local-key-item.cc | 2 +- lily/lookup.cc | 56 +-- lily/lyric-grav.cc | 6 +- lily/lyric-performer.cc | 8 +- lily/main.cc | 16 +- lily/meter-grav.cc | 120 +---- lily/meter-performer.cc | 20 +- lily/meter.cc | 2 +- lily/midi-def.cc | 25 +- lily/midi-item.cc | 48 +- lily/midi-stream.cc | 14 +- lily/midi-walker.cc | 18 +- lily/music-iterator.cc | 310 ++----------- lily/music-list.cc | 6 +- lily/music-output-def.cc | 12 + lily/music.cc | 6 +- lily/musical-request.cc | 63 +-- lily/my-lily-lexer.cc | 4 +- lily/my-lily-parser.cc | 134 +++--- lily/note-column-grav.cc | 90 ++-- lily/note-column.cc | 15 +- lily/note-performer.cc | 10 +- lily/note.cc | 2 +- lily/notehead.cc | 56 +-- lily/p-col.cc | 136 ++---- lily/p-score.cc | 288 ++++++------ lily/paper-def.cc | 38 +- lily/parser.y | 188 ++++---- lily/performer-group-performer.cc | 20 +- lily/performer.cc | 2 +- lily/request-iterator.cc | 75 ++++ lily/request.cc | 8 +- lily/rest-collision-grav.cc | 2 +- lily/rest-collision.cc | 14 +- lily/score-align-grav.cc | 2 +- lily/score-column.cc | 26 +- lily/score-elem.cc | 318 ++++++------- lily/score-grav.cc | 182 ++++---- lily/score-performer.cc | 34 +- lily/score.cc | 194 +++----- lily/scoreline.cc | 146 +++--- lily/scores.cc | 5 - lily/script-column.cc | 48 +- lily/script-def.cc | 36 +- lily/script-grav.cc | 24 +- lily/script.cc | 38 +- lily/slur-grav.cc | 68 +-- lily/slur.cc | 56 +-- lily/span-bar-grav.cc | 36 +- lily/span-bar.cc | 10 +- lily/span-score-bar.cc | 6 +- lily/spanner-elem-group.cc | 30 -- lily/spanner.cc | 147 ++++--- lily/spring-spacer.cc | 252 +++++------ lily/staff-info.cc | 4 +- lily/staff-performer.cc | 2 +- lily/staff-side.cc | 56 +-- lily/staff-sym-grav.cc | 5 +- lily/staff-sym.cc | 12 +- lily/stem-beam-grav.cc | 193 -------- lily/stem-grav.cc | 59 +++ lily/stem.cc | 156 +++---- lily/super-elem.cc | 15 +- lily/symbol.cc | 2 +- lily/symtable.cc | 20 +- lily/template1.cc | 3 +- lily/template2.cc | 2 +- lily/template3.cc | 4 +- lily/template6.cc | 4 +- lily/template7.cc | 4 +- lily/template8.cc | 5 +- lily/tex-beam.cc | 34 +- lily/tex-slur.cc | 92 ++-- lily/tex.cc | 4 - lily/text-def.cc | 4 +- lily/text-grav.cc | 76 ---- lily/text-item.cc | 26 +- lily/text-spanner.cc | 10 +- lily/tie-grav.cc | 16 +- lily/tie.cc | 84 ++-- lily/time-description.cc | 10 +- lily/timing-grav.cc | 123 +++++- lily/translator.cc | 2 +- lily/vertical-align-elem.cc | 4 +- lily/vertical-align-grav.cc | 18 +- lily/voice-group-gravs.cc | 14 +- lily/voice-iterator.cc | 129 ++++++ lily/word-wrap.cc | 126 +++--- make/lilypond.lsm | 8 +- make/lilypond.spec | 6 +- mi2mu/mudela-score.cc | 96 ++-- mi2mu/template.cc | 10 +- 328 files changed, 6132 insertions(+), 5690 deletions(-) delete mode 100644 Documentation/Vocab-British delete mode 100644 Documentation/Vocab-French delete mode 100644 Documentation/Vocab-German create mode 100644 Documentation/vocabulary-data create mode 100644 Documentation/vocabulary-forms.el create mode 100644 input/fugue1.ly create mode 100644 input/prelude1.ly delete mode 100644 input/standchen-16.ly delete mode 100644 input/standchen-20.ly rename input/{standchen-part.ly => standchen.ly} (93%) delete mode 100644 lib/file-storage.cc create mode 100644 lib/mapped-file-storage.cc create mode 100644 lily/beam-grav.cc create mode 100644 lily/chord-iterator.cc create mode 100644 lily/include/beam-grav.hh create mode 100644 lily/include/chord-iterator.hh create mode 100644 lily/include/direction.hh create mode 100644 lily/include/drul-array.hh create mode 100644 lily/include/music-output-def.hh create mode 100644 lily/include/music-output.hh create mode 100644 lily/include/request-iterator.hh delete mode 100644 lily/include/spanner-elem-group.hh delete mode 100644 lily/include/stem-beam-grav.hh create mode 100644 lily/include/stem-grav.hh create mode 100644 lily/include/voice-iterator.hh create mode 100644 lily/music-output-def.cc create mode 100644 lily/request-iterator.cc delete mode 100644 lily/spanner-elem-group.cc delete mode 100644 lily/stem-beam-grav.cc create mode 100644 lily/stem-grav.cc delete mode 100644 lily/text-grav.cc create mode 100644 lily/voice-iterator.cc diff --git a/.dstreamrc b/.dstreamrc index 211edb54f5..6e401c89cf 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -22,14 +22,14 @@ Bar 0 Beam 0 Change_iterator 0 Chord 0 -Chord_iterator 1 +Chord_iterator 0 Clef_item 0 Col_configuration 0 Colinfo 0 Colinfo 0 Collision 0 -Engraver 1 -Engraver_group_engraver 1 +Engraver 0 +Engraver_group_engraver 0 Group_change_req 0 Head_column 0 Idealspacing 0 @@ -43,7 +43,7 @@ Melodic_req 0 Midi_def 0 Mixed_qp 0 Music 0 -Music_iterator 1 +Music_iterator 0 My_lily_lexer 1 Note_head 0 Note_performer 0 diff --git a/AUTHORS.text b/AUTHORS.text index 74174c3073..ce11d24663 100644 --- a/AUTHORS.text +++ b/AUTHORS.text @@ -23,9 +23,9 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS lily/midi-*, mi2mu/*, parts flower/string*.cc, make/*.make, */Makefile parts of Documentation/mudela.pod, lib/*source-file*, - lib/duration.cc, lib/source, flower/*{list,cursor}*, + lib/duration.cc, lib/source*, flower/*{list,cursor}*, lily/rest-collision*, conflily, cygnus w32 stuff, - lily/*perf* + lily/*perf*, some input files and corresponding header files. @@ -42,10 +42,15 @@ CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSS +o Anthony Fok , debian package: make/debian/* + +o Franc,ois Pinard , Neil + Jerram . Documentation/Vocab* + Your name could be here! If you want to help, then take a look at the SMALLISH PROJECTS section of in the file _T_O_D_O. Some do not involve coding C++ + [And of course, J.S.Bach, F.Schubert, T. Merula and + W.A.Mozart] @@ -56,11 +61,6 @@ CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSS - - - - - -12/Aug/97 LilyPond 0.1.10 1 +30/Aug/97 LilyPond 0.1.11 1 diff --git a/DEDICATION b/DEDICATION index c96c364dfa..36414b54e8 100644 --- a/DEDICATION +++ b/DEDICATION @@ -15,7 +15,7 @@ Janneke! That's a nice thought, Wendy. I've got a few too, to spread the credits a bit (Again, no particular order) Michelle, Illushka, Ruth, Eva, Fro/ydis, Monique, Noor, Sascha, Monique, Ilse, Monique, -Eva, Roos, Judith, and, of course, Wendy! +Eva, Roos, Judith, Tim, and, of course, Wendy! JCN diff --git a/Documentation/AUTHORS.pod b/Documentation/AUTHORS.pod index f6366d5e00..2d40fefc7f 100644 --- a/Documentation/AUTHORS.pod +++ b/Documentation/AUTHORS.pod @@ -22,8 +22,8 @@ Jan Nieuwenhuizen , http://www.digicash.com/~jan lily/midi-*, mi2mu/*, parts flower/string*.cc, make/*.make, */Makefile parts of Documentation/mudela.pod, lib/*source-file*, lib/duration.cc, -lib/source, flower/*{list,cursor}*, lily/rest-collision*, conflily, -cygnus w32 stuff, lily/*perf* +lib/source*, flower/*{list,cursor}*, lily/rest-collision*, conflily, +cygnus w32 stuff, lily/*perf*, some input files and corresponding header files. @@ -51,8 +51,15 @@ Alexandre Oliva , testing Anthony Fok , debian package: make/debian/* +=item * + +Franc,ois Pinard , Neil Jerram +. Documentation/Vocab* + =back Your name could be here! If you want to help, then take a look at the SMALLISH PROJECTS section of in the file F. Some do not involve coding C++ + +[And of course, J.S.Bach, F.Schubert, T. Merula and W.A.Mozart] diff --git a/Documentation/Makefile b/Documentation/Makefile index 521caa1bb6..4da45d58b0 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -39,7 +39,7 @@ giffiles=$(XPMS:.xpm=.gif) gifs: $(addprefix $(outdir)/, $(giffiles)) -EXTRA_DISTFILES = $(XPMS) $(DOCFILES) $(wildcard Vocab*) +EXTRA_DISTFILES = $(XPMS) $(DOCFILES) vocabulary-data vocabulary-forms.el # don't do DVI files. They can only be made if lily is installed do-doc: $(TEXTFILES) diff --git a/Documentation/Rules.make b/Documentation/Rules.make index 5ac09affd2..7e87d4ff6b 100644 --- a/Documentation/Rules.make +++ b/Documentation/Rules.make @@ -43,7 +43,7 @@ $(outdir)/%.gz: $(outdir)/% gzip -c9 $< > $@ name-stem= $(notdir $(basename $<)) -$(outdir)/%.dvi: $(depth)/input/%.ly +$(outdir)/%.dvi: $(depth)/input/%.ly $(depth)/VERSION (cd $(outdir); \ lilypond -o $(name-stem) ../$< ) (cd $(outdir); \ diff --git a/Documentation/Vocab-British b/Documentation/Vocab-British deleted file mode 100644 index d2b666a42f..0000000000 --- a/Documentation/Vocab-British +++ /dev/null @@ -1,21 +0,0 @@ -# Musical vocabulary, correspondance from British. -# Copyright (C) 1993 Free Software Foundation, Inc. -# Neil Jerram , 1993. - -British American - -breve double whole note -crotchet quarter note -crotchet rest quarter rest -demisemiquaver thirty-second note -demisemiquaver rest thirty-second rest -hemidemisemiquaver sixty-fourth note -hemidemisemiquaver rest sixty-fourth rest -minim half note -minim rest half rest -quaver eighth note -quaver rest eighth rest -semibreve whole note -semibreve rest whole rest -semiquaver sixteenth note -semiquaver rest sixteenth rest diff --git a/Documentation/Vocab-French b/Documentation/Vocab-French deleted file mode 100644 index 74e46227a2..0000000000 --- a/Documentation/Vocab-French +++ /dev/null @@ -1,237 +0,0 @@ -# Musical vocabulary, correspondance from French. -# Copyright (C) 1993 Free Software Foundation, Inc. -# Francois Pinard , 1993. - -# Thanks to Neil Jerram . - -French American - -accentuation accentuation -accolade brace -accord chord -accord de neuvième dominante chord of the dominant ninth -accord de septième dominante chord of the dominant seventh -accord parfait majeur perfect major chord -accord parfait mineur perfect minor chord -alto alto -altération accidentelle accident; accidental alteration -altération essentielle essential alteration -appogiature appoggiatura -appogiature brève short appoggiatura -appogiature double double appoggiatura -appogiature longue long appoggiatura -appogiature simple simple appoggiatura -armature [de la clé] key signature -armure [de la clé] key signature -arpège arpeggio -augmenté (intervalle) augmented (interval) -bariton baritone -barre de mesure bar line -barre de reprise repeat -basse bass -blanche half note -bâton de pause (arbitrary number of bars' rest) -bâton de pause four-bar rest -bâton de pause two-bar rest -bécarre natural sign -bémol flat -cadence cadence -cadence harmonique harmonic cadence -cadence mélodique melodic cadence -caractère character -chaîne de trilles chain of trills -chevron chevron -chiffrage time signature -chiffre inférieur lower number -chiffre supérieur upper number -chiffres indicateurs time signature -clé clef -clé d'octave octave line -clé d'ut middle C clef -clé de fa bass clef -clé de sol treble clef -comma comma -comma enharmonique -comma pythagoricien -comma syntonique -consonance consonant interval; consonance -contralto contralto -contre-temps contro-time -contre-temps irrégulier irregular contro-time -contre-temps régulier regular contro-time -coulé slur -courbe rythmique rythmic curve -cresendo opening angular bracket -croche eighth note -decrescendo closing angular bracket -degré [de la gamme] degree [of the scale] -demi-pause half rest -demi-soupir eighth rest -demi-ton semitone -demi-ton chromatique chromatic semitone -demi-ton diatonique diatonic semitone -diapason pitch pipe; tuning fork -diminué (intervalle) diminished (interval) -dissonance dissonant interval; dissonance -dièse sharp -do C -do central middle C -doigté -doigté de pédale -dominante dominant -double barre double bar line -double bémol double flat -double croche sixteenth note -double dièse double sharp -double triolet double triplet -duolet duplet -durée duration -échelle d'octave octave line -échelle musicale Musical Ladder -enharmonie enharmony -espace space -extension d'intervalle extension of interval -fa F -figure de note kind of note -figure de silence kind of rest -fioriture cadenza -forme du mode mineur ancien ancient form (diatonic minor scale) -forme harmonique harmonic form (diatonic minor scale) -forme mélodique melodic form (diatonic minor scale) -gamme scale -gamme chromatique chromatic scale -gamme diatonique majeure diatonic major scale -gamme diatonique mineure diatonic minor scale -gammes enharmoniques enharmonic scales -gammes relatives relative scales -genre chromatique chromatic type -genre diatonique diatonic type -genre enharmonique enharmonic type -groupe irrégulier irregular group -grupetto turn; gruppetto -hauteur pitch -huitième de soupir thirty-second rest -incise motive -indication de pédale -indication métronomique metronomic indication -intervalle interval -intervalle ascendant ascending interval -intervalle composé compound interval -intervalle descendant descending interval -intervalle harmonique harmonic interval -intervalle simple simple interval -intervalles enharmoniques enharmonic intervals -juste (intervalle) perfect (interval) -la A -liaison tie -liaison rythmique legato curve -ligne line -ligne supplémentaire ledger line -majeur (intervalle) major (interval) -membre de phrase phrase member -mesure bar; measure -mesure artificielle artificial measure -mesure composée compound measure -mesure incomplète incomplete measure -mesure irrégulière irregular measure -mesure simple simple measure -mezzo-soprano mezzo-soprano -mi E -mineur (intervalle) minor (interval) -mode mode -mode ecclésiastique -mode majeur major mode -mode mineur minor mode -modulation modulation -mordant mordent -mouvement tempo; movement -mouvement conjoint conjunct movement -mouvement disjoint disjunct movement -mouvement lent slow tempo -mouvement modéré moderate tempo -mouvement rapide fast tempo -médiante mediant -métronome metronome -noire quarter note -note note -note doublement pointée double dotted note -note modale modal note -note pointée dotted note -note tonale tonal note -notes enharmoniques enharmonic notes -nuance shading -octave octave -ornement embellishment; accessory -partition score -pause whole rest -phrase phrase -phrasé phrasing -pizzicato dash over/below -point dot -point d'orgue pause -point et liaison combinés dot and curved line combined -pointillés -portamento underline over/below -portée staff -portées staves -quadruple croche sixty-fourth note -quart de soupir sixteenth rest -quarte fourth -quartolet quadruplet -quinte fifth -registre register -renversement d'intervalle inversion of interval -renvoi return sign -respiration artificial rest -ronde whole note -rythme rythm -ré D -seconde second -seizième de soupir sixty-fourth rest -sensible leading note -septième seventh -sextolet sextuplet -si B -signes indicateurs de nuance shading signs -silence rest -sixain sextuplet -sixte sixth -sol G -soprano soprano -soupir quarter rest -sous-dominante subdominant -sous-tonique subtonic -staccato dot over/below -sus-dominante superdominant -sus-tonique supertonic -syncope syncopation; upbeat -syncope irrégulière irregular syncopation -syncope régulière regular syncopation -temps beat -temps binaire binary beat -temps faible weak beat -temps fort strong beat -temps ternaire ternary beat -tempérament mésotonique meantone tuning -tempérament égal tempered tuning -tierce third -ton tone -tonalité tonality -tonique tonic -tons relatifs relative scales -tons voisins adjacent keys -transposition transposition -transposition chromatique chromatic transposition -transposition enharmonique enharmonic transposition -trille trill; shake -trille double double trill -triolet triplet -triple croche thirty-second note -triton tritone -ténor tenor -tétracorde tetrachord -unisson unison -unité de mesure unit of measure -unité de temps unit of beat -ut C -voix voice diff --git a/Documentation/Vocab-German b/Documentation/Vocab-German deleted file mode 100644 index 488c4f0c49..0000000000 --- a/Documentation/Vocab-German +++ /dev/null @@ -1,8 +0,0 @@ -# Musical vocabulary, correspondance from German. -# Copyright (C) 1993 Free Software Foundation, Inc. -# Francois Pinard , 1993. - -German American - -B B flat -H B diff --git a/Documentation/gnu-music.pod b/Documentation/gnu-music.pod index 2a2ee0009a..3398e283bc 100644 --- a/Documentation/gnu-music.pod +++ b/Documentation/gnu-music.pod @@ -4,63 +4,7 @@ GNU Music project - manifesto =head1 DESCRIPTION -Random ranting about the GNU Music project. - -=head2 History of the GNU Music Project - -Please note that this all happened when I wasn't around yet. If you -think that I am a biased, unfair, predisposed hypocrite, then don't -bother flaming me; I already know that. - -The GNU Music project is a project which aims to create free software -for music printing and composing. It was started in november '92 by a -core team of four members (Bryan Ford , David Linn -, Francois Pinard , -Neil Jerram and in January '93 Robert Strandh - joined. - -After serious disputes with Robert Strandh - and the FSF staff in '94, the -project core team got divided. The development efforts of GMP stopped. - -Independently, I (HWN) started LilyPond. When I showed it to -RMS, he was very enthousiastic about having LilyPond in the GNU -project. I subsequently learned about the GNU Music project, and -contacted them. - -What was left of the GMP (Robert Strandh) and us, LilyPond people, -agreed that cooperation would be desirable. Although merging of both -efforts was and is technically infeasible, we did decide that LilyPond -should also be part of the GNU Music project. - -Only later did I discover the previous quarrels about the GMP-"take -1". To show that I am aware of the history, and to make sure nobody -gets me wrong or is angry at me because I stole a project or a -project's name, I wrote this note. - -In summary, LilyPond is now the only substantial embodiment of the GNU Music -Project, and it is part of the GNU project. - -For completeness' sake, I will mention the other efforts here: - -=over 4 - -=item G Sharp, http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp - -An alpha version notation editor for X in Scheme. Source available on -request. - -=item GNU music, - -An alpha version of a music editing system with Musictex -output. Pretest versions of GNU Music (v0.3) can still be obtained from -Francois Pinard. - -=back - -This history note is probably biased in some way, because I wrote it. -The rest of this document is also entirely mine, and is not meant to -reflect anyone else's opinion. +Random ranting about the GNU Music project. =head1 GOAL @@ -264,3 +208,62 @@ support would be desirable. =back + + +=head1 HISTORY + + +Please note that this all happened when I wasn't around yet. If you +think that I am a biased, unfair, predisposed hypocrite, then don't +bother flaming me; I already know that. + +The GNU Music project is a project which aims to create free software +for music printing and composing. It was started in november '92 by a +core team of four members (Bryan Ford , David Linn +, Francois Pinard , +Neil Jerram and in January '93 Robert Strandh + joined. + +After serious disputes with Robert Strandh + and the FSF staff in '94, the +project core team got divided. The development efforts of GMP stopped. + +Independently, I (HWN) started LilyPond. When I showed it to +RMS, he was very enthousiastic about having LilyPond in the GNU +project. I subsequently learned about the GNU Music project, and +contacted them. + +What was left of the GMP (Robert Strandh) and us, LilyPond people, +agreed that cooperation would be desirable. Although merging of both +efforts was and is technically infeasible, we did decide that LilyPond +should also be part of the GNU Music project. + +Only later did I discover the previous quarrels about the GMP-"take +1". To show that I am aware of the history, and to make sure nobody +gets me wrong or is angry at me because I stole a project or a +project's name, I wrote this note. + +In summary, LilyPond is now the only substantial embodiment of the GNU Music +Project, and it is part of the GNU project. + +For completeness' sake, I will mention the other efforts here: + +=over 4 + +=item G Sharp, http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp + +An alpha version notation editor for X in Scheme. Source available on +request. + +=item GNU music, + +An alpha version of a music editing system with Musictex +output. Pretest versions of GNU Music (v0.3) can still be obtained from +Francois Pinard. + +=back + +This history note is probably biased in some way, because I wrote it. +The rest of this document is also entirely mine, and is not meant to +reflect anyone else's opinion. + diff --git a/Documentation/index.pod b/Documentation/index.pod index 6701961f3f..29ec80b6a3 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -52,6 +52,7 @@ The installation instructions. +=back =head2 Why: Background Information diff --git a/Documentation/links.pod b/Documentation/links.pod index 2402e2e533..955f9f3ec6 100644 --- a/Documentation/links.pod +++ b/Documentation/links.pod @@ -114,7 +114,7 @@ gnu-music-discuss. =item http://www.ssc.com/linux/ -The Number One Free OS-Kernel: Linux +The Number One Free Operating System Kernel: Linux =item http://www.bright.net/~dlphilp/linux_soundapps.html @@ -126,7 +126,7 @@ More software for (early) music. =item http://www.emry.net/webwatcher/ -The Linux webwatcher. +The Linux webwatcher: this site logs changes in important Linux sites. =item http://www.pbm.com/~lindahl/ravenscroft/modern diff --git a/Documentation/mudela-course.doc b/Documentation/mudela-course.doc index 369cfc745c..da2be2526b 100644 --- a/Documentation/mudela-course.doc +++ b/Documentation/mudela-course.doc @@ -19,8 +19,9 @@ \section{Overview} + Mudela is a language for specifying music. LilyPond is a -program which converts such a specification into formatted sheet +program which converts such a specification into formatted sheet music, or MIDI output. Please note that some examples not only demonstrate features but also @@ -100,12 +101,13 @@ etc. \end{mudela} -LilyPond is designed to handle complicated stuff -automatically. Expertise should be in the program, not in the user. +LilyPond is designed to handle complicated stuff automatically. +Expertise should be in the program, not in the user. -The following example shows how multiple voice on the same staff are +The following example shows how multiple voices on the same staff are handled graciously (well, somewhat). If the noteheads of different -voices collide, they are moved horizontally. The same goes for the rests. +voices collide, they are moved horizontally. Rests are moved +vertically. \begin[verbatim]{mudela} two_voice = \melodic diff --git a/Documentation/vocabulary-data b/Documentation/vocabulary-data new file mode 100644 index 0000000000..c2ed3f098f --- /dev/null +++ b/Documentation/vocabulary-data @@ -0,0 +1,244 @@ +Francais:US English:Deutsch:UK English:Nederlands:Italiaans +accentuation:accentuation:::accent: +accolade:brace:::: +accord:chord:::akkoord: +accord de neuvième dominante:chord of the dominant ninth:::dominant akkoord: +accord de septième dominante:chord of the dominant seventh:::septiem akkoord: +accord parfait majeur:perfect major chord:::: +accord parfait mineur:perfect minor chord:::: +alto:alto:::alt: +altération accidentelle:accident; accidental alteration:::toevallig teken: +altération essentielle:essential alteration:::: +appogiature:appoggiatura:::: +appogiature brève:short appoggiatura:::: +appogiature double:double appoggiatura:::: +appogiature longue:long appoggiatura:::: +appogiature simple:simple appoggiatura:::: +armature [de la clé]:key signature:::toonsoort (voortekens): +armure [de la clé]:key signature:::: +arpège:arpeggio:::: +augmenté (intervalle):augmented (interval):::: +bariton:baritone:::: +barre de mesure:bar line:::: +barre de reprise:repeat:::: +basse:bass:::: +blanche:half note:::: +bâton de pause:(arbitrary number of bars' rest):::: +bâton de pause:four-bar rest:::: +bâton de pause:two-bar rest:::: +bécarre:natural sign:::herstellingsteken: +bémol:flat:::mol: +cadence:cadence:::: +cadence harmonique:harmonic cadence:::: +cadence mélodique:melodic cadence:::: +caractère:character:::: +chaîne de trilles:chain of trills:::: +chevron:chevron:::: +chiffrage (chiffres indicateurs):time signature:::maatsoort: +chiffre inférieur:lower number:::: +chiffre supérieur:upper number:::: +clé:clef:::sleutel: +clé d'octave:octave line:::: +clé d'ut:middle C clef:::C sleutel: +clé de fa:bass clef:::: +clé de sol:treble clef:::: +comma:comma:::: +comma enharmonique:::: +comma pythagoricien:::: +comma syntonique:::: +consonance:consonant interval; consonance:::consonant: +contralto:contralto:::: +contre-temps:contro-time:::: +contre-temps irrégulier:irregular contro-time:::: +contre-temps régulier:regular contro-time:::: +coulé:slur:::binding, bindingsboog: +courbe rythmique:rythmic curve:::: +cresendo:opening angular bracket:::: +croche:eighth note:::: +decrescendo:closing angular bracket:::: +degré [de la gamme]:degree [of the scale]:::: +demi-pause:half rest:::: +demi-soupir:eighth rest:::: +demi-ton:semitone:::: +demi-ton chromatique:chromatic semitone:::: +demi-ton diatonique:diatonic semitone:::: +diapason:pitch pipe; tuning fork:::: +diminué (intervalle):diminished (interval):::: +dissonance:dissonant interval; dissonance:::: +dièse:sharp:::: +do:C:::: +do central:middle C::::: +doigté::::: +doigté de pédale::::: +dominante:dominant:::: +double barre:double bar line:::: +double bémol:double flat:::: +double croche:sixteenth note:::: +double dièse:double sharp:::: +double triolet:double triplet:::: +duolet:duplet:::: +durée:duration:::: +échelle d'octave:octave line:::: +échelle musicale:Musical Ladder:::: +enharmonie:enharmony:::: +espace:space:::: +extension d'intervalle:extension of interval:::: +fa:F:::: +figure de note:kind of note:::: +figure de silence:kind of rest:::: +fioriture:cadenza:::: +forme du mode mineur ancien:ancient form (diatonic minor scale):::: +forme harmonique:harmonic form (diatonic minor scale):::: +forme mélodique:melodic form (diatonic minor scale):::: +gamme:scale:::: +gamme chromatique:chromatic scale:::: +gamme diatonique majeure:diatonic major scale:::: +gamme diatonique mineure:diatonic minor scale:::: +gammes enharmoniques:enharmonic scales:::: +gammes relatives:relative scales:::: +genre chromatique:chromatic type:::: +genre diatonique:diatonic type:::: +genre enharmonique:enharmonic type:::: +groupe irrégulier:irregular group:::: +grupetto:turn; gruppetto:::: +hauteur:pitch:::: +huitième de soupir:thirty-second rest:::: +incise:motive:::: +indication de pédale:::: +indication métronomique:metronomic indication:::: +intervalle:interval:::: +intervalle ascendant:ascending interval:::: +intervalle composé:compound interval:::: +intervalle descendant:descending interval:::: +intervalle harmonique:harmonic interval:::: +intervalle simple:simple interval:::: +intervalles enharmoniques:enharmonic intervals:::: +juste (intervalle):perfect (interval):::: +la:A:::: +liaison:tie:::: +liaison rythmique:legato curve:::: +ligne:line:::: +ligne supplémentaire:ledger line:::: +majeur (intervalle):major (interval):::: +membre de phrase:phrase member:::: +mesure:bar; measure:::maat, maatstreep: +mesure artificielle:artificial measure:::: +mesure composée:compound measure:::: +mesure incomplète:incomplete measure:::: +mesure irrégulière:irregular measure:::: +mesure simple:simple measure:::: +mezzo-soprano:mezzo-soprano:::: +mi:E:::: +mineur (intervalle):minor (interval):::: +mode:mode:::: +mode ecclésiastique:::: +mode majeur:major mode:::: +mode mineur:minor mode:::: +modulation:modulation:::: +mordant:mordent:::: +mouvement:tempo; movement:::: +mouvement conjoint:conjunct movement:::: +mouvement disjoint:disjunct movement:::: +mouvement lent:slow tempo:::: +mouvement modéré:moderate tempo:::: +mouvement rapide:fast tempo:::: +médiante:mediant:::: +métronome:metronome:::: +noire:quarter note:::: +note:note:::: +note doublement pointée:double dotted note:::: +note modale:modal note:::: +note pointée:dotted note:::: +note tonale:tonal note:::: +notes enharmoniques:enharmonic notes:::: +nuance:shading:::: +octave:octave:::: +ornement:embellishment; accessory:::: +partition:score:::: +pause:whole rest:::: +phrase:phrase:::: +phrasé:phrasing:::: +pizzicato:dash over/below:::: +point:dot:::: +point d'orgue:pause:::: +point et liaison combinés:dot and curved line combined:::: +pointillés:::: +portamento:underline over/below:::: +portée:staff:::: +portées:staves:::: +quadruple croche:sixty-fourth note:::: +quart de soupir:sixteenth rest:::: +quarte:fourth:::: +quartolet:quadruplet:::: +quinte:fifth:::: +registre:register:::: +renversement d'intervalle:inversion of interval:::: +renvoi:return sign:::: +respiration:artificial rest:::: +:double whole note::breve:brevis:breve +ronde:whole note:::: +rythme:rythm:::: +ré:D:::: +seconde:second:::: +seizième de soupir:sixty-fourth rest:::: +sensible:leading note:::: +septième:seventh:::: +sextolet:sextuplet:::: +si:B:::: +signes indicateurs de nuance:shading signs:::: +silence:rest:::: +sixain:sextuplet:::: +sixte:sixth:::: +sol:G:::: +soprano:soprano:::: +soupir:quarter rest:::: +sous-dominante:subdominant:::: +sous-tonique:subtonic:::: +staccato:dot over/below:::: +sus-dominante:superdominant:::: +sus-tonique:supertonic:::: +syncope:syncopation; upbeat:::: +syncope irrégulière:irregular syncopation:::: +syncope régulière:regular syncopation:::: +temps:beat:::: +temps binaire:binary beat:::: +temps faible:weak beat:::: +temps fort:strong beat:::: +temps ternaire:ternary beat:::: +tempérament mésotonique:meantone tuning:::: +tempérament égal:tempered tuning:::: +tierce:third:::: +ton:tone:::: +tonalité:tonality:::: +tonique:tonic:::: +tons relatifs:relative scales:::: +tons voisins:adjacent keys:::: +transposition:transposition:::: +transposition chromatique:chromatic transposition:::: +transposition enharmonique:enharmonic transposition:::: +trille:trill; shake:::: +trille double:double trill:::: +triolet:triplet:::: +triple croche:thirty-second note:::: +triton:tritone:::: +ténor:tenor:::: +tétracorde:tetrachord:::: +unisson:unison:::: +unité de mesure:unit of measure:::: +unité de temps:unit of beat:::: +ut:C:::: +voix:voice:::: +:quarter note::crotchet:: +:quarter rest::crotchet rest:: +:thirty-second note::demisemiquaver:: +:thirty-second rest::demisemiquaver rest:: +:sixty-fourth note::hemidemisemiquaver:: +:sixty-fourth rest::hemidemisemiquaver rest:: +:half note::minim:: +:half rest::minim rest:: +:eighth note::quaver:: +:eighth rest::quaver rest:: +:whole note::semibreve:: +:whole rest::semibreve rest:: +:sixteenth note::semiquaver:: +:sixteenth rest::semiquaver rest:: diff --git a/Documentation/vocabulary-forms.el b/Documentation/vocabulary-forms.el new file mode 100644 index 0000000000..87893d2e13 --- /dev/null +++ b/Documentation/vocabulary-forms.el @@ -0,0 +1,21 @@ +; Musical vocabularies are Copyright (C) 1993 Free Software Foundation, Inc. +; Francois Pinard , +; Neil Jerram . +; Forms by Han-Wen Nienhuys + +(setq forms-file "vocabulary-data") +(setq forms-number-of-fields 6) +(setq forms-read-only nil) ; to make sure +(setq forms-field-sep ":") +(setq forms-multi-line nil) + +(setq forms-format-list + (list + "*** Musical vocabulary ***\n" + "\nItalian: " 6 + "\nFrench: " 1 + "\nUS English: " 2 + "\nGerman: " 3 + "\nBritish English: " 4 + "\nDutch: " 5 + )) diff --git a/INSTALL.text b/INSTALL.text index 0720e8bead..5329182265 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG -8/Aug/97 LilyPond 0.1.10 1 +8/Aug/97 LilyPond 0.1.11 1 @@ -127,7 +127,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -8/Aug/97 LilyPond 0.1.10 2 +8/Aug/97 LilyPond 0.1.11 2 @@ -193,7 +193,7 @@ INSTALL(1) LilyPond documentation INSTALL(1) -8/Aug/97 LilyPond 0.1.10 3 +8/Aug/97 LilyPond 0.1.11 3 @@ -259,7 +259,7 @@ IIIINNNNSSSSTTTTAAAALLLLLLLLIIIINNNNGGGG -8/Aug/97 LilyPond 0.1.10 4 +8/Aug/97 LilyPond 0.1.11 4 @@ -325,7 +325,7 @@ RRRREEEEDDDDHHHHAAAATTTT LLLLIIIINNNNUUUUXXXX -8/Aug/97 LilyPond 0.1.10 5 +8/Aug/97 LilyPond 0.1.11 5 @@ -391,6 +391,6 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS -8/Aug/97 LilyPond 0.1.10 6 +8/Aug/97 LilyPond 0.1.11 6 diff --git a/NEWS b/NEWS index 980752826c..b7e1b5bba1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,31 @@ + +pl 11 + - forms for Musical vocabulary + - ignore \r for windows + - Now paper{score,def} & midi{def,score} derived of class +Music_output[_def]. Score is almost empty. + - Engraver hacking: + * junk Text_engraver + * Timing_engraver + * barnumber now really counts the number of bars + * Separated Stem_engraver and Beam_engraver + * junk Stem_beam_engraver + * no need for Stem_reqs + - use Direction = {LEFT, RIGHT, UP, DOWN} iso. -1, 1 throughout source + - ties and slurs with Drul_array + - junked Spanner_elem_group + - bf: w32 fixes + - Spanner now spans items. + - more GNITting ( bla ) -> (bla), indentation + - Drul_array + - Paper_column now is derived of Horizontal_group_item. Items +are no longer hardwired into a Paper_column + - bf: stdin input + - PCol -> Paper_column + - Wtk-i, fugue1, prelude1 (SR) + +******* +aug 21 pl 10 - bf: init pending_indent_i_ - output header to TeX file. Who wants to write TeX to make it work? diff --git a/README b/README index 5b975730b5..d6881435f3 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is the toplevel README to LilyPond +This is the toplevel README to LilyPond -*-Text-*- GNU LilyPond which converts music definition files into visual or @@ -81,4 +81,29 @@ might help (Without -O2 optimisation, my execs run fine on Solaris; without -O2, but with purify, it dumps core) +Linux (intel) +LilyPond occasionally crashes while parsing the initialisation files. +This is a very obscure bug, and usually entering the commandline +differently "fixes" it. + + lilypond input.ly + +and + + lilypond -I. ./input.ly + +makes a difference + +Typical stacktrace: + + SIGSEGV + __libc_malloc (bytes=16384) + ?? () + yyFlexLexer::yy_create_buffer () + Includable_lexer::new_input (this=0x8209a00, s={strh_ = { + : + + +I get bitten by this every once in a while, and I am very interested +in hints what might be wrong. diff --git a/TODO b/TODO index 26517e4b48..ff14045e1e 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,10 @@ done, or is an idea that I want to think about Most of the items are marked in the code as well, with full explanation. grep for TODO and ugh/ugr + * check out egcs + + * give Items/Spanners access to unbroken originals + 3RD PARTY BUGS: * ICE: spring-spacer::calcideal() @@ -38,17 +42,19 @@ PROJECTS - have make dist produce tarball in out/ directory. - Use Automake - shared lib on Solaris too. - - check libtool, automake + - check libtool - generate stuff in out/default, out/sun5-irix etc iso out/ and out-sun5/ + * Add mudela-output to Rosegarden. - * Add mudela to Rosegarden. - - * a musical dictionary. See Documentation/Vocab* - - other languages - - emacs forms mode for editing it. - + * a musical dictionary. See Documentation/vocabulary-*, other +languages: + - italian + - german + - dutch + - swedish + .. ? * chords - guitar chords @@ -58,7 +64,7 @@ PROJECTS - MIDI output? - typesetting - * integrate midi-elts from mi2mu and lily + * integrate midi-elts from mi2mu and lily? * Debug logs: - derive lily_stream, Dstream, texstream from ostream? @@ -80,8 +86,7 @@ PROJECTS - adapt for multiple font sizes. - make separate class for Grace_*_engravers (which is at Voice_gravs level) - - move stem, beam, slur into baseclass to adapt for (fixed - size) grace notes. + - make encapsulated spacing problems. * accidentals per Voice_group @@ -111,7 +116,7 @@ PROJECTS - NIFF ? - Common Music Notation - PostScript output (esp. Beams, Slurs, etc) - - Move PScore, Items, Spanners etc. into libmutype.a + - Move all Score_elems, into libmutype.a * Documentation @@ -148,7 +153,6 @@ PROJECTS - rewrite : make a metafont iso font * Font support: - - update 20 pt table - mixed fontsizes * lines: @@ -175,7 +179,6 @@ PROJECTS - redo Notehead to allow digits as heads - add a \tablature {} lexer mode for easy entering - * should adjust stemlength for flag number. * breaking: @@ -188,6 +191,8 @@ PROJECTS * Rhythmic staff. + * Baroque superstaff + SEVERELY LACKING: * SPEED! @@ -240,9 +245,6 @@ SMALLISH PROJECTS * lyric in staff (sharpsharp in staff, text below) - * replace Score_elem member access by get()/set() methods, to enable - future embedded code. - * write Dynamic_line (to group dynamics horizontally) * write Rest_collision @@ -275,7 +277,6 @@ SMALLISH PROJECTS - String hash - Pointer hash - * binsearch/hash for identifiers * stafftypes: voice names/ instrument names. @@ -290,10 +291,9 @@ SMALLISH PROJECTS * textspanner: center position - * Brackets - * Scricts: + * Scripts: - stack scripts in chords: % fingering: footing: < a-4 c-2 g-1 > < c-\ltoe e-\lheel > @@ -309,13 +309,6 @@ SMALLISH PROJECTS % --|--- --|--- (where "to" is a tiny bow) -DOC - * all errors - - * hacking-HOWTO - -FUTURE - * auxilliary file for caching info. * Text_crescendo @@ -326,6 +319,11 @@ FUTURE * volta +DOC + * all errors + + * hacking-HOWTO + IDEAS * scoping in Lexer: do general id- assignments in mudela. @@ -357,7 +355,9 @@ IDEAS * move towards incremental algorithms. - * design meta-language like TeX and Metafont + * far fetched language ideas + - design meta-language like TeX and Metafont + - programming/macros input * Global type registration. @@ -366,11 +366,6 @@ IDEAS if ( t <= get_type( q )) .. - - * virtualise PCols to make encapsulated spacing problems - - * don't count bars which are not on first beat. - * naming of Voice_group/Voice * benchmark band_matrices. @@ -391,8 +386,11 @@ IDEAS * lyrics in chords still fuck up. - * rewire acknowledge_element() logic with a process_acknowledged() - + * + - rewire acknowledge_element() logic with a process_acknowledged() + - construct Stem upon receiving Notehead. Junk Stem_req + + * pushgroup/popgroup * whole head on ledger line diff --git a/VERSION b/VERSION index d3a300ce96..3747f21228 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 1 -TOPLEVEL_PATCH_LEVEL = 10 +TOPLEVEL_PATCH_LEVEL = 11 # use to send patches, always empty for released version: -TOPLEVEL_MY_PATCH_LEVEL = .jcn1 +TOPLEVEL_MY_PATCH_LEVEL = diff --git a/bin/make-website.in b/bin/make-website.in index be95633992..75fba55de0 100644 --- a/bin/make-website.in +++ b/bin/make-website.in @@ -77,9 +77,13 @@ sub my_system local $base="lilypond/"; -local @examples=("twinkle-pop", "twinkle", "multi", "wohltemperirt" - ,"standchen-16", "standchen-20", "toccata-fuga-E", "scsii-menuetto", - "cadenza", "scales", "rhythm", "gallina"); +local @examples=("twinkle-pop", "twinkle", "multi", "wohltemperirt", + #"standchen-16", + #"standchen-20", + "toccata-fuga-E", "scsii-menuetto", + "cadenza", "scales", + #"rhythm", + "gallina"); # rhythm, scales, diff --git a/flower/VERSION b/flower/VERSION index 7aec79ceb0..2d9d483b19 100644 --- a/flower/VERSION +++ b/flower/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 26 +PATCH_LEVEL = 27 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/choleski.cc b/flower/choleski.cc index 4a98301af3..5932f10f97 100644 --- a/flower/choleski.cc +++ b/flower/choleski.cc @@ -13,7 +13,7 @@ const Real EPS = 1e-7; // so sue me. Hard coded //#define PARANOID void -Choleski_decomposition::full_matrix_solve (Vector &out, Vector const &rhs)const +Choleski_decomposition::full_matrix_solve (Vector &out, Vector const &rhs) const { int n= rhs.dim(); assert (n == L.dim()); @@ -45,7 +45,7 @@ Choleski_decomposition::full_matrix_solve (Vector &out, Vector const &rhs)const } void -Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs)const +Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs) const { int n= rhs.dim(); int b = L.band_i(); @@ -79,7 +79,7 @@ Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs)const } void -Choleski_decomposition::solve (Vector &x, Vector const &rhs)const +Choleski_decomposition::solve (Vector &x, Vector const &rhs) const { if (L.band_b()) { @@ -90,7 +90,7 @@ Choleski_decomposition::solve (Vector &x, Vector const &rhs)const } Vector -Choleski_decomposition::solve (Vector rhs)const +Choleski_decomposition::solve (Vector rhs) const { Vector r; solve (r, rhs); diff --git a/flower/diagonal-storage.cc b/flower/diagonal-storage.cc index 17699384cd..695819171a 100644 --- a/flower/diagonal-storage.cc +++ b/flower/diagonal-storage.cc @@ -19,7 +19,7 @@ #include "full-storage.icc" int -Diagonal_storage::dim()const +Diagonal_storage::dim() const { return band_.rows(); } @@ -41,7 +41,7 @@ Diagonal_storage::cols() const } int -Diagonal_storage::band_size_i()const +Diagonal_storage::band_size_i() const { return (band_.cols()-1)/2; } @@ -104,13 +104,13 @@ Diagonal_storage::~Diagonal_storage() bool -Diagonal_storage::band_elt_b (int i,int j)const +Diagonal_storage::band_elt_b (int i,int j) const { return abs (i-j) <= band_size_i(); } void -Diagonal_storage::assert_valid (int i,int j)const +Diagonal_storage::assert_valid (int i,int j) const { assert (band_elt_b (i,j)); assert (i >=0 && j >=0 && i < dim() && j < dim ()); @@ -133,13 +133,13 @@ Diagonal_storage::resize_dim (int d) bool -Diagonal_storage::mult_ok (int i,int)const +Diagonal_storage::mult_ok (int i,int) const { return i < dim(); } void -Diagonal_storage::mult_next (int &i, int &j)const +Diagonal_storage::mult_next (int &i, int &j) const { j++; if ( j < i - band_size_i()) @@ -152,13 +152,13 @@ Diagonal_storage::mult_next (int &i, int &j)const } bool -Diagonal_storage::trans_ok (int ,int j)const +Diagonal_storage::trans_ok (int ,int j) const { return j < dim(); } void -Diagonal_storage::trans_next (int &i, int& j)const +Diagonal_storage::trans_next (int &i, int& j) const { i++; if ( i < j - band_size_i()) @@ -174,7 +174,7 @@ Diagonal_storage::trans_next (int &i, int& j)const static Real nul_entry=0.0; Real -Diagonal_storage::elem (int i, int j)const +Diagonal_storage::elem (int i, int j) const { if (abs ( i-j) > band_size_i()) return 0; @@ -202,7 +202,7 @@ Diagonal_storage::elem (int i, int j) bool Diagonal_storage::try_right_multiply (Matrix_storage*dest, - const Matrix_storage*right)const + const Matrix_storage*right) const { if ( right->name() != Diagonal_storage::static_name ()) return false; diff --git a/flower/directed-graph.cc b/flower/directed-graph.cc index 46511b4c31..9a07629dab 100644 --- a/flower/directed-graph.cc +++ b/flower/directed-graph.cc @@ -22,7 +22,7 @@ Directed_graph_node::get_in_edge_arr() const } Link_array const & -Directed_graph_node::get_out_edge_arr()const +Directed_graph_node::get_out_edge_arr() const { return edge_out_l_arr_; } @@ -56,7 +56,7 @@ Directed_graph_node::OK() const } bool -Directed_graph_node::contains_b (const Directed_graph_node *d)const +Directed_graph_node::contains_b (const Directed_graph_node *d) const { return edge_out_l_arr_.find_l ((Directed_graph_node*)d); } @@ -95,7 +95,7 @@ Directed_graph_node::remove_edge_out (Directed_graph_node *d_l) PARANOID_OK(); } bool -Directed_graph_node::linked_b()const +Directed_graph_node::linked_b() const { return edge_out_l_arr_.size() || edge_in_l_arr_.size (); } diff --git a/flower/full-storage.cc b/flower/full-storage.cc index ee59ea23ed..71aa74c10c 100644 --- a/flower/full-storage.cc +++ b/flower/full-storage.cc @@ -129,7 +129,7 @@ Full_storage::insert_row (int k) } bool -Full_storage::try_right_multiply (Matrix_storage * dest, Matrix_storage const * right)const +Full_storage::try_right_multiply (Matrix_storage * dest, Matrix_storage const * right) const { if (dest->name() != Full_storage::static_name () || right->name() != Full_storage::static_name ()) diff --git a/flower/include/assoc-iter.hh b/flower/include/assoc-iter.hh index 9157ad0ab7..f1ba2f89b2 100644 --- a/flower/include/assoc-iter.hh +++ b/flower/include/assoc-iter.hh @@ -28,7 +28,7 @@ struct Assoc_iter { bool ok() const { return i < assoc_.arr.size(); } - void OK()const { + void OK() const { assert (!ok() || !assoc_.arr[i].free); } void operator++(int) { i++; i = next (i); } diff --git a/flower/include/choleski.hh b/flower/include/choleski.hh index dd21237550..a1c3a8c47e 100644 --- a/flower/include/choleski.hh +++ b/flower/include/choleski.hh @@ -30,7 +30,7 @@ struct Choleski_decomposition { solve Px = rhs */ Vector solve (Vector rhs) const; - void solve (Vector &dest, Vector const &rhs)const; + void solve (Vector &dest, Vector const &rhs) const; Vector operator * (Vector rhs) const { return solve (rhs); } /** return the inverse of the matrix P. @@ -41,8 +41,8 @@ struct Choleski_decomposition { */ Matrix original() const; private: - void full_matrix_solve (Vector &,Vector const&)const; - void band_matrix_solve (Vector &, Vector const&)const; + void full_matrix_solve (Vector &,Vector const&) const; + void band_matrix_solve (Vector &, Vector const&) const; void full_matrix_decompose (Matrix const & P); void band_matrix_decompose (Matrix const &P); diff --git a/flower/include/cursor.hh b/flower/include/cursor.hh index 2e205ba330..4abefd3dea 100644 --- a/flower/include/cursor.hh +++ b/flower/include/cursor.hh @@ -53,13 +53,13 @@ class Cursor Cursor operator --( int); /// point to link? - bool ok()const; + bool ok() const; /// ++ items left? - bool forward()const; + bool forward() const; /// -- items left? - bool backward()const; + bool backward() const; /** put (copy) after me in List. analogously to editor. ok() interpreted as at end diff --git a/flower/include/cursor.icc b/flower/include/cursor.icc index 4fce0b1953..b1004b600a 100644 --- a/flower/include/cursor.icc +++ b/flower/include/cursor.icc @@ -90,21 +90,21 @@ Cursor::pointer() template inline bool -Cursor::backward()const +Cursor::backward() const { return ( pointer_ != 0); } template inline bool -Cursor::forward()const +Cursor::forward() const { return ( pointer_ != 0); } template inline bool -Cursor::ok()const +Cursor::ok() const { return ( pointer_ != 0); } diff --git a/flower/include/diagonal-storage.hh b/flower/include/diagonal-storage.hh index 9ac2be679d..f000cf2387 100644 --- a/flower/include/diagonal-storage.hh +++ b/flower/include/diagonal-storage.hh @@ -26,10 +26,10 @@ class Diagonal_storage : public Matrix_storage { public: void set_band_size (int b); - int band_size_i()const; + int band_size_i() const; void assert_valid (int i, int j) const; - bool band_elt_b (int,int)const; + bool band_elt_b (int,int) const; void resize_dim (int); virtual void resize_rows (int d) { resize_dim (d); } @@ -54,12 +54,12 @@ public: virtual void delete_column (int k); ~Diagonal_storage(); - virtual bool mult_ok (int i, int j)const; + virtual bool mult_ok (int i, int j) const; virtual void mult_next (int &i, int &j) const ; virtual bool trans_ok (int i, int j) const; virtual void trans_next (int &i, int &j) const; DECLARE_VIRTUAL_COPY_CONS(Diagonal_storage, Matrix_storage); DECLARE_MY_RUNTIME_TYPEINFO; - virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *)const; + virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *) const; }; #endif // DIAGONAL_STORAGE_HH diff --git a/flower/include/directed-graph.hh b/flower/include/directed-graph.hh index caa065abec..f822221585 100644 --- a/flower/include/directed-graph.hh +++ b/flower/include/directed-graph.hh @@ -35,7 +35,7 @@ public: bool contains_b (Directed_graph_node const*) const; Directed_graph_node (Directed_graph_node const &); - void OK()const; + void OK() const; Directed_graph_node(); ~Directed_graph_node(); diff --git a/flower/include/full-storage.hh b/flower/include/full-storage.hh index 0d17df412f..50eb0e0109 100644 --- a/flower/include/full-storage.hh +++ b/flower/include/full-storage.hh @@ -41,8 +41,8 @@ public: virtual void resize (int i, int j); virtual void resize (int i); virtual Real& elem (int i,int j); - virtual Real elem (int i, int j)const ; - int dim()const; + virtual Real elem (int i, int j) const ; + int dim() const; Full_storage (Matrix_storage*); Full_storage(); Full_storage (int i, int j); @@ -56,13 +56,13 @@ public: virtual void delete_column (int k); ~Full_storage(); - virtual bool mult_ok (int i, int j)const; + virtual bool mult_ok (int i, int j) const; virtual void mult_next (int &i, int &j) const ; virtual bool trans_ok (int i, int j) const; virtual void trans_next (int &i, int &j) const; DECLARE_VIRTUAL_COPY_CONS(Full_storage,Matrix_storage); DECLARE_MY_RUNTIME_TYPEINFO; - virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *)const; + virtual bool try_right_multiply (Matrix_storage * dest, Matrix_storage const *) const; }; #endif // FULL_STORAGE_HH diff --git a/flower/include/full-storage.icc b/flower/include/full-storage.icc index 0e45f15b24..c919bf1ac9 100644 --- a/flower/include/full-storage.icc +++ b/flower/include/full-storage.icc @@ -18,7 +18,7 @@ Full_storage::init() height_i_=width_i_=max_height_i_=max_width_i_=0; } INLINE bool -Full_storage::valid (int i, int j)const +Full_storage::valid (int i, int j) const { return (i>=0 && i < height_i_) && (j < width_i_ && j >=0); @@ -62,7 +62,7 @@ Full_storage::cols() const return width_i_; } INLINE int -Full_storage::dim()const +Full_storage::dim() const { assert (rows()==cols ()); return rows(); diff --git a/flower/include/interval.hh b/flower/include/interval.hh index 19d5061114..865a791574 100644 --- a/flower/include/interval.hh +++ b/flower/include/interval.hh @@ -46,8 +46,8 @@ struct Interval_t { return ((Interval_t *)this)->idx (j); } T &max() { return right;} - T max()const { return right;} - T min()const{ return left; } + T max() const { return right;} + T min() const{ return left; } T &min(){ return left; } /** PRE diff --git a/flower/include/interval.tcc b/flower/include/interval.tcc index 50864b7894..1a483b5f18 100644 --- a/flower/include/interval.tcc +++ b/flower/include/interval.tcc @@ -34,7 +34,7 @@ _Interval__compare (const Interval_t&a,Interval_t const&b) template bool -Interval_t::contains_b (Interval_t const& a)const +Interval_t::contains_b (Interval_t const& a) const { int c_i= _Interval__compare (*this, a); if (c_i == -2) @@ -62,9 +62,12 @@ Interval_t::set_empty() template T -Interval_t::length() const { - assert (right >= left); - return right-left; +Interval_t::length() const +{ + if (right < left) + return 0; + else + return right-left; } template diff --git a/flower/include/lgetopt.hh b/flower/include/lgetopt.hh index b8a2e19049..9341d1dcaf 100644 --- a/flower/include/lgetopt.hh +++ b/flower/include/lgetopt.hh @@ -14,7 +14,7 @@ struct Long_option_init { char const * longname; char shortname; - void printon (ostream &errorout)const ; + void printon (ostream &errorout) const ; }; @@ -68,7 +68,7 @@ public: void next(); const Long_option_init *parselong(); const Long_option_init *parseshort(); - void OK()const; + void OK() const; bool ok() const; /// report an error and abort diff --git a/flower/include/list.icc b/flower/include/list.icc index 80d12f56ba..f77a201836 100644 --- a/flower/include/list.icc +++ b/flower/include/list.icc @@ -40,7 +40,7 @@ List::size() const template inline Cursor -List::top()const +List::top() const { return Cursor( *this, top_); } @@ -48,7 +48,7 @@ List::top()const template inline Cursor -List::bottom()const +List::bottom() const { return Cursor( *this, bottom_); } diff --git a/flower/include/list.tcc b/flower/include/list.tcc index 1233c4821d..06aa312bc3 100644 --- a/flower/include/list.tcc +++ b/flower/include/list.tcc @@ -10,7 +10,7 @@ // instantiate a template: explicit instantiation. -#define L_INSTANTIATE(a) class List; template class Cursor; \ +#define LIST_INSTANTIATE(a) class List; template class Cursor; \ template class Link #include "list.hh" diff --git a/flower/include/matrix-storage.hh b/flower/include/matrix-storage.hh index 662cdddc89..5027b6f555 100644 --- a/flower/include/matrix-storage.hh +++ b/flower/include/matrix-storage.hh @@ -109,7 +109,7 @@ public: virtual void delete_row (int k)=0; virtual void delete_column (int k)=0; virtual ~Matrix_storage() { } - virtual Matrix_storage *clone()const=0; + virtual Matrix_storage *clone() const=0; @@ -153,7 +153,7 @@ public: static void set_band (Matrix_storage*&, int band); static void set_full (Matrix_storage*&); virtual bool try_right_multiply (Matrix_storage *dest, - const Matrix_storage *fact)const ; + const Matrix_storage *fact) const ; /** RTTI. */ diff --git a/flower/include/matrix.hh b/flower/include/matrix.hh index c2545a072d..c87613c454 100644 --- a/flower/include/matrix.hh +++ b/flower/include/matrix.hh @@ -48,9 +48,9 @@ public: 0 <= band_i() <= dim */ int band_i() const; - bool band_b()const; - void set_full()const; - void try_set_band()const; + bool band_b() const; + void set_full() const; + void try_set_band() const; ~Matrix() { delete dat; } /// set entries to r diff --git a/flower/include/parray.hh b/flower/include/parray.hh index 054288b809..e1e5972020 100644 --- a/flower/include/parray.hh +++ b/flower/include/parray.hh @@ -67,7 +67,7 @@ public: return i; return -1; } - T *find_l (T const *t)const + T *find_l (T const *t) const { int i = find_i (t); if (i >= 0) diff --git a/flower/include/path.hh b/flower/include/path.hh index 81a8cb1038..1f3a5eb97a 100644 --- a/flower/include/path.hh +++ b/flower/include/path.hh @@ -27,7 +27,7 @@ class File_path : private Array { public: /// locate a file in the search path - String find (String nm)const; + String find (String nm) const; /// add to end of path. Array::push; diff --git a/flower/include/plist.icc b/flower/include/plist.icc index 7fda7abb2c..d81b322e48 100644 --- a/flower/include/plist.icc +++ b/flower/include/plist.icc @@ -8,7 +8,7 @@ #define PLIST_INL template -void +inline void PL_copy (Pointer_list &to, Pointer_list const&src) { for (PCursor pc (src); pc.ok(); pc++) @@ -19,4 +19,15 @@ PL_copy (Pointer_list &to, Pointer_list const&src) } } + +template +inline PCursor +Link_list::find (T what) const +{ + PCursor i (*this); + for (; i.ok(); i++) + if (i.ptr() == what) + break; + return i; +} #endif diff --git a/flower/include/plist.tcc b/flower/include/plist.tcc index 07c1a0118f..5ce6c2446c 100644 --- a/flower/include/plist.tcc +++ b/flower/include/plist.tcc @@ -1,9 +1,19 @@ +/* + plist.tcc -- implement Pointer_list + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef PLIST_TCC +#define PLIST_TCC + #include "plist.hh" -#define PL_INSTANTIATE(a) class Link_list; \ +#define POINTERLIST_INSTANTIATE(a) class Pointer_list;\ template class PCursor; -#define IPL_INSTANTIATE(a) PL_INSTANTIATE(a); \ - template class Pointer_list template void @@ -16,13 +26,4 @@ Pointer_list::junk() } } -template -PCursor -Link_list::find (T what) const -{ - PCursor i (*this); - for (; i.ok(); i++) - if (i.ptr() == what) - break; - return i; -} +#endif // PLIST_TCC diff --git a/flower/include/pointer.tcc b/flower/include/pointer.tcc index 5eed1f4ef6..4ce1302189 100644 --- a/flower/include/pointer.tcc +++ b/flower/include/pointer.tcc @@ -13,7 +13,7 @@ template inline T * -P::copy_p()const +P::copy_p() const { return t_p? new T(*t_p) : 0; } diff --git a/flower/include/string-data.hh b/flower/include/string-data.hh index d4440b1c26..4dfe5544b9 100644 --- a/flower/include/string-data.hh +++ b/flower/include/string-data.hh @@ -78,7 +78,7 @@ friend class String_handle; #String_data# knowing it. */ Byte &operator [](int j); Byte operator [](int j) const; - bool is_binary_bo()const; + bool is_binary_bo() const; }; diff --git a/flower/include/string-data.icc b/flower/include/string-data.icc index 6a88eef8c9..c2225782d7 100644 --- a/flower/include/string-data.icc +++ b/flower/include/string-data.icc @@ -186,7 +186,7 @@ String_data::trunc (int j) } INLINE bool -String_data::is_binary_bo()const +String_data::is_binary_bo() const { // return !memchr (data_byte_p_, length_i_, 0); return ( (int)strlen ((char const*)data_byte_p_) != length_i_ ); diff --git a/flower/include/string-handle.hh b/flower/include/string-handle.hh index c6e73ada10..ccd149b9cf 100644 --- a/flower/include/string-handle.hh +++ b/flower/include/string-handle.hh @@ -42,7 +42,7 @@ public: char const* ch_C() const; Byte* byte_l(); char* ch_l(); - bool is_binary_bo()const; + bool is_binary_bo() const; void operator =(String_handle const &src); void operator += (char const *s); Byte operator[](int j) const; diff --git a/flower/include/virtual-methods.hh b/flower/include/virtual-methods.hh index e56496605d..278ed57190 100644 --- a/flower/include/virtual-methods.hh +++ b/flower/include/virtual-methods.hh @@ -17,7 +17,7 @@ #define DECLARE_MY_RUNTIME_TYPEINFO \ static char const *static_name();\ static bool static_is_type_b (const char*s);\ -virtual bool is_type_b (const char *s)const { return static_is_type_b (s); } \ +virtual bool is_type_b (const char *s) const { return static_is_type_b (s); } \ virtual char const *name() const{ return static_name (); } \ int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out() diff --git a/flower/lgetopt.cc b/flower/lgetopt.cc index a73334fe00..f0a49ab360 100644 --- a/flower/lgetopt.cc +++ b/flower/lgetopt.cc @@ -74,7 +74,7 @@ Getopt_long::parselong() void -Long_option_init::printon (ostream &errorout)const +Long_option_init::printon (ostream &errorout) const { if (shortname) errorout <<"-" << shortname; @@ -219,7 +219,7 @@ Getopt_long::Getopt_long (int c, char **v, Long_option_init *lo) } bool -Getopt_long::ok()const +Getopt_long::ok() const { return array_index_i_ < argument_count_i_; } diff --git a/flower/matrix-storage.cc b/flower/matrix-storage.cc index 698f673b25..7556a2cdd5 100644 --- a/flower/matrix-storage.cc +++ b/flower/matrix-storage.cc @@ -92,7 +92,7 @@ Matrix_storage::get_full (int n, int m) bool Matrix_storage::try_right_multiply (Matrix_storage *, - const Matrix_storage *)const + const Matrix_storage *) const { return false; } diff --git a/flower/matrix.cc b/flower/matrix.cc index 3f9b28f835..0641d8032f 100644 --- a/flower/matrix.cc +++ b/flower/matrix.cc @@ -11,7 +11,7 @@ #include "diagonal-storage.hh" bool -Matrix::band_b()const +Matrix::band_b() const { return dat->is_type_b (Diagonal_storage::static_name()); } @@ -26,7 +26,7 @@ Matrix::set_full() const } void -Matrix::try_set_band()const +Matrix::try_set_band() const { if (band_b()) return; @@ -107,7 +107,7 @@ Matrix::operator=(Matrix const &m) } int -Matrix::band_i()const +Matrix::band_i() const { if ( band_b()) { diff --git a/flower/path.cc b/flower/path.cc index e880b200ae..bdfaf80b63 100644 --- a/flower/path.cc +++ b/flower/path.cc @@ -54,7 +54,7 @@ split_path (String path, in any other added path, in this order. */ String -File_path::find (String nm)const +File_path::find (String nm) const { fdebug << "looking for " << nm << ": "; diff --git a/init/engraver.ly b/init/engraver.ly index c80d39e6fe..359667459f 100644 --- a/init/engraver.ly +++ b/init/engraver.ly @@ -19,7 +19,8 @@ staff_engraver = \requesttranslator { Engraver "Voice_group_engravers" \alias "Voice_group"; \consists "Dynamic_engraver"; - \consists "Stem_beam_engraver"; + \consists "Stem_engraver"; + \consists "Beam_engraver"; \consists "Script_engraver"; \consists "Note_column_engraver"; \consists "Slur_engraver"; @@ -72,6 +73,7 @@ orchestral_score_translator = \requesttranslator { Engraver Score_engraver \alias "Score"; + \consists "Timing_engraver"; \consists "Bar_column_engraver"; \consists "Bar_number_grav"; @@ -89,5 +91,10 @@ orchestral_score_translator = \requesttranslator { \contains \requesttranslator { \piano_staff_engraver } } +stupid_engraver = \requesttranslator { + Engraver Score_engraver + \consists "Staff_sym_engraver"; +} + diff --git a/input/fugue1.ly b/input/fugue1.ly new file mode 100644 index 0000000000..f3d8fb0c03 --- /dev/null +++ b/input/fugue1.ly @@ -0,0 +1,208 @@ +\header{ +filename fugue1.ly +title Fuga a 4 +description Das Wohltemperierte Clavier I, Fuga I (c-major) +opus BWV 846 +composer Johann Sebastian Bach (1685-1750) +enteredby Shay Rojansky +copyright Public Domain +} + +%{ + +%} +\version "0.1.1"; + + +global = + \melodic { + \meter 4/4; % should be \meter C + } + +tenor = + \melodic { + \clef "violin"; + \octave c'; + + \stem \down; + r8 [c8 d e] [f. g32 f] [e8 a] | + [d g] ~ [g16 a g f] [e f e d] [c d c 'b] | + ['a8 fis] g4 ~ [g8 fis16 e] [f8 d] | + [g f! e d] c r r g ~ | +%% 5 + [g f16 e] f4 ~ [f16 f e8] d4 | + [c8 f] r16 [g f e] [f8 d] g4 ~ | + g4 r4 r2 | + r1 | + r8 [g8 a b] [c'. d'32 c'] [b8 e'] +%% 10 + [a d'] ~ [d'16 e' d' c'] b8 r8 r d | + [e fis] [g. a32 g] [fis8 b e a] ~ | + [a16 b a gis] [fis8 f!] [e d] ~ [d16 e fis gis] | + [a gis a b] [gis fis gis a] b8 r8 r4 | + r8 [c8 d e] \stem 1; [f. g32 f] [e8 a] | +%% 15 + [d g] ~ [g16 a g f] e8 \stem -1; [e fis g] ~ | + [g8 fis] [gis8 a] ~ [a g! a b] | + \stem 0; + [c'. d'32 c'] [b8 e'] [a d'] ~ [d'16 e' d' c'] | + [b8 g' cis' d'] [e' cis' d' e' ] | + \stem -1; a8 r8 r e [fis g] \stem 0; [a. b32 a] | +%% 20 + [g8 c' fis b] ~ [b16 c' b a] \stem -1; [g fis e d] \stem 0; | + e4 \stem -1; d ~ [d16 a g f!] [e g f! a] | + g4 ~ [g16 a bes8] c'4 [d'8 g] | + \stem 0; g4. f8 ~ [f e] d4 | + \stem -1; e8 a4 g8 ~ [g8 f g a] | +%% 25 + [bes8. c'32 b] [a8 d'] [g c'] ~ [c'16 d' c' bes] | + [a bes a g] [f g f e] d4 ~ [d8. g16] | + a4 r16 [f'16 d'8] e'2 | + } + + +soprane = + \melodic { + \octave c'; + \stem \up; + r1 | + r2 r8 [g8 a b] | + [c'. d'32 c'] [b8 e'] [a d'] ~ [d'16 e' d' c'] | + [b g a b] [c' b c' d'] [e' d' e' fis'] [g'8 b] | +%% 5 + [c' a] [d'16 c' b a] [g8. g16] [f e f g] | + [a g a b] c'2 b4 | + \octave c''; + r8 [c8 d e] [f. g32 f] [e8 a] | + [d g] ~ [g16 a g f] [e8 a] ~ [a16 b a g] | + f2 [e8. fis16] g4 ~ +%% 10 + g4 fis [g16 f! e d] [c d c 'b] | + ['a16 c 'b 'a] 'g8 r8 r16 [c16 'b 'a] ['gis8 e] | + [d c16 'b16] ['a 'gis 'a 'b] [c 'fis 'a 'gis] ['b8 'a16 'b] + [c8 f e d] ~ [d c16 'b] ['b8. 'a16] | + 'a4 r4 r2 | +%% 15 + r2 r8 ['g8 'a 'b] | + [c8. d32 c] ['b8 c] [d e] [f!. g32 f!] | + [e8 a d g] ~ [g16 a g f] [e8 a] | + [d8 bes] [a g16 f] [g f g e] [f g g f32 g] | + [a16 cis d g] [e8. d16] d8 r8 r4 | +%% 20 + r2 r4 r8 'g | + ['a 'b] [c. d32 c] ['b8 e 'a d] ~ | + [e16 e d c] ['b c d e] [f g a g] [f e d c] | + 'b4 [c8 d] 'g c4 'b8 | + c4 ['b8 'bes8] 'a d4 c8 | +%% 25 + [d8 e] f4 ~ [f16 a g f] [e f e d] | + c2 r16 ['g32 'a 'b!16 c] [d e f8] ~ | + [f32 c d e f16 g] [a8. b16] | + } + +alt = + \melodic { + \clef "bass"; + \octave c; + + \stem 1; + r1 | + r | + r | + r8 [g8 a b] [c'. d'32 c'] [b8 e'] | +%% 5 + [a d'] ~ [d'16 e' d' c'] [b8 c' ~ c' bes8] | + [a d' g c'] r16 [a16 b c'] d'4 | + g4 r8 g8 [a b] [c'. d'32 c'] | + [b8 e' a d'] ~ [d'16 e' d' c'!] [b!8 e'] ~ | + e'4 d'4 [c'16 b c' a] [e' d' c' b] | +%% 10 + [c'16 a b c'] [d' c' b a] g4 r4 | + r1 | + r8 [e8 fis gis] [a. b32 a] [gis8 c'] | + [fis b] ~ [b16 c' b a] gis8 a4 gis8 | + a4 r8 g8 [a b] c'. [d'32 c'] | +%% 15 + [b8 e' a d'] ~ [d' g] d'4 | + [c'8 a] e'4 d'8 r8 r4 | + r8 [a8 b cis'] [d'. e'32 d'] [c'!8 f'] | + [b8 e'] ~ [e'16 f' e' d'] cis'8 r8 r4 | + r8 [a8 b cis'] [d'. e'32 d'] [c'!8 fis'] | +%% 20 + [b e'] ~ [e'16 fis' e' d'] c'2 ~ | + [c'16 d' c' b] [a g a fis] [g8 b c' d'] | + [e'. f'32 e'] [d'8 g'] [c' f'] ~ [f'16 g' f' e'] | + d'4 [e'8 d'] ~ [d' g] g4 ~ + [g8 c d e] [f. g32 f] [e8 a] | +%% 25 + [d g] ~ [g16 a g f] [e d e f] [g a bes g] | + [a e f g] [a b c' a] b2 | + c'1 | + } + +bass = + \melodic { + \clef "bass"; + \octave c; + + \stem -1; + r1 | + r | + r | + r | +%% 5 + r2 r8 [c8 d e] | + [f. g32 f] [e8 a] [d g] ~ [g16 a g f] | + [e f e d] [c d c 'b] ['a8 d a fis] | + [g16 a bes g] [cis8 d] a4 e4 | + [a16 b c' d'] [c' b a g] c'8 r8 r4 | +%% 10 + r2 r8 ['g8 'a 'b] | + [c. d32 c] ['b8 e] ['a d] ~ [d16 e d c] | + 'b8 e4 d8 c f!4 e8 ~ | + e d4 e8 [f! e16 d] e4 | + 'a4 r4 r2 | +%% 15 + r8 ['g8 'a 'b] [c. d32 c] ['b8 e] | + ['a8 d] ~ [d16 e d c] ['b8 'bes 'a g'] | + ['a8 fis g e] d4 [e8 f!] | + [g8. a32 g] [f8 bes] [e a] ~ [a16 bes a g] | + [f e f d] [g8 a] d2 ~ | +%% 20 + [d16 e d c] ['b 'a 'g 'fis] ['e8 e fis g] ~ | + [g a16 g16] [fis8 d] g2 ~ | + g2 a4 [b8 c'] | + [f16 a g f] [e d c 'b] [c d e f] [g8 'g] | + c1 ~ | +%% 25 + c1 ~ | + c1 ~ | + c1 | + } + + +\score { + \melodic < \id "Piano" ""; + \multi 1; + < \multi 2; + \global + \soprane + \tenor + > + < \multi 2; + \global + \alt + \bass + > + > + + \paper{ + gourlay_maxmeasures =5.; +% castingalgorithme = \Wordwrap + } + \midi { + \tempo 4 = 84; + } +} + +% EOF diff --git a/input/prelude1.ly b/input/prelude1.ly new file mode 100644 index 0000000000..da66d87d81 --- /dev/null +++ b/input/prelude1.ly @@ -0,0 +1,190 @@ +\header{ +filename prelude1.ly +title Preludium +description Das Wohltemperierte Clavier I, Prelude I (c-major) +opus BWV 846 +source +composer Johann Sebastian Bach (1685-1750) +enteredby Shay Rojansky +copyright Public Domain" +} + +\version "0.1.1"; + + % should add \need{dutch.ini} for + % correct parsing of note names + +global = + \melodic { + \meter 4/4; % should be \meter C + } + + +% should do programmable input. + +soprane = + \melodic { + \clef "violin"; + \octave c'; + + <\multi 2; + % Real soprane + {\stem 1; + r8 [g16 c'] [e' g c' e'] r8 [g16 c'] [e' g c' e'] | + r8 [a16 d'] [f' a d' f'] r8 [a16 d'] [f' a d' f'] | + r8 [g16 d'] [f' g d' f'] r8 [g16 d'] [f' g d' f'] | + r8 [g16 c'] [e' g c' e'] r8 [g16 c'] [e' g c' e'] | + r8 [a16 e'] [a' a e' a'] r8 [a16 e'] [a' a e' a'] | + r8 [fis16 a] [d' fis a d'] r8 [fis16 a] [d' fis a d'] | + r8 [g16 d'] [g' g d' g'] r8 [g16 d'] [g' g d' g'] | + r8 [e16 g] [c' e g c'] r8 [e16 g] [c' e g c'] | + r8 [e16 g] [c' e g c'] r8 [e16 g] [c' e g c'] |} + % Tenor + {\stem -1; + r16 e8. ~ e4 r16 e8. ~ e4 | + r16 d8. ~ d4 r16 d8. ~ d4 | + r16 d8. ~ d4 r16 d8. ~ d4 | + r16 e8. ~ e4 r16 e8. ~ e4 | + r16 e8. ~ e4 r16 e8. ~ e4 | + r16 d8. ~ d4 r16 d8. ~ d4 | + r16 d8. ~ d4 r16 d8. ~ d4 | + r16 c8. ~ c4 r16 c8. ~ c4 | + r16 c8. ~ c4 r16 c8. ~ c4 |}> +%% 10 + r8 [d16 fis] [c' d fis c'] r8 [d16 fis] [c' d fis c'] | + r8 [d16 g] [b d g b] r8 [d16 g] [b d g b] | + r8 [e16 g] [cis' e g cis'] r8 [e16 g] [cis' e g cis'] | + r8 [d16 a] [d' d a d'] r8 [d16 a] [d' d a d'] | + r8 [d16 f] [b d f b] r8 [d16 f] [b d f b] | + r8 [c16 g] [c' c g c'] r8 [c16 g] [c' c g c'] | + r8 ['a16 c] [f 'a c f] r8 ['a16 c] [f 'a c f] | + r8 ['a16 c] [f 'a c f] r8 ['a16 c] [f 'a c f] | + r8 ['g16 'b] [f 'g 'b f] r8 ['g16 'b] [f 'g 'b f] | + r8 ['g16 c] [e 'g c e] r8 ['g16 c] [e 'g c e] | +%% 20 + r8 ['bes16 c] [e 'bes c e] r8 ['bes16 c] [e 'bes c e] | + r8 ['a16 c] [e 'a c e] r8 ['a16 c] [e 'a c e] | + r8 ['a16 c] [ees 'a c ees] r8 ['a16 c] [ees 'a c ees] | + r8 ['b16 c] [d 'b c d] r8 ['b16 c] [d 'b c d] | + r8 ['g16 'b] [d 'g 'b d] r8 ['g16 'b] [d 'g 'b d] | + r8 ['g16 c] [e 'g c e] r8 ['g16 c] [e 'g c e] | + r8 ['g16 c] [f 'g c f] r8 ['g16 c] [f 'g c f] | + r8 ['g16 'b] [f 'g 'b f] r8 ['g16 'b] [f 'g 'b f] | + r8 ['a16 c] [fis 'a c fis] r8 ['a16 c] [fis 'a c fis] | + r8 ['g16 c] [g 'g c g] r8 ['g16 c] [g 'g c g] | +%% 30 + r8 ['g16 c] [f 'g c f] r8 ['g16 c] [f 'g c f] | + r8 ['g16 'b] [f 'g 'b f] r8 ['g16 'b] [f 'g 'b f] | + r8 ['g16 'bes] [e 'g 'bes e] r8 ['g16 'bes] [e 'g 'bes e] | + + r8 ['f16 'a] [c f c 'a] [c 'a 'f 'a] ['f 'd 'f 'd] | + r8 [g16 b] [d' f' d' b] [d' b g b] [d f e d] | + || + } + +bass = + \melodic { + \clef "bass"; + \octave c; + + \stem -1; + c'2 c' | + c' c' | + b b | + c' c' | + c' c' | + c' c' | + b b | + b b | + a a | +%% 10 + <\multi 2; + % Alt + {\stem 1; + r16 a8. ~ a4 r16 a8. ~ a4 | + r16 b8. ~ b4 r16 b8. ~ b4 | + r16 bes8. ~ bes4 r16 bes8. ~ bes4 | + r16 a8. ~ a4 r16 a8. ~ a4 | + r16 aes8. ~ aes4 r16 aes8. ~ aes4 | + r16 g8. ~ g4 r16 g8. ~ g4 | + r16 f8. ~ f4 r16 f8. ~ f4 | + r16 f8. ~ f4 r16 f8. ~ f4 | + r16 d8. ~ d4 r16 d8. ~ d4 | + r16 e8. ~ e4 r16 e8. ~ e4 | +%% 20 + r16 g8. ~ g4 r16 g8. ~ g4 | + r16 f8. ~ f4 r16 f8. ~ f4 | + r16 c8. ~ c4 r16 c8. ~ c4 | + r16 f8. ~ f4 r16 f8. ~ f4 | + r16 f8. ~ f4 r16 f8. ~ f4 | + r16 e8. ~ e4 r16 e8. ~ e4 | + r16 d8. ~ d4 r16 d8. ~ d4 | + r16 d8. ~ d4 r16 d8. ~ d4 | + r16 ees8. ~ ees4 r16 ees8. ~ ees4 | + r16 e!8. ~ e4 r16 e8. ~ e4 | +%% 30 + r16 d8. ~ d4 r16 d8. ~ d4 | + r16 d8. ~ d4 r16 d8. ~ d4 | + r16 c8. ~ c4 r16 c8. ~ c4 | + + r16 c8. ~ c4 ~ c2 | + r16 'b8. ~ 'b4 ~ 'b2 | + c1 ||} + + % Bass + {\stem -1; + d2 d | + g g | + g g | + f f | + f f | + e e | + e e | + d d | + 'g 'g | + c c | +%% 20 + c c | + 'f 'f | + 'fis 'fis | + 'aes 'aes | + 'g 'g | + 'g 'g | + 'g 'g | + 'g 'g | + 'g 'g | + 'g 'g | +%% 30 + 'g 'g | + 'g 'g | + 'c 'c | + + 'c 'c | + 'c 'c | + 'c1 }> + } + + +\score { + \melodic < \id "Piano" ""; + \multi 1; + < \multi 2; + \global + \soprane + > + < \multi 2; + \global + \bass + > + > + + \paper{ + gourlay_maxmeasures =5.; + + } + \midi { + \tempo 4 = 84; + } +} + +% EOF diff --git a/input/rhythm.ly b/input/rhythm.ly index 14454306a2..8f897af126 100644 --- a/input/rhythm.ly +++ b/input/rhythm.ly @@ -1,15 +1,13 @@ -%{MudelaHeader - filename:rhythm.ly - title: - description: - composers: - entered-by:HWN - copyright:public domain - - Tested Features: multiple meters, beaming +\header{ + filename rhythm.ly + entered-by HWN + copyright public domain + Tested Features multiple meters, beaming unsynced bars -EndMudelaHeader +} +%{ +has to be revised for 0.1.12 %} diff --git a/input/standchen-16.ly b/input/standchen-16.ly deleted file mode 100644 index 191760b3ca..0000000000 --- a/input/standchen-16.ly +++ /dev/null @@ -1,20 +0,0 @@ -%{ -16-point version of "leise flehen meine lieder" -%} - -\include "standchen-part.ly" - -\score{ - \themusic - \paper{ - % 16pt mustn't use whole page width - linewidth= 160.\mm; - % we want gourlay, don't set geometric - % geometric= 1.4; - gourlay_maxmeasures = 9.; - \output "standchen.out"; - } - \midi{ - \tempo 4 = 54; - } -} diff --git a/input/standchen-16.tex b/input/standchen-16.tex index 2818ebc4ac..ae3ccc33ba 100644 --- a/input/standchen-16.tex +++ b/input/standchen-16.tex @@ -16,6 +16,6 @@ \instrument{M\"a\ss ig} % heu %#%\tempo{M\"a\ss ig} \maketit -\input standchen.out +\input{standchen-16.out} %\input lelie.tex \end{document} diff --git a/input/standchen-20.ly b/input/standchen-20.ly deleted file mode 100644 index 5a9eb1b6da..0000000000 --- a/input/standchen-20.ly +++ /dev/null @@ -1,22 +0,0 @@ -%{ -20-point version of "leise flehen meine lieder" -%} - -\include "standchen-part.ly" - -\score{ - \themusic - \paper{ - \paper_twenty - % 20pt music uses whole pagewidth - linewidth= 195.\mm; - - % we want gourlay, don't set geometric - % geometric= 1.4; - gourlay_maxmeasures = 9.; - \output "standchen.out"; - } - \midi{ - \tempo 4 = 54; - } -} diff --git a/input/standchen-20.tex b/input/standchen-20.tex index 2818ebc4ac..9870b620ea 100644 --- a/input/standchen-20.tex +++ b/input/standchen-20.tex @@ -16,6 +16,6 @@ \instrument{M\"a\ss ig} % heu %#%\tempo{M\"a\ss ig} \maketit -\input standchen.out +\input{standchen-20.out} %\input lelie.tex \end{document} diff --git a/input/standchen-part.ly b/input/standchen.ly similarity index 93% rename from input/standchen-part.ly rename to input/standchen.ly index e1e86247ac..23bac1d862 100644 --- a/input/standchen-part.ly +++ b/input/standchen.ly @@ -1,5 +1,5 @@ \header{ -filename standchen-part.ly +filename standchen.ly title St\"andchen (Serenade) "Leise flehen meine Lieder" opus D. 957 No. 4 composers Franz Schubert (1797-1828) @@ -7,8 +7,10 @@ composers Franz Schubert (1797-1828) enteredby JCN copyright public domain } + %{ - Tested Features: multivoice, accents, lyrics, chords, piano music + Tested Features: multivoice, accents, lyrics, chords, piano music, +multiple \paper{}s in one \score %} \version "0.1.1"; @@ -482,3 +484,29 @@ themusic = \melodic < \begeleiding \commands > > > + + +\score{ + \themusic + \paper{ + \paper_twenty + % 20pt music uses whole pagewidth + linewidth= 195.\mm; + + % we want gourlay, don't set geometric + % geometric= 1.4; + gourlay_maxmeasures = 9.; + \output "standchen-20.out"; + } + \paper{ + % 16pt mustn't use whole page width + linewidth= 160.\mm; + % we want gourlay, don't set geometric + % geometric= 1.4; + gourlay_maxmeasures = 9.; + \output "standchen-16.out"; + } + \midi{ + \tempo 4 = 54; + } +} diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly index 97429e7d88..b3443e8a65 100644 --- a/input/wohltemperirt.ly +++ b/input/wohltemperirt.ly @@ -1,12 +1,12 @@ \header{ filename wohltemperirt.ly title Fuga a 3 -description Das Wohltemperirte Clavier I, Fuga II (c-minor) -opus BWV ? +description Das Wohltemperierte Clavier I, Fuga II (c-minor) +opus BWV 847-Fuga source Henle's Urtext composer Johann Sebastian Bach (1685-1750) enteredby HWN and Werner Lemberg -copyright Public Domain" +copyright Public Domain } %{ Tested Features: stem direction, multivoice, forced accidentals. diff --git a/lib/binary-source-file.cc b/lib/binary-source-file.cc index 8c4aac4474..306ca97855 100644 --- a/lib/binary-source-file.cc +++ b/lib/binary-source-file.cc @@ -17,8 +17,8 @@ #include "binary-source-file.hh" #include "string-convert.hh" -Binary_source_file::Binary_source_file( String& filename_str ) - : Source_file( filename_str ) +Binary_source_file::Binary_source_file(String& filename_str) + : Source_file(filename_str) { } @@ -27,35 +27,35 @@ Binary_source_file::~Binary_source_file() } String -Binary_source_file::error_str( char const* pos_ch_c_l ) const +Binary_source_file::error_str(char const* pos_ch_c_l) const { - assert( this ); - if ( !in_b( pos_ch_c_l ) ) + assert(this); + if (!in_b(pos_ch_c_l)) return ""; char const* begin_ch_c_l = pos_ch_c_l - 8 >? ch_C(); char const* end_ch_c_l = pos_ch_c_l + 7 Duration_convert::dur_array_s; String -Duration_convert::dur2_str( Duration dur ) +Duration_convert::dur2_str(Duration dur) { - if ( dur.ticks_i_ ) - return String( "[" ) + String( dur.ticks_i_ ) + "]"; + if (dur.ticks_i_) + return String("[") + String(dur.ticks_i_) + "]"; - String str; - if (dur.durlog_i_ <= 0) - str="\\breve"; - else - str= String( type2_i(dur.durlog_i_) ); - str += String( '.', dur.dots_i_ ); - if ( dur.plet_b()) - str += String( "*" ) + String( dur.plet_.iso_i_ ) - + String( "/" ) + String( dur.plet_.type_i_ ); - return str; + String str; + if (dur.durlog_i_ <= 0) + str="\\breve"; + else + str= String(type2_i(dur.durlog_i_)); + str += String('.', dur.dots_i_); + if (dur.plet_b()) + str += String("*") + String(dur.plet_.iso_i_) + + String("/") + String(dur.plet_.type_i_); + return str; } #if 0 int -Duration_convert::dur2_i( Duration dur, int division_1_i ) +Duration_convert::dur2_i(Duration dur, int division_1_i) { - return dur2_mom( dur ) * Moment( division_1_i ); + return dur2_mom(dur) * Moment(division_1_i); } #endif int -Duration_convert::dur2ticks_i( Duration dur ) +Duration_convert::dur2ticks_i(Duration dur) { - if ( dur.ticks_i_ ) - return dur.ticks_i_; - return dur2_mom( dur ) * Moment( Duration::division_1_i_s ); + if (dur.ticks_i_) + return dur.ticks_i_; + return dur2_mom(dur) * Moment(Duration::division_1_i_s); } int Duration_convert::i2_type(int i) { - int t=0; - while (!(i & 1)) { - i >>= 1; - t++; - } - return t; + int t=0; + while (!(i & 1)) { + i >>= 1; + t++; + } + return t; } int Duration_convert::type2_i(int type) { - if (type<0) - return 0; - else - return 1 << type; + if (type<0) + return 0; + else + return 1 << type; } Moment -Duration_convert::dur2_mom( Duration dur ) +Duration_convert::dur2_mom(Duration dur) { - if ( dur.ticks_i_ ) - return Moment( dur.ticks_i_, Duration::division_1_i_s ); - - // or simply assert? - if ( dur.durlog_i_<-10 ) - return Moment( 0 ); - Moment mom; - if (dur.durlog_i_<0) - mom = Moment( type2_i( -dur.durlog_i_ ), 1 ); - else - mom = Moment( 1 , type2_i( dur.durlog_i_ ) ); - - Moment delta = mom; - while ( dur.dots_i_-- ) - { - delta /= 2.0; - mom += delta; - } - - return mom * plet_factor_mom( dur ); + if (dur.ticks_i_) + return Moment(dur.ticks_i_, Duration::division_1_i_s); + + // or simply assert? + if (dur.durlog_i_<-10) + return Moment(0); + Moment mom; + if (dur.durlog_i_<0) + mom = Moment(type2_i(-dur.durlog_i_), 1); + else + mom = Moment(1 , type2_i(dur.durlog_i_)); + + Moment delta = mom; + while (dur.dots_i_--) + { + delta /= 2.0; + mom += delta; + } + + return mom * plet_factor_mom(dur); } #if 0 Moment -Duration_convert::i2_mom( int time_i, int division_1_i ) +Duration_convert::i2_mom(int time_i, int division_1_i) { - if ( !time_i ) - return Moment( 0 ); + if (!time_i) + return Moment(0); - if ( division_1_i > 0 ) - return Moment( time_i, division_1_i ); - else - return Moment( -division_1_i, time_i ); + if (division_1_i > 0) + return Moment(time_i, division_1_i); + else + return Moment(-division_1_i, time_i); } #endif Duration -Duration_convert::mom2_dur( Moment mom ) +Duration_convert::mom2_dur(Moment mom) { - if (!mom) - { - Duration dur; - dur.set_plet(0,1); - return dur; - } + if (!mom) + { + Duration dur; + dur.set_plet(0,1); + return dur; + } - Duration dur = mom2standardised_dur( mom ); -// if ( !dur.mom() || ( dur.mom() == mom ) ) - if ( !dur.length() || ( dur.length() == mom ) ) - return dur; - assert( midi_as_plet_b_s ); - -// dur.set_plet( type_mom, Duration::division_1_i_s / 4 ); - -// Moment as_plet_mom = mom / dur.mom(); - Moment as_plet_mom = mom / dur.length(); - as_plet_mom *= dur.plet_.mom(); - long num = as_plet_mom.numerator().as_long(); - long den = as_plet_mom.denominator().as_long(); - dur.set_plet( num, den ); - return dur; + Duration dur = mom2standardised_dur(mom); + // if (!dur.mom() || (dur.mom() == mom)) + if (!dur.length() || (dur.length() == mom)) + return dur; + assert(midi_as_plet_b_s); + + // dur.set_plet(type_mom, Duration::division_1_i_s / 4); + + // Moment as_plet_mom = mom / dur.mom(); + Moment as_plet_mom = mom / dur.length(); + as_plet_mom *= dur.plet_.mom(); + long num = as_plet_mom.numerator().as_long(); + long den = as_plet_mom.denominator().as_long(); + dur.set_plet(num, den); + return dur; } Duration -Duration_convert::mom2standardised_dur( Moment mom ) +Duration_convert::mom2standardised_dur(Moment mom) { -// if ( !dur_array_s.length_i() ) - if ( !dur_array_s.size() ) - set_array(); - assert( dur_array_s.size() ); - for ( int i = 0; i < dur_array_s.size() - 1; i++ ) - { - Moment lower_mom = dur2_mom( dur_array_s[ i ] ); - if ( mom <= lower_mom ) - { - // all arbitrary, but 3/4 will get rid of the noise... - // kinda ok - if ( i || ( mom / lower_mom > Moment( 3, 4 ) ) ) - return dur_array_s[ i ]; - else - { - Duration d; - d.durlog_i_ = -100; - return d; - } - } - Moment upper_mom = dur2_mom( dur_array_s[ i + 1 ] ); - if ( ( mom < upper_mom ) - && ( ( mom - lower_mom ) / lower_mom - < ( upper_mom - mom ) / upper_mom ) ) - return dur_array_s[ i ]; - } - return dur_array_s[ dur_array_s.size() - 1 ]; + // if (!dur_array_s.length_i()) + if (!dur_array_s.size()) + set_array(); + assert(dur_array_s.size()); + for (int i = 0; i < dur_array_s.size() - 1; i++) + { + Moment lower_mom = dur2_mom(dur_array_s[ i ]); + if (mom <= lower_mom) + { + // all arbitrary, but 3/4 will get rid of the noise... + // kinda ok + if (i || (mom / lower_mom > Moment(3, 4))) + return dur_array_s[ i ]; + else + { + Duration d; + d.durlog_i_ = -100; + return d; + } + } + Moment upper_mom = dur2_mom(dur_array_s[ i + 1 ]); + if ((mom < upper_mom) + && ((mom - lower_mom) / lower_mom + < (upper_mom - mom) / upper_mom)) + return dur_array_s[ i ]; + } + return dur_array_s[ dur_array_s.size() - 1 ]; } void Duration_convert::set_array() { - dur_array_s.clear(); + dur_array_s.clear(); - Duration_iterator iter_dur; - assert( iter_dur ); - while ( iter_dur ) - dur_array_s.push( iter_dur++ ); + Duration_iterator iter_dur; + assert(iter_dur); + while (iter_dur) + dur_array_s.push(iter_dur++); } Moment -Duration_convert::plet_factor_mom( Duration dur ) +Duration_convert::plet_factor_mom(Duration dur) { - return dur.plet_.mom(); + return dur.plet_.mom(); } Real -Duration_convert::sync_f( Duration dur, Moment mom ) +Duration_convert::sync_f(Duration dur, Moment mom) { - return mom / dur2_mom( dur ); + return mom / dur2_mom(dur); } Duration -Duration_convert::ticks2_dur( int ticks_i ) +Duration_convert::ticks2_dur(int ticks_i) { -// Duration dur( 4, 0 ); -// dur.set_plet( ticks_i, Duration::division_1_i_s / 4 ); + // Duration dur(4, 0); + // dur.set_plet(ticks_i, Duration::division_1_i_s / 4); - Moment mom( ticks_i, Duration::division_1_i_s ); - if ( midi_as_plet_b_s ) - return mom2_dur( mom ); + Moment mom(ticks_i, Duration::division_1_i_s); + if (midi_as_plet_b_s) + return mom2_dur(mom); - Duration dur = mom2standardised_dur( mom ); + Duration dur = mom2standardised_dur(mom); -// if ( dur.mom() == mom ) - if ( dur.length() == mom ) - return dur; + // if (dur.mom() == mom) + if (dur.length() == mom) + return dur; // huh? #if 0 - dur.durlog_i_ = -100; - dur.dots_i_ = 0; - dur.set_ticks( ticks_i ); - return dur; + dur.durlog_i_ = -100; + dur.dots_i_ = 0; + dur.set_ticks(ticks_i); + return dur; #else - return mom2_dur( mom ); + return mom2_dur(mom); #endif } Duration -Duration_convert::ticks2standardised_dur( int ticks_i ) +Duration_convert::ticks2standardised_dur(int ticks_i) { - Moment mom( ticks_i, Duration::division_1_i_s ); - Duration dur = mom2standardised_dur( mom ); - return dur; + Moment mom(ticks_i, Duration::division_1_i_s); + Duration dur = mom2standardised_dur(mom); + return dur; } Duration_iterator::Duration_iterator() { - cursor_dur_.durlog_i_ = 7; - if ( Duration_convert::no_smaller_than_i_s ) - cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s; -// cursor_dur_.set_plet( 1, 1 ); + cursor_dur_.durlog_i_ = 7; + if (Duration_convert::no_smaller_than_i_s) + cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s; + // cursor_dur_.set_plet(1, 1); } Duration Duration_iterator::operator ++(int) { - return forward_dur(); + return forward_dur(); } Duration Duration_iterator::operator ()() { - return dur(); + return dur(); } Duration_iterator::operator bool() { - return ok(); + return ok(); } Duration Duration_iterator::dur() { - return cursor_dur_; + return cursor_dur_; } Duration Duration_iterator::forward_dur() { - /* should do smart table? guessing: - duration wholes - 16 0.0625 - 32.. 0.0703 - 8:2/3 0.0833 - 16. 0.0938 - 8 0.1250 - 16.. 0.1406 - 4:2/3 0.1667 - 8. 0.1875 + /* should do smart table? guessing: + duration wholes + 16 0.0625 + 32.. 0.0703 + 8:2/3 0.0833 + 16. 0.0938 + 8 0.1250 + 16.. 0.1406 + 4:2/3 0.1667 + 8. 0.1875 - */ - assert( ok() ); - - Duration dur = cursor_dur_; - - if ( !cursor_dur_.dots_i_ && !cursor_dur_.plet_b() ) - { - cursor_dur_.durlog_i_ += 1; - cursor_dur_.dots_i_ = 2; - } - else if ( cursor_dur_.dots_i_ == 2 ) - { - assert( !cursor_dur_.plet_b() ); - cursor_dur_.dots_i_ = 0; - cursor_dur_.durlog_i_ -=2; - cursor_dur_.set_plet( 2, 3 ); - } - else if ( cursor_dur_.plet_b() - && ( cursor_dur_.plet_.iso_i_ == 2 ) - && ( cursor_dur_.plet_.type_i_ == 3 ) ) - { - assert( !cursor_dur_.dots_i_ ); - cursor_dur_.set_plet( 1, 1 ); - cursor_dur_.durlog_i_ += 1; - cursor_dur_.dots_i_ = 1; - } - else if ( cursor_dur_.dots_i_ == 1 ) - { - assert( !cursor_dur_.plet_b() ); - cursor_dur_.dots_i_ = 0; - cursor_dur_.durlog_i_ -= 1; - } + */ + assert(ok()); + + Duration dur = cursor_dur_; + + if (!cursor_dur_.dots_i_ && !cursor_dur_.plet_b()) + { + cursor_dur_.durlog_i_ += 1; + cursor_dur_.dots_i_ = 2; + } + else if (cursor_dur_.dots_i_ == 2) + { + assert(!cursor_dur_.plet_b()); + cursor_dur_.dots_i_ = 0; + cursor_dur_.durlog_i_ -=2; + cursor_dur_.set_plet(2, 3); + } + else if (cursor_dur_.plet_b() + && (cursor_dur_.plet_.iso_i_ == 2) + && (cursor_dur_.plet_.type_i_ == 3)) + { + assert(!cursor_dur_.dots_i_); + cursor_dur_.set_plet(1, 1); + cursor_dur_.durlog_i_ += 1; + cursor_dur_.dots_i_ = 1; + } + else if (cursor_dur_.dots_i_ == 1) + { + assert(!cursor_dur_.plet_b()); + cursor_dur_.dots_i_ = 0; + cursor_dur_.durlog_i_ -= 1; + } - if ( Duration_convert::no_triplets_b_s - && cursor_dur_.plet_b() && ok() ) - forward_dur(); - if ( Duration_convert::no_double_dots_b_s - && ( cursor_dur_.dots_i_ == 2 ) && ok() ) - forward_dur(); - if ( Duration_convert::no_smaller_than_i_s - && ( cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s ) && ok() ) - forward_dur(); - if ( Duration_convert::no_smaller_than_i_s - && cursor_dur_.dots_i_ - && ( cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s ) - && ok() ) - forward_dur(); - if ( Duration_convert::no_smaller_than_i_s - && ( cursor_dur_.dots_i_ == 2 ) - && ( cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2 ) - && ok() ) - forward_dur(); - - return dur; + if (Duration_convert::no_triplets_b_s + && cursor_dur_.plet_b() && ok()) + forward_dur(); + if (Duration_convert::no_double_dots_b_s + && (cursor_dur_.dots_i_ == 2) && ok()) + forward_dur(); + if (Duration_convert::no_smaller_than_i_s + && (cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s) && ok()) + forward_dur(); + if (Duration_convert::no_smaller_than_i_s + && cursor_dur_.dots_i_ + && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s) + && ok()) + forward_dur(); + if (Duration_convert::no_smaller_than_i_s + && (cursor_dur_.dots_i_ == 2) + && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2) + && ok()) + forward_dur(); + + return dur; } bool Duration_iterator::ok() { - return ( cursor_dur_.durlog_i_ - && !( ( cursor_dur_.durlog_i_ == 0 ) && ( cursor_dur_.dots_i_ > 2 ) ) ); + return (cursor_dur_.durlog_i_ + && !((cursor_dur_.durlog_i_ == 0) && (cursor_dur_.dots_i_ > 2))); } diff --git a/lib/duration.cc b/lib/duration.cc index 24ae6b5da6..f04c5e42c0 100644 --- a/lib/duration.cc +++ b/lib/duration.cc @@ -34,7 +34,7 @@ Duration::duration_type_b(int t) /* ugh. Assuming behavior of conversion funcs on broken input. */ - return t == Duration_convert::type2_i( Duration_convert::i2_type(t)); + return t == Duration_convert::type2_i(Duration_convert::i2_type(t)); } // ugh, what's this? @@ -60,15 +60,15 @@ Duration::set_plet(Duration d) } void -Duration::set_ticks( int ticks_i ) +Duration::set_ticks(int ticks_i) { - assert( durlog_i_ <10 ); - assert( !dots_i_ ); + assert(durlog_i_ <10); + assert(!dots_i_); ticks_i_ = ticks_i; } String -Duration::str()const +Duration::str() const { return Duration_convert::dur2_str(*this); } diff --git a/lib/file-storage.cc b/lib/file-storage.cc deleted file mode 100644 index 849c27c994..0000000000 --- a/lib/file-storage.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* - file-storage.cc -- implement Mapped_file_storage - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys - Jan Nieuwenhuizen -*/ -#include // open, mmap -#include // open -#include // mmap -#include // INT_MAX -#include // open -#include // close, stat -#include // fdopen -#include // strerror -#include // errno - - - -#include "string.hh" -#include "proto.hh" -#include "warn.hh" -#include "file-storage.hh" - -Mapped_file_storage::Mapped_file_storage(String s) -{ - data_caddr_ = 0; - fildes_i_ = 0; - size_off_ = 0; - open(s); -} - -char const* -Mapped_file_storage::ch_C()const -{ - return (char const*)data_caddr_; -} - -void -Mapped_file_storage::map() -{ - if ( fildes_i_ == -1 ) - return; - - data_caddr_ = (caddr_t)mmap( (void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0 ); - - if ( (int)data_caddr_ == -1 ) - warning( String( "can't map: error no: " ) + strerror( errno )); -} - - -void -Mapped_file_storage::open(String name_str) -{ - fildes_i_ = ::open( name_str, O_RDONLY ); - - if ( fildes_i_ == -1 ) - { - warning( String( "can't open: " ) + name_str + String( ": " ) + strerror( errno )); - return; - } - - struct stat file_stat; - fstat( fildes_i_, &file_stat ); - size_off_ = file_stat.st_size; - map(); -} - -void -Mapped_file_storage::unmap() -{ - if ( data_caddr_ ) - { - munmap( data_caddr_, size_off_ ); - data_caddr_ = 0; - size_off_ = 0; - } -} - -void -Mapped_file_storage::close() -{ - unmap(); - if ( fildes_i_ ) - { - ::close( fildes_i_ ); - fildes_i_ = 0; - } -} - -int -Mapped_file_storage::length_i()const -{ - return size_off_; -} - -Mapped_file_storage::~Mapped_file_storage() -{ - close(); -} diff --git a/lib/includable-lexer.cc b/lib/includable-lexer.cc index 73d00498a8..4e15405164 100644 --- a/lib/includable-lexer.cc +++ b/lib/includable-lexer.cc @@ -15,7 +15,7 @@ Includable_lexer::Includable_lexer() { - yy_current_buffer = 0; + yy_current_buffer = 0; } /** set the new input to s, remember old file. @@ -23,31 +23,28 @@ Includable_lexer::Includable_lexer() void Includable_lexer::new_input(String s, Sources * global_sources) { - Source_file * sl = global_sources->get_file_l(s); - if (!sl) - { - LexerError("Can't find file `" + s+ "'"); - return; - } + Source_file * sl = global_sources->get_file_l(s); + if (!sl) + { + LexerError("Can't find file `" + s+ "'"); + return; + } - char_count_stack_.push(0); - if (yy_current_buffer) - state_stack_.push(yy_current_buffer); - cout << "[" << s<istream_l(), YY_BUF_SIZE )); + */ + yy_switch_to_buffer(yy_create_buffer(sl->istream_l(), YY_BUF_SIZE)); } /** pop the inputstack. conceptually this is a destructor, but it @@ -55,14 +52,14 @@ Includable_lexer::new_input(String s, Sources * global_sources) bool Includable_lexer::close_input() { - include_stack_.pop(); - char_count_stack_.pop(); - cout << "]"<ch_C() + char_count_stack_.top(); + if (include_stack_.empty()) + return 0; + return include_stack_.top()->ch_C() + char_count_stack_.top(); } Includable_lexer::~Includable_lexer() { - while (!include_stack_.empty()) - { - close_input(); - }; + while (!include_stack_.empty()) + { + close_input(); + } } /** Since we don't create the buffer state from the bytes directly, we @@ -92,14 +89,14 @@ Includable_lexer::~Includable_lexer() void Includable_lexer::add_lexed_char(int count) { - char_count_stack_.top() += count; + char_count_stack_.top() += count; } Source_file* -Includable_lexer::source_file_l()const +Includable_lexer::source_file_l() const { - if (include_stack_.empty()) - return 0; - else - return include_stack_.top(); + if (include_stack_.empty()) + return 0; + else + return include_stack_.top(); } diff --git a/lib/include/duration.hh b/lib/include/duration.hh index 0ae66d572e..293c9681fd 100644 --- a/lib/include/duration.hh +++ b/lib/include/duration.hh @@ -31,7 +31,7 @@ struct Duration { Duration(); /// is the "plet factor" of this note != 1 ? bool plet_b(); - String str()const; + String str() const; void set_plet(int,int ); void set_plet(Duration ); static bool duration_type_b(int t); diff --git a/lib/include/file-storage.hh b/lib/include/file-storage.hh index 850046236c..23da07e19f 100644 --- a/lib/include/file-storage.hh +++ b/lib/include/file-storage.hh @@ -18,8 +18,8 @@ class File_storage { public: - virtual char const* ch_C()const=0; - virtual int length_i()const=0; + virtual char const* ch_C() const=0; + virtual int length_i() const=0; virtual ~File_storage(){} }; @@ -31,8 +31,8 @@ class Mapped_file_storage:public File_storage public: Mapped_file_storage(String); protected: - virtual char const* ch_C()const; - virtual int length_i()const; + virtual char const* ch_C() const; + virtual int length_i() const; virtual ~Mapped_file_storage(); private: void open(String name); @@ -53,8 +53,8 @@ class Simple_file_storage : public File_storage char * data_p_; int len_i_; protected: - virtual char const*ch_C()const; - virtual int length_i()const; + virtual char const*ch_C() const; + virtual int length_i() const; virtual ~Simple_file_storage(); public: Simple_file_storage(String); diff --git a/lib/include/includable-lexer.hh b/lib/include/includable-lexer.hh index a84f736c48..fb1a96d0bc 100644 --- a/lib/include/includable-lexer.hh +++ b/lib/include/includable-lexer.hh @@ -31,7 +31,7 @@ protected: Array char_count_stack_; public: - Source_file* source_file_l()const; + Source_file* source_file_l() const; void new_input(String s,Sources*); Includable_lexer(); ~Includable_lexer(); diff --git a/lib/include/input.hh b/lib/include/input.hh index e68940257c..2fdb97615a 100644 --- a/lib/include/input.hh +++ b/lib/include/input.hh @@ -20,12 +20,12 @@ class Input { Source_file * source_file_l_; public: - void warning(String)const; // should use member func? - void error(String)const; - void message(String)const; + void warning(String) const; // should use member func? + void error(String) const; + void message(String) const; void set_spot(Input const &); - String location_str()const; + String location_str() const; Input(Source_file*, char const*); Input(); Input( Input const& ); diff --git a/lib/include/plet.hh b/lib/include/plet.hh index 1f1033f87b..2326416716 100644 --- a/lib/include/plet.hh +++ b/lib/include/plet.hh @@ -18,8 +18,8 @@ */ struct Plet { Plet(); - Moment mom()const; - bool unit_b()const; + Moment mom() const; + bool unit_b() const; int iso_i_; // 2/3; 2 is not duration, maar of count! int type_i_; }; diff --git a/lib/include/source-file.hh b/lib/include/source-file.hh index 39cd533e41..5991a2e804 100644 --- a/lib/include/source-file.hh +++ b/lib/include/source-file.hh @@ -21,14 +21,14 @@ public: Source_file( String filename_str_r ); virtual ~Source_file(); - char const* ch_C()const; - virtual String error_str( char const* pos_ch_c_l )const; + char const* ch_C() const; + virtual String error_str( char const* pos_ch_c_l ) const; istream * istream_l(); - bool in_b( char const* pos_ch_c_l )const; - int length_i()const; - virtual int line_i( char const* pos_ch_c_l )const; - String name_str()const; - String file_line_no_str( char const* ch_c_l )const; + bool in_b( char const* pos_ch_c_l ) const; + int length_i() const; + virtual int line_i( char const* pos_ch_c_l ) const; + String name_str() const; + String file_line_no_str( char const* ch_c_l ) const; private: String name_str_; diff --git a/lib/input.cc b/lib/input.cc index 6f05290422..3ef073cb39 100644 --- a/lib/input.cc +++ b/lib/input.cc @@ -36,37 +36,37 @@ Input::set_spot(Input const &i) } void -Input::message(String message_str)const +Input::message(String message_str) const { String str = ""; - if ( source_file_l_ ) + if (source_file_l_) { str += location_str() + String(": "); } str += message_str; - if ( source_file_l_ ) + if (source_file_l_) { str += ":\n"; - str += source_file_l_->error_str( defined_ch_C_); + str += source_file_l_->error_str(defined_ch_C_); } cerr << str << endl; } void -Input::warning( String message_str)const +Input::warning(String message_str) const { - message( "warning: " + message_str); + message("warning: " + message_str); } void -Input::error(String s)const +Input::error(String s) const { message("error: "+ s); } String -Input::location_str()const +Input::location_str() const { if (source_file_l_) return source_file_l_->file_line_no_str(defined_ch_C_); diff --git a/lib/mapped-file-storage.cc b/lib/mapped-file-storage.cc new file mode 100644 index 0000000000..2267164ae7 --- /dev/null +++ b/lib/mapped-file-storage.cc @@ -0,0 +1,101 @@ +/* + file-storage.cc -- implement Mapped_file_storage + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys + Jan Nieuwenhuizen +*/ +#include // open, mmap +#include // open +#include // mmap +#include // INT_MAX +#include // open +#include // close, stat +#include // fdopen +#include // strerror +#include // errno + + + +#include "string.hh" +#include "proto.hh" +#include "warn.hh" +#include "file-storage.hh" + +Mapped_file_storage::Mapped_file_storage(String s) +{ + data_caddr_ = 0; + fildes_i_ = 0; + size_off_ = 0; + open(s); +} + +char const* +Mapped_file_storage::ch_C() const +{ + return (char const*)data_caddr_; +} + +void +Mapped_file_storage::map() +{ + if (fildes_i_ == -1) + return; + + data_caddr_ = (caddr_t)mmap((void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0); + + if ((int)data_caddr_ == -1) + warning(String("can't map: error no: ") + strerror(errno)); +} + + +void +Mapped_file_storage::open(String name_str) +{ + fildes_i_ = ::open(name_str, O_RDONLY); + + if (fildes_i_ == -1) + { + warning(String("can't open: ") + name_str + String(": ") + strerror(errno)); + return; + } + + struct stat file_stat; + fstat(fildes_i_, &file_stat); + size_off_ = file_stat.st_size; + map(); +} + +void +Mapped_file_storage::unmap() +{ + if (data_caddr_) + { + munmap(data_caddr_, size_off_); + data_caddr_ = 0; + size_off_ = 0; + } +} + +void +Mapped_file_storage::close() +{ + unmap(); + if (fildes_i_) + { + ::close(fildes_i_); + fildes_i_ = 0; + } +} + +int +Mapped_file_storage::length_i() const +{ + return size_off_; +} + +Mapped_file_storage::~Mapped_file_storage() +{ + close(); +} diff --git a/lib/plet.cc b/lib/plet.cc index 73df524f7d..686909382a 100644 --- a/lib/plet.cc +++ b/lib/plet.cc @@ -16,13 +16,13 @@ Plet::Plet() } Moment -Plet::mom()const +Plet::mom() const { - return Moment( iso_i_, type_i_ ); + return Moment(iso_i_, type_i_); } bool -Plet::unit_b()const +Plet::unit_b() const { return type_i_ == 1 && iso_i_ == 1; } diff --git a/lib/simple-file-storage.cc b/lib/simple-file-storage.cc index 2f72a4efc0..ed1784ba63 100644 --- a/lib/simple-file-storage.cc +++ b/lib/simple-file-storage.cc @@ -17,50 +17,57 @@ Stupid but foolproof way of opening files. TODO - Should use obstack. Should check IO status + Should check IO status This is of course a build it yourself version of mmap, so we should have been using that... (see Mapped_file_storage) But we noticed some problems with this (unexplained lexer crashes) - */ + [Some versions later] The crashes aren't caused by the mmap + code. But no reason to take it out, is there? */ Simple_file_storage::Simple_file_storage(String s) { - data_p_ =0; - FILE * f = fopen ( s.ch_C(), "r"); - if ( !f ) - { - warning("can't open file\n"); - return ; - } + data_p_ =0; + /* + let's hope that "b" opens anything binary, and does not apply + CR/LF translation + */ + FILE * f = fopen (s.ch_C(), "rb"); + if (!f) + { + warning("can't open file\n"); + return ; + } - int ret = fseek( f, 0, SEEK_END); - len_i_ = ftell(f); - rewind(f); - data_p_ = new char[len_i_+1]; - data_p_[len_i_] = 0; - ret = fread(data_p_, sizeof(char), len_i_, f); -#ifndef __CYGWIN32__ // ugh, \r\n -> \n translation - assert (ret==len_i_); + int ret = fseek(f, 0, SEEK_END); + len_i_ = ftell(f); + rewind(f); + data_p_ = new char[len_i_+1]; + data_p_[len_i_] = 0; + ret = fread(data_p_, sizeof(char), len_i_, f); + + +#if 1 // ugh, \r\n -> \n translation + assert (ret==len_i_); #endif - fclose(f); + fclose(f); } char const* Simple_file_storage::ch_C() const { - return data_p_; + return data_p_; } int -Simple_file_storage::length_i()const +Simple_file_storage::length_i() const { - return len_i_; + return len_i_; } Simple_file_storage::~Simple_file_storage() { - delete []data_p_; + delete []data_p_; } diff --git a/lib/source-file.cc b/lib/source-file.cc index 4ac7017f05..7d912edd63 100644 --- a/lib/source-file.cc +++ b/lib/source-file.cc @@ -19,7 +19,7 @@ #include "source-file.hh" #include "file-storage.hh" -Source_file::Source_file( String filename_str ) +Source_file::Source_file(String filename_str) { name_str_ = filename_str; istream_p_ = 0; @@ -29,16 +29,16 @@ Source_file::Source_file( String filename_str ) istream* Source_file::istream_l() { - if ( !name_str_.length_i()) + if (!name_str_.length_i()) return &cin; - if ( !istream_p_ ) + if (!istream_p_) { - if ( length_i() ) // can-t this be done without such a hack? - istream_p_ = new istrstream( ch_C(), length_i() ); + if (length_i()) // can-t this be done without such a hack? + istream_p_ = new istrstream(ch_C(), length_i()); else { - istream_p_ = new istrstream( "", 0 ); + istream_p_ = new istrstream("", 0); istream_p_->set(ios::eofbit); } } @@ -46,14 +46,17 @@ Source_file::istream_l() } String -Source_file::file_line_no_str(char const *ch_C )const +Source_file::file_line_no_str(char const *context_ch_C) const { + if (!ch_C()) + return "(unknown)"; + else return name_str() + ": " - + String( line_i( ch_C ) ); + + String(line_i(context_ch_C)); } String -Source_file::name_str()const +Source_file::name_str() const { return name_str_; } @@ -66,79 +69,82 @@ Source_file::~Source_file() } String -Source_file::error_str( char const* pos_ch_C )const +Source_file::error_str(char const* pos_ch_C) const { char const* data_ch_C = ch_C(); char const * eof_C_ = data_ch_C + length_i(); - if ( !in_b( pos_ch_C ) ) + if (!in_b(pos_ch_C)) return "(position unknown)"; - if ( pos_ch_C == eof_C_) + if (pos_ch_C == eof_C_) pos_ch_C --; char const* begin_ch_C = pos_ch_C; - while ( begin_ch_C > data_ch_C ) - if ( *--begin_ch_C == '\n' ) + while (begin_ch_C > data_ch_C) + if (*--begin_ch_C == '\n') { begin_ch_C++; break; } char const* end_ch_C = pos_ch_C; - while ( end_ch_C < eof_C_ ) - if ( *end_ch_C++ == '\n' ) + while (end_ch_C < eof_C_) + if (*end_ch_C++ == '\n') { end_ch_C--; break; } - // String( char const* p, int length ) is missing!? - String line_str( (Byte const*)begin_ch_C, end_ch_C - begin_ch_C ); + // String(char const* p, int length) is missing!? + String line_str((Byte const*)begin_ch_C, end_ch_C - begin_ch_C); int error_col_i = 0; char const* scan_ch_C = begin_ch_C; - while ( scan_ch_C < pos_ch_C ) - if ( *scan_ch_C++ == '\t' ) - error_col_i = ( error_col_i / 8 + 1 ) * 8; + while (scan_ch_C < pos_ch_C) + if (*scan_ch_C++ == '\t') + error_col_i = (error_col_i / 8 + 1) * 8; else error_col_i++; - String str = line_str.left_str( pos_ch_C - begin_ch_C ) - + String( '\n' ) - + String( ' ', error_col_i ) - + line_str.mid_str( pos_ch_C - begin_ch_C, INT_MAX ); // String::mid should take 0 arg.. + String str = line_str.left_str(pos_ch_C - begin_ch_C) + + String('\n') + + String(' ', error_col_i) + + line_str.mid_str(pos_ch_C - begin_ch_C, INT_MAX); // String::mid should take 0 arg.. return str; } bool -Source_file::in_b( char const* pos_ch_C )const +Source_file::in_b(char const* pos_ch_C) const { - return ( pos_ch_C && ( pos_ch_C >= ch_C() ) && ( pos_ch_C <= ch_C() + length_i() ) ); + return (pos_ch_C && (pos_ch_C >= ch_C()) && (pos_ch_C <= ch_C() + length_i())); } int -Source_file::line_i( char const* pos_ch_C )const +Source_file::line_i(char const* pos_ch_C) const { - if ( !in_b( pos_ch_C ) ) + if (!in_b(pos_ch_C)) return 0; int i = 1; char const* scan_ch_C = ch_C(); - while ( scan_ch_C < pos_ch_C ) - if ( *scan_ch_C++ == '\n' ) + if (!scan_ch_C) + return 0; + + while (scan_ch_C < pos_ch_C) + if (*scan_ch_C++ == '\n') i++; return i; } int -Source_file::length_i()const +Source_file::length_i() const { return storage_p_->length_i(); } char const * -Source_file::ch_C()const +Source_file::ch_C() const { return storage_p_->ch_C(); } diff --git a/lib/source.cc b/lib/source.cc index dd1c5f27d6..3f2daf6a23 100644 --- a/lib/source.cc +++ b/lib/source.cc @@ -19,20 +19,20 @@ Sources::Sources() { - path_C_= 0; - binary_b_ = false; + path_C_= 0; + binary_b_ = false; } void Sources::set_binary(bool bo) { - binary_b_ = bo; + binary_b_ = bo; } void Sources::set_path(File_path *f_C) { - path_C_ = f_C; + path_C_ = f_C; } /** @@ -44,25 +44,25 @@ Sources::set_path(File_path *f_C) @return 0 if no file found */ Source_file* -Sources::get_file_l(String &file_str ) //UGH +Sources::get_file_l(String &file_str) //UGH { - if (path_C_) - { - String file_str_o = path_C_->find(file_str); - if ( ( file_str_o == "" ) && ( file_str != "" ) ) - return 0; - file_str = file_str_o; - } - Source_file * f_p= (!binary_b_) ? - new Source_file(file_str) : new Binary_source_file(file_str); - add(f_p); - return f_p; + if (path_C_) + { + String file_str_o = path_C_->find(file_str); + if ((file_str_o == "") && (file_str != "")) + return 0; + file_str = file_str_o; + } + Source_file * f_p= (!binary_b_) ? + new Source_file(file_str) : new Binary_source_file(file_str); + add(f_p); + return f_p; } void -Sources::add( Source_file* sourcefile_p ) +Sources::add(Source_file* sourcefile_p) { - sourcefile_p_list_.bottom().add( sourcefile_p ); + sourcefile_p_list_.bottom().add(sourcefile_p); } /** @@ -71,12 +71,12 @@ Sources::add( Source_file* sourcefile_p ) @return 0 if not found. */ Source_file* -Sources::sourcefile_l( char const* ch_C ) +Sources::sourcefile_l(char const* ch_C) { - PCursor sourcefile_l_pcur( sourcefile_p_list_.top() ); - for ( ; sourcefile_l_pcur.ok(); sourcefile_l_pcur++ ) - if ( sourcefile_l_pcur->in_b( ch_C ) ) - return *sourcefile_l_pcur; - return 0; + PCursor sourcefile_l_pcur(sourcefile_p_list_.top()); + for (; sourcefile_l_pcur.ok(); sourcefile_l_pcur++) + if (sourcefile_l_pcur->in_b(ch_C)) + return *sourcefile_l_pcur; + return 0; } diff --git a/lib/template.cc b/lib/template.cc index 4fefc0b563..90f9818d85 100644 --- a/lib/template.cc +++ b/lib/template.cc @@ -12,5 +12,5 @@ #include "cursor.tcc" #include "list.tcc" -template L_INSTANTIATE(void *); -template IPL_INSTANTIATE(Source_file); +template LIST_INSTANTIATE(void *); +template POINTERLIST_INSTANTIATE(Source_file); diff --git a/lib/windhoos-suck-suck-suck-thank-you-cygnus.cc b/lib/windhoos-suck-suck-suck-thank-you-cygnus.cc index b2681e4826..8a7fe9f8b2 100644 --- a/lib/windhoos-suck-suck-suck-thank-you-cygnus.cc +++ b/lib/windhoos-suck-suck-suck-thank-you-cygnus.cc @@ -18,7 +18,7 @@ HANDLE CreateFileMapping( DWORD dwMaximumSizeHigh, // high-order 32 bits of object size DWORD dwMaximumSizeLow, // low-order 32 bits of object size LPCTSTR lpName // name of file-mapping object - ); +); LPVOID MapViewOfFile( @@ -27,11 +27,11 @@ LPVOID MapViewOfFile( DWORD dwFileOffsetHigh, // high-order 32 bits of file offset DWORD dwFileOffsetLow, // low-order 32 bits of file offset DWORD dwNumberOfBytesToMap // number of bytes to map - ); +); io.h: -long _get_osfhandle( int filehandle ); +long _get_osfhandle(int filehandle); */ // cygnus's gnu-win32-b17.1 does not have _get_osfhandle @@ -46,9 +46,9 @@ static const int OSF_FACTOR_i = 8; // #define HAVE_GET_OSFHANDLE // no we still cannot; works only with cl.exe long -_get_osfhandle( int filedes_i ) +_get_osfhandle(int filedes_i) { - return (long)( OSF_OFFSET_i + ( filedes_i + OSF_BASE_i ) * OSF_FACTOR_i ); + return (long)(OSF_OFFSET_i + (filedes_i + OSF_BASE_i) * OSF_FACTOR_i); } #ifdef HAVE_GET_OSFHANDLE @@ -61,10 +61,10 @@ mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) (void)flags; (void)prot; (void)addr; - HANDLE osf = (HANDLE)_get_osfhandle( fd ); - HANDLE file_handle = CreateFileMapping( osf, (void*)0, PAGE_READONLY, - 0, len, 0 ); - return (caddr_t)MapViewOfFile( file_handle, FILE_MAP_READ, 0, offset, len ); + HANDLE osf = (HANDLE)_get_osfhandle(fd); + HANDLE file_handle = CreateFileMapping(osf, (void*)0, PAGE_READONLY, + 0, len, 0); + return (caddr_t)MapViewOfFile(file_handle, FILE_MAP_READ, 0, offset, len); } @@ -72,7 +72,7 @@ int munmap(caddr_t addr, size_t len) { (void)len; - return UnmapViewOfFile( addr ); + return UnmapViewOfFile(addr); } #else // ! HAVE_GET_OSFHANDLE // @@ -85,8 +85,8 @@ mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) (void)addr; (void)offset; char* ch_p = new char[ len ]; - if ( ch_p ) - read( fd, (void*)ch_p, len ); + if (ch_p) + read(fd, (void*)ch_p, len); return ch_p; } diff --git a/lily/VERSION b/lily/VERSION index 2302cb4717..7ce3b25fba 100644 --- a/lily/VERSION +++ b/lily/VERSION @@ -1,7 +1,7 @@ MAJOR_VERSION = 0 MINOR_VERSION = 1 -PATCH_LEVEL = 10 +PATCH_LEVEL = 11 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf -MY_PATCH_LEVEL =.jcn1 +MY_PATCH_LEVEL = diff --git a/lily/audio-item.cc b/lily/audio-item.cc index eaa895049a..55367026fa 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -18,7 +18,7 @@ Audio_instrument::Audio_instrument (String instrument_str) Midi_item* Audio_instrument::midi_item_p() { - return str_.length_i() ? new Midi_instrument( 0, str_ ) : 0; + return str_.length_i() ? new Midi_instrument(0, str_) : 0; } Audio_item::Audio_item (Request* req_l) @@ -83,7 +83,7 @@ Audio_text::Audio_text (Audio_text::Type type, String text_str) Midi_item* Audio_text::midi_item_p() { - return text_str_.length_i() ? new Midi_text( this ) : 0; + return text_str_.length_i() ? new Midi_text(this) : 0; } diff --git a/lily/audio-score.cc b/lily/audio-score.cc index 1c406c5b7f..37125f6fc3 100644 --- a/lily/audio-score.cc +++ b/lily/audio-score.cc @@ -19,9 +19,9 @@ #include "audio-score.hh" #include "score.hh" -Audio_score::Audio_score (Score* l) +Audio_score::Audio_score () { - score_l_ = l; + midi_l_ =0; } void @@ -40,7 +40,7 @@ Audio_score::output (Midi_stream& midi_stream_r) midi_stream_r << Midi_header (1, tracks_i, clocks_per_4_i); output_header_track (midi_stream_r); int n = 1; - for ( PCursor i (audio_staff_l_list_); i.ok(); i++ ) + for (PCursor i (audio_staff_l_list_); i.ok(); i++) i->output (midi_stream_r, n++); } @@ -55,26 +55,26 @@ Audio_score::output_header_track (Midi_stream& midi_stream_r) String str = String ("Creator: ") + get_version_str() + "\n"; Midi_text creator (Midi_text::TEXT, str); - midi_track.add (Moment (0), &creator ); + midi_track.add (Moment (0), &creator); str = "Automatically generated at "; str += ctime (&t); str = str.left_str (str.length_i() - 1); str += "\n"; Midi_text generate (Midi_text::TEXT, str); - midi_track.add (Moment (0), &generate ); + midi_track.add (Moment (0), &generate); str = "from musical definition: "; - str += score_l_->location_str(); + str += origin_str_; Midi_text from (Midi_text::TEXT, str); - midi_track.add (Moment (0), &from ); + midi_track.add (Moment (0), &from); Midi_text track_name (Midi_text::TRACK_NAME, "Track " - + String_convert::i2dec_str (0, 0, '0') ); - midi_track.add (Moment (0), &track_name ); + + String_convert::i2dec_str (0, 0, '0')); + midi_track.add (Moment (0), &track_name); - Midi_tempo tempo (score_l_->midi_p_->get_tempo_i (Moment (1, 4) ) ); + Midi_tempo tempo (midi_l_->get_tempo_i (Moment (1, 4))); midi_track.add (Moment (0), &tempo); midi_stream_r << midi_track; @@ -97,9 +97,8 @@ Audio_score::print() const { #ifndef NPRINT DOUT << "Audio_score { "; - score_l_->midi_p_->print(); DOUT << "\ncolumns: "; - for ( PCursor i (audio_column_p_list_); i.ok(); i++ ) + for (PCursor i (audio_column_p_list_); i.ok(); i++) i->print(); DOUT << "}\n"; #endif @@ -108,5 +107,13 @@ Audio_score::print() const void Audio_score::process() { -} + String out=midi_l_->outfile_str_; + if (out == "") + out = default_out_str_ + ".midi"; + + Midi_stream midi_stream (out); + *mlog << "MIDI output to " << out<< " ..." << endl; + output (midi_stream); + *mlog << endl; +} diff --git a/lily/audio-staff.cc b/lily/audio-staff.cc index 21de1e0c9e..199657677c 100644 --- a/lily/audio-staff.cc +++ b/lily/audio-staff.cc @@ -23,7 +23,7 @@ Audio_staff::output (Midi_stream& midi_stream_r, int track_i) { Midi_track midi_track; midi_track.number_i_ = track_i; - for ( Midi_walker i (this, &midi_track); i.ok(); i++ ) + for (Midi_walker i (this, &midi_track); i.ok(); i++) i.process(); midi_stream_r << midi_track; } diff --git a/lily/axis-group-item.cc b/lily/axis-group-item.cc index 325c2a0297..d033d97571 100644 --- a/lily/axis-group-item.cc +++ b/lily/axis-group-item.cc @@ -16,19 +16,17 @@ Axis_group_item::OK() const Link_array elems = axis_admin_.elem_l_arr_; for (int i=0; i < elems.size(); i++) { - Item * it_l = elems[i]->item(); - assert (it_l); - - // somebody probably broke it in pieces - assert (it_l->pcol_l_ == pcol_l_); + Item * it_l = elems[i]->item(); + assert (it_l); } } void Axis_group_item::do_breakable_col_processing() { - if (!pcol_l_->breakable_b()) - return; + if (!breakable_b_) + return; + OK(); copy_breakable_items(); @@ -36,12 +34,15 @@ Axis_group_item::do_breakable_col_processing() Link_array elems = axis_admin_.elem_l_arr_; for (int i=0; i < elems.size(); i++) { - Item* it_l = elems[i]->item(); - for ( int j=0; j < 2; j++) - { - Item *new_l = it_l->find_prebroken_piece (broken_to_a_[j]->pcol_l_); - ((Axis_group_item*)broken_to_a_[j])->add_element (new_l); - } + Item* it_l = elems[i]->item(); + Direction j=LEFT; + do + { + Item *new_l = + it_l->find_prebroken_piece (broken_to_drul_[j]->break_status_i_); + ((Axis_group_item*)broken_to_drul_[j])->add_element (new_l); + } + while ((j*=-1)!=LEFT); } Item::do_breakable_col_processing(); } diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc index 1d45de3ae0..033a55b33a 100644 --- a/lily/axis-group-spanner.cc +++ b/lily/axis-group-spanner.cc @@ -21,97 +21,95 @@ Axis_group_spanner::do_break_processing_if_unbroken() Line_of_score *my_line = line_l(); for (int i=0; i < elems.size(); i++) { - if (!elems[i]->line_l()) - { - Item * item_l = elems[i]->item(); - if (item_l - && item_l->breakable_b_ - && item_l->break_status_i() == 0) - { - // last two checks are paranoia - Item * broken_item_l = - item_l->find_prebroken_piece (my_line); - add_element (broken_item_l); - } - remove_element (elems[i]); - } + if (!elems[i]->line_l()) + { + Item * item_l = elems[i]->item(); + if (item_l + && item_l->breakable_b_ + && item_l->break_status_i() == 0) + { + // last two checks are paranoia + Item * broken_item_l = + item_l->find_prebroken_piece (my_line); + add_element (broken_item_l); + } + remove_element (elems[i]); + } } - } void Axis_group_spanner::do_break_processing() { - set_my_columns(); bool breaking_self_b = ! Spanner::line_l(); if (!breaking_self_b) { - do_break_processing_if_unbroken(); - Spanner::do_break_processing(); - return; + do_break_processing_if_unbroken(); + Spanner::do_break_processing(); + return; } - break_into_pieces (true); + break_into_pieces (); Link_array loose_elems = axis_admin_.elem_l_arr_; remove_all(); for (int i=0; i < loose_elems.size(); i++) { - Score_elem * elt = loose_elems[i]; - Line_of_score *elt_line = elt->line_l(); + Score_elem * elt = loose_elems[i]; + Line_of_score *elt_line = elt->line_l(); - if ( ! elt_line) - { - /* this piece doesn't know where it belongs. - Find out if it was broken, and use the broken remains - */ - if (elt->spanner()) - { - Spanner * sp = elt->spanner(); + if (! elt_line) + { + /* this piece doesn't know where it belongs. + Find out if it was broken, and use the broken remains + */ + if (elt->spanner()) + { + Spanner * sp = elt->spanner(); - for (int j =0; j < broken_into_l_arr_.size(); j++) - { - Axis_group_spanner * my_broken_l - = (Axis_group_spanner*)broken_into_l_arr_[j]; + for (int j =0; j < broken_into_l_arr_.size(); j++) + { + Axis_group_spanner * my_broken_l + = (Axis_group_spanner*)broken_into_l_arr_[j]; - Spanner * broken_span_l - = sp->find_broken_piece ( - ((Score_elem*)my_broken_l)->line_l()); + Spanner * broken_span_l + = sp->find_broken_piece ( + ((Score_elem*)my_broken_l)->line_l()); - if (broken_span_l) - my_broken_l->add_element (broken_span_l); - - } - } - else if (elt->item() - && elt->item()->breakable_b_ - && elt->item()->break_status_i () == 0) - { - - // broken items - for (int j =0; j < 2; j++) - { - Item * my_item = elt->item()->broken_to_a_[j]; - Line_of_score * item_line_l = my_item->line_l() ; - if ( ! item_line_l) - continue; + if (broken_span_l) + my_broken_l->add_element (broken_span_l); - Axis_group_spanner * v - = (Axis_group_spanner*)find_broken_piece (item_line_l); - if (v) - v->add_element (my_item); - } + } + } + else if (elt->item() + && elt->item()->breakable_b_ + && elt->item()->break_status_i () == 0) + { + // broken items + Direction j=LEFT; + do + { + Item * my_item = elt->item()->broken_to_drul_[j]; + Line_of_score * item_line_l = my_item->line_l() ; + if (! item_line_l) + continue; - } - } - else - { + Axis_group_spanner * v + = (Axis_group_spanner*)find_broken_piece (item_line_l); + if (v) + v->add_element (my_item); + } + while ((j*=-1) != LEFT); + } + } + else + { /* this piece *does* know where it belongs. Put it in appropriate piece of this spanner */ - Axis_group_spanner * my_broken_l - = (Axis_group_spanner*)find_broken_piece (elt->line_l()); - my_broken_l->add_element (elt); - } + Axis_group_spanner * my_broken_l + = (Axis_group_spanner*)find_broken_piece (elt->line_l()); + my_broken_l->add_element (elt); + } } Spanner::do_break_processing(); diff --git a/lily/axis-group.cc b/lily/axis-group.cc index c0fff81760..ac5a334e31 100644 --- a/lily/axis-group.cc +++ b/lily/axis-group.cc @@ -13,33 +13,33 @@ /** don't copy anything: an element can only be in one Axis_group_element at one time. */ Axis_group_administration::Axis_group_administration ( - Axis_group_administration const&) + Axis_group_administration const&) { } bool -Axis_group_administration::contains_b (Score_elem const *e)const +Axis_group_administration::contains_b (Score_elem const *e) const { return elem_l_arr_.find_l (e); } Interval -Axis_group_administration::extent (Axis axis)const +Axis_group_administration::extent (Axis axis) const { Interval r; for (int i=0; i < elem_l_arr_.size(); i++) - r.unite (elem_l_arr_[i]->extent (axis)); + r.unite (elem_l_arr_[i]->extent (axis)); return r; } void Axis_group_administration::add_element (Score_elem*e, - Axis_group_element*g, Axis a1, Axis a2) + Axis_group_element*g, Axis a1, Axis a2) { assert (! e->axis_group_l_a_[a1] && !e->axis_group_l_a_[a2]); e->axis_group_l_a_[a1] = g; e->axis_group_l_a_[a2] = g; - elem_l_arr_.push ( e); + elem_l_arr_.push (e); } @@ -59,9 +59,9 @@ Axis_group_administration::remove_all (Axis a1, Axis a2) { for (int i=0; i < elem_l_arr_.size(); i++) { - Score_elem*e=elem_l_arr_[i]; - e->axis_group_l_a_[a1] = 0; - e->axis_group_l_a_[a2] = 0; + Score_elem*e=elem_l_arr_[i]; + e->axis_group_l_a_[a1] = 0; + e->axis_group_l_a_[a2] = 0; } elem_l_arr_.clear(); } @@ -72,6 +72,6 @@ Axis_group_administration::print() const { #ifndef NPRINT for (int i=0; i < elem_l_arr_.size(); i++) - DOUT << elem_l_arr_[i]->name() << ' '; + DOUT << elem_l_arr_[i]->name() << ' '; #endif } diff --git a/lily/bar-column-grav.cc b/lily/bar-column-grav.cc index 4c073ac57e..ac3e868a52 100644 --- a/lily/bar-column-grav.cc +++ b/lily/bar-column-grav.cc @@ -36,7 +36,7 @@ Bar_column_engraver::acknowledge_element (Score_elem_info info) bar_l_ = (Bar*)info.elem_l_->item(); } - if ( bar_l_ && !barcol_p_) + if (bar_l_ && !barcol_p_) { barcol_p_ = new Bar_column; barcol_p_->breakable_b_ =true; diff --git a/lily/bar-column.cc b/lily/bar-column.cc index f4c4d2f96b..c9a0025208 100644 --- a/lily/bar-column.cc +++ b/lily/bar-column.cc @@ -26,7 +26,7 @@ void Bar_column::do_substitute_dependency (Score_elem*o,Score_elem*n) { Script_column::do_substitute_dependency (o,n); - if ( o == bar_l_) + if (o == bar_l_) { bar_l_ = n ? (Bar*)n->item() : 0; } diff --git a/lily/bar-grav.cc b/lily/bar-grav.cc index c390c78a31..c11a7debee 100644 --- a/lily/bar-grav.cc +++ b/lily/bar-grav.cc @@ -22,10 +22,10 @@ Bar_engraver::do_try_request (Request*r_l) { Command_req* c_l = r_l->command(); if (!c_l|| !c_l->bar()) - return false; + return false; Bar_req * b= c_l->bar(); if (bar_req_l_ && bar_req_l_->equal_b (b)) - return false; + return false; bar_req_l_ = b; @@ -37,22 +37,24 @@ Bar_engraver::do_process_requests() { if (bar_req_l_) { - bar_p_ = new Bar; - bar_p_->type_str_=bar_req_l_->type_str_; + bar_p_ = new Bar; + bar_p_->type_str_=bar_req_l_->type_str_; } - else if (!get_staff_info().time_C_->whole_in_measure_) + else { + Time_description const *time = get_staff_info().time_C_; + if (time && !time->whole_in_measure_) bar_p_ = new Bar; } if (bar_p_) { - announce_element (Score_elem_info (bar_p_, bar_req_l_)); + announce_element (Score_elem_info (bar_p_, bar_req_l_)); } else { - Disallow_break_req r; - daddy_grav_l_->try_request (&r); + Disallow_break_req r; + daddy_grav_l_->try_request (&r); } } @@ -60,11 +62,11 @@ Bar_engraver::do_process_requests() void Bar_engraver::do_pre_move_processing() { - if (bar_p_) - { - typeset_element (bar_p_); - bar_p_ =0; - } + if (bar_p_) + { + typeset_element (bar_p_); + bar_p_ =0; + } } void diff --git a/lily/bar-number-grav.cc b/lily/bar-number-grav.cc index 4a468119c7..1414f7b7de 100644 --- a/lily/bar-number-grav.cc +++ b/lily/bar-number-grav.cc @@ -12,10 +12,10 @@ #include "text-def.hh" #include "command-request.hh" #include "bar.hh" +#include "time-description.hh" Bar_number_grav::Bar_number_grav() { - number_i_ =1; script_p_ =0; } @@ -25,27 +25,31 @@ void Bar_number_grav::acknowledge_element (Score_elem_info i) { if (i.origin_grav_l_arr_.size() == 1 && - i.elem_l_->is_type_b (Bar::static_name()) && !script_p_) - { - - script_p_ = new Script; - Text_def *td_p =new Text_def; - td_p->text_str_ = number_i_++; - script_p_->specs_l_ = td_p; - script_p_->breakable_b_ = true; - script_p_->dir_i_ = 1; - - announce_element (Score_elem_info (script_p_, &dummy)); + i.elem_l_->is_type_b (Bar::static_name()) && !script_p_) + { + Time_description const * time = get_staff_info().time_C_; + if (!time || time->cadenza_b_) + return ; + + script_p_ = new Script; + Text_def *td_p =new Text_def; + td_p->text_str_ = time->bars_i_; + + script_p_->specs_l_ = td_p; + script_p_->breakable_b_ = true; + script_p_->dir_ = UP; + + announce_element (Score_elem_info (script_p_, &dummy)); } } void Bar_number_grav::do_pre_move_processing() { - if ( script_p_) + if (script_p_) { - typeset_element (script_p_); - script_p_ =0; + typeset_element (script_p_); + script_p_ =0; } } diff --git a/lily/bar.cc b/lily/bar.cc index 7dc97c7c59..cbf8438869 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -25,13 +25,13 @@ Bar::Bar() IMPLEMENT_IS_TYPE_B1(Bar,Item); void -Bar::do_print()const +Bar::do_print() const { DOUT << type_str_; } Molecule* -Bar::brew_molecule_p()const +Bar::brew_molecule_p() const { Paper_def *p = paper(); Symbol s = p->lookup_l()->bar (type_str_, diff --git a/lily/beam-grav.cc b/lily/beam-grav.cc new file mode 100644 index 0000000000..dcdce82975 --- /dev/null +++ b/lily/beam-grav.cc @@ -0,0 +1,130 @@ +/* + beam-grav.cc -- implement Beam_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ +#include "duration-convert.hh" +#include "time-description.hh" +#include "beam-grav.hh" +#include "stem.hh" +#include "beam.hh" +#include "musical-request.hh" +#include "grouping.hh" +#include "text-spanner.hh" +#include "text-def.hh" + +Beam_engraver::Beam_engraver() +{ + span_reqs_drul_[LEFT] = span_reqs_drul_[RIGHT] =0; + beam_p_ =0; + current_grouping_p_ =0; +} + +bool +Beam_engraver::do_try_request(Request*r) +{ + Musical_req* mus_l = r->musical(); + if (!mus_l) + return false; + + Beam_req * b = mus_l->beam(); + + if (!b) + return false; + + if (bool (beam_p_) == bool (b->spantype == Span_req::START)) + return false; + + Direction d = (!beam_p_) ? LEFT : RIGHT; + if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (mus_l)) + return false; + + span_reqs_drul_[d] = b; + return true; +} + +void +Beam_engraver::do_process_requests() +{ + if ( !beam_p_ && span_reqs_drul_[LEFT]) { + current_grouping_p_ = new Rhythmic_grouping; + beam_p_ = new Beam; + if (span_reqs_drul_[LEFT]->nplet) + { + Text_spanner* t = new Text_spanner(); + Text_def *defp = new Text_def; + t->set_support (beam_p_); + defp->align_i_ = 0; + defp->text_str_ = span_reqs_drul_[LEFT]->nplet; + defp->style_str_="italic"; + t->spec_p_ = defp; + announce_element (Score_elem_info (t,0)); + typeset_element (t); + } + announce_element (Score_elem_info (beam_p_, span_reqs_drul_[LEFT])); + } +} + +void +Beam_engraver::do_pre_move_processing() +{ + if (beam_p_ && span_reqs_drul_[RIGHT]) { + Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_; + rg_C->extend (current_grouping_p_->interval()); + beam_p_->set_grouping (*rg_C, *current_grouping_p_); + typeset_element (beam_p_); + beam_p_ = 0; + + delete current_grouping_p_; + current_grouping_p_ = 0; + + span_reqs_drul_[RIGHT] = + span_reqs_drul_[LEFT] = 0; + } +} + +void +Beam_engraver::do_removal_processing() +{ + if (beam_p_) + { + span_reqs_drul_[LEFT]->warning ("unterminated beam"); + typeset_element (beam_p_); + beam_p_ =0; + } +} + + +void +Beam_engraver::acknowledge_element (Score_elem_info i) +{ + if (beam_p_ && i.elem_l_->is_type_b (Stem::static_name())) + { + Stem * s = (Stem*)i.elem_l_->item(); + Rhythmic_req *rhythmic_req = i.req_l_->musical ()->rhythmic (); + if (rhythmic_req->duration_.durlog_i_<= 2) + { + rhythmic_req->warning ("Stem doesn't fit in Beam"); + return ; + } + + /* + TODO: do something sensible if it doesn't fit in the beam. + */ + current_grouping_p_->add_child (get_staff_info().time_C_->whole_in_measure_, + rhythmic_req->duration()); + /* + TODO + should change rep. of flags too.k + */ + s->flag_i_ = Duration_convert::type2_i + (rhythmic_req->duration_.durlog_i_); + s->print_flag_b_ = false; + beam_p_->add (s); + } +} + +IMPLEMENT_IS_TYPE_B1(Beam_engraver, Engraver); +ADD_THIS_ENGRAVER(Beam_engraver); diff --git a/lily/beam.cc b/lily/beam.cc index 70a1ce88d0..927d85cd8d 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -32,7 +32,7 @@ struct Stem_info { Real x; - int dir_i_; + int dir_; Real idealy_f_; Real miny_f_; int beams_i_; @@ -44,45 +44,45 @@ struct Stem_info { Stem_info::Stem_info (Stem const *s) { x = s->hpos_f(); - dir_i_ = s->dir_i_; - beams_i_ = intlog2( s->flag_i_) - 2; + dir_ = s->dir_; + beams_i_ = intlog2(s->flag_i_) - 2; /* - [todo] - * get algorithm - * runtime - - Breitkopf + H\"artel: - miny_f_ = interline + #beams * interbeam - ideal8 = 2 * interline + interbeam - ideal16,32,64,128 = 1.5 * interline + #beams * interbeam - - * B\"arenreiter: - miny_f_ = interline + #beams * interbeam - ideal8,16 = 2 interline + #beams * interbeam - ideal32,64,128 = 1.5 interline + #beams * interbeam + [todo] + * get algorithm + * runtime + + Breitkopf + H\"artel: + miny_f_ = interline + #beams * interbeam + ideal8 = 2 * interline + interbeam + ideal16,32,64,128 = 1.5 * interline + #beams * interbeam + + * B\"arenreiter: + miny_f_ = interline + #beams * interbeam + ideal8,16 = 2 interline + #beams * interbeam + ideal32,64,128 = 1.5 interline + #beams * interbeam - */ + */ Real notehead_y = s->paper()->interline_f (); // huh? why do i need the / 2 -// Real interbeam_f = s->paper()->interbeam_f (); + // Real interbeam_f = s->paper()->interbeam_f (); Real interbeam_f = s->paper()->interbeam_f () / 2; /* well eh, huh? - idealy_f_ = dir_i_ * s->stem_start_f() + beams_i_ * interbeam_f; - if ( beams_i_ < 3) - idealy_f_ += 2 * interline_f; - else - idealy_f_ += 1.5 * interline_f; - */ + idealy_f_ = dir_ * s->stem_start_f() + beams_i_ * interbeam_f; + if (beams_i_ < 3) + idealy_f_ += 2 * interline_f; + else + idealy_f_ += 1.5 * interline_f; + */ - idealy_f_ = dir_i_ * s->stem_end_f(); + idealy_f_ = dir_ * s->stem_end_f(); - miny_f_ = dir_i_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f; + miny_f_ = dir_ * s->stem_start_f() + notehead_y + beams_i_ * interbeam_f; idealy_f_ = miny_f_ >? idealy_f_; -// assert (miny_f_ <= idealy_f_); + // assert (miny_f_ <= idealy_f_); } @@ -90,7 +90,7 @@ Stem_info::Stem_info (Stem const *s) Offset -Beam::center()const +Beam::center() const { Real w=(paper()->note_width () + width ().length ())/2.0; return Offset (w, (left_pos + w* slope)*paper()->internote_f ()); @@ -109,6 +109,10 @@ Beam::add (Stem*s) stems.push (s); s->add_dependency (this); s->print_flag_b_ = false; + + if (!spanned_drul_[LEFT]) + set_bounds(LEFT,s); + set_bounds(RIGHT,s); } void @@ -119,34 +123,34 @@ Beam::set_default_dir() for (int i=0; i get_center_distance_from_top(); - int cur_up = sl->get_center_distance_from_bottom(); - if (cur_down) - { - down += cur_down; - down_count++; - } - if (cur_up) - { - up += cur_up; - up_count++; - } + Stem *sl = stems[i]; + int cur_down = sl->get_center_distance_from_top(); + int cur_up = sl->get_center_distance_from_bottom(); + if (cur_down) + { + down += cur_down; + down_count++; + } + if (cur_up) + { + up += cur_up; + up_count++; + } } if (!down) - down_count = 1; + down_count = 1; if (!up) - up_count = 1; + up_count = 1; // the following relation is equal to // up / up_count > down / down_count - dir_i_ = (up * down_count > down * up_count) ? 1 : -1; + dir_ = (up * down_count > down * up_count) ? UP : DOWN; - for (int i=0; i dir_i_ = dir_i_; - } + for (int i=0; i dir_ = dir_; + } } /* @@ -163,57 +167,57 @@ Beam::solve_slope() Array sinfo; for (int j=0; j set_default_extents(); - if (i->invisible_b()) - continue; + i->set_default_extents(); + if (i->invisible_b()) + continue; - Stem_info info (i); - sinfo.push (info); + Stem_info info (i); + sinfo.push (info); } if (! sinfo.size()) - slope = left_pos = 0; + slope = left_pos = 0; else if (sinfo.size() == 1) { - slope = 0; - left_pos = sinfo[0].idealy_f_; + 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); + 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); } Real dy = 0.0; for (int i=0; i < sinfo.size(); i++) { - Real y = sinfo[i].x * slope + left_pos; - Real my = sinfo[i].miny_f_; + Real y = sinfo[i].x * slope + left_pos; + Real my = sinfo[i].miny_f_; - if (my - y > dy) - dy = my -y; + if (my - y > dy) + dy = my -y; } left_pos += dy; - left_pos *= dir_i_; + left_pos *= dir_; - slope *= dir_i_; + slope *= dir_; /* This neat trick is by Werner Lemberg, damped = tanh (slope) corresponds with some tables in [Wanske] - */ + */ slope = 0.6 * tanh (slope); - // ugh + // ugh Real sl = slope*paper()->internote_f (); paper()->lookup_l ()->beam (sl, 20 PT); slope = sl /paper()->internote_f (); @@ -225,10 +229,10 @@ Beam::set_stemlens() Real x0 = stems[0]->hpos_f(); for (int j=0; j hpos_f()-x0; - s->set_stemend (left_pos + slope * x); + Real x = s->hpos_f()-x0; + s->set_stemend (left_pos + slope * x); } } @@ -236,11 +240,11 @@ Beam::set_stemlens() void Beam::do_post_processing() { - if ( stems.size() < 2) + if (stems.size() < 2) { - warning ("Beam with less than 2 stems"); - transparent_b_ = true; - return ; + warning ("Beam with less than 2 stems"); + transparent_b_ = true; + return ; } solve_slope(); set_stemlens(); @@ -257,35 +261,35 @@ Beam::set_grouping (Rhythmic_grouping def, Rhythmic_grouping cur) Array b; { - Array flags; - for (int j=0; j flag_i_))-2; - assert (f>0); - flags.push (f); - } - int fi =0; - b= cur.generate_beams (flags, fi); - b.insert (0,0); - b.push (0); - assert (stems.size() == b.size ()/2); - } + Array flags; + for (int j=0; j flag_i_))-2; + assert (f>0); + flags.push (f); + } + int fi =0; + b= cur.generate_beams (flags, fi); + b.insert (0,0); + b.push (0); + assert (stems.size() == b.size ()/2); + } for (int j=0, i=0; i < b.size() && j beams_left_i_ = b[i]; - s->beams_right_i_ = b[i+1]; + Stem *s = stems[j]; + s->beams_left_i_ = b[i]; + s->beams_right_i_ = b[i+1]; } } void Beam::do_pre_processing() { - if (!dir_i_) - set_default_dir(); + if (!dir_) + set_default_dir(); } @@ -294,18 +298,18 @@ Interval Beam::do_width() const { return Interval (stems[0]->hpos_f(), - stems.top()->hpos_f ()); + stems.top()->hpos_f ()); } /* beams to go with one stem. */ Molecule -Beam::stem_beams (Stem *here, Stem *next, Stem *prev)const +Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const { - assert (!next || next->hpos_f() > here->hpos_f () ); - assert (!prev || prev->hpos_f() < here->hpos_f () ); -// Real dy=paper()->internote_f ()*2; + assert (!next || next->hpos_f() > here->hpos_f ()); + assert (!prev || prev->hpos_f() < here->hpos_f ()); + // Real dy=paper()->internote_f ()*2; Real dy = paper()->interbeam_f (); Real stemdx = paper()->rule_thickness (); Real sl = slope*paper()->internote_f (); @@ -317,48 +321,48 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev)const /* half beams extending to the left. */ if (prev) { - int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ; - int lwholebeams= here->beams_left_i_ beams_right_i_ ; - Real w = (here->hpos_f() - prev->hpos_f ())/4; - Symbol dummy; - Atom a (dummy); - if (lhalfs) // generates warnings if not - a = paper()->lookup_l ()->beam (sl, w); - a.translate (Offset (-w, -w * sl)); - for (int j = 0; j < lhalfs; j++) - { - Atom b (a); - b.translate (-dir_i_ * dy * (lwholebeams+j), Y_AXIS); - leftbeams.add (b); - } + int lhalfs= lhalfs = here->beams_left_i_ - prev->beams_right_i_ ; + int lwholebeams= here->beams_left_i_ beams_right_i_ ; + Real w = (here->hpos_f() - prev->hpos_f ())/4; + Symbol dummy; + Atom a (dummy); + if (lhalfs) // generates warnings if not + a = paper()->lookup_l ()->beam (sl, w); + a.translate (Offset (-w, -w * sl)); + for (int j = 0; j < lhalfs; j++) + { + Atom b (a); + b.translate (-dir_ * dy * (lwholebeams+j), Y_AXIS); + leftbeams.add (b); + } } if (next) { - int rhalfs = here->beams_right_i_ - next->beams_left_i_; - int rwholebeams = here->beams_right_i_ beams_left_i_; + int rhalfs = here->beams_right_i_ - next->beams_left_i_; + int rwholebeams = here->beams_right_i_ beams_left_i_; - Real w = next->hpos_f() - here->hpos_f (); - Atom a = paper()->lookup_l ()->beam (sl, w + stemdx); + Real w = next->hpos_f() - here->hpos_f (); + Atom a = paper()->lookup_l ()->beam (sl, w + stemdx); - int j = 0; - for (; j < rwholebeams; j++) - { - Atom b (a); - b.translate (-dir_i_ * dy * j, Y_AXIS); - rightbeams.add (b); - } - - w /= 4; - if (rhalfs) - a = paper()->lookup_l ()->beam (sl, w); + int j = 0; + for (; j < rwholebeams; j++) + { + Atom b (a); + b.translate (-dir_ * dy * j, Y_AXIS); + rightbeams.add (b); + } + + w /= 4; + if (rhalfs) + a = paper()->lookup_l ()->beam (sl, w); - for (; j < rwholebeams + rhalfs; j++) - { - Atom b (a); - b.translate (-dir_i_ * dy * j, Y_AXIS); - rightbeams.add (b); - } + for (; j < rwholebeams + rhalfs; j++) + { + Atom b (a); + b.translate (-dir_ * dy * j, Y_AXIS); + rightbeams.add (b); + } } leftbeams.add (rightbeams); @@ -372,21 +376,21 @@ Beam::brew_molecule_p() const Molecule *mol_p = new Molecule; // huh? inter-what -// Real inter_f = paper()->interbeam_f (); + // Real inter_f = paper()->interbeam_f (); Real inter_f = paper()->internote_f (); Real x0 = stems[0]->hpos_f(); for (int j=0; j 0)? stems[j-1] : 0; - Stem * next = (j < stems.size()-1) ? stems[j+1] :0; - - Molecule sb = stem_beams (i, next, prev); - Real x = i->hpos_f()-x0; - sb.translate (Offset (x, (x * slope + left_pos)* inter_f)); - mol_p->add (sb); + Stem *i = stems[j]; + Stem * prev = (j > 0)? stems[j-1] : 0; + Stem * next = (j < stems.size()-1) ? stems[j+1] :0; + + Molecule sb = stem_beams (i, next, prev); + Real x = i->hpos_f()-x0; + sb.translate (Offset (x, (x * slope + left_pos)* inter_f)); + mol_p->add (sb); } - mol_p->translate (x0 - left_col_l_->hpos_f_, X_AXIS); + mol_p->translate (x0 - spanned_drul_[LEFT]->absolute_coordinate(X_AXIS), X_AXIS); return mol_p; } @@ -394,7 +398,7 @@ Beam::brew_molecule_p() const IMPLEMENT_IS_TYPE_B1(Beam, Spanner); void -Beam::do_print()const +Beam::do_print() const { #ifndef NPRINT DOUT << "slope " <is_type_b (Stem::static_name())) { - stems.substitute ((Stem*)o->item(), n?(Stem*) n->item ():0); + stems.substitute ((Stem*)o->item(), n?(Stem*) n->item ():0); } } diff --git a/lily/bow.cc b/lily/bow.cc index 1ef733c61a..1bd0a00762 100644 --- a/lily/bow.cc +++ b/lily/bow.cc @@ -13,15 +13,15 @@ Bow::Bow() { - left_pos_i_ = right_pos_i_ = 0; - left_dx_f_ = right_dx_f_ = 0.0; + pos_i_drul_[LEFT] = pos_i_drul_[RIGHT] = 0; + dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0; } Offset Bow::center() const { - int dy = right_pos_i_-left_pos_i_; + int dy = pos_i_drul_[RIGHT]-pos_i_drul_[LEFT]; Real w = width().length (); @@ -35,22 +35,22 @@ Bow::brew_molecule_p() const Molecule*output = new Molecule; Real w = width().length (); - int dy = right_pos_i_ - left_pos_i_; + int dy = pos_i_drul_[RIGHT] - pos_i_drul_[LEFT]; Real nw_f = paper()->note_width (); Real nh_f = paper()->internote_f (); - w+= (right_dx_f_ - left_dx_f_) * nw_f ; + w+= (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]) * nw_f ; Real round_w = w; // slur lookup rounds the slurwidth . - Symbol sl = paper()->lookup_l ()->slur (dy , round_w, dir_i_); + Symbol sl = paper()->lookup_l ()->slur (dy , round_w, dir_); Real error = w-round_w; Atom a (sl); - a.translate (Offset ((left_dx_f_ + 0.5)*nw_f + error/2, - left_pos_i_ * nh_f)); + a.translate (Offset ((dx_f_drul_[LEFT] + 0.5)*nw_f + error/2, + pos_i_drul_[LEFT] * nh_f)); output->add (a); return output; } diff --git a/lily/break.cc b/lily/break.cc index 3ebba2eb63..7f5139a831 100644 --- a/lily/break.cc +++ b/lily/break.cc @@ -20,7 +20,7 @@ Col_stats::str() const { String s (count_i_); s += " lines"; if (count_i_) - s += String (Real (cols_i_)/count_i_, ", (with an average of %.1f columns)"); + s += String (Real (cols_i_)/count_i_, ", (with an average of %.1f columns)"); return s; } @@ -42,14 +42,14 @@ Col_stats::Col_stats() /* **************************************************************** */ Line_of_cols -Break_algorithm::all_cols()const +Break_algorithm::all_cols() const { Line_of_cols retval; - for (PCursor c (pscore_l_->col_p_list_.top()); - c.ok(); c++) - { + for (PCursor c (pscore_l_->col_p_list_.top()); + c.ok(); c++) + { - retval.push (c); + retval.push (c); } return retval; } @@ -61,12 +61,12 @@ Break_algorithm::find_break_indices() const Array retval; for (int i=0; i < all.size(); i++) - if (all[i]->breakable_b()) - retval.push (i); + if (all[i]->breakable_b_) + retval.push (i); - if ( linelength <=0) - while ( retval.size() >2) - retval.del (1); + if (linelength <=0) + while (retval.size() >2) + retval.del (1); return retval; } @@ -79,13 +79,13 @@ Break_algorithm::find_breaks() const Line_of_cols retval; for (int i=0; i < all.size(); i++) - if (all[i]->breakable_b()) - retval.push (all[i]); + if (all[i]->breakable_b_) + retval.push (all[i]); - if ( linelength <=0) - while ( retval.size() >2) - retval.del (1); + if (linelength <=0) + while (retval.size() >2) + retval.del (1); return retval; } @@ -95,19 +95,19 @@ Break_algorithm::find_breaks() const Line_spacer* -Break_algorithm::generate_spacing_problem (Line_of_cols curline)const +Break_algorithm::generate_spacing_problem (Line_of_cols curline) const { Line_spacer * sp= (*get_line_spacer)(); sp->paper_l_ = pscore_l_->paper_l_; sp->add_column (curline[0], true, 0.0); for (int i=1; i< curline.size()-1; i++) - sp->add_column (curline[i]); + sp->add_column (curline[i]); - if ( linelength > 0) - sp->add_column (curline.top(), true, linelength); + if (linelength > 0) + sp->add_column (curline.top(), true, linelength); else - sp->add_column (curline.top()); + sp->add_column (curline.top()); sp->prepare(); return sp; @@ -132,11 +132,11 @@ bool Break_algorithm::feasible (Line_of_cols curline) const { if (linelength <= 0) - return true; + return true; Real l =0; for (int i=0; i < curline.size(); i++) - l +=curline[i]->width().length (); + l +=curline[i]->width().length (); return l < linelength; } @@ -144,24 +144,24 @@ void Break_algorithm::problem_OK() const { if (!pscore_l_->col_p_list_.size()) - error ("Score does not have any columns"); + error ("Score does not have any columns"); OK(); } void -Break_algorithm::OK()const +Break_algorithm::OK() const { #ifndef NDEBUG iter_top (pscore_l_->col_p_list_,start); - PCursor end (pscore_l_->col_p_list_.bottom()); + PCursor end (pscore_l_->col_p_list_.bottom()); - assert (start->breakable_b()); - assert (end->breakable_b()); + assert (start->breakable_b_); + assert (end->breakable_b_); #endif } Array -Break_algorithm::solve()const +Break_algorithm::solve() const { return do_solve(); } @@ -173,10 +173,10 @@ Break_algorithm::do_set_pscore() } void -Break_algorithm::print_stats()const +Break_algorithm::print_stats() const { if (approx_stats_.count_i_) - *mlog << "\nApproximated: " << approx_stats_.str() << "\n"; + *mlog << "\nApproximated: " << approx_stats_.str() << "\n"; if (exact_stats_.count_i_) - *mlog << "Calculated exactly: " << exact_stats_.str() << "\n"; + *mlog << "Calculated exactly: " << exact_stats_.str() << "\n"; } diff --git a/lily/chord-iterator.cc b/lily/chord-iterator.cc new file mode 100644 index 0000000000..2bca2b16ed --- /dev/null +++ b/lily/chord-iterator.cc @@ -0,0 +1,88 @@ +/* + chord-iter.cc -- implement Chord_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "translator.hh" +#include "debug.hh" +#include "chord-iterator.hh" + +#include "music-list.hh" + + +Chord_iterator::~Chord_iterator() +{ +} + +Chord_iterator::Chord_iterator (Chord const *chord_C) +{ + chord_C_ = chord_C; +} + +void +Chord_iterator::construct_children() +{ + int j = 0; + for (PCursor i (chord_C_->music_p_list_.top()); //, int j = 0; + i.ok(); j++, i++) + { + Music_iterator * mi = get_iterator_p (i.ptr()); + if (mi->ok()) + { + set_translator (mi->report_to_l()->ancestor_l (chord_C_->multi_level_i_)); + children_p_list_.bottom().add (mi); + } + else + delete mi; + } +} +void +Chord_iterator::do_print() const +{ +#ifndef NPRINT + for (PCursor i (children_p_list_.top()); i.ok (); i++) + { + i->print(); + } +#endif +} + +void +Chord_iterator::process_and_next (Moment until) +{ + for (PCursor i (children_p_list_.top()); i.ok ();) + { + if (i->next_moment() == until) + { + i->process_and_next (until); + } + if (!i->ok()) + delete i.remove_p(); + else + i++; + } + Music_iterator::process_and_next (until); +} + + +IMPLEMENT_IS_TYPE_B1(Chord_iterator,Music_iterator); + +Moment +Chord_iterator::next_moment() const +{ + Moment next_ = infinity_mom; + for (PCursor i (children_p_list_.top()); i.ok (); i++) + next_ = next_ next_moment() ; + return next_; +} + + + +bool +Chord_iterator::ok() const +{ + return children_p_list_.size(); +} diff --git a/lily/clef-grav.cc b/lily/clef-grav.cc index 1afaa3cc44..a9bea179f0 100644 --- a/lily/clef-grav.cc +++ b/lily/clef-grav.cc @@ -66,7 +66,7 @@ Clef_engraver::acknowledge_element (Score_elem_info info) if (info.elem_l_->name() == Bar::static_name ()) { create_clef(); - if ( !clef_req_l_) + if (!clef_req_l_) clef_p_->default_b_ = true; } } diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 8a2534b111..fc579ec347 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -21,8 +21,8 @@ Clef_item::do_pre_processing() if (default_b_) { - empty_b_ = (break_status_i() != 1); - transparent_b_ = (break_status_i() != 1); + empty_b_ = (break_status_i() != 1); + transparent_b_ = (break_status_i() != 1); } } @@ -39,13 +39,13 @@ Clef_item::read (String t) { type_= t; if (type_ == "violin") - y_off = 2; + y_off = 2; if (type_ == "alto") - y_off = 4; + y_off = 4; if (type_ == "tenor") - y_off = 6; + y_off = 6; if (type_ == "bass") - y_off = 6; + y_off = 6; } void Clef_item::read (Clef_engraver const &k) @@ -54,11 +54,11 @@ Clef_item::read (Clef_engraver const &k) } Molecule* -Clef_item::brew_molecule_p()const +Clef_item::brew_molecule_p() const { String t = type_; if (change_b_) - t += "_change"; + t += "_change"; Symbol s = paper()->lookup_l ()->clef (t); Molecule*output = new Molecule (Atom (s)); output->translate (paper()->internote_f () * y_off, Y_AXIS); diff --git a/lily/col-info.cc b/lily/col-info.cc index e05498f0e1..086b7c7e3e 100644 --- a/lily/col-info.cc +++ b/lily/col-info.cc @@ -16,20 +16,22 @@ Colinfo::print() const #ifndef NPRINT DOUT << "column { "; if (fixed()) - DOUT << "fixed at " << fixed_position()<<", "; + DOUT << "fixed at " << fixed_position()<<", "; assert (pcol_l_); DOUT << "[" << minleft() << ", " << minright () << "]"; DOUT <<"}\n"; #endif } -Colinfo::Colinfo (PCol *col_l, Real const *fixed_C) +Colinfo::Colinfo (Paper_column *col_l, Real const *fixed_C) { if (fixed_C) - fixpos_p_.set_l (fixed_C); + fixpos_p_.set_l (fixed_C); ugh_b_ = false; pcol_l_ = col_l; width = pcol_l_->width(); + if (width.empty_b()) + width = Interval(0,0); } diff --git a/lily/colhpos.cc b/lily/colhpos.cc index d7850f5c27..62cc881bde 100644 --- a/lily/colhpos.cc +++ b/lily/colhpos.cc @@ -26,7 +26,7 @@ Col_hpositions::~Col_hpositions() } void -Col_hpositions::add (PCol*c) +Col_hpositions::add (Paper_column*c) { cols.push (c); } @@ -43,7 +43,7 @@ Col_hpositions::print() const } void -Col_hpositions::OK()const +Col_hpositions::OK() const { #ifndef NDEBUG assert (config.size() == cols.size ()); diff --git a/lily/collision.cc b/lily/collision.cc index a5fd6aee0b..881c561e95 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -30,7 +30,7 @@ int idx (int dir, bool h_shift_b) { assert (abs (dir) == 1); int j = dir > 0 ? 0 : 3; - if ( h_shift_b) + if (h_shift_b) j += dir; return j; } @@ -57,12 +57,12 @@ Collision::do_pre_processing() for (int i=0; i < clash_l_arr_.size(); i++) { Note_column* c_l = clash_l_arr_[i]; - if (! c_l->dir_i_) + if (! c_l->dir_) { warning ("No stem direction set. Ignoring column in clash. "); continue; } - int d = (c_l->dir_i_); + int d = (c_l->dir_); clash_group_arr_a[idx (d, c_l->h_shift_b_)].push (c_l); } diff --git a/lily/command-request.cc b/lily/command-request.cc index 051ce84465..69e7f4b7db 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -21,7 +21,7 @@ IMPLEMENT_IS_TYPE_B1(Command_script_req,Command_req); IMPLEMENT_IS_TYPE_B1(Cadenza_req, Timing_req); void -Cadenza_req::do_print()const +Cadenza_req::do_print() const { #ifndef NPRINT DOUT << on_b_; @@ -29,7 +29,7 @@ Cadenza_req::do_print()const } bool -Cadenza_req::do_equal_b (Request*r)const +Cadenza_req::do_equal_b (Request*r) const { Cadenza_req*cad = r->command()->timing ()->cadenza (); @@ -44,7 +44,7 @@ Cadenza_req::Cadenza_req (bool b) bool -Bar_req::do_equal_b (Request*r)const +Bar_req::do_equal_b (Request*r) const { Bar_req * b = r->command()->bar (); return type_str_ == b->type_str_; @@ -70,7 +70,7 @@ Partial_measure_req::Partial_measure_req (Moment m) } bool -Partial_measure_req::do_equal_b (Request* r)const +Partial_measure_req::do_equal_b (Request* r) const { Partial_measure_req *p = r->command()->timing ()->partial (); @@ -81,18 +81,18 @@ Partial_measure_req::do_equal_b (Request* r)const IMPLEMENT_IS_TYPE_B1(Timing_req,Command_req); void -Timing_req::do_print()const{} +Timing_req::do_print() const{} IMPLEMENT_IS_TYPE_B1(Command_req,Request); void -Command_req::do_print()const{} +Command_req::do_print() const{} IMPLEMENT_IS_TYPE_B1(Disallow_break_req,Command_req); void -Disallow_break_req::do_print()const +Disallow_break_req::do_print() const { } /* *************** */ @@ -103,7 +103,7 @@ void Barcheck_req::do_print() const{} bool -Barcheck_req::do_equal_b (Request*)const +Barcheck_req::do_equal_b (Request*) const { return true; } @@ -158,12 +158,12 @@ Meter_change_req::do_print() const } bool -Meter_change_req::do_equal_b (Request * r)const +Meter_change_req::do_equal_b (Request * r) const { Meter_change_req * m = r->command()->timing ()->meterchange (); return m->beats_i_ == beats_i_ - && one_beat_i_ == m->one_beat_i_; + && one_beat_i_ == m->one_beat_i_; } Meter_change_req::Meter_change_req() @@ -187,14 +187,14 @@ Tempo_req::Tempo_req() } void -Tempo_req::do_print()const +Tempo_req::do_print() const { DOUT << dur_.str() << " = " <command()->timing ()->tempo (); @@ -211,13 +211,13 @@ Measure_grouping_req::do_print() const { for (int i=0; i < elt_length_arr_.size(); i++) { - DOUT << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" "; + DOUT << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" "; } } bool -Measure_grouping_req::do_equal_b (Request*)const +Measure_grouping_req::do_equal_b (Request*) const { return false; // todo } @@ -225,12 +225,12 @@ Measure_grouping_req::do_equal_b (Request*)const /* *************** */ void -Key_change_req::transpose (Melodic_req const & d)const +Key_change_req::transpose (Melodic_req const & d) const { WARN << "don't know how to transpose a key. \n"; for (int i=0; i < melodic_p_arr_.size(); i++) { - melodic_p_arr_[i]->transpose (d); + melodic_p_arr_[i]->transpose (d); } } @@ -241,7 +241,7 @@ Key_change_req::squash_octaves() { for (int i=0; i < melodic_p_arr_.size(); i++) { - melodic_p_arr_[i]->octave_i_ = 0; + melodic_p_arr_[i]->octave_i_ = 0; } } @@ -251,62 +251,62 @@ Key_change_req::do_print() const #ifndef NPRINT for (int i=0; i < melodic_p_arr_.size(); i++) { - melodic_p_arr_[i]->print(); + melodic_p_arr_[i]->print(); } #endif } Key_change_req::Key_change_req() { - minor_b_ = false; - multi_octave_b_= false; + minor_b_ = false; + multi_octave_b_= false; } Key_change_req::Key_change_req (Key_change_req const&c) { - for (int i=0; i < c.melodic_p_arr_.size(); i++) - melodic_p_arr_.push (c.melodic_p_arr_[i]->clone()->musical ()->melodic ()); - minor_b_ = c.minor_b_; - multi_octave_b_ = c.multi_octave_b_; + for (int i=0; i < c.melodic_p_arr_.size(); i++) + melodic_p_arr_.push (c.melodic_p_arr_[i]->clone()->musical ()->melodic ()); + minor_b_ = c.minor_b_; + multi_octave_b_ = c.multi_octave_b_; } Key_change_req::~Key_change_req() { - for (int i=0; i < melodic_p_arr_.size(); i++) - delete melodic_p_arr_[i]; + for (int i=0; i < melodic_p_arr_.size(); i++) + delete melodic_p_arr_[i]; } int Key_change_req::flats_i() { - int flats_i = 0; - for ( int i = 0; i < melodic_p_arr_.size(); i++) - { - Melodic_req* mel_l = melodic_p_arr_[i]->melodic(); - assert (mel_l); - if ( mel_l->accidental_i_ < 0) - flats_i -= mel_l->accidental_i_; - } - return flats_i; + int flats_i = 0; + for (int i = 0; i < melodic_p_arr_.size(); i++) + { + Melodic_req* mel_l = melodic_p_arr_[i]->melodic(); + assert (mel_l); + if (mel_l->accidental_i_ < 0) + flats_i -= mel_l->accidental_i_; + } + return flats_i; } int Key_change_req::minor_b() { - return minor_b_; + return minor_b_; } int Key_change_req::sharps_i() { - int sharps_i = 0; - for ( int i = 0; i < melodic_p_arr_.size(); i++) - { - Melodic_req* mel_l = melodic_p_arr_[i]->melodic(); - assert (mel_l); - if ( mel_l->accidental_i_ > 0) - sharps_i+= mel_l->accidental_i_; - } - return sharps_i; + int sharps_i = 0; + for (int i = 0; i < melodic_p_arr_.size(); i++) + { + Melodic_req* mel_l = melodic_p_arr_[i]->melodic(); + assert (mel_l); + if (mel_l->accidental_i_ > 0) + sharps_i+= mel_l->accidental_i_; + } + return sharps_i; } diff --git a/lily/crescendo.cc b/lily/crescendo.cc index d5c16cb442..3fe1a4114c 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -15,14 +15,14 @@ Crescendo::Crescendo() { - grow_dir_i_ =0; - dir_i_ = -1 ; - left_dyn_b_ = right_dyn_b_ =false; + grow_dir_ =0; + dir_ = DOWN ; + dyn_b_drul_[LEFT] = dyn_b_drul_[RIGHT] =false; inside_staff_b_ = false; } Interval -Crescendo::symbol_height()const +Crescendo::symbol_height() const { return get_symbol().dim[Y_AXIS]; } @@ -30,25 +30,25 @@ Crescendo::symbol_height()const static Real absdyn_dim = 10 PT; // ugh Symbol -Crescendo::get_symbol()const +Crescendo::get_symbol() const { Real w_dim = width().length (); - if ( left_dyn_b_) + if (dyn_b_drul_[LEFT]) { - w_dim -= absdyn_dim; + w_dim -= absdyn_dim; } - if ( right_dyn_b_) + if (dyn_b_drul_[RIGHT]) { - w_dim -= absdyn_dim; + w_dim -= absdyn_dim; } if (w_dim < 0) { - warning ("Crescendo too small"); - w_dim = 0; + warning ("Crescendo too small"); + w_dim = 0; } - return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_i_ < 0)); + return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_ < 0)); } Molecule* @@ -56,8 +56,8 @@ Crescendo::brew_molecule_p() const { Molecule* m_p =0; Real x_off_dim=0.0; - if ( left_dyn_b_) - x_off_dim += absdyn_dim; + if (dyn_b_drul_[LEFT]) + x_off_dim += absdyn_dim; m_p = new Molecule; Symbol s (get_symbol()); diff --git a/lily/dimen.cc b/lily/dimen.cc index 73fa9d3ca7..499d286cf2 100644 --- a/lily/dimen.cc +++ b/lily/dimen.cc @@ -10,7 +10,7 @@ parse_dimen (String dim) char const *s = dim; while (i > 0 && (isspace (s[i]) || isalpha (s[i]))) { - i--; + i--; } String unit (s + i+1); return convert_dimen (dim.value_f(), unit); @@ -21,13 +21,13 @@ Real convert_dimen (Real quant, String unit) { if (unit == "cm") - return quant * CM_TO_PT; + return quant * CM_TO_PT; if (unit == "pt") - return quant; + return quant; if (unit == "mm") - return quant*CM_TO_PT/10; + return quant*CM_TO_PT/10; if (unit == "in") - return quant * INCH_TO_PT; + return quant * INCH_TO_PT; error ("unknown length unit: `" + unit+"'"); } diff --git a/lily/directional-spanner.cc b/lily/directional-spanner.cc index 837fae76d9..62ab05f8b4 100644 --- a/lily/directional-spanner.cc +++ b/lily/directional-spanner.cc @@ -3,17 +3,17 @@ void Directional_spanner::set_default_dir() { - dir_i_ = -1; + dir_ = DOWN; } void Directional_spanner::do_pre_processing() { - if (!dir_i_) + if (!dir_) set_default_dir(); } Directional_spanner::Directional_spanner() { - dir_i_ = 0; + dir_ = CENTER; } diff --git a/lily/dynamic-grav.cc b/lily/dynamic-grav.cc index a159d32d72..9da5b1386c 100644 --- a/lily/dynamic-grav.cc +++ b/lily/dynamic-grav.cc @@ -18,7 +18,7 @@ Dynamic_engraver::Dynamic_engraver() { - dir_i_ =0; + dir_ = CENTER; do_post_move_processing(); dynamic_p_ =0; to_end_cresc_p_ = cresc_p_ = 0; @@ -36,7 +36,7 @@ Dynamic_engraver::do_try_request (Request * r) { Musical_req * m = r->musical(); if (!m || !m->dynamic()) - return false; + return false; dynamic_req_l_arr_.push (m->dynamic()); return true; } @@ -46,58 +46,58 @@ 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_); + 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"; + td_p->text_str_ = paper()->lookup_l ()->dynamic (loud).tex; + td_p->style_str_ = "dynamic"; - assert (!dynamic_p_) ; // TODO + 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()) - { + 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)); - } - } + 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_ = span_l->dynamic_dir_; + announce_element (Score_elem_info (new_cresc_p, span_l)); + } + } } - if ( new_cresc_p) + if (new_cresc_p) { - cresc_p_ = new_cresc_p; - cresc_p_->left_col_l_ = get_staff_info().musical_l (); - if (dynamic_p_) - { - cresc_p_->left_dyn_b_ = true; - } + cresc_p_ = new_cresc_p; + cresc_p_->set_bounds(LEFT,get_staff_info().musical_l ()); + if (dynamic_p_) + { + cresc_p_->dyn_b_drul_[LEFT] = true; + } } } @@ -107,19 +107,19 @@ 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; + dynamic_p_->set_staffsym (s_l); + typeset_element (dynamic_p_); + dynamic_p_ = 0; } - if ( to_end_cresc_p_) + if (to_end_cresc_p_) { - if (dynamic_p_) - to_end_cresc_p_->right_dyn_b_=true; + if (dynamic_p_) + to_end_cresc_p_->dyn_b_drul_[RIGHT]=true; - to_end_cresc_p_->right_col_l_ = get_staff_info().musical_l (); - to_end_cresc_p_->set_staffsym (s_l); - typeset_element (to_end_cresc_p_); - to_end_cresc_p_ = 0; + to_end_cresc_p_->set_bounds(RIGHT,get_staff_info().musical_l ()); + to_end_cresc_p_->set_staffsym (s_l); + typeset_element (to_end_cresc_p_); + to_end_cresc_p_ = 0; } } @@ -127,7 +127,7 @@ void Dynamic_engraver::set_feature (Feature i) { if (i.type_ == "vdir") - dir_i_ = i.value_; + dir_ = (Direction) int(i.value_); } @@ -140,7 +140,7 @@ Dynamic_engraver::~Dynamic_engraver() delete to_end_cresc_p_; if (cresc_p_) { - cresc_req_l_->warning ("unended crescendo"); + cresc_req_l_->warning ("unended crescendo"); } delete cresc_p_; } @@ -149,10 +149,10 @@ 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_); + 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/elem-group-item.cc b/lily/elem-group-item.cc index ec744fee45..9209796cae 100644 --- a/lily/elem-group-item.cc +++ b/lily/elem-group-item.cc @@ -11,7 +11,7 @@ #include "p-col.hh" void -Horizontal_vertical_group_item::do_print()const +Horizontal_vertical_group_item::do_print() const { Horizontal_vertical_group_element::do_print(); } diff --git a/lily/elem-group.cc b/lily/elem-group.cc index 807573384f..8c4c573b26 100644 --- a/lily/elem-group.cc +++ b/lily/elem-group.cc @@ -17,25 +17,37 @@ Axis_group_element::do_unlink() remove_all(); } +void +Axis_group_element::do_junk_links() +{ + axis_admin_.elem_l_arr_.set_size (0); +} + bool -Axis_group_element::contains_b (Score_elem const*e)const +Axis_group_element::contains_b (Score_elem const*e) const { return axis_admin_.contains_b (e); } Link_array -Axis_group_element::get_extra_dependencies()const +Axis_group_element::get_extra_dependencies() const { return axis_admin_.elem_l_arr_; } void -Axis_group_element::do_print()const +Axis_group_element::do_print() const { axis_admin_.print(); } + +Axis_group_element::Axis_group_element() +{ + transparent_b_ = true; +} + // **************** @@ -62,6 +74,7 @@ Vertical_group_element::remove_all() { axis_admin_.remove_all (Y_AXIS,Y_AXIS); } + // **************** void @@ -84,7 +97,7 @@ Horizontal_group_element::remove_element (Score_elem*e) Interval -Horizontal_group_element::do_width()const +Horizontal_group_element::do_width() const { return axis_admin_.extent (X_AXIS); } diff --git a/lily/engraver-group.cc b/lily/engraver-group.cc index aae1051fb2..3c7e7ca86b 100644 --- a/lily/engraver-group.cc +++ b/lily/engraver-group.cc @@ -18,7 +18,7 @@ Engraver* get_engraver_p (String); void -Engraver_group_engraver::print()const +Engraver_group_engraver::print() const { Engraver::print(); } @@ -33,16 +33,16 @@ 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++; + 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 +Engraver_group_engraver::removable_b() const { return !iterator_count_&& !group_l_arr_.size() ; } @@ -59,9 +59,9 @@ Engraver_group_engraver::set_feature (Feature d) // why the while construct? while (i.ok()) { - // this construction to ensure clean deletion - Engraver *grav_l = i++; - grav_l->set_feature (d); + // this construction to ensure clean deletion + Engraver *grav_l = i++; + grav_l->set_feature (d); } } @@ -71,8 +71,8 @@ Engraver_group_engraver::sync_features() PCursor i (grav_list_.top()); while (i.ok()) { - Engraver *grav_l = i++; - grav_l->sync_features(); + Engraver *grav_l = i++; + grav_l->sync_features(); } } @@ -82,8 +82,8 @@ Engraver_group_engraver::do_pre_move_processing() PCursor i (grav_list_.top()); while (i.ok()) { - Engraver *grav_l = i++; - grav_l->pre_move_processing(); + Engraver *grav_l = i++; + grav_l->pre_move_processing(); } } @@ -93,8 +93,8 @@ Engraver_group_engraver::do_process_requests() PCursor i (grav_list_.top()); while (i.ok()) { - Engraver *grav_l = i++; - grav_l->process_requests(); + Engraver *grav_l = i++; + grav_l->process_requests(); } } @@ -105,23 +105,23 @@ Engraver_group_engraver::do_post_move_processing() PCursor i (grav_list_.top()); while (i.ok()) { - // this construction to ensure clean deletion - Engraver *grav_l = i++; - grav_l->post_move_processing(); + // this construction to ensure clean deletion + Engraver *grav_l = i++; + grav_l->post_move_processing(); } } bool -Engraver_group_engraver::contains_b (Engraver* grav_l)const +Engraver_group_engraver::contains_b (Engraver* grav_l) const { bool parent_b = Engraver::contains_b (grav_l); if (parent_b) - return true; + return true; for (PCursor i (grav_list_.top()); i.ok (); i++) - if (i->contains_b (grav_l)) - return true; + if (i->contains_b (grav_l)) + return true; return false; } @@ -132,9 +132,9 @@ 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); + hebbes_b =nongroup_l_arr_[i]->try_request (req_l); if (!hebbes_b && daddy_grav_l_) - hebbes_b = daddy_grav_l_->try_request (req_l); + hebbes_b = daddy_grav_l_->try_request (req_l); return hebbes_b ; } @@ -152,11 +152,11 @@ Engraver_group_engraver::add (Engraver *grav_p) if (grav_p->is_type_b (Engraver_group_engraver::static_name())) { - group_l_arr_.push ((Engraver_group_engraver*)grav_p); + group_l_arr_.push ((Engraver_group_engraver*)grav_p); } else { - nongroup_l_arr_ .push (grav_p); + nongroup_l_arr_ .push (grav_p); } } @@ -186,15 +186,15 @@ IMPLEMENT_IS_TYPE_B2(Engraver_group_engraver,Engraver, Translator); ADD_THIS_ENGRAVER(Engraver_group_engraver); void -Engraver_group_engraver::do_print()const +Engraver_group_engraver::do_print() const { #ifndef NPRINT - if ( !check_debug) - return ; + if (!check_debug) + return ; DOUT << "ID: " << id_str_ ; DOUT << " iterators: " << iterator_count_<< "\n"; for (PCursor i (grav_list_.top()); i.ok (); i++) - i->print(); + i->print(); #endif } @@ -203,11 +203,11 @@ Engraver_group_engraver* Engraver_group_engraver::find_engraver_l (String n, String id) { if (name() == n && id_str_ == id) - return this; + 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); + r = group_l_arr_[i]->find_engraver_l (n,id); } return r; @@ -217,37 +217,37 @@ Translator* Engraver_group_engraver::find_get_translator_l (String n,String id) { Translator * ret=0; - Input_translator * itrans_l= itrans_l_-> recursive_find ( n); + Input_translator * itrans_l= itrans_l_-> recursive_find (n); if (itrans_l) { - ret = find_engraver_l (n,id); - if (!ret) - { - Engraver_group_engraver * group = - itrans_l-> get_group_engraver_p(); + ret = find_engraver_l (n,id); + if (!ret) + { + Engraver_group_engraver * group = + itrans_l-> get_group_engraver_p(); - add (group); - ret = group; + add (group); + ret = group; - if (group->itrans_l_->is_name_b (n) ) - ret ->id_str_ = id; - else - return ret->find_get_translator_l (n,id); + if (group->itrans_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); + ret =daddy_grav_l_->find_get_translator_l (n,id); else { - warning ("Can't find or create `" + n + "' called `" + id + "'\n"); - ret =0; + warning ("Can't find or create `" + n + "' called `" + id + "'\n"); + ret =0; } return ret; } int -Engraver_group_engraver::depth_i()const +Engraver_group_engraver::depth_i() const { return daddy_grav_l_->depth_i() + 1; } @@ -256,7 +256,7 @@ Translator* Engraver_group_engraver::ancestor_l (int l) { if (!l || !daddy_grav_l_) - return this; + return this; return daddy_grav_l_->ancestor_l (l-1); } @@ -273,21 +273,21 @@ Engraver_group_engraver::do_announces() { for (int i=0; i < group_l_arr_.size(); i++) { - group_l_arr_[i]->do_announces(); + 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]; + 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++) { // Is this good enough?6 - if (nongroup_l_arr_[i] != info.origin_grav_l_arr_[0]) - nongroup_l_arr_[i]->acknowledge_element (info); - } + if (!info.req_l_) + info.req_l_ = &dummy_req; + for (int i=0; i < nongroup_l_arr_.size(); i++) { // Is this good enough?6 + if (nongroup_l_arr_[i] != info.origin_grav_l_arr_[0]) + nongroup_l_arr_[i]->acknowledge_element (info); + } } announce_info_arr_.clear(); } @@ -297,16 +297,16 @@ void Engraver_group_engraver::do_removal_processing() { for (PCursor i (grav_list_.top()); i.ok (); i++) - i->removal_processing(); + i->removal_processing(); } Staff_info -Engraver_group_engraver::get_staff_info()const +Engraver_group_engraver::get_staff_info() const { Staff_info inf = Engraver::get_staff_info(); for (int i=0; i < nongroup_l_arr_.size(); i++) - nongroup_l_arr_[i]->fill_staff_info (inf); + nongroup_l_arr_[i]->fill_staff_info (inf); return inf; } @@ -315,34 +315,34 @@ Translator* Engraver_group_engraver::get_default_interpreter() { // ? - if ( is_bottom_engraver_b()) - return daddy_grav_l_->get_default_interpreter(); + if (is_bottom_engraver_b()) + return daddy_grav_l_->get_default_interpreter(); Engraver_group_engraver *grav_p= itrans_l_-> - get_default_itrans_l()->get_group_engraver_p (); + get_default_itrans_l()->get_group_engraver_p (); add (grav_p); if (grav_p->is_bottom_engraver_b()) - return grav_p; + return grav_p; else - return grav_p->get_default_interpreter(); + return grav_p->get_default_interpreter(); } bool -Engraver_group_engraver::is_bottom_engraver_b()const +Engraver_group_engraver::is_bottom_engraver_b() const { return !itrans_l_->get_default_itrans_l(); } Engraver* -Engraver_group_engraver::get_simple_engraver (char const *type)const +Engraver_group_engraver::get_simple_engraver (char const *type) const { for (int i=0; i < nongroup_l_arr_.size(); i++) { - if (nongroup_l_arr_[i]->name() == type) - return nongroup_l_arr_[i]; + if (nongroup_l_arr_[i]->name() == type) + return nongroup_l_arr_[i]; } - if ( daddy_grav_l_) - return daddy_grav_l_->get_simple_engraver (type); + if (daddy_grav_l_) + return daddy_grav_l_->get_simple_engraver (type); return 0; } diff --git a/lily/engraver.cc b/lily/engraver.cc index 52eba772e0..11ac18d61e 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -30,7 +30,7 @@ Engraver::post_move_processing() void Engraver::removal_processing() { - if ( status < CREATION_INITED) + if (status < CREATION_INITED) do_creation_processing(); do_removal_processing(); @@ -102,13 +102,13 @@ Engraver::typeset_element (Score_elem*p) } Paper_def* -Engraver::paper()const +Engraver::paper() const { return daddy_grav_l_->paper(); } bool -Engraver::contains_b (Engraver *grav_l)const +Engraver::contains_b (Engraver *grav_l) const { return this == grav_l; } @@ -116,7 +116,10 @@ Engraver::contains_b (Engraver *grav_l)const Staff_info Engraver::get_staff_info() const { - return daddy_grav_l_->get_staff_info(); + if (daddy_grav_l_) + return daddy_grav_l_->get_staff_info(); + Staff_info info; + return info; } void diff --git a/lily/general-script-def.cc b/lily/general-script-def.cc index f3b202e805..70c2b740af 100644 --- a/lily/general-script-def.cc +++ b/lily/general-script-def.cc @@ -10,39 +10,40 @@ #include "general-script-def.hh" #include "debug.hh" #include "symbol.hh" -int -General_script_def::staff_dir_i()const +Direction +General_script_def::staff_dir() const { - return -1; + return DOWN; } -int -General_script_def::rel_stem_dir_i()const + +Direction +General_script_def::rel_stem_dir() const { - return 0; + return CENTER; } int -General_script_def::priority_i()const +General_script_def::priority_i() const { return 1000; } bool -General_script_def::inside_b()const +General_script_def::inside_b() const { return false; } bool -General_script_def::equal_b (General_script_def const&g)const +General_script_def::equal_b (General_script_def const&g) const { if (name() != g.name ()) - return false; + return false; return do_equal_b (&g); } bool -General_script_def::do_equal_b (General_script_def const*)const +General_script_def::do_equal_b (General_script_def const*) const { return true; } @@ -62,7 +63,7 @@ General_script_def::do_print() const } Atom -General_script_def::get_atom (Paper_def*, int)const +General_script_def::get_atom (Paper_def*, Direction) const { Symbol s; return Atom (s); diff --git a/lily/global-translator.cc b/lily/global-translator.cc index f92156e6e4..f4213dd6a6 100644 --- a/lily/global-translator.cc +++ b/lily/global-translator.cc @@ -6,14 +6,10 @@ (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; } @@ -36,18 +32,11 @@ Global_translator::add_moment_to_process (Moment m) } int -Global_translator::depth_i()const +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) { @@ -58,7 +47,7 @@ Global_translator::modify_next (Moment &w) } int -Global_translator::moments_left_i()const +Global_translator::moments_left_i() const { return extra_mom_pq_.size(); } @@ -70,3 +59,9 @@ Global_translator::prepare (Moment) IMPLEMENT_IS_TYPE_B1(Global_translator, Translator); + +Music_output* +Global_translator::get_output_p() +{ + return 0; +} diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 90d07e6851..740899418b 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -39,7 +39,7 @@ struct Break_node { */ Array -Gourlay_breaking::do_solve()const +Gourlay_breaking::do_solve() const { Array optimal_paths; @@ -78,8 +78,8 @@ Gourlay_breaking::do_solve()const Line_of_cols line = all.slice (breaks[start_idx], breaks[break_idx]+1); - line[0] = line[0]->postbreak_p_; - line.top() = line.top ()->prebreak_p_; + line[0] = line[0]->postbreak_l(); + line.top() = line.top ()->prebreak_l(); if (!feasible (line)) break; @@ -110,22 +110,22 @@ Gourlay_breaking::do_solve()const for (int j=0; j < candidates.size(); j++) { int start = candidates[j]; - if ( optimal_paths[start].line_config_.energy_f_ + if (optimal_paths[start].line_config_.energy_f_ + candidate_lines[j].energy_f_ > minimal_energy) continue; - if ( !candidate_lines[j].satisfies_constraints_b_) + if (!candidate_lines[j].satisfies_constraints_b_) { candidate_lines[j].solve_line(); - ((Break_algorithm*)this)->exact_stats_.add ( candidate_lines[j].cols); + ((Break_algorithm*)this)->exact_stats_.add (candidate_lines[j].cols); } Real this_energy = optimal_paths[start].line_config_.energy_f_ + candidate_lines[j].energy_f_ ; - if ( this_energy < minimal_energy) + if (this_energy < minimal_energy) { minimal_j = j; minimal_energy = this_energy; @@ -143,24 +143,24 @@ Gourlay_breaking::do_solve()const optimal_paths[break_idx].line_config_ = candidate_lines[minimal_j]; } - if ( !(break_idx % HAPPY_DOTS_I)) + if (!(break_idx % HAPPY_DOTS_I)) *mlog << "[" << break_idx << "]"< final_breaks; Array lines; - Real min_energy_f_ = infinity_f; - Real max_energy_f_ = 0; + + Real max_energy_f = 0; /* skip 0-th element, since it is a "dummy" elt*/ for (int i = optimal_paths.size()-1; i> 0;) { - final_breaks.push ( i); - assert ( i > optimal_paths[i].prev_break_i_); + final_breaks.push (i); + assert (i > optimal_paths[i].prev_break_i_); // there was no "feasible path" if (!optimal_paths[i].line_config_.config.size()) { @@ -174,7 +174,7 @@ Gourlay_breaking::do_solve()const /* TODO print variation in energy */ - if (max_energy_f_ ) + if (max_energy_f) { ; } @@ -182,7 +182,7 @@ Gourlay_breaking::do_solve()const for (int i= final_breaks.size(); i--;) - lines.push ( optimal_paths[final_breaks[i]].line_config_); + lines.push (optimal_paths[final_breaks[i]].line_config_); return lines; diff --git a/lily/grouping.cc b/lily/grouping.cc index c106db0861..15401fced9 100644 --- a/lily/grouping.cc +++ b/lily/grouping.cc @@ -18,7 +18,7 @@ Rhythmic_grouping::init() } void -Rhythmic_grouping::OK()const +Rhythmic_grouping::OK() const { #ifndef NDEBUG assert (bool (children.size()) != bool (interval_)); @@ -40,7 +40,7 @@ Rhythmic_grouping::length() const } MInterval -Rhythmic_grouping::interval()const +Rhythmic_grouping::interval() const { if (interval_) return *interval_; @@ -138,7 +138,7 @@ Rhythmic_grouping::split (Array splitpoints) Array ch; while (1) { - if ( i >= children.size() || j >= splitpoints.size ()) + if (i >= children.size() || j >= splitpoints.size ()) break; assert ( @@ -235,7 +235,7 @@ Rhythmic_grouping::junk() } void -Rhythmic_grouping::print()const +Rhythmic_grouping::print() const { #ifndef NPRINT DOUT << "{ \n"; @@ -253,7 +253,7 @@ bool Rhythmic_grouping::child_fit_b (Moment start) { if (children.size()) - return ( children.top()->interval ().right== start); + return (children.top()->interval ().right== start); return true; } @@ -347,7 +347,7 @@ Rhythmic_grouping::translate (Moment m) } void -Rhythmic_grouping::extend (MInterval m)const +Rhythmic_grouping::extend (MInterval m) const { assert (m.left >= interval().left); while (m.right >interval().right) diff --git a/lily/head-column.cc b/lily/head-column.cc index a5d1ecbebd..b8707965a6 100644 --- a/lily/head-column.cc +++ b/lily/head-column.cc @@ -15,22 +15,22 @@ Head_column::Head_column() { stem_l_ = 0; - dir_i_ =0; + dir_ =CENTER; } void Head_column::do_substitute_dependency (Score_elem*o, - Score_elem*n) + Score_elem*n) { Script_column::do_substitute_dependency (o,n); if (o->name() == Note_head::static_name ()) { - head_l_arr_.substitute ((Note_head*)o->item(), - (n)? (Note_head*)n->item() : 0); + head_l_arr_.substitute ((Note_head*)o->item(), + (n)? (Note_head*)n->item() : 0); } if (stem_l_ == o) { - stem_l_ = n ? (Stem*)n->item():0; + stem_l_ = n ? (Stem*)n->item():0; } } @@ -40,8 +40,8 @@ Head_column::set (Stem*stem_l) { stem_l_ = stem_l; Score_elem::add_dependency (stem_l); - for (int i=0; script_l_arr_.size(); i++) - script_l_arr_[i]->set_stem (stem_l); + for (int i=0; i < script_l_arr_.size(); i++) + script_l_arr_[i]->set_stem (stem_l); } void @@ -49,7 +49,7 @@ Head_column::add (Script *script_l) { Script_column::add (script_l) ; if (stem_l_) - script_l->set_stem (stem_l_); + script_l->set_stem (stem_l_); } void Head_column::add (Note_head *n_l) @@ -73,10 +73,10 @@ Head_column::do_print() const void Head_column::do_pre_processing() { - if (!dir_i_) + if (!dir_) { - if (stem_l_) - dir_i_ = stem_l_->dir_i_; + if (stem_l_) + dir_ = stem_l_->dir_; } Script_column::do_pre_processing(); } diff --git a/lily/horizontal-align-item.cc b/lily/horizontal-align-item.cc index 163a1bf61c..48701d148a 100644 --- a/lily/horizontal-align-item.cc +++ b/lily/horizontal-align-item.cc @@ -10,14 +10,9 @@ IMPLEMENT_IS_TYPE_B1(Horizontal_align_item,Item); -void -Horizontal_align_item::OK() const -{ - for (int i =0; i < item_l_arr_.size(); i++) - assert ( pcol_l_ == item_l_arr_[i]->pcol_l_); -} + bool -Horizontal_align_item::contains_b (Item *i)const +Horizontal_align_item::contains_b (Item *i) const { return item_l_arr_.find_l (i); } @@ -37,10 +32,10 @@ Horizontal_align_item::do_substitute_dependency (Score_elem*o,Score_elem*n) int i; while ((i = item_l_arr_.find_i (o->item())) >=0) { - if (n) - item_l_arr_[i] = n->item(); - else - item_l_arr_.del (i); + if (n) + item_l_arr_[i] = n->item(); + else + item_l_arr_.del (i); } } @@ -48,15 +43,15 @@ struct Horizontal_align_item_content { Item * item_l_; int priority_i_; static int compare (Horizontal_align_item_content const &h1, - Horizontal_align_item_content const &h2) - { - return h1.priority_i_ - h2.priority_i_; - } + Horizontal_align_item_content const &h2) + { + return h1.priority_i_ - h2.priority_i_; + } Horizontal_align_item_content (Item*i, int p) - { - priority_i_ = p; - item_l_ = i; - } + { + priority_i_ = p; + item_l_ = i; + } Horizontal_align_item_content(){item_l_ =0; priority_i_ =0; } }; @@ -64,50 +59,49 @@ struct Horizontal_align_item_content { void Horizontal_align_item::do_pre_processing() { - OK(); { - Array content; - for (int i =0; i < item_l_arr_.size(); i++) - content.push ( - Horizontal_align_item_content ( - item_l_arr_[i], priority_i_arr_[i])); - content.sort (Horizontal_align_item_content::compare); - item_l_arr_.clear(); - priority_i_arr_.clear(); - for (int i =0; i < content.size(); i++) - { - item_l_arr_.push (content[i].item_l_); - priority_i_arr_.push (content[i].priority_i_); - } - } + Array content; + for (int i =0; i < item_l_arr_.size(); i++) + content.push ( + Horizontal_align_item_content ( + item_l_arr_[i], priority_i_arr_[i])); + content.sort (Horizontal_align_item_content::compare); + item_l_arr_.clear(); + priority_i_arr_.clear(); + for (int i =0; i < content.size(); i++) + { + item_l_arr_.push (content[i].item_l_); + priority_i_arr_.push (content[i].priority_i_); + } + } Array dims; Real total =0; for (int i =0; i < item_l_arr_.size(); i++) { - Interval item_width= item_l_arr_[i]->width(); - if (item_width.empty_b()) - { - item_width = Interval (0,0); - } - dims.push (item_width); - total += item_width.length(); + Interval item_width= item_l_arr_[i]->width(); + if (item_width.empty_b()) + { + item_width = Interval (0,0); + } + dims.push (item_width); + total += item_width.length(); } Real where_f= total * (align_i_-1.0)/2.0; Real center_dx_f = 0; - for ( int i=0 ; i < item_l_arr_.size(); i++) + for (int i=0 ; i < item_l_arr_.size(); i++) { - Real dx = where_f -dims[i][-1]; - item_l_arr_[i]->translate (dx , X_AXIS); - if (item_l_arr_[i] == center_l_) - center_dx_f = where_f; - where_f += dims[i].length(); + Real dx = where_f -dims[i][-1]; + item_l_arr_[i]->translate (dx , X_AXIS); + if (item_l_arr_[i] == center_l_) + center_dx_f = where_f; + where_f += dims[i].length(); } if (center_dx_f && !align_i_) - for ( int i=0 ; i < item_l_arr_.size(); i++) - item_l_arr_[i]->translate (- center_dx_f , X_AXIS); + for (int i=0 ; i < item_l_arr_.size(); i++) + item_l_arr_[i]->translate (- center_dx_f , X_AXIS); } @@ -118,7 +112,7 @@ Horizontal_align_item::do_width() const } void -Horizontal_align_item::do_print()const +Horizontal_align_item::do_print() const { } diff --git a/lily/identifier.cc b/lily/identifier.cc index ad7f5de1f4..035c93b244 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -35,7 +35,7 @@ Identifier::error (String expect) ::error (e); } -Identifier::Identifier ( int code) +Identifier::Identifier (int code) { token_code_i_ = code; accessed_b_ = 0; @@ -43,7 +43,7 @@ Identifier::Identifier ( int code) } void -Identifier::print()const +Identifier::print() const { DOUT << "identifier "; do_print(); @@ -70,7 +70,7 @@ DEFAULT_PRINT(Paper_def_id,Paper_def, paperdef); void -Duration_id::do_print()const +Duration_id::do_print() const {} void diff --git a/lily/include/audio-score.hh b/lily/include/audio-score.hh index 5fad1355f2..0585a0b25d 100644 --- a/lily/include/audio-score.hh +++ b/lily/include/audio-score.hh @@ -9,31 +9,33 @@ #include "lily-proto.hh" #include "plist.hh" +#include "music-output.hh" /** all stuff which goes onto midi. notes, signs, symbols in a score #Audio_score# contains the items, the columns. */ -class Audio_score { +class Audio_score : public Music_output { public: - Audio_score (Score* l); + Audio_score (); + ~Audio_score () {} - void add (Audio_column*); - void add_staff (Audio_staff* l); - void add (Audio_element*p); + void add (Audio_column*); + void add_staff (Audio_staff* l); + void add (Audio_element*p); - void output (Midi_stream& midi_stream_r); - void output_header_track (Midi_stream& midi_stream_r); + void output (Midi_stream& midi_stream_r); + void output_header_track (Midi_stream& midi_stream_r); - void print() const; - void process(); + void print() const; + void process(); - Pointer_list audio_column_p_list_; - Link_list audio_staff_l_list_; - Pointer_list audio_elem_p_list_; - Score* score_l_; + Pointer_list audio_column_p_list_; + Link_list audio_staff_l_list_; + Pointer_list audio_elem_p_list_; + Midi_def * midi_l_; }; #endif // AUDIO_SCORE_HH diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh index a461f52c25..526d3ccd26 100644 --- a/lily/include/axis-group-item.hh +++ b/lily/include/axis-group-item.hh @@ -19,12 +19,19 @@ class Axis_group_item : public virtual Axis_group_element, public Item { protected: - virtual void do_breakable_col_processing(); - void OK()const; - virtual void do_print() const; + virtual void do_breakable_col_processing(); + void OK() const; + virtual void do_print() const; + virtual void do_junk_links() { + Item::do_junk_links(); + Axis_group_element::do_junk_links(); + } + virtual void do_unlink() { + Item::do_unlink(); + Axis_group_element::do_unlink(); + } public: - DECLARE_MY_RUNTIME_TYPEINFO; - + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // AXIS_ITEM_HH diff --git a/lily/include/axis-group-spanner.hh b/lily/include/axis-group-spanner.hh index 2b7d6e22bf..028529a6ef 100644 --- a/lily/include/axis-group-spanner.hh +++ b/lily/include/axis-group-spanner.hh @@ -17,13 +17,21 @@ useful example of this is the Vertical_group_spanner */ class Axis_group_spanner : public Spanner, public virtual Axis_group_element { - void do_break_processing_if_unbroken(); + void do_break_processing_if_unbroken(); protected: - virtual void do_break_processing(); - virtual void do_print()const; + virtual void do_junk_links () { + Spanner::do_junk_links(); + Axis_group_element::do_junk_links(); + } + virtual void do_unlink() { + Spanner::do_unlink(); + Axis_group_element::do_unlink(); + } + virtual void do_break_processing(); + virtual void do_print() const; public: - DECLARE_MY_RUNTIME_TYPEINFO; + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // SPAN_AXIS_GROUP_HH diff --git a/lily/include/axis-group.hh b/lily/include/axis-group.hh index 92d0cd8806..e2e030f0b9 100644 --- a/lily/include/axis-group.hh +++ b/lily/include/axis-group.hh @@ -15,21 +15,22 @@ axis-group.hh -- declare Axis_group_administration, Axis_group_element #include "real.hh" #include "lily-proto.hh" #include "score-elem.hh" + /** Do the dirty work for Axis_group_element. */ struct Axis_group_administration { - Link_array elem_l_arr_; - - Interval extent (Axis)const; - void print() const ; - Axis_group_administration (Axis_group_administration const&); - Axis_group_administration(){} - void remove_all (Axis a1,Axis a2); + Link_array elem_l_arr_; - bool contains_b (Score_elem const *)const; - void add_element (Score_elem*, Axis_group_element*, Axis a1, Axis a2); - void remove_element (Score_elem*, Axis a1, Axis a2); + Interval extent (Axis) const; + void print() const ; + Axis_group_administration (Axis_group_administration const&); + Axis_group_administration(){} + void remove_all (Axis a1, Axis a2); + + bool contains_b (Score_elem const *) const; + void add_element (Score_elem*, Axis_group_element*, Axis a1, Axis a2); + void remove_element (Score_elem*, Axis a1, Axis a2); }; /** @@ -38,16 +39,18 @@ struct Axis_group_administration { */ class Axis_group_element : public virtual Score_elem { protected: - Axis_group_administration axis_admin_; - virtual void do_print()const; - virtual Link_array get_extra_dependencies()const; - virtual void do_unlink(); + Axis_group_administration axis_admin_; + virtual void do_print() const; + virtual Link_array get_extra_dependencies() const; + virtual void do_unlink(); + virtual void do_junk_links(); public: - virtual void remove_all()=0; - virtual void add_element (Score_elem*)=0; - virtual void remove_element (Score_elem*)=0; - virtual bool contains_b (Score_elem const *)const; - DECLARE_MY_RUNTIME_TYPEINFO; + Axis_group_element(); + virtual void remove_all()=0; + virtual void add_element (Score_elem*)=0; + virtual void remove_element (Score_elem*)=0; + virtual bool contains_b (Score_elem const *) const; + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // Axis_group_administration_HH diff --git a/lily/include/bar-number-grav.hh b/lily/include/bar-number-grav.hh index ad1956648a..fcce6d53a6 100644 --- a/lily/include/bar-number-grav.hh +++ b/lily/include/bar-number-grav.hh @@ -16,14 +16,13 @@ catch bars, and put a number over them. */ class Bar_number_grav : public Engraver { - Script * script_p_; - int number_i_; + Script * script_p_; protected: - void acknowledge_element (Score_elem_info); - void do_pre_move_processing(); + void acknowledge_element (Score_elem_info); + void do_pre_move_processing(); public: - Bar_number_grav(); - DECLARE_MY_RUNTIME_TYPEINFO; + Bar_number_grav(); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // BAR_NUMBER_GRAV_HH diff --git a/lily/include/bar.hh b/lily/include/bar.hh index c03527e6cc..ce886830b0 100644 --- a/lily/include/bar.hh +++ b/lily/include/bar.hh @@ -14,17 +14,17 @@ */ class Bar:public Item { public: - String type_str_; - int spanned_i_; + String type_str_; + int spanned_i_; - DECLARE_MY_RUNTIME_TYPEINFO; - SCORE_ELEM_CLONE(Bar); - Bar(); + DECLARE_MY_RUNTIME_TYPEINFO; + SCORE_ELEM_CLONE(Bar); + Bar(); private: - void do_print() const; + void do_print() const; protected: - virtual void do_pre_processing(); - Molecule*brew_molecule_p()const; + virtual void do_pre_processing(); + Molecule*brew_molecule_p() const; }; #endif // BAR_HH diff --git a/lily/include/beam-grav.hh b/lily/include/beam-grav.hh new file mode 100644 index 0000000000..3db08fc073 --- /dev/null +++ b/lily/include/beam-grav.hh @@ -0,0 +1,36 @@ +/* + beam-grav.hh -- declare Beam_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef BEAM_GRAV_HH +#define BEAM_GRAV_HH + +#include "engraver.hh" +#include "drul-array.hh" + +/** + Generate a beam. Eats stems. + */ +class Beam_engraver : public Engraver +{ + Drul_array span_reqs_drul_; + Beam *beam_p_; + Rhythmic_grouping *current_grouping_p_; + +public: + DECLARE_MY_RUNTIME_TYPEINFO; + Beam_engraver(); +protected: + virtual void do_removal_processing(); + virtual void do_process_requests(); + virtual bool do_try_request (Request*); + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing(); +}; + +#endif // BEAM_GRAV_HH diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 48b4f9bb4c..ad775b7a3c 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -15,36 +15,36 @@ direction */ class Beam: public Directional_spanner { public: - Link_array stems; - /// the slope of the beam in posns / point (dimension) - Real slope; + Link_array stems; + /// the slope of the beam in posns / point (dimension) + Real slope; - /// position of leftmost end of beam - Real left_pos; + /// position of leftmost end of beam + Real left_pos; - /* *************** */ - DECLARE_MY_RUNTIME_TYPEINFO; - Beam(); - void add (Stem*); + /* *************** */ + DECLARE_MY_RUNTIME_TYPEINFO; + Beam(); + void add (Stem*); - void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current); - void set_stemlens(); - SCORE_ELEM_CLONE(Beam); + void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current); + void set_stemlens(); + SCORE_ELEM_CLONE(Beam); protected: - virtual Interval do_width()const; - virtual Offset center() const; - virtual void set_default_dir(); - virtual void do_pre_processing(); - virtual void do_post_processing(); - virtual void do_substitute_dependent (Score_elem*, Score_elem*); + virtual Interval do_width() const; + virtual Offset center() const; + virtual void set_default_dir(); + virtual void do_pre_processing(); + virtual void do_post_processing(); + virtual void do_substitute_dependent (Score_elem*, Score_elem*); - virtual void do_print() const; + virtual void do_print() const; private: - Molecule stem_beams (Stem *here, Stem *next, Stem *prev)const; - void solve_slope(); - Molecule*brew_molecule_p()const; + Molecule stem_beams (Stem *here, Stem *next, Stem *prev) const; + void solve_slope(); + Molecule*brew_molecule_p() const; }; #endif // BEAM_HH diff --git a/lily/include/bow.hh b/lily/include/bow.hh index e483c36ac2..1ef139c60e 100644 --- a/lily/include/bow.hh +++ b/lily/include/bow.hh @@ -17,15 +17,13 @@ */ class Bow : public Directional_spanner { protected: - int left_pos_i_; - int right_pos_i_; - Real left_dx_f_; - Real right_dx_f_; + Drul_array pos_i_drul_; + Drul_array dx_f_drul_; - Molecule*brew_molecule_p()const; + Molecule*brew_molecule_p() const; public: - Bow(); - DECLARE_MY_RUNTIME_TYPEINFO; - Offset center() const; + Bow(); + DECLARE_MY_RUNTIME_TYPEINFO; + Offset center() const; }; #endif // BOW_HH diff --git a/lily/include/boxes.hh b/lily/include/boxes.hh index 36db4b88ba..45490033bd 100644 --- a/lily/include/boxes.hh +++ b/lily/include/boxes.hh @@ -16,8 +16,8 @@ struct Box { Interval &x() {return interval_a_[X_AXIS]; } Interval &y(){ return interval_a_[Y_AXIS]; } - Interval x()const{ return interval_a_[X_AXIS]; } - Interval y()const{return interval_a_[Y_AXIS]; } + Interval x() const{ return interval_a_[X_AXIS]; } + Interval y() const{return interval_a_[Y_AXIS]; } Interval operator[](Axis a) { return interval_a_[a]; } diff --git a/lily/include/break-caching.hh b/lily/include/break-caching.hh index 73b07d21ee..676be223df 100644 --- a/lily/include/break-caching.hh +++ b/lily/include/break-caching.hh @@ -16,7 +16,7 @@ struct Break_caching : Break_algorithm { void do_set_pscore(); - Array do_solve()const; + Array do_solve() const; }; diff --git a/lily/include/break.hh b/lily/include/break.hh index 000ef3ec92..b77414482e 100644 --- a/lily/include/break.hh +++ b/lily/include/break.hh @@ -24,7 +24,7 @@ struct Col_stats Col_stats(); void add (Line_of_cols const&l); - String str()const; + String str() const; }; /** Class representation of an algorithm which decides where to put @@ -43,7 +43,7 @@ protected: Line_of_cols find_breaks() const; Line_of_cols all_cols() const; - Array find_break_indices()const; + Array find_break_indices() const; /// helper: solve for the columns in #curline#. @@ -53,13 +53,13 @@ protected: void approximate_solve_line (Col_hpositions*) const; /// does curline fit on the paper? - bool feasible (Line_of_cols)const; + bool feasible (Line_of_cols) const; - Line_spacer* generate_spacing_problem (Line_of_cols)const; + Line_spacer* generate_spacing_problem (Line_of_cols) const; - virtual Array do_solve()const=0; - void print_stats()const; + virtual Array do_solve() const=0; + void print_stats() const; virtual void do_set_pscore(); public: @@ -72,9 +72,9 @@ public: void set_pscore (Paper_score*); /// check if the spacing/breaking problem is well-stated - void problem_OK()const; - void OK()const; - Array solve()const; + void problem_OK() const; + void OK() const; + Array solve() const; }; #endif // BREAK_HH diff --git a/lily/include/chord-iterator.hh b/lily/include/chord-iterator.hh new file mode 100644 index 0000000000..a3adc4a381 --- /dev/null +++ b/lily/include/chord-iterator.hh @@ -0,0 +1,33 @@ +/* + chord-iter.hh -- declare Chord_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef CHORD_ITER_HH +#define CHORD_ITER_HH + + +#include "music-iterator.hh" +#include "plist.hh" + +class Chord_iterator : public Music_iterator +{ + const Chord *chord_C_; + Pointer_list children_p_list_; +public: + ~Chord_iterator(); + Chord_iterator (Chord const*); + DECLARE_MY_RUNTIME_TYPEINFO; +protected: + virtual void do_print() const; + virtual void construct_children(); + virtual void process_and_next (Moment); + virtual Moment next_moment() const; + virtual bool ok() const; +}; + +#endif // CHORD_ITER_HH diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index ad8a674242..33190aceeb 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -14,7 +14,7 @@ class Clef_item : public Item { protected: virtual void do_pre_processing(); - Molecule* brew_molecule_p()const; + Molecule* brew_molecule_p() const; public: String type_; diff --git a/lily/include/col-info.hh b/lily/include/col-info.hh index 36a2f73f72..505c11f991 100644 --- a/lily/include/col-info.hh +++ b/lily/include/col-info.hh @@ -16,7 +16,7 @@ /// helper struct for #Spacing_problem# struct Colinfo { - PCol *pcol_l_; + Paper_column *pcol_l_; P fixpos_p_; Interval width; int rank_i_; @@ -24,11 +24,11 @@ struct Colinfo { bool ugh_b_; /* *************** */ Colinfo(); - Colinfo (PCol *,Real const *); + Colinfo (Paper_column *,Real const *); void print() const; bool fixed() const { return fixpos_p_.get_C();} - Real fixed_position()const { return *fixpos_p_; } + Real fixed_position() const { return *fixpos_p_; } Real minright() const { return width.right; } Real minleft() const { return -width.left; } }; diff --git a/lily/include/colhpos.hh b/lily/include/colhpos.hh index 3f198f2ca1..56f70c8506 100644 --- a/lily/include/colhpos.hh +++ b/lily/include/colhpos.hh @@ -10,7 +10,7 @@ #include "varray.hh" #include "lily-proto.hh" -typedef Array Line_of_cols; +typedef Array Line_of_cols; struct Col_hpositions { Line_spacer * spacer_l_; @@ -22,7 +22,7 @@ struct Col_hpositions { bool satisfies_constraints_b_; /* ************** */ - void OK()const; + void OK() const; ~Col_hpositions(); void solve_line(); void approximate_solve_line(); @@ -30,7 +30,7 @@ struct Col_hpositions { constraints. should always work */ void stupid_solution(); Col_hpositions(); - void add (PCol*c); + void add (Paper_column*c); void print() const; }; diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index f5adca4428..848d4d9e43 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -64,7 +64,7 @@ public: Tempo_req(); REQUESTMETHODS(Tempo_req, tempo); - bool do_equal_b (Request *)const; + bool do_equal_b (Request *) const; }; class Partial_measure_req : public Timing_req { @@ -73,7 +73,7 @@ public: Partial_measure_req (Moment); REQUESTMETHODS(Partial_measure_req, partial); - bool do_equal_b (Request*)const; + bool do_equal_b (Request*) const; }; /** @@ -85,7 +85,7 @@ public: Meter_change_req(); void set (int,int); - bool do_equal_b (Request*)const; + bool do_equal_b (Request*) const; REQUESTMETHODS(Meter_change_req, meterchange); }; @@ -94,7 +94,7 @@ class Cadenza_req : public Timing_req { public: /// turn on? bool on_b_; - bool do_equal_b (Request*)const; + bool do_equal_b (Request*) const; Cadenza_req (bool); REQUESTMETHODS(Cadenza_req,cadenza); }; @@ -102,7 +102,7 @@ public: /// check if we're at start of a measure. class Barcheck_req : public Timing_req { public: - bool do_equal_b (Request *)const; + bool do_equal_b (Request *) const; REQUESTMETHODS(Barcheck_req,barcheck); }; @@ -110,7 +110,7 @@ class Measure_grouping_req : public Timing_req { public: Array beat_i_arr_; Array elt_length_arr_; - bool do_equal_b (Request *)const; + bool do_equal_b (Request *) const; REQUESTMETHODS(Measure_grouping_req, measuregrouping); }; @@ -120,7 +120,7 @@ class Bar_req : public Command_req { public: String type_str_; Bar_req (String); - bool do_equal_b (Request*)const; + bool do_equal_b (Request*) const; REQUESTMETHODS(Bar_req,bar); }; diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh index 4539ac209c..99e0e287cc 100644 --- a/lily/include/crescendo.hh +++ b/lily/include/crescendo.hh @@ -17,23 +17,20 @@ */ class Crescendo : public Spanner , public Staff_side { public: - int grow_dir_i_; + int grow_dir_; -/// if there is a dynamic at the end, make the sign smaller. - bool right_dyn_b_; + /// if there is a dynamic at the end, make the sign smaller. + Drul_array dyn_b_drul_; - /// if there is a dynamic at the end, make the sign smaller. - bool left_dyn_b_; - Crescendo(); + Crescendo(); protected: - SCORE_ELEM_CLONE(Crescendo); - virtual Molecule*brew_molecule_p()const; - virtual Interval symbol_height()const; - DECLARE_MY_RUNTIME_TYPEINFO; + SCORE_ELEM_CLONE(Crescendo); + virtual Molecule*brew_molecule_p() const; + virtual Interval symbol_height() const; + DECLARE_MY_RUNTIME_TYPEINFO; private: - Symbol get_symbol()const; - + Symbol get_symbol() const; }; #endif // CRESCENDO_HH diff --git a/lily/include/direction.hh b/lily/include/direction.hh new file mode 100644 index 0000000000..032effc64f --- /dev/null +++ b/lily/include/direction.hh @@ -0,0 +1,26 @@ +/* + direction.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef DIRECTION_HH +#define DIRECTION_HH + +enum Direction +{ + UP=1, + DOWN=-1, + LEFT=-1, + RIGHT=1, + CENTER=0, + SMALLER=-1, + BIGGER=1, + +}; + + +#endif // DIRECTION_HH diff --git a/lily/include/directional-spanner.hh b/lily/include/directional-spanner.hh index abff328b59..7854a348ce 100644 --- a/lily/include/directional-spanner.hh +++ b/lily/include/directional-spanner.hh @@ -14,7 +14,7 @@ class Directional_spanner : public Spanner{ public: /// -1 below heads, +1 above heads. - int dir_i_; + Direction dir_; Directional_spanner(); /// offset of "center" relative to left-column/0-pos of staff diff --git a/lily/include/drul-array.hh b/lily/include/drul-array.hh new file mode 100644 index 0000000000..69db537a9b --- /dev/null +++ b/lily/include/drul-array.hh @@ -0,0 +1,34 @@ +/* + drul-array.hh -- declare Drul_array + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef DRUL_ARRAY_HH +#define DRUL_ARRAY_HH + +#include "direction.hh" + +/** + Left/right or Up/down arrays. Drul is nicer sounding than udlr + */ +template +struct Drul_array +{ + T array_[2]; + T &operator[] (Direction d) + { + assert (d==1 || d== -1); + return array_[(d+1)/2]; + } + T operator[] (Direction d) const + { + assert (d==1 || d== -1); + return array_[(d+1)/2]; + } +}; + +#endif // DRUL_ARRAY_HH diff --git a/lily/include/dynamic-grav.hh b/lily/include/dynamic-grav.hh index 26556edf9d..bf71902245 100644 --- a/lily/include/dynamic-grav.hh +++ b/lily/include/dynamic-grav.hh @@ -13,7 +13,7 @@ #include "engraver.hh" class Dynamic_engraver : public Engraver { - int dir_i_; + Direction dir_; Text_item * dynamic_p_; Crescendo * to_end_cresc_p_; Crescendo * cresc_p_; diff --git a/lily/include/elem-group-item.hh b/lily/include/elem-group-item.hh index 8e0fcd5154..52475d905a 100644 --- a/lily/include/elem-group-item.hh +++ b/lily/include/elem-group-item.hh @@ -19,16 +19,15 @@ */ class Horizontal_vertical_group_item : public Axis_group_item, public Horizontal_vertical_group_element { protected: - virtual void do_print() const; - virtual void remove_all() { Horizontal_vertical_group_element::remove_all (); } + virtual void do_print() const; + virtual void remove_all() { Horizontal_vertical_group_element::remove_all (); } + virtual void do_unlink () { Horizontal_vertical_group_element::do_unlink (); } + SCORE_ELEM_CLONE(Horizontal_vertical_group_item); public: - virtual void add_element (Score_elem*e) { Horizontal_vertical_group_element::add_element (e); } - virtual void remove_element (Score_elem*e) { Horizontal_vertical_group_element::remove_element (e); } + virtual void add_element (Score_elem*e) { Horizontal_vertical_group_element::add_element (e); } + virtual void remove_element (Score_elem*e) { Horizontal_vertical_group_element::remove_element (e); } - DECLARE_MY_RUNTIME_TYPEINFO; - SCORE_ELEM_CLONE(Horizontal_vertical_group_item); - - + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // ELEM_GROUP_ITEM_HH diff --git a/lily/include/elem-group.hh b/lily/include/elem-group.hh index 61ad7519f3..d65c173123 100644 --- a/lily/include/elem-group.hh +++ b/lily/include/elem-group.hh @@ -22,7 +22,7 @@ class Horizontal_group_element : public virtual Axis_group_element { protected: virtual void remove_all(); - virtual Interval do_width()const; + virtual Interval do_width() const; public: DECLARE_MY_RUNTIME_TYPEINFO; @@ -35,7 +35,7 @@ public: */ class Vertical_group_element : public virtual Axis_group_element { protected: - virtual Interval do_height()const; + virtual Interval do_height() const; virtual void remove_all(); public: diff --git a/lily/include/engraver-group.hh b/lily/include/engraver-group.hh index 03e26c9610..cdfee08c38 100644 --- a/lily/include/engraver-group.hh +++ b/lily/include/engraver-group.hh @@ -30,10 +30,10 @@ protected: Array announce_info_arr_; - virtual void do_print()const; - virtual bool removable_b()const; + virtual void do_print() const; + virtual bool removable_b() const; public: - Engraver*get_simple_engraver (char const*typeinfo)const; + Engraver*get_simple_engraver (char const*typeinfo) const; virtual void print() const ; Input_translator * itrans_l_; @@ -68,13 +68,13 @@ public: virtual bool try_request (Request*); virtual void do_process_requests(); - virtual Staff_info get_staff_info()const; + 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 (Engraver* grav_p); - virtual bool contains_b (Engraver*)const; + virtual bool contains_b (Engraver*) const; virtual Translator* find_get_translator_l (String name, String id); virtual Translator * get_default_interpreter(); diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh index a750704437..335ab13034 100644 --- a/lily/include/engraver.hh +++ b/lily/include/engraver.hh @@ -94,15 +94,15 @@ protected: virtual void sync_features() {} - virtual bool contains_b (Engraver*grav_l)const; + virtual bool contains_b (Engraver*grav_l) const; /** Get information on the staff. Default: ask daddy. */ - virtual Staff_info get_staff_info()const; + virtual Staff_info get_staff_info() const; virtual void fill_staff_info (Staff_info&); - virtual void do_print()const; + virtual void do_print() const; /* @see{try_request} Default: always return false diff --git a/lily/include/general-script-def.hh b/lily/include/general-script-def.hh index 4f927b2dfd..3788df867c 100644 --- a/lily/include/general-script-def.hh +++ b/lily/include/general-script-def.hh @@ -13,6 +13,8 @@ #include "lily-proto.hh" #include "input.hh" #include "virtual-methods.hh" +#include "direction.hh" + /** Definition of anything that is put aside staff/notes. */ @@ -20,18 +22,18 @@ class General_script_def : public Input { public: VIRTUAL_COPY_CONS(General_script_def,General_script_def); DECLARE_MY_RUNTIME_TYPEINFO; - virtual int staff_dir_i()const; + virtual Direction staff_dir() const; void print() const; - virtual int rel_stem_dir_i()const; - virtual int priority_i()const; - virtual bool inside_b()const; - virtual Atom get_atom (Paper_def* p, int dir_i_)const; - bool equal_b (General_script_def const&)const; + virtual Direction rel_stem_dir() const; + virtual int priority_i() const; + virtual bool inside_b() const; + virtual Atom get_atom (Paper_def* p, Direction dir_) const; + bool equal_b (General_script_def const&) const; virtual ~General_script_def() {} protected: - virtual bool do_equal_b (General_script_def const *)const; - virtual void do_print()const; + virtual bool do_equal_b (General_script_def const *) const; + virtual void do_print() const; }; #endif // GENERAL_SCRIPT_DEF_HH diff --git a/lily/include/global-translator.hh b/lily/include/global-translator.hh index 25f5968714..ae97418b7f 100644 --- a/lily/include/global-translator.hh +++ b/lily/include/global-translator.hh @@ -14,28 +14,26 @@ #include "pqueue.hh" class Global_translator : public virtual Translator { - PQueue extra_mom_pq_; - Moment last_mom_; + PQueue extra_mom_pq_; public: - Score *score_l_; + Moment last_mom_; + Global_translator(); + int moments_left_i() const; + void modify_next (Moment&); + void add_moment_to_process (Moment); + + virtual Music_output *get_output_p (); + virtual void prepare (Moment); + virtual void process() {} + virtual void finish() {} + virtual void start() {} - 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() {} - virtual void start() {} - - DECLARE_MY_RUNTIME_TYPEINFO; + DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual Global_translator *global_l() { return this; } - virtual int depth_i() const; - virtual Translator *ancestor_l (int); + virtual Global_translator *global_l() { return this; } + virtual int depth_i() const; + virtual Translator *ancestor_l (int); }; diff --git a/lily/include/gourlay-breaking.hh b/lily/include/gourlay-breaking.hh index 99fa0c9340..d8c3472a14 100644 --- a/lily/include/gourlay-breaking.hh +++ b/lily/include/gourlay-breaking.hh @@ -22,7 +22,7 @@ struct Gourlay_breaking : public Break_algorithm /// maximum number of measures in a line int max_measures_i_; void do_set_pscore(); - Array do_solve()const; + Array do_solve() const; Gourlay_breaking(); }; #endif // GOURLAY_BREAKING_HH diff --git a/lily/include/grouping.hh b/lily/include/grouping.hh index 13fcbd790a..d88ed2876b 100644 --- a/lily/include/grouping.hh +++ b/lily/include/grouping.hh @@ -21,7 +21,7 @@ struct Rhythmic_grouping { /* *************** */ Array intervals(); - MInterval interval()const; + MInterval interval() const; Moment length() const; void intersect (MInterval); diff --git a/lily/include/head-column.hh b/lily/include/head-column.hh index 57c560b18b..ab38222b1a 100644 --- a/lily/include/head-column.hh +++ b/lily/include/head-column.hh @@ -18,27 +18,27 @@ class Head_column : public Script_column { public: - Link_array head_l_arr_; - /** The relative position of the "voice" containing this - chord. Normally this would be the same as the stem direction, - but rests do not have stems. - - Hmm. outdated.. Rests *do* have stems. - */ - - int dir_i_; - Stem* stem_l_; - - void add (Note_head*); - virtual void add (Script*s); - virtual void set (Stem*); - Head_column(); - DECLARE_MY_RUNTIME_TYPEINFO; + Link_array head_l_arr_; + /** The relative position of the "voice" containing this + chord. Normally this would be the same as the stem direction, + but rests do not have stems. + + Hmm. outdated.. Rests *do* have stems. + */ + + Direction dir_; + Stem* stem_l_; + + void add (Note_head*); + virtual void add (Script*s); + void set (Stem*); + Head_column(); + DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual void do_pre_processing(); - virtual void do_print()const; - virtual void do_substitute_dependency (Score_elem*,Score_elem*); + virtual void do_pre_processing(); + virtual void do_print() const; + virtual void do_substitute_dependency (Score_elem*,Score_elem*); }; #endif // HEAD_COLUMN_HH diff --git a/lily/include/header.hh b/lily/include/header.hh index c5fcae96a8..d5919b0de5 100644 --- a/lily/include/header.hh +++ b/lily/include/header.hh @@ -16,7 +16,7 @@ struct Header : Assoc { - String TeX_string()const; + String TeX_string() const; }; #endif // HEADER_HH diff --git a/lily/include/horizontal-align-item.hh b/lily/include/horizontal-align-item.hh index c1d6313657..07c1934eda 100644 --- a/lily/include/horizontal-align-item.hh +++ b/lily/include/horizontal-align-item.hh @@ -35,15 +35,14 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Horizontal_align_item); void add (Item*, int p); - void OK()const; Horizontal_align_item(); protected: virtual void do_substitute_dependency (Score_elem * , Score_elem *); /// do calculations before determining horizontal spacing virtual void do_pre_processing(); - virtual void do_print()const; - virtual Interval do_width()const; - bool contains_b (Item*)const; + virtual void do_print() const; + virtual Interval do_width() const; + bool contains_b (Item*) const; }; #endif // HORIZONTAL_ALIGN_ITEM_HH diff --git a/lily/include/horizontal-group-item.hh b/lily/include/horizontal-group-item.hh index b9045a4bdb..35918c9570 100644 --- a/lily/include/horizontal-group-item.hh +++ b/lily/include/horizontal-group-item.hh @@ -13,17 +13,24 @@ #include "elem-group.hh" #include "axis-group-item.hh" +/** + Group stuff in horizontal sense. Example: Paper_column + */ class Horizontal_group_item : public Axis_group_item, public Horizontal_group_element { protected: - virtual void remove_all() { Horizontal_group_element::remove_all (); } - virtual void do_print() const; + virtual void remove_all() { Horizontal_group_element::remove_all (); } + virtual void do_unlink () { + Axis_group_item::do_unlink (); + } + virtual void do_junk_links() { + Axis_group_item::do_junk_links(); + } + virtual void do_print() const; public: - virtual void add_element (Score_elem*e) { Horizontal_group_element::add_element (e); } - virtual void remove_element (Score_elem*e) { Horizontal_group_element::remove_element (e); } - DECLARE_MY_RUNTIME_TYPEINFO; - SCORE_ELEM_CLONE(Horizontal_group_item); - - + virtual void add_element (Score_elem*e) { Horizontal_group_element::add_element (e); } + virtual void remove_element (Score_elem*e) { Horizontal_group_element::remove_element (e); } + DECLARE_MY_RUNTIME_TYPEINFO; + SCORE_ELEM_CLONE(Horizontal_group_item); }; #endif // HORIZONTAL_GROUP_ITEM_HH diff --git a/lily/include/idealspacing.hh b/lily/include/idealspacing.hh index 83fb5ba89d..068ec5836c 100644 --- a/lily/include/idealspacing.hh +++ b/lily/include/idealspacing.hh @@ -21,7 +21,7 @@ struct Idealspacing { int left_i_; int right_i_; - void print()const; + void print() const; void OK() const ; Idealspacing(); }; diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index dd4b8f75f8..935f962e39 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -28,7 +28,7 @@ struct Identifier : public Input { Identifier (int code) ; virtual ~Identifier() ; - void print()const; + void print() const; DECLARE_MY_RUNTIME_TYPEINFO; void error (String); IDACCESSOR(Input_translator, input_translator) @@ -45,7 +45,7 @@ struct Identifier : public Input { IDACCESSOR(Duration, duration) protected: - virtual void do_print()const=0; + virtual void do_print() const=0; private: Identifier (Identifier const&); }; @@ -57,7 +57,7 @@ struct Idclass : Identifier {\ Idclass (Class*st, int code);\ virtual Class* accessor ();\ ~Idclass();\ - virtual void do_print()const; \ + virtual void do_print() const; \ }\ diff --git a/lily/include/ineq-constrained-qp.hh b/lily/include/ineq-constrained-qp.hh index 7e28fd7a82..a7bd31693d 100644 --- a/lily/include/ineq-constrained-qp.hh +++ b/lily/include/ineq-constrained-qp.hh @@ -31,7 +31,7 @@ public: */ void assert_solution (Vector sol) const; /// solve the problem using a projected gradient method - Vector constraint_solve (Vector)const; + Vector constraint_solve (Vector) const; /** Solve it. First try it the easy way. */ @@ -65,7 +65,7 @@ public: Real eval (Vector v); void eliminate_var (int idx, Real value); - void OK()const; + void OK() const; void print() const; }; diff --git a/lily/include/item.hh b/lily/include/item.hh index e465931074..524c6772e1 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -12,6 +12,7 @@ #include "boxes.hh" #include "string.hh" #include "score-elem.hh" +#include "drul-array.hh" /** A horizontally fixed size element of the score. @@ -25,31 +26,33 @@ */ class Item : public virtual Score_elem { public: - /// indirection to the column it is in - PCol * pcol_l_; - - Item * broken_to_a_[2]; - - /// should be put in a breakable col. - bool breakable_b_; - int break_status_i_; - /// nobreak = 0, pre = -1, post = 1 - int break_status_i()const; - Item * find_prebroken_piece (PCol*)const; - Item * find_prebroken_piece (Line_of_score*)const; - - virtual Item *item() { return this; } - Item(); - Real hpos_f() const; - DECLARE_MY_RUNTIME_TYPEINFO; - virtual Line_of_score * line_l() const; + Link_array attached_span_l_arr_; + Drul_array broken_to_drul_; + + /// should be put in a breakable col. + bool breakable_b_; + int break_status_i_; + /// nobreak = 0, pre = -1, post = 1 + int break_status_i() const; + Item * find_prebroken_piece (int) const; + Item * find_prebroken_piece (Line_of_score*) const; + + virtual Item *item() { return this; } + Item(); + Real hpos_f() const; + DECLARE_MY_RUNTIME_TYPEINFO; + virtual Line_of_score * line_l() const; + static int left_right_compare (Item const *, Item const*); protected: - virtual void do_breakable_col_processing(); - virtual void handle_prebroken_dependencies(); - virtual void do_print()const; - - void copy_breakable_items(); + virtual void do_unlink (); + virtual void do_junk_links(); + virtual void do_breakable_col_processing(); + virtual void handle_prebroken_dependencies(); + virtual void do_print() const; + virtual bool linked_b() const; + + void copy_breakable_items(); }; diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index 84d1ac709f..3f4b7f30e0 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -28,7 +28,7 @@ struct Key_item : Item { void set_c_position (int); protected: virtual void do_pre_processing(); - Molecule* brew_molecule_p()const; + Molecule* brew_molecule_p() const; }; #endif // KEYITEM_HH diff --git a/lily/include/key.hh b/lily/include/key.hh index 10c5779455..4a68fa8148 100644 --- a/lily/include/key.hh +++ b/lily/include/key.hh @@ -18,7 +18,7 @@ public: Octave_key(); void set (int i, int acc); - int acc (int i)const { return accidental_i_arr_[i]; } + int acc (int i) const { return accidental_i_arr_[i]; } }; /// administration of accidentals diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index c024791de5..f5aa4f56c9 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -67,6 +67,8 @@ struct Element_group; struct Element_group_item; struct Feature; struct General_script_def; +struct Music_output; +struct Music_output_def; struct Global_translator; struct Group_change_req; struct Group_feature_req; @@ -142,7 +144,7 @@ struct Notename_table; struct Offset; struct Output; struct Performer; -struct PCol; +struct Paper_column; struct Paper_score; struct Paper_def; struct Partial_measure_req; diff --git a/lily/include/line-spacer.hh b/lily/include/line-spacer.hh index f6f6cfe5c7..053e59a902 100644 --- a/lily/include/line-spacer.hh +++ b/lily/include/line-spacer.hh @@ -26,7 +26,7 @@ class Line_spacer public: Paper_def * paper_l_; - Paper_def *paper_l()const; + Paper_def *paper_l() const; Line_spacer(); /** solve the spacing problem @@ -41,7 +41,7 @@ public: /** add a col to the problem. columns have to be added left to right. The column contains info on it's minimum width. */ - virtual void add_column (PCol *, bool fixed=false, Real fixpos=0.0)=0; + virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0)=0; /** can the posed problem be solved? diff --git a/lily/include/linespace.hh b/lily/include/linespace.hh index 415a5376be..12058cfc8e 100644 --- a/lily/include/linespace.hh +++ b/lily/include/linespace.hh @@ -48,7 +48,7 @@ class Spacing_problem { /// mark column #i# as being loose. void loosen_column (int i); /// the index of #c# in #cols# - int col_id (PCol const *c) const; + int col_id (Paper_column const *c) const; /// generate an (nonoptimal) solution Vector find_initial_solution() const; @@ -57,7 +57,7 @@ class Spacing_problem { bool check_feasible() const; /// does #this# contain the column #w#? - bool contains (PCol const *w); + bool contains (Paper_column const *w); /// make the energy function void make_matrices (Matrix &quad, Vector &lin,Real&) const; @@ -76,7 +76,7 @@ class Spacing_problem { not in this problem, the spacing is ignored. */ void add_ideal (Idealspacing const *i); - void print_ideal (Idealspacing const *)const; + void print_ideal (Idealspacing const *) const; Vector try_initial_solution() const; void calcideal(); @@ -86,10 +86,10 @@ public: static Line_spacer *constructor() { return new Line_spacer; } - Array error_pcol_l_arr() const; + Array error_pcol_l_arr() const; virtual Array solve() const; - virtual void add_column (PCol *, bool fixed=false, Real fixpos=0.0); + virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0); virtual Vector default_solution() contains { diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index 467f331201..4d0ed37e2d 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -43,7 +43,7 @@ public: protected: virtual void do_pre_processing(); virtual void do_substitute_dependency (Score_elem*,Score_elem*); - virtual Molecule* brew_molecule_p()const; + virtual Molecule* brew_molecule_p() const; }; #endif // LOCALKEYITEM_HH diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 46155bded3..ce55ce4657 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -20,42 +20,42 @@ struct Lookup { String texsetting; /* *************** */ void add (String, Symtable*); - void print()const; + void print() const; - Symbol linestaff (int n, Real w)const; - Symbol fill (Box b)const; - Symbol beam_element (int,int,Real=0)const; + Symbol linestaff (int n, Real w) const; + Symbol fill (Box b) const; + Symbol beam_element (int,int,Real=0) const; /// round slope to closest TeXslope - Symbol beam (Real&,Real)const; + Symbol beam (Real&,Real) const; /** pos == 3 : 3 lines above staff (extending below note) pos == -3: below staff */ - Symbol streepjes (int pos)const; + Symbol streepjes (int pos) const; Symbol vbrace (Real &dy) const; - Symbol meter (Array)const; - Symbol stem (Real y1_pos, Real y2_pos)const; - Symbol rule_symbol (Real height, Real width)const; - Symbol accidental (int)const; - Symbol ball (int)const; - Symbol flag (int)const; - Symbol rest (int, bool outside)const; - Symbol clef (String)const; - Symbol bar (String, Real height)const; + Symbol meter (Array) const; + Symbol stem (Real y1_pos, Real y2_pos) const; + Symbol rule_symbol (Real height, Real width) const; + Symbol accidental (int) const; + Symbol ball (int) const; + Symbol flag (int) const; + Symbol rest (int, bool outside) const; + Symbol clef (String) const; + Symbol bar (String, Real height) const; - Symbol dots (int)const; - Symbol slur (int dy, Real &dx, int dir)const; - Symbol half_slur (int dy, Real &dx, int dir, int xpart)const; - Symbol half_slur_middlepart (Real &dx, int dir)const; - Symbol big_slur (int dy, Real &dx, int dir)const; - Symbol text (String style, String text, int align = 1)const; - Symbol script (String idx)const; - Symbol hairpin (Real & width, bool decresc)const; - Symbol dynamic (String)const; + Symbol dots (int) const; + Symbol slur (int dy, Real &dx, int dir) const; + Symbol half_slur (int dy, Real &dx, int dir, int xpart) const; + Symbol half_slur_middlepart (Real &dx, int dir) const; + Symbol big_slur (int dy, Real &dx, int dir) const; + Symbol text (String style, String text, int align = 1) const; + Symbol script (String idx) const; + Symbol hairpin (Real & width, bool decresc) const; + Symbol dynamic (String) const; Lookup(); Lookup (Lookup const &); ~Lookup(); diff --git a/lily/include/meter-grav.hh b/lily/include/meter-grav.hh index 9c1d72d820..e9e372f8ae 100644 --- a/lily/include/meter-grav.hh +++ b/lily/include/meter-grav.hh @@ -17,20 +17,13 @@ generate meters. */ class Meter_engraver : public Engraver { +protected: + virtual void do_process_requests(); + virtual void do_pre_move_processing(); 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(); - DECLARE_MY_RUNTIME_TYPEINFO; + Meter * meter_p_; + + Meter_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // METERGRAV_HH diff --git a/lily/include/midi-def.hh b/lily/include/midi-def.hh index bb96d961e8..115158dfdc 100644 --- a/lily/include/midi-def.hh +++ b/lily/include/midi-def.hh @@ -13,34 +13,34 @@ #include "real.hh" #include "string.hh" #include "moment.hh" - +#include "music-output-def.hh" /** definitions for midi output. Rather empty */ -struct Midi_def { - // ugh! - static int den_i_s; - static int num_i_s; - - /// output file name - String outfile_str_; - - Input_translator* itrans_p_; - - /// duration of whole note - Real whole_seconds_f_; - - Midi_def(); - Midi_def (Midi_def const& midi_c_r); - ~Midi_def(); - - Real duration_to_seconds_f (Moment); - Global_translator* get_global_translator_p() const; - int get_tempo_i (Moment moment); - void print() const; - void set (Input_translator* itrans_p); - void set_tempo (Moment moment, int count_per_minute_i); +class Midi_def : public Music_output_def { +public: + // ugh! + static int den_i_s; + static int num_i_s; + VIRTUAL_COPY_CONS(Midi_def, Music_output_def); + DECLARE_MY_RUNTIME_TYPEINFO; + Input_translator* itrans_p_; + + /// duration of whole note + Real whole_seconds_f_; + + Midi_def(); + Midi_def (Midi_def const& midi_c_r); + ~Midi_def(); + + Real duration_to_seconds_f (Moment); + int get_tempo_i (Moment moment); + void print() const; + void set (Input_translator* itrans_p); + void set_tempo (Moment moment, int count_per_minute_i); +protected: + virtual Global_translator * get_global_translator_p (); }; #endif // MIDI_DEF_HH diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 636fc659c9..352af5f379 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -1,5 +1,5 @@ /* - music-iterator.hh -- declare {Music,Chord,Voice}_iterator + music-iterator.hh -- declare Music_iterator source file of the GNU LilyPond music typesetter @@ -14,88 +14,34 @@ #include "plist.hh" #include "varray.hh" #include "moment.hh" +#include "virtual-methods.hh" class Music_iterator { - Arrayreport_to_l_arr_; - void push_translator (Translator*); - void pop_translator(); + Arrayreport_to_l_arr_; + void push_translator (Translator*); + void pop_translator(); protected: - bool first_b_; - virtual void do_print()const; + bool first_b_; + virtual void do_print() const; - virtual Translator * get_req_translator_l(); - Music_iterator* get_iterator_p (Music*)const; - void set_translator (Translator*); - Music_iterator *daddy_iter_l_; + virtual Translator * get_req_translator_l(); + Music_iterator* get_iterator_p (Music*) const; + void set_translator (Translator*); + Music_iterator *daddy_iter_l_; public: - Translator *report_to_l()const; - DECLARE_MY_RUNTIME_TYPEINFO; + Translator *report_to_l() const; + DECLARE_MY_RUNTIME_TYPEINFO; - static Music_iterator* static_get_iterator_p (Music*,Translator*); - Music_iterator(); + static Music_iterator* static_get_iterator_p (Music*,Translator*); + Music_iterator(); - virtual void process_and_next (Moment until); - virtual Moment next_moment()const; - virtual bool ok()const; - virtual ~Music_iterator(); - virtual void construct_children(); - void print()const; -}; - - -class Chord_iterator : public Music_iterator -{ - const Chord *chord_C_; - Pointer_list children_p_list_; -public: - ~Chord_iterator(); - Chord_iterator (Chord const*); - DECLARE_MY_RUNTIME_TYPEINFO; -protected: - virtual void do_print()const; - virtual void construct_children(); - virtual void process_and_next (Moment); - virtual Moment next_moment()const; - virtual bool ok()const; -}; - -class Request_chord_iterator : public Music_iterator { - const Request_chord * elt_l_; - Moment elt_duration_; - bool last_b_; -public: - Request_chord_iterator (Request_chord*); - DECLARE_MY_RUNTIME_TYPEINFO; - -protected: - virtual void process_and_next (Moment); - virtual Moment next_moment()const; - virtual void construct_children(); - virtual bool ok()const; - virtual void do_print()const; -}; - - -class Voice_iterator : private PCursor, public Music_iterator -{ - Moment here_mom_; - const Voice * voice_C_; - Music_iterator * iter_p_; - void start_next_element(); - void leave_element(); - void set_voice_translator(); - -public: - Voice_iterator (Voice const*); - DECLARE_MY_RUNTIME_TYPEINFO; -protected: - virtual void do_print()const; - virtual void construct_children(); - ~Voice_iterator(); - virtual void process_and_next (Moment); - virtual Moment next_moment()const; - virtual bool ok()const; + virtual void process_and_next (Moment until); + virtual Moment next_moment() const; + virtual bool ok() const; + virtual ~Music_iterator(); + virtual void construct_children(); + void print() const; }; #endif // MUSIC_ITERATOR_HH diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh index 2ce9625999..f084c19ecb 100644 --- a/lily/include/music-list.hh +++ b/lily/include/music-list.hh @@ -45,7 +45,7 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; VIRTUAL_COPY_CONS(Chord,Music); virtual void translate (Moment dt); - virtual MInterval time_int()const; + virtual MInterval time_int() const; }; /** @@ -71,7 +71,7 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; VIRTUAL_COPY_CONS(Voice, Music); virtual void translate (Moment dt); - virtual MInterval time_int()const; + virtual MInterval time_int() const; }; /** A simple piece of music, which wishes to change the spot of its diff --git a/lily/include/music-output-def.hh b/lily/include/music-output-def.hh new file mode 100644 index 0000000000..b0b8316941 --- /dev/null +++ b/lily/include/music-output-def.hh @@ -0,0 +1,29 @@ +/* + music-output-def.hh -- declare Music_output_def + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef Music_output_DEF_HH +#define Music_output_DEF_HH +#include "string.hh" +#include "lily-proto.hh" +#include "virtual-methods.hh" + +/** + Definition of how to output mudela. + */ +class Music_output_def +{ +public: + VIRTUAL_COPY_CONS(Music_output_def, Music_output_def); + DECLARE_MY_RUNTIME_TYPEINFO; + virtual void print () const {} + virtual ~Music_output_def () {} + virtual Global_translator * get_global_translator_p () { return 0; } + String outfile_str_; +}; +#endif // Music_output_DEF_HH diff --git a/lily/include/music-output.hh b/lily/include/music-output.hh new file mode 100644 index 0000000000..f777f1b6bb --- /dev/null +++ b/lily/include/music-output.hh @@ -0,0 +1,35 @@ +/* + music-output.hh -- declare Music_output + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef Music_output_HH +#define Music_output_HH + +#include "string.hh" +#include "lily-proto.hh" + +/** + Output something that was defined in a mudela file. + */ +class Music_output +{ +public: + Header * header_l_; + String default_out_str_; + String origin_str_; + int errorlevel_i_; + + virtual void process() {} + virtual ~Music_output (){} + Music_output() + { + errorlevel_i_ = 0; + } + +}; +#endif // Music_output_HH diff --git a/lily/include/music.hh b/lily/include/music.hh index 5aec401462..a267fc04eb 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -42,7 +42,7 @@ public: /// what name (or look for this name) String id_str_; - virtual MInterval time_int()const; + virtual MInterval time_int() const; virtual ~Music(){} void print() const; virtual void transpose (Melodic_req const *); diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 2346d1625c..64328afc97 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -22,22 +22,22 @@ class Musical_req : public virtual Request { public: - virtual Lyric_req* lreq_l() { return 0; } - virtual Note_req *note() { return 0;} - virtual Stem_req *stem() { return 0;} - virtual Melodic_req *melodic() { return 0; } - virtual Slur_req *slur() { return 0 ; } - virtual Beam_req *beam() { return 0 ; } - virtual Rhythmic_req*rhythmic() { return 0; } - virtual Musical_script_req*musicalscript() { return 0; } - virtual Text_req*text() { return 0; } - virtual Rest_req *rest() { return 0; } - virtual Skip_req* skip() { return 0; } - virtual Dynamic_req* dynamic() { return 0; } - virtual Absolute_dynamic_req * absdynamic() { return 0; } - virtual Tie_req * tie() { return 0; } - virtual Span_dynamic_req * span_dynamic() { return 0; } - REQUESTMETHODS(Musical_req, musical); + virtual Lyric_req* lreq_l() { return 0; } + virtual Note_req *note() { return 0;} + virtual Stem_req *stem() { return 0;} + virtual Melodic_req *melodic() { return 0; } + virtual Slur_req *slur() { return 0 ; } + virtual Beam_req *beam() { return 0 ; } + virtual Rhythmic_req*rhythmic() { return 0; } + virtual Musical_script_req*musicalscript() { return 0; } + virtual Text_req*text() { return 0; } + virtual Rest_req *rest() { return 0; } + virtual Skip_req* skip() { return 0; } + virtual Dynamic_req* dynamic() { return 0; } + virtual Absolute_dynamic_req * absdynamic() { return 0; } + virtual Tie_req * tie() { return 0; } + virtual Span_dynamic_req * span_dynamic() { return 0; } + REQUESTMETHODS(Musical_req, musical); }; @@ -47,50 +47,50 @@ public: */ class Rhythmic_req : public virtual Musical_req { public: - Duration duration_; + Duration duration_; - /* *************** */ - void set_duration (Duration); - bool do_equal_b (Request*)const; - virtual Moment duration() const; - Rhythmic_req(); - static int compare (Rhythmic_req const&,Rhythmic_req const&); - REQUESTMETHODS(Rhythmic_req, rhythmic); + /* *************** */ + void set_duration (Duration); + bool do_equal_b (Request*) const; + virtual Moment duration() const; + Rhythmic_req(); + static int compare (Rhythmic_req const&,Rhythmic_req const&); + REQUESTMETHODS(Rhythmic_req, rhythmic); }; class Skip_req : public Rhythmic_req { public: - REQUESTMETHODS(Skip_req, skip); + REQUESTMETHODS(Skip_req, skip); }; struct Spacing_req :virtual Request { - Moment next; - Real distance; - Real strength; - /* *************** */ - Spacing_req(); - REQUESTMETHODS(Spacing_req, spacing); + Moment next; + Real distance; + Real strength; + /* *************** */ + Spacing_req(); + REQUESTMETHODS(Spacing_req, spacing); }; class Blank_req : public Spacing_req, Rhythmic_req { public: - REQUESTMETHODS(Spacing_req, spacing); + REQUESTMETHODS(Spacing_req, spacing); }; /// Put a text above or below (?) this staff. class Text_req : public virtual Musical_req { public: - /// preferred position (above/below) - int dir_i_; - /// the characteristics of the text - Text_def *tdef_p_; + /// preferred position (above/below) + Direction dir_; + /// the characteristics of the text + Text_def *tdef_p_; - /* *************** */ - Text_req (int d, Text_def*); - ~Text_req(); - Text_req (Text_req const&); + /* *************** */ + Text_req (int d, Text_def*); + ~Text_req(); + Text_req (Text_req const&); - REQUESTMETHODS(Text_req,text); + REQUESTMETHODS(Text_req,text); }; /** Put a text in lyric_staff @@ -98,65 +98,55 @@ public: */ class Lyric_req : public Rhythmic_req, public Text_req { public: - Lyric_req (Text_def* t_p); - REQUESTMETHODS(Lyric_req, lreq_l); + Lyric_req (Text_def* t_p); + REQUESTMETHODS(Lyric_req, lreq_l); }; /// request which has some kind of pitch struct Melodic_req :virtual Musical_req { - /// 0 is c, 6 is b - int notename_i_; - /// 0 is central c - int octave_i_; + /// 0 is c, 6 is b + int notename_i_; + /// 0 is central c + int octave_i_; /// 0 natural, 1 sharp, etc - int accidental_i_; + int accidental_i_; - /// return height from central c (in halflines) - int height()const; + /// return height from central c (in halflines) + int height() const; - /// transpose. #delta# is relative to central c. - void transpose (Melodic_req const &delta); - /// return pitch from central c (in halfnotes) - int pitch()const; - Melodic_req(); - bool do_equal_b (Request*)const; - static int compare (Melodic_req const&,Melodic_req const&); - REQUESTMETHODS(Melodic_req,melodic); + /// transpose. #delta# is relative to central c. + void transpose (Melodic_req const &delta); + /// return pitch from central c (in halfnotes) + int pitch() const; + Melodic_req(); + bool do_equal_b (Request*) const; + static int compare (Melodic_req const&,Melodic_req const&); + REQUESTMETHODS(Melodic_req,melodic); }; /// Put a note of specified type, height, and with accidental on the staff. class Note_req : public Rhythmic_req, virtual public Melodic_req { public: - /// force/supress printing of accidental. - bool forceacc_b_; - Note_req(); - bool do_equal_b (Request*)const; - Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic (); } - REQUESTMETHODS(Note_req, note); - }; + /// force/supress printing of accidental. + bool forceacc_b_; + Note_req(); + bool do_equal_b (Request*) const; + Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic (); } + REQUESTMETHODS(Note_req, note); +}; /** Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded. */ class Rest_req : public Rhythmic_req { public: - REQUESTMETHODS(Rest_req,rest); + REQUESTMETHODS(Rest_req,rest); }; -/** - attach a stem to the noteball. - Rhythmic_req parent needed to determine if it will fit inside a beam. - */ -class Stem_req : public Rhythmic_req { -public: - /// preferred direction for the stem - int dir_i_; - Stem_req(); - REQUESTMETHODS(Stem_req,stem); -}; + /** Requests to start or stop something. @@ -164,14 +154,14 @@ public: */ class Span_req : public virtual Musical_req { public: - /// should the spanner start or stop, or is it unwanted? - enum { - NOSPAN, START, STOP - } spantype ; - bool do_equal_b (Request*)const; - REQUESTMETHODS(Span_req,span); + /// should the spanner start or stop, or is it unwanted? + enum { + NOSPAN, START, STOP + } spantype ; + bool do_equal_b (Request*) const; + REQUESTMETHODS(Span_req,span); - Span_req(); + Span_req(); }; @@ -179,12 +169,12 @@ public: will try to put an appropriate number over the beam */ class Beam_req : public Span_req { public: - int nplet; + int nplet; - /* *************** */ - REQUESTMETHODS(Beam_req,beam); + /* *************** */ + REQUESTMETHODS(Beam_req,beam); - Beam_req(); + Beam_req(); }; /** @@ -192,45 +182,45 @@ public: */ class Tie_req : public Musical_req { public: - REQUESTMETHODS(Tie_req, tie); + REQUESTMETHODS(Tie_req, tie); }; /// a slur class Slur_req : public Span_req { public: - REQUESTMETHODS(Slur_req,slur); + REQUESTMETHODS(Slur_req,slur); }; class Musical_script_req : public Musical_req, public Script_req { public: - REQUESTMETHODS(Musical_script_req, musicalscript); + REQUESTMETHODS(Musical_script_req, musicalscript); }; class Dynamic_req : public virtual Musical_req { public: - /// for absolute dynamics - enum Loudness { - FFF, FF, F, MF, MP, P, PP, PPP - }; - static String loudness_str (Loudness); - REQUESTMETHODS(Dynamic_req, dynamic); + /// for absolute dynamics + enum Loudness { + FFF, FF, F, MF, MP, P, PP, PPP + }; + static String loudness_str (Loudness); + REQUESTMETHODS(Dynamic_req, dynamic); }; class Absolute_dynamic_req : public Dynamic_req { public: - Loudness loudness_; - Absolute_dynamic_req(); - REQUESTMETHODS(Absolute_dynamic_req, absdynamic); + Loudness loudness_; + Absolute_dynamic_req(); + REQUESTMETHODS(Absolute_dynamic_req, absdynamic); }; class Span_dynamic_req : public Dynamic_req, public Span_req { public: - /// Grow or shrink the volume: 1=cresc, -1 = decresc - int dynamic_dir_i_; - Span_dynamic_req(); - REQUESTMETHODS(Span_dynamic_req, span_dynamic); + /// Grow or shrink the volume: 1=cresc, -1 = decresc + Direction dynamic_dir_; + Span_dynamic_req(); + REQUESTMETHODS(Span_dynamic_req, span_dynamic); }; #endif // MUSICALREQUESTS_HH diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index 766906c282..7930c9c7a2 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -21,7 +21,7 @@ #include "input.hh" class My_lily_parser { - char const* here_ch_C()const; + char const* here_ch_C() const; Array define_spot_array_; String init_str_; @@ -53,7 +53,7 @@ public: Moment plet_mom(); void add_notename (String, Melodic_req* req_p); - Input here_input()const; + Input here_input() const; void remember_spot(); Input pop_spot(); diff --git a/lily/include/note-column-grav.hh b/lily/include/note-column-grav.hh index 43784776f9..9c68248eb1 100644 --- a/lily/include/note-column-grav.hh +++ b/lily/include/note-column-grav.hh @@ -21,10 +21,10 @@ class Note_column_engraver :public Engraver { Note_column *ncol_p_; Rest_column *restcol_p_; bool h_shift_b_; - int dir_i_; + Direction dir_; - bool acceptable_elem_b (Score_elem const*)const; + bool acceptable_elem_b (Score_elem const*) const; protected: virtual void set_feature (Feature); virtual void acknowledge_element (Score_elem_info); diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index 3ee218ec12..3c2eb7568e 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -17,17 +17,16 @@ (chord) and scripts) as a single entity. */ class Note_column : public Head_column { protected: - virtual void do_pre_processing(); + virtual void do_pre_processing(); public: - bool h_shift_b_; + bool h_shift_b_; - Interval_t head_positions_interval()const; + Interval_t head_positions_interval() const; - DECLARE_MY_RUNTIME_TYPEINFO; - Note_column(); - virtual void set (Stem *); - void sort(); + DECLARE_MY_RUNTIME_TYPEINFO; + Note_column(); + void sort(); }; #endif // NOTE_COLUMN_HH diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 6fab4812b5..c6826f2cfc 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -33,7 +33,7 @@ public: int dots_i_; int balltype_i_; int dot_delta_y_i_; - int x_dir_i_; + Direction x_dir_; /* *************** */ @@ -46,9 +46,9 @@ public: void set_dots(); static int compare (Note_head * const &a, Note_head *const &b) ; protected: - virtual void do_print()const; + virtual void do_print() const; virtual void do_pre_processing(); - virtual Molecule* brew_molecule_p()const; + virtual Molecule* brew_molecule_p() const; }; #endif // NOTEHEAD_HH diff --git a/lily/include/offset.hh b/lily/include/offset.hh index b4ed5478ac..ea22500fd7 100644 --- a/lily/include/offset.hh +++ b/lily/include/offset.hh @@ -13,40 +13,40 @@ /// 2d vector struct Offset { - Real coordinate_a_[NO_AXES]; + Real coordinate_a_[NO_AXES]; - Real &y() { return coordinate_a_[Y_AXIS]; } - Real &x() { return coordinate_a_[X_AXIS]; } - Real y()const { return coordinate_a_[Y_AXIS]; } - Real x()const { return coordinate_a_[X_AXIS]; } + Real &y() { return coordinate_a_[Y_AXIS]; } + Real &x() { return coordinate_a_[X_AXIS]; } + Real y() const { return coordinate_a_[Y_AXIS]; } + Real x() const { return coordinate_a_[X_AXIS]; } - Real &operator[](Axis i) { - return coordinate_a_[i]; - } - Real operator[](Axis i) const{ - return coordinate_a_[i]; - } + Real &operator[](Axis i) { + return coordinate_a_[i]; + } + Real operator[](Axis i) const{ + return coordinate_a_[i]; + } - Offset operator+=(Offset o) { - x()+=o.x (); - y()+=o.y (); - return *this; - } - Offset (Real ix , Real iy) { - x()=ix; - y()=iy; - } - Offset() { - x()=0.0; - y()=0.0; - } + Offset operator+=(Offset o) { + x()+=o.x (); + y()+=o.y (); + return *this; + } + Offset (Real ix , Real iy) { + x()=ix; + y()=iy; + } + Offset() { + x()=0.0; + y()=0.0; + } }; inline Offset -operator+(Offset o1, Offset const& o2) +operator+ (Offset o1, Offset const& o2) { - o1 += o2; - return o1; + o1 += o2; + return o1; } #endif // OFFSET_HH diff --git a/lily/include/p-col.hh b/lily/include/p-col.hh index 797fde9584..c297bb7843 100644 --- a/lily/include/p-col.hh +++ b/lily/include/p-col.hh @@ -1,11 +1,17 @@ -#ifndef COLS_HH -#define COLS_HH +/* + p-col.hh -- declare Paper_column + source file of the GNU LilyPond music typesetter -#include "boxes.hh" -#include "plist.hh" -#include "item.hh" + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef P_COL_HH +#define P_COL_HH +#include "horizontal-group-item.hh" +#include "plist.hh" /** stuff grouped vertically. @@ -20,81 +26,64 @@ \end{itemize} */ -class PCol { +class Paper_column : public Horizontal_group_item { public: - Link_list its; - Link_list starters; - - /** prebreak is put before end of line. + DECLARE_MY_RUNTIME_TYPEINFO; + SCORE_ELEM_CLONE(Paper_column); + + /** prebreak is put before end of line. if broken here, then (*this) column is discarded, and prebreak is put at end of line, owned by Col */ - PCol *prebreak_p_; + Paper_column *prebreak_l() const; - /// postbreak at beginning of the new line - PCol *postbreak_p_; - - /** if this column is pre or postbreak, then this field points to - the parent. */ - PCol *daddy_l_; + /// postbreak at beginning of the new line + Paper_column *postbreak_l() const; - /// if lines are broken then this column is in #line# - Line_of_score *line_l_; + /// if lines are broken then this column is in #line# + Line_of_score *line_l_; - /** if lines are broken then this column x-coord #hpos# if not - known, then hpos == -1.(ugh?) */ - - Real hpos_f_; // should use ptr? - - bool error_mark_b_; - bool used_b_ ; // manual override.. + virtual Line_of_score *line_l () const; + bool error_mark_b_; + bool used_b_ ; // manual override.. - Paper_score * pscore_l_; + /* *************** */ - /* *************** */ - /// which one (left =0) - int rank_i() const; + /// which one (left =0) + int rank_i() const; - /// does this column have items - bool used_b() const; - bool breakpoint_b() const; - void clean_breakable_items(); + /// does this column have items + bool used_b() const; + bool breakpoint_b() const; - void add (Item *i); + void add (Item *i); - /// Can this be broken? true eg. for bars. - bool breakable_b()const; - - Interval width() const; - virtual ~PCol(); - PCol(); + Paper_column(); - /** - which col comes first?. - signed compare on columns. + /** + which col comes first?. + signed compare on columns. - @return < 0 if c1 < c2. + @return < 0 if c1 < c2. */ - static int compare (const PCol &c1, const PCol &c2); - void set_rank (int); + static int compare (const Paper_column &c1, const Paper_column &c2); + void set_rank (int); - void OK() const; - void set_breakable(); - virtual void do_set_breakable(); - void print()const; + void OK() const; + virtual void do_print() const; private: - /** - The ranking: left is smaller than right - -1 is uninitialised. - */ - int rank_i_; - PCol (PCol const&){} + /** + The ranking: left is smaller than right + -1 is uninitialised. + */ + int rank_i_; + }; #include "compare.hh" -INSTANTIATE_COMPARE(PCol &, PCol::compare); +INSTANTIATE_COMPARE(Paper_column &, Paper_column::compare); +#endif // P_COL_HH -#endif diff --git a/lily/include/p-score.hh b/lily/include/p-score.hh index 7c497cd919..1ca1f30ac8 100644 --- a/lily/include/p-score.hh +++ b/lily/include/p-score.hh @@ -14,87 +14,74 @@ #include "parray.hh" #include "lily-proto.hh" #include "plist.hh" +#include "music-output.hh" /** all stuff which goes onto paper. notes, signs, symbols in a score #Paper_score# contains the items, the columns. */ -class Paper_score { +class Paper_score : public Music_output { public: - Paper_def *paper_l_; + Paper_def *paper_l_; - /// the columns, ordered left to right - Pointer_list col_p_list_; + /// the columns, ordered left to right + Link_list col_p_list_; - /// the idealspacings, no particular order - Pointer_list suz_p_list_; + /// crescs etc; no particular order + Pointer_list span_p_list_; - /// crescs etc; no particular order - Pointer_list span_p_list_; - - /// other elements - Pointer_list elem_p_list_; - - Super_elem *super_elem_l_; - - /* *************** */ - /* CONSTRUCTION */ + /// other elements + Pointer_list elem_p_list_; - Paper_score (Paper_def*); - /// add a line to the broken stuff. Positions given in #config# - void set_breaking (Array const &); - - /** add an item. - add the item in specified containers. If breakstatus is set - properly, add it to the {pre,post}break of the pcol. - */ - void typeset_item (Item *item_p, PCol *pcol_l); - - /// add to bottom of pcols - void add (PCol*); - - /** - @return argument as a cursor of the list - */ - PCursor find_col (PCol const *)const; - - Link_array col_range (PCol *left_l, PCol *right_l) const; - Link_array breakable_col_range (PCol*,PCol*) const; - Link_array broken_col_range (PCol*,PCol*) const; + Super_elem *super_elem_l_; - /* MAIN ROUTINES */ - void process(); + Paper_score (); + /// add a line to the broken stuff. Positions given in #config# + void set_breaking (Array const &); - /// last deed of this struct - void output (Tex_stream &ts); - /* UTILITY ROUTINES */ + /// add to bottom of pcols + void add_column (Paper_column*); + /** + @return argument as a cursor of the list + */ + PCursor find_col (Paper_column const *) const; + + Link_array col_range (Paper_column *left_l, Paper_column *right_l) const; + Link_array breakable_col_range (Paper_column*,Paper_column*) const; + Link_array broken_col_range (Item const*,Item const*) const; + - /* STANDARD ROUTINES */ - void OK()const; - void print() const; - ~Paper_score(); - void typeset_element (Score_elem*); - void typeset_broken_spanner (Spanner*); - /// add a Spanner - void typeset_unbroken_spanner (Spanner*); + /* STANDARD ROUTINES */ + void OK() const; + void print() const; + + void typeset_element (Score_elem*); + void typeset_broken_spanner (Spanner*); + /// add a Spanner + void typeset_unbroken_spanner (Spanner*); +protected: + /* MAIN ROUTINES */ + virtual void process(); + virtual ~Paper_score(); + private: - /// before calc_breaking - void preprocess(); + /// before calc_breaking + void preprocess(); - void calc_idealspacing(); - /// calculate where the lines are to be broken, and use results - void calc_breaking(); + void calc_idealspacing(); + /// calculate where the lines are to be broken, and use results + void calc_breaking(); - /// after calc_breaking - void postprocess(); + /// after calc_breaking + void postprocess(); - /// delete unused columns - void clean_cols(); + /// delete unused columns + void clean_cols(); }; #endif diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 41b8e2d38e..2210b2f4c2 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -12,9 +12,9 @@ #include "lily-proto.hh" #include "real.hh" -#include "string.hh" -#include "moment.hh" +#include "moment.hh" +#include "music-output-def.hh" /** @@ -27,60 +27,60 @@ TODO: 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_; - Assoc *real_vars_p_; - - Input_translator * itrans_p_; +class Paper_def : public Music_output_def { + Lookup *lookup_p_; + Assoc *real_vars_p_; + + Input_translator * itrans_p_; +protected: + virtual Global_translator * get_global_translator_p(); + VIRTUAL_COPY_CONS(Paper_def,Music_output_def); + DECLARE_MY_RUNTIME_TYPEINFO; public: - String outfile_str_; - - - /* *************** */ - void set_var (String, Real); - Real get_var (String)const; - void reinit(); - Paper_def(); - void set (Lookup*); - void set (Input_translator *); - Global_translator * get_global_translator_p()const; - ~Paper_def(); - Paper_def (Paper_def const&); - /// The distance between beams - Real interbeam_f()const; - /** - The distance between lines - */ - Real interline_f()const; - /// half the distance between lines - Real internote_f()const; - - /// 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 crotchet 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 parameters. - */ - Real duration_to_dist (Moment, Real)const; - Real geometric_spacing(Moment)const; - Real arithmetic_constant(Moment minimal_mom)const; - Real arithmetic_spacing( Moment mom,Real constant)const; + virtual ~Paper_def(); + + void set_var (String, Real); + Real get_var (String) const; + void reinit(); + Paper_def(); + void set (Lookup*); + void set (Input_translator *); + + Paper_def (Paper_def const&); + /// The distance between beams + Real interbeam_f() const; + /** + The distance between lines + */ + Real interline_f() const; + /// half the distance between lines + Real internote_f() const; + + /// 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 crotchet 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 parameters. + */ + Real duration_to_dist (Moment, Real) const; + Real geometric_spacing(Moment) const; + Real arithmetic_constant(Moment minimal_mom) const; + Real arithmetic_spacing( Moment mom,Real constant) const; }; #endif // Paper_def_HH diff --git a/lily/include/performer-group-performer.hh b/lily/include/performer-group-performer.hh index 5c640cc636..e06dd3b017 100644 --- a/lily/include/performer-group-performer.hh +++ b/lily/include/performer-group-performer.hh @@ -43,7 +43,7 @@ protected: bool is_bottom_performer_b() const; virtual Performer_group_performer* find_performer_l (String name, String id); - virtual void do_print()const; + virtual void do_print() const; private: Pointer_list perf_p_list_; diff --git a/lily/include/qlpsolve.hh b/lily/include/qlpsolve.hh index 3ef601188a..9098a02238 100644 --- a/lily/include/qlpsolve.hh +++ b/lily/include/qlpsolve.hh @@ -35,7 +35,7 @@ class Active_constraints { Ineq_constrained_qp const *opt; public: - String status()const; + String status() const; Vector vec (int k) const { return opt->cons[k]; } Real rhs (int k) const { return opt->consrhs[k]; } diff --git a/lily/include/request-iterator.hh b/lily/include/request-iterator.hh new file mode 100644 index 0000000000..866bb7e929 --- /dev/null +++ b/lily/include/request-iterator.hh @@ -0,0 +1,32 @@ +/* + request-iter.hh -- declare Request_chord_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef REQUEST_ITER_HH +#define REQUEST_ITER_HH + +#include "music-iterator.hh" + +class Request_chord_iterator : public Music_iterator { + const Request_chord * elt_l_; + Moment elt_duration_; + bool last_b_; +public: + Request_chord_iterator (Request_chord*); + DECLARE_MY_RUNTIME_TYPEINFO; + +protected: + virtual void process_and_next (Moment); + virtual Moment next_moment() const; + virtual void construct_children(); + virtual bool ok() const; + virtual void do_print() const; +}; + + +#endif // REQUEST_ITER_HH diff --git a/lily/include/request.hh b/lily/include/request.hh index 3dc1eb9ba2..e93f493176 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -15,6 +15,7 @@ #include "virtual-methods.hh" #include "input.hh" #include "music.hh" +#include "direction.hh" /** a voice element wants something printed. @@ -49,7 +50,7 @@ public: bool equal_b (Request*) const; protected: virtual bool do_equal_b (Request*) const; - virtual void do_print()const; + virtual void do_print() const; }; #define REQUESTMETHODS(T,accessor) \ @@ -65,11 +66,11 @@ virtual void do_print() const this also a request */ class Script_req : public virtual Request { public: - int dir_i_; + Direction dir_; General_script_def *scriptdef_p_; /* *************** */ - bool do_equal_b (Request*)const; + bool do_equal_b (Request*) const; Script_req(); REQUESTMETHODS(Script_req,script); diff --git a/lily/include/score-column.hh b/lily/include/score-column.hh index 0e19baa461..699c84a280 100644 --- a/lily/include/score-column.hh +++ b/lily/include/score-column.hh @@ -25,13 +25,15 @@ */ -class Score_column : public PCol { +class Score_column : public Paper_column { friend class Score; friend class Score_engraver; bool musical_b_; Moment when_; public: + DECLARE_MY_RUNTIME_TYPEINFO; + SCORE_ELEM_CLONE(Score_column); /// length of notes/rests in this column Array durations; @@ -42,8 +44,7 @@ public: void add_duration (Moment); void preprocess(); bool musical_b() { return musical_b_; } - void print() const; - virtual void do_set_breakable(); + void do_print() const; }; diff --git a/lily/include/score-elem.hh b/lily/include/score-elem.hh index 7e7259f6a2..c67510040a 100644 --- a/lily/include/score-elem.hh +++ b/lily/include/score-elem.hh @@ -27,144 +27,141 @@ (elem) */ class Score_elem : private Directed_graph_node { - /// member: the symbols - Molecule *output; // should scrap, and use temp var? - - - - /** - for administration of what was done already - */ - enum Status { - ORPHAN, // not yet added to pstaff - VIRGIN, // added to pstaff - PREBREAKING, - PREBROKEN, - PRECALCING, - PRECALCED, // calcs before spacing done - BREAKING, - BROKEN, - POSTCALCING, // busy calculating. This is used to trap cyclic deps. - POSTCALCED, // after spacing calcs done - OUTPUT, // molecule has been output - DELMARKED, // mark for 'unclean' deletion - DELETED, // to catch malloc mistakes. - }; + /// member: the symbols + Molecule *output; // should scrap, and use temp var? + + + + /** + for administration of what was done already + */ + enum Status { + ORPHAN, // not yet added to pstaff + VIRGIN, // added to pstaff + PREBREAKING, + PREBROKEN, + PRECALCING, + PRECALCED, // calcs before spacing done + BREAKING, + BROKEN, + POSTCALCING, // busy calculating. This is used to trap cyclic deps. + POSTCALCED, // after spacing calcs done + BREWED, + TEXOUTPUT, // molecule has been output + DELETED, // to catch malloc mistakes. + }; - Status status_; + Status status_; - Score_elem* dependency (int) const; - Score_elem* dependent (int) const; - int dependent_size() const; - int dependency_size() const; + Score_elem* dependency (int) const; + Score_elem* dependent (int) const; + int dependent_size() const; + int dependency_size() const; public: - /** - This is needed, because #output# may still be - NULL. - */ - Offset offset_; + /** + This is needed, because #output# may still be + NULL. + */ + Offset offset_; - Paper_score *pscore_l_; - Axis_group_element * axis_group_l_a_[2]; + Paper_score *pscore_l_; + Axis_group_element * axis_group_l_a_[NO_AXES]; - Score_elem (Score_elem const&); - virtual String TeX_string() const ; - String TeX_string_without_offset (Offset)const; + Score_elem (Score_elem const&); + virtual String TeX_output_str () const ; virtual void print() const; - Paper_def *paper() const; + Paper_def *paper() const; - virtual ~Score_elem(); - Score_elem(); - DECLARE_MY_RUNTIME_TYPEINFO; + virtual ~Score_elem(); + Score_elem(); + DECLARE_MY_RUNTIME_TYPEINFO; - Interval extent (Axis)const; - Interval width() const; - Interval height() const; - Status status() const; + Interval extent (Axis) const; + Interval width() const; + Interval height() const; + Status status() const; - /** - translate the symbol. The symbol does not have to be created yet. - */ - void translate (Offset); - /** - translate in one direction - */ + /** + translate the symbol. The symbol does not have to be created yet. + */ + void translate (Offset); + /** + translate in one direction + */ - void translate (Real, Axis); - Real relative_coordinate (Axis_group_element*, Axis)const; - Offset absolute_offset()const; - Real absolute_coordinate (Axis)const; - Axis_group_element*common_group (Score_elem const* s, Axis a)const; - - void add_processing(); - void OK() const; - void pre_processing(); - void breakable_col_processing(); - void break_processing(); + void translate (Real, Axis); + Real relative_coordinate (Axis_group_element*, Axis) const; + Offset absolute_offset() const; + Real absolute_coordinate (Axis) const; + Axis_group_element*common_group (Score_elem const* s, Axis a) const; + + void add_processing(); + void OK() const; + void pre_processing(); + void breakable_col_processing(); + void break_processing(); - void post_processing(); - void molecule_processing(); - - /** - Remove all links (dependencies, dependents, Axis_group_elements. - */ - void unlink(); - void unlink_all(); - void substitute_dependency (Score_elem*,Score_elem*); - void remove_dependency (Score_elem*); - /** - add a dependency. It may be the 0 pointer, in which case, it is ignored. - */ - void add_dependency (Score_elem*); - void copy_dependencies (Score_elem const&); - /** - junk the dependency array. Don't do derived stuff. - */ - void junk_dependencies(); - - - /* - virtual accessors - */ - - virtual Spanner* spanner() { return 0; } - virtual Item * item() { return 0; } - virtual Line_of_score * line_l() const; - SCORE_ELEM_CLONE(Score_elem); + void post_processing(); + void molecule_processing(); + + /** + Remove all links (dependencies, dependents, Axis_group_elements. + */ + void unlink(); + void unlink_all(); + void substitute_dependency (Score_elem*,Score_elem*); + void remove_dependency (Score_elem*); + /** + add a dependency. It may be the 0 pointer, in which case, it is ignored. + */ + void add_dependency (Score_elem*); + + /* + virtual accessors + */ + + virtual Spanner* spanner() { return 0; } + virtual Item * item() { return 0; } + virtual Line_of_score * line_l() const; + virtual bool linked_b() const; + SCORE_ELEM_CLONE(Score_elem); - /// no dimension, translation is noop - bool empty_b_; - /// do not print anything black - bool transparent_b_; + /// no dimension, translation is noop + bool empty_b_; + /// do not print anything black + bool transparent_b_; protected: - virtual Interval do_height()const; - virtual Interval do_width()const; + virtual Interval do_height() const; + virtual Interval do_width() const; - /// do printing of derived info. - virtual void do_print() const {} - /// generate the molecule - virtual Molecule* brew_molecule_p()const; - ///executed directly after the item is added to the Paper_score - virtual void do_add_processing(); - /// do calculations before determining horizontal spacing - virtual void do_pre_processing(); - - virtual void do_breakable_col_processing(); - /// do calculations after determining horizontal spacing - virtual void do_post_processing(); + /// do printing of derived info. + virtual void do_print() const {} + /// generate the molecule + virtual Molecule* brew_molecule_p() const; + ///executed directly after the item is added to the Paper_score + virtual void do_add_processing(); + /// do calculations before determining horizontal spacing + virtual void do_pre_processing(); + + virtual void do_breakable_col_processing(); + /// do calculations after determining horizontal spacing + virtual void do_post_processing(); + virtual String do_TeX_output_str () const; - virtual void do_substitute_dependency (Score_elem * , Score_elem *); - virtual void do_substitute_dependent (Score_elem *, Score_elem *); - virtual void do_break_processing(); - virtual void handle_broken_dependencies(); - virtual void handle_prebroken_dependencies(); - virtual Link_array get_extra_dependencies()const; - virtual void do_unlink(); + virtual void do_substitute_dependency (Score_elem * , Score_elem *); + virtual void do_substitute_dependent (Score_elem *, Score_elem *); + virtual void do_break_processing(); + virtual void handle_broken_dependencies(); + virtual void handle_prebroken_dependencies(); + virtual Link_array get_extra_dependencies() const; + virtual void do_unlink(); + virtual void do_junk_links(); + String make_TeX_string (Offset) const; }; diff --git a/lily/include/score-grav.hh b/lily/include/score-grav.hh index 5cb3936bb5..6328c9bd26 100644 --- a/lily/include/score-grav.hh +++ b/lily/include/score-grav.hh @@ -17,48 +17,44 @@ Top level engraver. Puts elements into appropriate columns. */ class Score_engraver : - public Engraver_group_engraver, public Global_translator + public Engraver_group_engraver, public Global_translator { - Line_of_score * scoreline_l_; - bool disallow_break_b_; - int breaks_i_; + Line_of_score * scoreline_l_; + bool disallow_break_b_; + int breaks_i_; + Link_array elem_p_arr_; - Array nobreak_item_p_arr_; - Link_array musical_item_p_arr_; + Score_column* command_column_l_; + Score_column* musical_column_l_; - Score_column* command_column_l_; - Score_column* musical_column_l_; - - friend class Score; - void set_columns (Score_column*,Score_column*); - void typeset_all(); + void set_columns (Score_column*,Score_column*); + void typeset_all(); public: - DECLARE_MY_RUNTIME_TYPEINFO; - - Score_engraver(); + Paper_score * pscore_p_; + DECLARE_MY_RUNTIME_TYPEINFO; + Score_engraver(); + virtual Music_output *get_output_p (); 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);} + 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 do_announces(); - virtual void typeset_element (Score_elem*elem_p); - virtual Paper_def * paper() const; - virtual void do_pre_move_processing(); + /* 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 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-performer.hh b/lily/include/score-performer.hh index 1a56148425..2638962d83 100644 --- a/lily/include/score-performer.hh +++ b/lily/include/score-performer.hh @@ -15,30 +15,30 @@ Top level performer. Completely takes care of MIDI output */ class Score_performer: - public Performer_group_performer, public Global_translator + public Performer_group_performer, public Global_translator { public: - DECLARE_MY_RUNTIME_TYPEINFO; - Score_performer(); - ~Score_performer(); + DECLARE_MY_RUNTIME_TYPEINFO; + Score_performer(); + ~Score_performer(); + Audio_score *performance_p_; protected: - virtual Translator* ancestor_l (int l); - virtual int depth_i() const; - - virtual void finish(); - virtual void prepare (Moment mom); - virtual void process(); - virtual void set_score (Score* score_l); - virtual void start(); - virtual int get_tempo_i() const; - virtual void play (Audio_element* p); - + virtual Translator* ancestor_l (int l); + virtual int depth_i() const; + + virtual void finish(); + virtual void prepare (Moment mom); + virtual void process(); + virtual void start(); + virtual int get_tempo_i() const; + virtual void play (Audio_element* p); + virtual Music_output *get_output_p (); private: - void header (Midi_stream&); + void header (Midi_stream&); - Moment now_mom_; - Audio_column* audio_column_l_; + Moment now_mom_; + Audio_column* audio_column_l_; }; #endif // SCORE_PERFORMER_HH diff --git a/lily/include/score.hh b/lily/include/score.hh index aa2501d9c2..8d9666b0c5 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -13,69 +13,31 @@ #include "varray.hh" #include "lily-proto.hh" #include "plist.hh" -#include "moment.hh" -#include "assoc.hh" #include "string.hh" #include "input.hh" #include "lily-proto.hh" +#include "parray.hh" /// the total music def of one movement class Score: public Input { public: - /// paper_, staffs_ and commands_ form the problem definition. - Paper_def *paper_p_; - Midi_def *midi_p_; - Music * music_p_; - Paper_score *pscore_p_; - Audio_score* audio_score_p_; - Header * header_p_; + /// paper_, staffs_ and commands_ form the problem definition. + Link_array def_p_arr_; + Music * music_p_; + Header * header_p_; - int errorlevel_i_; + int errorlevel_i_; - /* *************************************************************** */ - - /// construction - Score(); - Score (Score const&); - ~Score(); - - /// do everything except outputting to file - void process(); - - /// output to file - void output (String fn); - - /// - void set (Midi_def* midi_p); - /// - void set (Paper_def* midi_p); - - void print() const; - + /// construction + Score(); + Score (Score const&); + ~Score(); + + void process(); + void add (Music_output_def *def_p); + void print() const; private: - void run_translator (Global_translator*); - void midi_output(); - void paper_output(); - - /// do midi stuff - void midi(); - - /// do paper stuff - void paper(); - - // utils: - PCursor create_cols (Moment, PCursor &last); - - /** - make the pcol_l_ fields of each Score_column point to the correct PCol, - remove any unnecessary Score_column's - */ - void do_cols(); - - /// remove unused cols - void clean_cols(); - - /// add #Idealspacings# to #pscore_# - void calc_idealspacing(); + void run_translator (Music_output_def*); }; + #endif diff --git a/lily/include/scoreline.hh b/lily/include/scoreline.hh index 9b9cf7d33f..fc1cac844e 100644 --- a/lily/include/scoreline.hh +++ b/lily/include/scoreline.hh @@ -8,31 +8,33 @@ #define SCORELINE_HH #include "colhpos.hh" -#include "spanner-elem-group.hh" +#include "spanner.hh" /// the columns of a score that form one line. -class Line_of_score : public Spanner{ +class Line_of_score : public Spanner +{ public: - Link_array cols; - bool error_mark_b_; - virtual String TeX_string() const; + Link_array cols; + bool error_mark_b_; + virtual String TeX_output_str () const; - DECLARE_MY_RUNTIME_TYPEINFO; - Line_of_score(); + DECLARE_MY_RUNTIME_TYPEINFO; + Line_of_score(); - void add (Score_elem *); + void add (Score_elem *); - /// is #c# contained in #*this#? - bool contains_b (PCol const *c)const; + /// is #c# contained in #*this#? + bool contains_b (Paper_column const *c) const; - Link_array get_lines()const; - void set_breaking (Array const&); + Link_array get_lines() const; + void set_breaking (Array const&); protected: - virtual void break_into_pieces (bool); - virtual Interval do_width()const; - virtual void do_print() const; - SCORE_ELEM_CLONE(Line_of_score); + virtual void do_breakable_col_processing (); + virtual void break_into_pieces (bool); + virtual Interval do_width() const; + virtual void do_print() const; + SCORE_ELEM_CLONE(Line_of_score); }; #endif diff --git a/lily/include/script-def.hh b/lily/include/script-def.hh index 1dd72b7ec7..ac5bf63561 100644 --- a/lily/include/script-def.hh +++ b/lily/include/script-def.hh @@ -12,37 +12,37 @@ /** The characteristics of a certain kind of accent. It is not the accent itself. */ class Script_def : public General_script_def { - /// invert if below staff? - bool invertsym_b_; - String symidx_str_; + /// invert if below staff? + bool invertsym_b_; + String symidx_str_; - /// on the other side of the stem? - int rel_stem_dir_i_; + /// on the other side of the stem? + Direction rel_stem_dir_; - /// below or above staff? - int staff_dir_i_; + /// below or above staff? + Direction staff_dir_; - /// how close to the note do we want to be? - int priority_i_; + /// how close to the note do we want to be? + int priority_i_; - /// follow the ball inside staff? - bool inside_staff_b_; + /// follow the ball inside staff? + bool inside_staff_b_; public: - virtual int staff_dir_i()const; - virtual int rel_stem_dir_i()const; - virtual int priority_i()const; - virtual bool inside_b()const; - virtual Atom get_atom (Paper_def* p, int dir_i_)const; - DECLARE_MY_RUNTIME_TYPEINFO; - - virtual bool do_equal_b (General_script_def const *)const; - virtual void do_print() const; - Script_def(); - void set_from_input (String, bool, int, int ,bool,int); + virtual Direction staff_dir() const; + virtual Direction rel_stem_dir() const; + virtual int priority_i() const; + virtual bool inside_b() const; + virtual Atom get_atom (Paper_def* p, Direction dir_) const; + DECLARE_MY_RUNTIME_TYPEINFO; + + virtual bool do_equal_b (General_script_def const *) const; + virtual void do_print() const; + Script_def(); + void set_from_input (String, bool, int, int ,bool,int); protected: - VIRTUAL_COPY_CONS(Script_def,General_script_def); + VIRTUAL_COPY_CONS(Script_def,General_script_def); }; diff --git a/lily/include/script.hh b/lily/include/script.hh index c15eae6330..35a945af5a 100644 --- a/lily/include/script.hh +++ b/lily/include/script.hh @@ -18,10 +18,10 @@ class Script : public Item, public Staff_side { Stem *stem_l_; protected: - Molecule *brew_molecule_p()const; + Molecule *brew_molecule_p() const; virtual void do_substitute_dependency (Score_elem*,Score_elem*); virtual void do_print() const; - virtual Interval symbol_height()const; + virtual Interval symbol_height() const; virtual void do_pre_processing(); virtual Interval do_width() const; SCORE_ELEM_CLONE(Script); diff --git a/lily/include/slur-grav.hh b/lily/include/slur-grav.hh index 35b2ca0df3..6662399cc7 100644 --- a/lily/include/slur-grav.hh +++ b/lily/include/slur-grav.hh @@ -15,7 +15,7 @@ class Slur_engraver :public Engraver { Array new_slur_req_l_arr_; Array slur_l_stack_; Array end_slur_l_arr_; - int dir_i_; + Direction dir_; /* *************** */ protected: virtual ~Slur_engraver(); diff --git a/lily/include/span-bar-grav.hh b/lily/include/span-bar-grav.hh index eda25e6ffa..8cb16c1302 100644 --- a/lily/include/span-bar-grav.hh +++ b/lily/include/span-bar-grav.hh @@ -31,7 +31,7 @@ protected: virtual void acknowledge_element (Score_elem_info); virtual void do_pre_move_processing(); - virtual Span_bar* get_span_bar_p()const; + virtual Span_bar* get_span_bar_p() const; }; #endif // SPAN_BAR_GRAV_HH diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index 644d9de0b4..d49974c902 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -24,11 +24,11 @@ public: void set (Vertical_align_element *); protected: - virtual Interval do_width()const; + virtual Interval do_width() const; virtual void do_pre_processing(); virtual void do_substitute_dependency (Score_elem*,Score_elem*); - virtual Molecule * brew_molecule_p()const; + virtual Molecule * brew_molecule_p() const; virtual Symbol get_bar_sym (Real dy) const; }; diff --git a/lily/include/span-score-bar-grav.hh b/lily/include/span-score-bar-grav.hh index 836424c0c2..7881c183e7 100644 --- a/lily/include/span-score-bar-grav.hh +++ b/lily/include/span-score-bar-grav.hh @@ -23,7 +23,7 @@ class Span_score_bar_engraver : public Span_bar_engraver { public: DECLARE_MY_RUNTIME_TYPEINFO; - virtual Span_bar* get_span_bar_p()const; + virtual Span_bar* get_span_bar_p() const; }; /** diff --git a/lily/include/span-score-bar.hh b/lily/include/span-score-bar.hh index ace2c84dc9..5b25faa3ca 100644 --- a/lily/include/span-score-bar.hh +++ b/lily/include/span-score-bar.hh @@ -31,7 +31,7 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Piano_brace); protected: - virtual Interval do_width()const; + virtual Interval do_width() const; virtual Symbol get_bar_sym (Real) const; }; diff --git a/lily/include/spanner-elem-group.hh b/lily/include/spanner-elem-group.hh deleted file mode 100644 index 2f65af207b..0000000000 --- a/lily/include/spanner-elem-group.hh +++ /dev/null @@ -1,25 +0,0 @@ -/* - spanner-elem-group.hh -- declare Spanner_elem_group - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef SPANNER_ELEM_GROUP_HH -#define SPANNER_ELEM_GROUP_HH - -#include "spanner.hh" -#include "elem-group.hh" - -class Spanner_elem_group : public Spanner, public Horizontal_vertical_group_element { - -protected: - virtual Interval do_width()const; - virtual void do_print() const; - SCORE_ELEM_CLONE(Spanner_elem_group); -public: - DECLARE_MY_RUNTIME_TYPEINFO; -}; -#endif // SPANNER_ELEM_GROUP_HH diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 1152be157b..44529faaf0 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -9,6 +9,7 @@ #include "lily-proto.hh" #include "score-elem.hh" +#include "drul-array.hh" /** A symbol which is attached between two columns. A spanner is a symbol which spans across several columns, so its final appearance @@ -30,30 +31,35 @@ length of stems of notes they encompass. */ -class Spanner:public virtual Score_elem { +class Spanner : public virtual Score_elem { public: - PCol *left_col_l_, *right_col_l_; - - /* *************** */ - DECLARE_MY_RUNTIME_TYPEINFO; - virtual Spanner* spanner() { return this; } - Spanner(); - bool broken_b() const; - Spanner* find_broken_piece (Line_of_score*)const; + + Drul_array spanned_drul_; + void set_bounds(Direction d, Item*); + + DECLARE_MY_RUNTIME_TYPEINFO; + virtual Spanner* spanner() { return this; } + Spanner(); + bool broken_b() const; + + Spanner* find_broken_piece (Line_of_score*) const; protected: - void set_my_columns(); - SCORE_ELEM_CLONE(Spanner); - - /** - this is virtual; for instance, Line_of_score overrides it. - */ - virtual void break_into_pieces (bool); - - Link_array broken_into_l_arr_; - - virtual void do_break_processing(); - virtual Interval do_width()const; - virtual void do_print()const; - virtual Line_of_score*line_l()const; + void set_my_columns(); + SCORE_ELEM_CLONE(Spanner); + + /** + this is virtual; for instance, Line_of_score overrides it. + */ + virtual void break_into_pieces (); + + Link_array broken_into_l_arr_; + + virtual void do_unlink(); + virtual void do_junk_links(); + virtual String do_TeX_output_str () const; + virtual void do_break_processing(); + virtual Interval do_width() const; + virtual void do_print() const; + virtual Line_of_score*line_l() const; }; #endif diff --git a/lily/include/spring-spacer.hh b/lily/include/spring-spacer.hh index e8dc25db3b..22c4d9634e 100644 --- a/lily/include/spring-spacer.hh +++ b/lily/include/spring-spacer.hh @@ -51,7 +51,7 @@ class Spring_spacer : public Line_spacer { /// mark column #i# as being loose. void loosen_column (int i); /// the index of #c# in #cols# - int col_id (PCol const *c) const; + int col_id (Paper_column const *c) const; /// generate an (nonoptimal) solution Vector find_initial_solution() const; @@ -60,7 +60,7 @@ class Spring_spacer : public Line_spacer { bool check_feasible() const; /// does #this# contain the column #w#? - bool contains (PCol const *w); + bool contains (Paper_column const *w); /// make the energy function void make_matrices (Matrix &quad, Vector &lin,Real&) const; @@ -82,17 +82,17 @@ class Spring_spacer : public Line_spacer { void add_ideal (Idealspacing const *i); Vector try_initial_solution() const; void calc_idealspacing(); - void set_fixed_cols (Mixed_qp&)const; + void set_fixed_cols (Mixed_qp&) const; Score_column* scol_l (int); void connect (int i,int j, Real,Real); - Line_of_cols error_pcol_l_arr()const; + Line_of_cols error_pcol_l_arr() const; public: static Line_spacer *constructor(); virtual void solve (Col_hpositions*) const; virtual void lower_bound_solution (Col_hpositions*) const; - virtual void add_column (PCol *, bool fixed=false, Real fixpos=0.0); + virtual void add_column (Paper_column *, bool fixed=false, Real fixpos=0.0); virtual Vector default_solution() const; diff --git a/lily/include/staff-info.hh b/lily/include/staff-info.hh index 5cceb59bdb..f5413d9346 100644 --- a/lily/include/staff-info.hh +++ b/lily/include/staff-info.hh @@ -28,10 +28,10 @@ struct Staff_info { Score * score_l_; Moment when(); Score *score_l(); - PCol * command_pcol_l(); + Paper_column * command_pcol_l(); Score_column* musical_l(); Score_column *command_l(); - PCol * musical_pcol_l(); + Paper_column * musical_pcol_l(); Staff_info(); }; diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index 7e7a75ea02..c682c9efbd 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -12,6 +12,7 @@ #include "score-elem.hh" #include "interval.hh" +#include "direction.hh" /** A symbol which sits along a staff. @@ -19,9 +20,9 @@ class Staff_side : virtual Score_elem { Link_array support_l_arr_; int staff_size_i_; - Interval support_height()const; + Interval support_height() const; Staff_symbol* staff_sym_l_; - int get_position_i()const; + int get_position_i() const; void read_staff_sym(); public: @@ -29,7 +30,7 @@ public: /** Vertical dir of symbol relative to staff. -1 = below staff? */ - int dir_i_; + Direction dir_; Interval sym_int_; /// follow the support inside the staff? diff --git a/lily/include/staff-sym.hh b/lily/include/staff-sym.hh index 705d92b0e5..31b69273cc 100644 --- a/lily/include/staff-sym.hh +++ b/lily/include/staff-sym.hh @@ -17,19 +17,16 @@ */ class Staff_symbol : public Spanner { - /// this many lines. - int no_lines_i_; + /// this many lines. + int no_lines_i_; public: - - - void set_extent (PCol* p1, PCol* p2); - DECLARE_MY_RUNTIME_TYPEINFO; - Staff_symbol (int lines); - Real inter_note_f()const; - int steps_i()const; + DECLARE_MY_RUNTIME_TYPEINFO; + Staff_symbol (int lines); + Real inter_note_f() const; + int steps_i() const; protected: - SCORE_ELEM_CLONE(Staff_symbol); - virtual Molecule* brew_molecule_p() const; - virtual void do_print()const; + SCORE_ELEM_CLONE(Staff_symbol); + virtual Molecule* brew_molecule_p() const; + virtual void do_print() const; }; #endif // STAFFSYM_HH diff --git a/lily/include/stem-beam-grav.hh b/lily/include/stem-beam-grav.hh deleted file mode 100644 index c7fe5ff4e8..0000000000 --- a/lily/include/stem-beam-grav.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* - stem-beam-grav.hh -- part of GNU LilyPond - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef STEMBEAMGRAV_HH -#define STEMBEAMGRAV_HH -#include "engraver.hh" - -/** - TODO: - override default_grouping if setting a n-plet - - */ -class Stem_beam_engraver : public Engraver { - Stem * stem_p_; - Beam * beam_p_; - Beam_req * beam_req_l_; - Stem_req * stem_req_l_; - Beam_req * start_req_l_; - bool end_beam_b_; - Rhythmic_grouping *current_grouping; - int default_dir_i_; -public: - /* *************** */ - DECLARE_MY_RUNTIME_TYPEINFO; - Stem_beam_engraver(); - -protected: - ~Stem_beam_engraver(); - virtual void set_feature (Feature dir_i_); - virtual bool do_try_request (Request*); - virtual void do_process_requests(); - virtual void acknowledge_element (Score_elem_info); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); -}; -#endif // STEMBEAMGRAV_HH diff --git a/lily/include/stem-grav.hh b/lily/include/stem-grav.hh new file mode 100644 index 0000000000..c5807f70be --- /dev/null +++ b/lily/include/stem-grav.hh @@ -0,0 +1,33 @@ +/* + stem-grav.hh -- declare Stem_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef STEM_GRAV_HH +#define STEM_GRAV_HH + +#include "engraver.hh" + +/** + Make stems upon receiving noteheads. + */ +class Stem_engraver : public Engraver +{ + Direction dir_; + Stem *stem_p_; + Rhythmic_req *rhythmic_req_l_; +protected: + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing (); + virtual void set_feature (Feature dir_i_); + +public: + Stem_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; +}; + +#endif // STEM_GRAV_HH diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 3ea7c35608..4cf67df0e2 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -28,75 +28,75 @@ */ class Stem : public Item { - Real stem_bottom_f_, stem_top_f_; + Real stem_bottom_f_, stem_top_f_; - /// needed for determining direction/length - int staff_size_i_; - - /**extent of the stem (positions). - fractional, since Beam has to adapt them. - */ - - - /** - geen gedonder, jij gaat onder. - -1 stem points down, +1: stem points up - */ - Real stem_xoffset_f_; - /** - store the wholes (for vapourware tremolo) - */ - Link_array whole_l_arr_; - Link_array head_l_arr_; - Link_array rest_l_arr_; + /// needed for determining direction/length + int staff_size_i_; + + /**extent of the stem (positions). + fractional, since Beam has to adapt them. + */ + + + /** + geen gedonder, jij gaat onder. + -1 stem points down, +1: stem points up + */ + Real stem_xoffset_f_; + /** + store the wholes (for vapourware tremolo) + */ + Link_array whole_l_arr_; + Link_array head_l_arr_; + Link_array rest_l_arr_; public: - /// flagtype? 4 none, 8 8th flag, 0 = beam. - int flag_i_; + /// flagtype? 4 none, 8 8th flag, 0 = beam. + int flag_i_; - int beams_left_i_; - int beams_right_i_; + int beams_left_i_; + int beams_right_i_; - /// false if in beam - bool print_flag_b_; + /// false if in beam + bool print_flag_b_; - int dir_i_; + Direction dir_; - /* *************** */ - Stem (int staff_size_i); + /* *************** */ + Stem (); - /// ensure that this Stem also encompasses the Notehead #n# - void add (Note_head*n); + /// ensure that this Stem also encompasses the Notehead #n# + void add (Note_head*n); - DECLARE_MY_RUNTIME_TYPEINFO; + DECLARE_MY_RUNTIME_TYPEINFO; - Real hpos_f()const; + Real hpos_f() const; - void do_print() const; - void set_stemend (Real); - int get_default_dir(); - int get_center_distance_from_top(); - int get_center_distance_from_bottom(); - void set_default_dir(); - void set_default_stemlen(); - void set_default_extents(); - void set_noteheads(); - - Real stem_length_f()const; - Real stem_end_f()const; - Real stem_start_f() const; - - bool invisible_b()const; + void do_print() const; + void set_stemend (Real); + Direction get_default_dir(); + int get_center_distance_from_top(); + int get_center_distance_from_bottom(); + void set_default_dir(); + void set_default_stemlen(); + void set_default_extents(); + void set_noteheads(); + + Real stem_length_f() const; + Real stem_end_f() const; + Real stem_start_f() const; + + bool invisible_b() const; - /// heads that the stem encompasses (positions) - int max_head_i() const; - int min_head_i() const; + /// heads that the stem encompasses (positions) + int max_head_i() const; + int min_head_i() const; protected: - virtual void do_substitute_dependency (Score_elem*,Score_elem*); - virtual void do_pre_processing(); - virtual Interval do_width() const; - Molecule* brew_molecule_p() const; + virtual void do_substitute_dependency (Score_elem*,Score_elem*); + virtual void do_pre_processing(); + virtual Interval do_width() const; + Molecule* brew_molecule_p() const; }; #endif diff --git a/lily/include/super-elem.hh b/lily/include/super-elem.hh index eb12e833a1..1b5a994037 100644 --- a/lily/include/super-elem.hh +++ b/lily/include/super-elem.hh @@ -20,7 +20,7 @@ public: Line_of_score * line_of_score_l_; void add_broken_line (Line_of_score*); Super_elem(); - virtual String TeX_string()const; + virtual String TeX_output_str() const; protected: virtual void do_substitute_dependency (Score_elem*,Score_elem*); virtual void handle_broken_dependencies(); diff --git a/lily/include/symbol.hh b/lily/include/symbol.hh index f099fc657b..09f7e14e4a 100644 --- a/lily/include/symbol.hh +++ b/lily/include/symbol.hh @@ -19,7 +19,7 @@ struct Symbol { Symbol (String, Box); Symbol(); - String str()const; // for printing. + String str() const; // for printing. }; diff --git a/lily/include/symtable.hh b/lily/include/symtable.hh index 43a21aa501..c0768988b9 100644 --- a/lily/include/symtable.hh +++ b/lily/include/symtable.hh @@ -10,8 +10,8 @@ struct Symtable : public Assoc { String id_str; - Symbol lookup (String)const; - void print()const; + Symbol lookup (String) const; + void print() const; }; @@ -22,7 +22,7 @@ struct Symtables : private Assoc { Symtables(); Symtables (Symtables const&); void add (String, Symtable*); - void print()const; + void print() const; }; diff --git a/lily/include/text-def.hh b/lily/include/text-def.hh index 3f13add205..d40a4c7b27 100644 --- a/lily/include/text-def.hh +++ b/lily/include/text-def.hh @@ -14,7 +14,7 @@ class Text_def : public General_script_def { protected: - virtual Atom get_atom (Paper_def* p, int dir_i_)const; + virtual Atom get_atom (Paper_def* p, Direction dir_) const; DECLARE_MY_RUNTIME_TYPEINFO; VIRTUAL_COPY_CONS(Text_def,General_script_def); public: @@ -30,7 +30,7 @@ public: virtual void do_print() const; virtual ~Text_def() {}; - virtual bool do_equal_b (const General_script_def*)const; + virtual bool do_equal_b (const General_script_def*) const; Text_def(); virtual void print() const; Interval width (Paper_def*) const; diff --git a/lily/include/text-grav.hh b/lily/include/text-grav.hh index 80540bae26..8bc0bb44a9 100644 --- a/lily/include/text-grav.hh +++ b/lily/include/text-grav.hh @@ -12,7 +12,7 @@ class Text_engraver : public Engraver{ Text_item * text_p_; Text_req * text_req_l_; - int dir_i_; + Direction dir_; /* *************** */ protected: virtual void set_feature (Feature); diff --git a/lily/include/text-item.hh b/lily/include/text-item.hh index 4543640540..ba7ae59db6 100644 --- a/lily/include/text-item.hh +++ b/lily/include/text-item.hh @@ -24,14 +24,14 @@ public: /* ***************/ - Text_item (General_script_def*,int dir=0); + Text_item (General_script_def*,Direction dir=0); virtual ~Text_item(); DECLARE_MY_RUNTIME_TYPEINFO; protected: General_script_def * tdef_p_; - virtual Interval symbol_height()const; + virtual Interval symbol_height() const; virtual Molecule* brew_molecule_p() const; virtual void do_pre_processing(); diff --git a/lily/include/text-spanner.hh b/lily/include/text-spanner.hh index 3bed168787..c5c9cae052 100644 --- a/lily/include/text-spanner.hh +++ b/lily/include/text-spanner.hh @@ -30,7 +30,7 @@ protected: virtual void do_pre_processing(); virtual void do_post_processing(); virtual Interval height() const ; - virtual Molecule* brew_molecule_p()const; + virtual Molecule* brew_molecule_p() const; virtual void do_print() const; }; #endif // TEXTSPANNER_HH diff --git a/lily/include/tie-grav.hh b/lily/include/tie-grav.hh index 63f472e3d8..ecdfd4fea7 100644 --- a/lily/include/tie-grav.hh +++ b/lily/include/tie-grav.hh @@ -17,7 +17,7 @@ class Tie_engraver : public Engraver { Tie * tie_p_; Moment end_mom_; Tie_req * req_l_; - int dir_i_; + Direction dir_; Tie_req *end_req_l_; Melodic_req * end_melodic_req_l_; Melodic_req * melodic_req_l_; diff --git a/lily/include/tie.hh b/lily/include/tie.hh index fde107fb81..30673fc9ee 100644 --- a/lily/include/tie.hh +++ b/lily/include/tie.hh @@ -23,9 +23,9 @@ class Tie : public Bow { public: bool same_pitch_b_; - Note_head * left_head_l_; - Note_head * right_head_l_; - void set_head (int, Note_head*head_l); + Drul_array head_l_drul_; + + void set_head (Direction, Note_head*head_l); Tie(); DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/time-description.hh b/lily/include/time-description.hh index cbc25ded74..cafd9a0664 100644 --- a/lily/include/time-description.hh +++ b/lily/include/time-description.hh @@ -39,12 +39,12 @@ struct Time_description { Time_description(); void add (Moment dt); bool allow_meter_change_b(); - String str()const; + String str() const; void print() const; void setpartial (Moment p); - String try_set_partial_str (Moment)const; - Moment barleft()const; - Moment next_bar_moment()const; + String try_set_partial_str (Moment) const; + Moment barleft() const; + Moment next_bar_moment() const; void set_meter (int,int); static int compare (const Time_description&, const Time_description&); }; diff --git a/lily/include/timing-grav.hh b/lily/include/timing-grav.hh index d65a831689..be8b6730a0 100644 --- a/lily/include/timing-grav.hh +++ b/lily/include/timing-grav.hh @@ -20,19 +20,21 @@ */ class Timing_engraver : public Engraver { - Time_description time_; - Rhythmic_grouping default_grouping_; - - Link_array timing_req_l_arr_; - - 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(); - Timing_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; -} +public: + Time_description time_; + Rhythmic_grouping default_grouping_; + Link_array timing_req_l_arr_; +protected: + virtual void do_creation_processing (); + 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_post_move_processing(); +public: + Meter_change_req * meter_req_l () const; + Timing_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; +}; #endif // TIMING_GRAV_HH diff --git a/lily/include/translator.hh b/lily/include/translator.hh index 17088c668f..bfcf734e30 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -14,25 +14,29 @@ #include "lily-proto.hh" #include "virtual-methods.hh" +/** Make some kind of #Element#s from Requests. Elements are made by + hierarchically grouped #Translator#s + */ class Translator { public: - String id_str_; + String id_str_; - int iterator_count_; + int iterator_count_; - virtual Global_translator *global_l() { return 0; } - - /// Score_register = 0, Staff_registers = 1, etc) - virtual void print()const; - virtual int depth_i()const=0; - virtual bool is_bottom_engraver_b() const { return false; } - virtual bool try_request (Request*); - virtual Translator *find_get_translator_l (String name, String id)=0; - virtual Translator *ancestor_l (int l=1)=0; - virtual ~Translator(){} - DECLARE_MY_RUNTIME_TYPEINFO; - Translator(); - virtual Translator *get_default_interpreter()=0; + virtual Global_translator *global_l() { return 0; } + + virtual void print() const; + + /// Score_register = 0, Staff_registers = 1, etc) + virtual int depth_i() const=0; + virtual bool is_bottom_engraver_b() const { return false; } + virtual bool try_request (Request*); + virtual Translator *find_get_translator_l (String name, String id)=0; + virtual Translator *ancestor_l (int l=1)=0; + virtual ~Translator(){} + DECLARE_MY_RUNTIME_TYPEINFO; + Translator(); + virtual Translator *get_default_interpreter()=0; }; #endif // TRANSLATOR_HH diff --git a/lily/include/vertical-align-elem.hh b/lily/include/vertical-align-elem.hh index 3683b304ba..bb6b7ed48f 100644 --- a/lily/include/vertical-align-elem.hh +++ b/lily/include/vertical-align-elem.hh @@ -19,7 +19,7 @@ class Vertical_align_element : virtual public Score_elem { Link_array elem_l_arr_; public: void add (Score_elem*); - bool contains_b (Score_elem const*)const; + bool contains_b (Score_elem const*) const; Vertical_align_element(); DECLARE_MY_RUNTIME_TYPEINFO; protected: diff --git a/lily/include/vertical-group-spanner.hh b/lily/include/vertical-group-spanner.hh index ee08375d6e..720b298932 100644 --- a/lily/include/vertical-group-spanner.hh +++ b/lily/include/vertical-group-spanner.hh @@ -18,13 +18,14 @@ class Vertical_group_spanner : public Axis_group_spanner, public Vertical_group_element { protected: - SCORE_ELEM_CLONE(Vertical_group_spanner); - virtual void remove_all() { Vertical_group_element::remove_all (); } + SCORE_ELEM_CLONE(Vertical_group_spanner); + virtual void remove_all() { Vertical_group_element::remove_all (); } + virtual void do_junk_links () { Axis_group_spanner::do_junk_links (); } + virtual void do_unlink () { Axis_group_spanner::do_unlink (); } public: - DECLARE_MY_RUNTIME_TYPEINFO; - virtual void add_element (Score_elem*e) { Vertical_group_element::add_element (e); } - virtual void remove_element (Score_elem*e) { Vertical_group_element::remove_element (e); } - + DECLARE_MY_RUNTIME_TYPEINFO; + virtual void add_element (Score_elem*e) { Vertical_group_element::add_element (e); } + virtual void remove_element (Score_elem*e) { Vertical_group_element::remove_element (e); } }; #endif // SPAN_VERTICAL_GROUP_HH diff --git a/lily/include/voice-group-gravs.hh b/lily/include/voice-group-gravs.hh index 38f57d574d..e6b9a3de84 100644 --- a/lily/include/voice-group-gravs.hh +++ b/lily/include/voice-group-gravs.hh @@ -17,7 +17,7 @@ */ class Voice_group_engravers : public Engraver_group_engraver { Moment termination_mom_; - int dir_i_; + Direction dir_; protected: virtual void do_print() const; diff --git a/lily/include/voice-iterator.hh b/lily/include/voice-iterator.hh new file mode 100644 index 0000000000..49bfbfc553 --- /dev/null +++ b/lily/include/voice-iterator.hh @@ -0,0 +1,38 @@ +/* + voice-iter.hh -- declare Voice_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef VOICE_ITER_HH +#define VOICE_ITER_HH + + +#include "music-iterator.hh" +#include "pcursor.hh" + +class Voice_iterator : private PCursor, public Music_iterator +{ + Moment here_mom_; + const Voice * voice_C_; + Music_iterator * iter_p_; + void start_next_element(); + void leave_element(); + void set_voice_translator(); + +public: + Voice_iterator (Voice const*); + DECLARE_MY_RUNTIME_TYPEINFO; +protected: + virtual void do_print() const; + virtual void construct_children(); + ~Voice_iterator(); + virtual void process_and_next (Moment); + virtual Moment next_moment() const; + virtual bool ok() const; +}; + +#endif // VOICE_ITER_HH diff --git a/lily/include/word-wrap.hh b/lily/include/word-wrap.hh index 6f16af30c8..a7d69ff083 100644 --- a/lily/include/word-wrap.hh +++ b/lily/include/word-wrap.hh @@ -14,7 +14,7 @@ /// wordwrap type algorithm: move to next line if current is optimal. struct Word_wrap : Break_algorithm { - virtual Array do_solve()const; + virtual Array do_solve() const; Word_wrap(); }; diff --git a/lily/ineq-constrained-qp.cc b/lily/ineq-constrained-qp.cc index f7b204fcff..a8cbd0a9db 100644 --- a/lily/ineq-constrained-qp.cc +++ b/lily/ineq-constrained-qp.cc @@ -210,10 +210,10 @@ Ineq_constrained_qp::constraint_solve (Vector start) const Vector -Ineq_constrained_qp::solve (Vector start)const +Ineq_constrained_qp::solve (Vector start) const { /* no hassle if no constraints*/ - if ( ! cons.size()) + if (! cons.size()) { Choleski_decomposition chol (quad); return - chol.solve (lin); diff --git a/lily/input-translator.cc b/lily/input-translator.cc index 34a65b7f3e..ff277cc672 100644 --- a/lily/input-translator.cc +++ b/lily/input-translator.cc @@ -27,7 +27,7 @@ void Input_translator::print() const { #ifndef NPRINT - if ( ! check_debug) + if (! check_debug) return ; DOUT << base_str_ <<" " << type_str_<<" {\n"; DOUT << "Consists of "; @@ -46,7 +46,7 @@ Input_translator::print() const Input_translator * Input_translator::recursive_find (String nm) { - if ( is_name_b (nm)) + if (is_name_b (nm)) return this; Input_translator * r =0; @@ -119,7 +119,7 @@ Input_translator::add (Input_translator *ip) Input_translator* Input_translator::get_default_itrans_l() { - if ( contains_itrans_p_list_.size()) + if (contains_itrans_p_list_.size()) return contains_itrans_p_list_.top(); else return 0; diff --git a/lily/item.cc b/lily/item.cc index 6c4a7699c8..6d72b4c5b8 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -11,13 +11,13 @@ #include "item.hh" #include "p-col.hh" #include "elem-group.hh" +#include "spanner.hh" Item::Item() { breakable_b_ = false; break_status_i_ = 0; - pcol_l_ = 0; - broken_to_a_[0] = broken_to_a_[1]=0; + broken_to_drul_[LEFT] = broken_to_drul_[RIGHT]=0; } IMPLEMENT_IS_TYPE_B1(Item, Score_elem); @@ -26,21 +26,22 @@ void Item::do_print() const { #ifndef NPRINT - DOUT << "(unknown)"; + DOUT << "breakable_b_: " << breakable_b_; + DOUT << "break_status_i_: " <hpos_f_ + absolute_coordinate (X_AXIS); + return absolute_coordinate (X_AXIS); } Line_of_score * -Item::line_l()const +Item::line_l() const { - return pcol_l_->line_l_; + return (axis_group_l_a_[X_AXIS])? axis_group_l_a_[X_AXIS]->line_l() : 0; } int @@ -52,36 +53,37 @@ Item::break_status_i() const void Item::copy_breakable_items() { - if ( broken_to_a_[0] || broken_to_a_[1]) - return; - Item *new_copies[2]; - for (int i=0; i < 2; i++) + if (broken_to_drul_[LEFT] || broken_to_drul_[RIGHT]) + return; + Drul_array new_copies; + Direction i=LEFT; + do { - Item * item_p = clone()->item (); - item_p->copy_dependencies (*this); - - item_p->break_status_i_ = -1+ 2*i; - pscore_l_->typeset_item (item_p, pcol_l_); - item_p->handle_prebroken_dependencies(); - new_copies[i] =item_p; + Item * item_p = clone()->item (); + + item_p->break_status_i_ = i; + pscore_l_->typeset_element (item_p); + item_p->handle_prebroken_dependencies(); + new_copies[i] =item_p; } - broken_to_a_= new_copies; + while ((i *= -1) != LEFT); + broken_to_drul_= new_copies; } void Item::do_breakable_col_processing() { - if (!breakable_b_ || !pcol_l_->breakable_b()) - return; + if (!breakable_b_) + return; copy_breakable_items(); handle_prebroken_dependencies(); /* Otherwise the broken items won't be pre_process()'ed. - */ - add_dependency (broken_to_a_[0]); - add_dependency (broken_to_a_[1]); + */ + add_dependency (broken_to_drul_[LEFT]); + add_dependency (broken_to_drul_[RIGHT]); } @@ -89,32 +91,67 @@ Item* Item::find_prebroken_piece (Line_of_score*l) const { if (line_l() == l) - return (Item*)this; - else if (broken_to_a_[0] && broken_to_a_[0]->line_l() == l) - return broken_to_a_[0]; - else if (broken_to_a_[1] && broken_to_a_[1]->line_l() == l) - return broken_to_a_[1]; + return (Item*)this; + else if (broken_to_drul_[LEFT] && broken_to_drul_[LEFT]->line_l() == l) + return broken_to_drul_[LEFT]; + else if (broken_to_drul_[RIGHT] && broken_to_drul_[RIGHT]->line_l() == l) + return broken_to_drul_[RIGHT]; return 0; } Item* -Item::find_prebroken_piece (PCol*c)const +Item::find_prebroken_piece (int breakstatus) const { - if (c == pcol_l_) - return (Item *) this; // ugh + if (!breakstatus) + return (Item *) this; // ugh + else + return (Item*) broken_to_drul_[(Direction)breakstatus]; +} - if (c == pcol_l_->prebreak_p_) - return (Item *) broken_to_a_[0]; - else if (c==pcol_l_->postbreak_p_) - return (Item *)broken_to_a_[1]; +void +Item::handle_prebroken_dependencies() +{ + if (breakable_b_) + Score_elem::handle_prebroken_dependencies(); +} - assert (false); +int +Item::left_right_compare(Item const *l, Item const *r) +{ + while (!l->is_type_b (Paper_column::static_name ())) + l = l->axis_group_l_a_[X_AXIS]->item(); + while (!r->is_type_b (Paper_column::static_name ())) + r = r->axis_group_l_a_[X_AXIS]->item(); + + Paper_column *p1 = (Paper_column*)l; + Paper_column* p2 = (Paper_column*)r; + return p1->rank_i () - p2->rank_i (); +} + + +bool +Item::linked_b() const +{ + return Score_elem::linked_b() || attached_span_l_arr_.size(); } void -Item::handle_prebroken_dependencies() +Item::do_junk_links() +{ + attached_span_l_arr_.set_size(0); +} + +void +Item::do_unlink() { - if ( breakable_b_) - Score_elem::handle_prebroken_dependencies(); + for (int i=0; i < attached_span_l_arr_.size (); i++) { + Spanner *&s= attached_span_l_arr_[i]; + if (s->spanned_drul_[LEFT] == this) + s->set_bounds (LEFT, 0); + if (s->spanned_drul_[RIGHT] == this) + s->set_bounds (RIGHT,0); + s =0; + } + attached_span_l_arr_.set_size (0); } diff --git a/lily/key-grav.cc b/lily/key-grav.cc index 96d51998c4..f2d81ae907 100644 --- a/lily/key-grav.cc +++ b/lily/key-grav.cc @@ -65,7 +65,7 @@ Key_engraver::acknowledge_element (Score_elem_info info) } else if (info.elem_l_->name() == Bar::static_name ()) { - if ( !keyreq_l_) + if (!keyreq_l_) default_key_b_ = true; create_key(); } diff --git a/lily/key-item.cc b/lily/key-item.cc index 12276dcbbf..5fbfd29f39 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -63,7 +63,7 @@ Key_item::add (int p, int a) Molecule* -Key_item::brew_molecule_p()const +Key_item::brew_molecule_p() const { Molecule*output = new Molecule; Real inter = paper()->internote_f (); @@ -76,7 +76,7 @@ Key_item::brew_molecule_p()const Molecule m (a); output->add_right (m); } - if ( pitch.size()) + if (pitch.size()) { Molecule m (paper()->lookup_l ()->fill (Box ( Interval (0, paper()->note_width ()), diff --git a/lily/key-performer.cc b/lily/key-performer.cc index d4d0527aa0..160dee4a64 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -28,7 +28,7 @@ void Key_performer::do_print() const { #ifndef NPRINT - if ( key_req_l_) + if (key_req_l_) key_req_l_->print(); #endif } @@ -36,21 +36,21 @@ Key_performer::do_print() const void Key_performer::process_requests() { - if ( key_req_l_) - play (new Audio_key (key_req_l_) ); + if (key_req_l_) + play (new Audio_key (key_req_l_)); key_req_l_ = 0; } bool Key_performer::do_try_request (Request* req_l) { - if ( key_req_l_) + if (key_req_l_) return false; - if ( req_l->command()) + if (req_l->command()) key_req_l_ = req_l->command()->keychange (); - if ( key_req_l_) + if (key_req_l_) return true; return false; diff --git a/lily/keyword.cc b/lily/keyword.cc index f027ee86d9..0274d1653f 100644 --- a/lily/keyword.cc +++ b/lily/keyword.cc @@ -45,7 +45,7 @@ Keyword_table::Keyword_table (Keyword_ent *tab) lookup with binsearch, return tokencode. */ int -Keyword_table::lookup (char const *s)const +Keyword_table::lookup (char const *s) const { int lo, hi, diff --git a/lily/lexer.l b/lily/lexer.l index 8e702b7c79..fa82ddd563 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -87,6 +87,10 @@ LYRICS ({AA}|{NATIONAL})[^0-9 \t\n\f]* %% +<*>\r { + // windows-suck-suck-suck +} + { "%{" { yy_push_state(longcomment); diff --git a/lily/line-group-grav.cc b/lily/line-group-grav.cc index 9d544d061e..5915e78544 100644 --- a/lily/line-group-grav.cc +++ b/lily/line-group-grav.cc @@ -12,6 +12,7 @@ #include "bar.hh" #include "debug.hh" #include "line-group-grav.hh" +#include "p-col.hh" Line_group_engraver::Line_group_engraver() { @@ -21,7 +22,7 @@ Line_group_engraver::Line_group_engraver() void Line_group_engraver::acknowledge_element (Score_elem_info elem) { - if ( !elem.elem_l_->axis_group_l_a_[Y_AXIS]) + if (!elem.elem_l_->axis_group_l_a_[Y_AXIS]) staffline_p_->add_element (elem.elem_l_); } @@ -29,7 +30,7 @@ Line_group_engraver::acknowledge_element (Score_elem_info elem) void Line_group_engraver::do_removal_processing() { - staffline_p_->right_col_l_ = get_staff_info().command_pcol_l (); + staffline_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ()); typeset_element (staffline_p_); staffline_p_ = 0; } @@ -38,7 +39,7 @@ void Line_group_engraver::do_creation_processing() { staffline_p_ = new Vertical_group_spanner ; - staffline_p_->left_col_l_ = get_staff_info().command_pcol_l (); + staffline_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ()); // don't broadcast to self. announce_element (Score_elem_info (staffline_p_,0)); diff --git a/lily/line-spacer.cc b/lily/line-spacer.cc index 5f51ad3ad4..c59589481a 100644 --- a/lily/line-spacer.cc +++ b/lily/line-spacer.cc @@ -14,7 +14,7 @@ Line_spacer::Line_spacer() paper_l_ =0; } Paper_def* -Line_spacer::paper_l()const +Line_spacer::paper_l() const { return paper_l_ ; } diff --git a/lily/local-key-grav.cc b/lily/local-key-grav.cc index 82134c8608..7da053d418 100644 --- a/lily/local-key-grav.cc +++ b/lily/local-key-grav.cc @@ -26,43 +26,43 @@ Local_key_engraver::do_pre_move_processing() Local_key_item *key_item_p = 0; if (mel_l_arr_.size()) { - for (int i=0; i < mel_l_arr_.size(); i++) - { - Item * support_l = support_l_arr_[i]; - Note_req * note_l = mel_l_arr_[i]; + for (int i=0; i < mel_l_arr_.size(); i++) + { + Item * support_l = support_l_arr_[i]; + Note_req * note_l = mel_l_arr_[i]; - if (tied_l_arr_.find_l (support_l) && - !note_l->forceacc_b_) - continue; + if (tied_l_arr_.find_l (support_l) && + !note_l->forceacc_b_) + continue; - if (!note_l->forceacc_b_ && - local_key_.oct (note_l->octave_i_).acc (note_l->notename_i_) - == note_l->accidental_i_) - continue; - if (!key_item_p) - { - int c0_i=0; + if (!note_l->forceacc_b_ && + local_key_.oct (note_l->octave_i_).acc (note_l->notename_i_) + == note_l->accidental_i_) + continue; + if (!key_item_p) + { + int c0_i=0; - Staff_info inf = get_staff_info(); - if (inf.c0_position_i_l_) - c0_i = *get_staff_info().c0_position_i_l_; + Staff_info inf = get_staff_info(); + if (inf.c0_position_i_l_) + c0_i = *get_staff_info().c0_position_i_l_; - key_item_p = new Local_key_item (c0_i); - } - key_item_p->add (note_l); - key_item_p->add_support (support_l); - local_key_.oct (note_l->octave_i_) - .set (note_l->notename_i_, note_l->accidental_i_); - } + key_item_p = new Local_key_item (c0_i); + } + key_item_p->add (note_l); + key_item_p->add_support (support_l); + local_key_.oct (note_l->octave_i_) + .set (note_l->notename_i_, note_l->accidental_i_); + } } if (key_item_p) { - for (int i=0; i < support_l_arr_.size(); i++) - key_item_p->add_support (support_l_arr_[i]); + for (int i=0; i < support_l_arr_.size(); i++) + key_item_p->add_support (support_l_arr_[i]); - announce_element (Score_elem_info (key_item_p, 0)); // ugh ugh ugh - typeset_element (key_item_p); + announce_element (Score_elem_info (key_item_p, 0)); // ugh ugh ugh + typeset_element (key_item_p); } mel_l_arr_.clear(); @@ -80,32 +80,32 @@ Local_key_engraver::acknowledge_element (Score_elem_info info) Score_elem * elem_l = info.elem_l_; if (info.req_l_->musical() && info.req_l_->musical ()->note ()) { - Note_req * note_l = info.req_l_->musical()->note (); - Item * item_l = info.elem_l_->item(); + Note_req * note_l = info.req_l_->musical()->note (); + Item * item_l = info.elem_l_->item(); - mel_l_arr_.push (note_l); - support_l_arr_.push (item_l); + mel_l_arr_.push (note_l); + support_l_arr_.push (item_l); } else if (info.req_l_->command() - && info.req_l_->command()->keychange ()) - { - Key_engraver * key_grav_l = - (Key_engraver*)info.origin_grav_l_arr_[0]; - key_C_ = &key_grav_l->key_; - local_key_ = *key_C_; + && info.req_l_->command()->keychange ()) + { + Key_engraver * key_grav_l = + (Key_engraver*)info.origin_grav_l_arr_[0]; + key_C_ = &key_grav_l->key_; + local_key_ = *key_C_; } else if (elem_l->name() == Key_item::static_name ()) { - Key_engraver * key_grav_l = - (Key_engraver*)info.origin_grav_l_arr_[0]; - key_C_ = &key_grav_l->key_; + Key_engraver * key_grav_l = + (Key_engraver*)info.origin_grav_l_arr_[0]; + key_C_ = &key_grav_l->key_; } else if (elem_l->name() == Tie::static_name ()) { - Tie * tie_l = (Tie*)elem_l->spanner(); - if (tie_l->same_pitch_b_) - tied_l_arr_.push (tie_l-> right_head_l_); + Tie * tie_l = (Tie*)elem_l->spanner(); + if (tie_l->same_pitch_b_) + tied_l_arr_.push (tie_l-> head_l_drul_[RIGHT]); } } @@ -115,8 +115,8 @@ Local_key_engraver::do_process_requests() Time_description const * time_C_ = get_staff_info().time_C_; if (time_C_ && !time_C_->whole_in_measure_) { - if (key_C_) - local_key_= *key_C_; + if (key_C_) + local_key_= *key_C_; } } diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index b81adc5fcf..33037e26ea 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -56,7 +56,7 @@ Local_key_item::do_pre_processing() } Molecule* -Local_key_item::brew_molecule_p()const +Local_key_item::brew_molecule_p() const { Molecule* output = new Molecule; Molecule*octmol = 0; diff --git a/lily/lookup.cc b/lily/lookup.cc index 18407dece2..480abb5f9a 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -45,13 +45,13 @@ Lookup::add (String s, Symtable*p) } void -Lookup::print()const +Lookup::print() const { - #ifndef NPRINT +#ifndef NPRINT DOUT << "Lookup: " << texsetting << " {\n"; symtables_->print(); DOUT << "}\n"; - #endif +#endif } Symbol @@ -75,7 +75,7 @@ Symbol Lookup::ball (int j) const { if (j > 2) - j = 2; + j = 2; Symtable * st = (*symtables_)("balls"); return st->lookup (String (j)); @@ -136,8 +136,8 @@ Lookup::dots (int j) const { if (j>3) { - j = 3; - warning ("max 3 dots"); // todo + j = 3; + warning ("max 3 dots"); // todo } return (*symtables_)("dots")->lookup (j); } @@ -158,13 +158,13 @@ Lookup::streepjes (int i) const if (i < 0) { - idx = "botlines"; - arg = -i; + idx = "botlines"; + arg = -i; } else { - arg = i; - idx = "toplines"; + arg = i; + idx = "toplines"; } Symbol ret = (*symtables_)("streepjes")->lookup (idx); @@ -227,9 +227,9 @@ Lookup::stem (Real y1,Real y2) const { if (y1 > y2) { - Real t = y1; - y1 = y2; - y2 = t; + Real t = y1; + y1 = y2; + y2 = t; } Symbol s; @@ -253,31 +253,31 @@ Lookup::vbrace (Real &y) const { if (y < 2* 20 PT) { - warning ( "piano brace too small (" + print_dimen (y)+ ")"); - y = 2*20 PT; + warning ("piano brace too small (" + print_dimen (y)+ ")"); + y = 2*20 PT; } if (y > 67 * 2 PT) { - warning ( "piano brace too big (" + print_dimen (y)+ ")"); - y = 67 *2 PT; + warning ("piano brace too big (" + print_dimen (y)+ ")"); + y = 67 *2 PT; } int idx = int (rint ((y/2.0 - 20) + 148)); Symbol s = (*symtables_)("param")->lookup ("brace"); { - Array a; - a.push (idx); - s.tex = substitute_args (s.tex,a); - s.dim.y() = Interval (0,y); - } + Array a; + a.push (idx); + s.tex = substitute_args (s.tex,a); + s.dim.y() = Interval (0,y); + } { - Array a; - a.push (print_dimen (y/2)); - a.push (print_dimen (0)); - a.push (s.tex); - s.tex = substitute_args ("\\placebox{%}{%}{%}", a); - } + Array a; + a.push (print_dimen (y/2)); + a.push (print_dimen (0)); + a.push (s.tex); + s.tex = substitute_args ("\\placebox{%}{%}{%}", a); + } return s; diff --git a/lily/lyric-grav.cc b/lily/lyric-grav.cc index c29b46d5fe..a10cf614b2 100644 --- a/lily/lyric-grav.cc +++ b/lily/lyric-grav.cc @@ -33,12 +33,12 @@ Lyric_engraver::do_try_request (Request*r) void Lyric_engraver::do_process_requests() { - if ( lreq_l_) + if (lreq_l_) { lyric_item_p_ = new Text_item (lreq_l_->tdef_p_); lyric_item_p_->translate (paper()->note_width ()/2 , X_AXIS); - lyric_item_p_->dir_i_ = -1; + lyric_item_p_->dir_ = DOWN; lyric_item_p_->fat_b_ = true; announce_element (Score_elem_info (lyric_item_p_, lreq_l_)); } @@ -53,7 +53,7 @@ Lyric_engraver::do_post_move_processing() void Lyric_engraver::do_pre_move_processing() { - if ( lyric_item_p_) + if (lyric_item_p_) { typeset_element (lyric_item_p_); lyric_item_p_ =0; diff --git a/lily/lyric-performer.cc b/lily/lyric-performer.cc index b800f3d1ad..9a7fef130c 100644 --- a/lily/lyric-performer.cc +++ b/lily/lyric-performer.cc @@ -28,7 +28,7 @@ void Lyric_performer::do_print() const { #ifndef NPRINT - if ( lreq_arr_.size()) + if (lreq_arr_.size()) lreq_arr_[ 0 ]->print(); #endif } @@ -36,8 +36,8 @@ Lyric_performer::do_print() const void Lyric_performer::process_requests() { - if ( lreq_arr_.size() && lreq_arr_[ 0 ]->tdef_p_->text_str_.length_i() ) - play (new Audio_text (Audio_text::LYRIC, lreq_arr_[ 0 ]->tdef_p_->text_str_) ); + if (lreq_arr_.size() && lreq_arr_[ 0 ]->tdef_p_->text_str_.length_i()) + play (new Audio_text (Audio_text::LYRIC, lreq_arr_[ 0 ]->tdef_p_->text_str_)); lreq_arr_.clear(); } @@ -45,7 +45,7 @@ bool Lyric_performer::do_try_request (Request* req_l) { Musical_req* m_l = req_l->musical(); - if ( !m_l || ! m_l->lreq_l()) + if (!m_l || ! m_l->lreq_l()) return false; lreq_arr_.push (m_l->lreq_l()); diff --git a/lily/main.cc b/lily/main.cc index eb9f611543..8c68dd1bc0 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -106,14 +106,14 @@ static File_path path; void do_one_file (String init_str, String file_str) { - if ( init_str != "" && "" == path.find (init_str) ) + if (init_str != "" && "" == path.find (init_str)) { - error ( "Can not find `" + init_str +"\'"); + error ("Can not find `" + init_str +"\'"); return ; } - if ( file_str!= "" && path.find (file_str) == "" ) + if (file_str!= "" && path.find (file_str) == "") { - error ( "Can not find `" + file_str + "'"); + error ("Can not find `" + file_str + "'"); return ; } @@ -142,7 +142,7 @@ main (int argc, char **argv) path.add (env_l); } path.add (""); - path.add (String (DIR_DATADIR) + "/init/" ); + path.add (String (DIR_DATADIR) + "/init/"); path.push (DIR_DATADIR); @@ -152,7 +152,7 @@ main (int argc, char **argv) while (Long_option_init const * opt = oparser()) { - switch ( opt->shortname) + switch (opt->shortname) { case 'o': set_default_output (oparser.optional_argument_ch_C_); @@ -188,7 +188,7 @@ main (int argc, char **argv) int p=0; const char *arg ; - while ( (arg= oparser.get_next_arg())) + while ((arg= oparser.get_next_arg())) { String f (arg); destill_inname (f); @@ -207,7 +207,7 @@ main (int argc, char **argv) void destill_inname (String &name_str_r) { - if ( name_str_r.length_i()) + if (name_str_r.length_i()) { if (name_str_r[ 0 ] != '-') { diff --git a/lily/meter-grav.cc b/lily/meter-grav.cc index 7f5a0d3bc8..378acbc741 100644 --- a/lily/meter-grav.cc +++ b/lily/meter-grav.cc @@ -9,106 +9,31 @@ #include "meter-grav.hh" #include "meter.hh" #include "command-request.hh" -#include "score-grav.hh" - +#include "timing-grav.hh" +#include "engraver-group.hh" Meter_engraver::Meter_engraver() { - meter_req_l_ = 0; meter_p_ =0; - default_grouping_ = Rhythmic_grouping (MInterval (0,4),4); // ugh -} - -void -Meter_engraver::fill_staff_info (Staff_info&inf) -{ - inf.time_C_ = &time_; - inf.rhythmic_C_ = &default_grouping_; -} - -bool -Meter_engraver::do_try_request (Request*r) -{ - bool gotcha = false; - - if (r->command() && r->command ()->timing ()) - { - gotcha = true; - Timing_req * tr_l = r->command()->timing (); - Meter_change_req *m_l = tr_l->meterchange(); - if (m_l) - { - meter_req_l_ = m_l; - - int b_i= m_l->beats_i_; - int o_i = m_l->one_beat_i_; - if (! time_.allow_meter_change_b()) - tr_l->warning ("Meter change not allowed here"); - else - { - time_.set_meter (b_i, o_i); - default_grouping_ = - Rhythmic_grouping (MInterval (0,Moment (b_i, o_i)), b_i); - } - } - else if (tr_l->partial()) - { - Moment m = tr_l->partial()->duration_; - String error = time_.try_set_partial_str (m); - if (error != "") - { - tr_l->warning (error); - } - else - time_.setpartial (m); - } - else if (tr_l->barcheck()) - { - if (time_.whole_in_measure_) - { - tr_l ->warning ("Barcheck failed"); - - time_.whole_in_measure_ = 0; // resync - time_.error_b_ = true; - } - - } - else if (tr_l->cadenza()) - { - time_.set_cadenza (tr_l->cadenza()->on_b_); - - } - else if (tr_l->measuregrouping()) - { - default_grouping_ = parse_grouping ( - tr_l->measuregrouping()->beat_i_arr_, - tr_l->measuregrouping()->elt_length_arr_); - - } - } - - return gotcha; -} - -void -Meter_engraver::do_creation_processing() -{ - time_.when_ = get_staff_info().when (); } void Meter_engraver::do_process_requests() { - if (meter_req_l_) + Timing_engraver * timing_grav_l= (Timing_engraver*) + daddy_grav_l_->get_simple_engraver (Timing_engraver::static_name()); + + Meter_change_req *req = timing_grav_l->meter_req_l(); + if (req) { - Array args; - args.push (meter_req_l_->beats_i_); - args.push (meter_req_l_->one_beat_i_); + Array args; + args.push (req->beats_i_); + args.push (req->one_beat_i_); - meter_p_ = new Meter (args); + meter_p_ = new Meter (args); } if (meter_p_) - announce_element (Score_elem_info (meter_p_, meter_req_l_)); + announce_element (Score_elem_info (meter_p_, req)); } void @@ -116,26 +41,9 @@ Meter_engraver::do_pre_move_processing() { if (meter_p_) { - typeset_element (meter_p_); - meter_p_ =0; - meter_req_l_ = 0; - } - - Engraver_group_engraver * grav_l = daddy_grav_l_; - while (grav_l->daddy_grav_l_) - { - grav_l = grav_l->daddy_grav_l_; + typeset_element (meter_p_); + meter_p_ =0; } - - assert (grav_l->name() == Score_engraver::static_name ()); - if (!time_.cadenza_b_) - ((Score_engraver*)grav_l)->add_moment_to_process (time_.next_bar_moment()); -} - -void -Meter_engraver::do_post_move_processing() -{ - time_.add (get_staff_info().when () - time_.when_); } diff --git a/lily/meter-performer.cc b/lily/meter-performer.cc index 0d23bb9a9b..63eb06946b 100644 --- a/lily/meter-performer.cc +++ b/lily/meter-performer.cc @@ -26,30 +26,30 @@ void Meter_performer::do_print() const { #ifndef NPRINT - if ( meter_req_l_) - meter_req_l_->print(); + if (meter_req_l_) + meter_req_l_->print(); #endif } void Meter_performer::process_requests() { - if ( meter_req_l_) - play (new Audio_meter (meter_req_l_) ); + if (meter_req_l_) + play (new Audio_meter (meter_req_l_)); meter_req_l_ = 0; } bool Meter_performer::do_try_request (Request* req_l) { - if ( meter_req_l_) - return false; + if (meter_req_l_) + return false; - if ( req_l->command()) - meter_req_l_ = req_l->command()->meterchange (); + if (req_l->command()) + meter_req_l_ = req_l->command()->meterchange (); - if ( meter_req_l_) - return true; + if (meter_req_l_) + return true; return false; } diff --git a/lily/meter.cc b/lily/meter.cc index e8fcd8f9f0..aa41b7922b 100644 --- a/lily/meter.cc +++ b/lily/meter.cc @@ -11,7 +11,7 @@ Meter::Meter (Arraya) } Molecule* -Meter::brew_molecule_p()const +Meter::brew_molecule_p() const { Symbol s = paper()->lookup_l ()->meter (args); return new Molecule (Atom (s)); diff --git a/lily/midi-def.cc b/lily/midi-def.cc index 2307155ba8..c3ffe65d47 100644 --- a/lily/midi-def.cc +++ b/lily/midi-def.cc @@ -10,9 +10,9 @@ #include "misc.hh" #include "midi-def.hh" #include "input-translator.hh" -#include "performer-group-performer.hh" +#include "audio-score.hh" #include "assoc-iter.hh" - +#include "score-performer.hh" #include "debug.hh" // classes, alphasorted @@ -32,7 +32,7 @@ Midi_def::Midi_def() outfile_str_ = ""; itrans_p_ = 0; // ugh - set_tempo (Moment (1, 4), 60 ); + set_tempo (Moment (1, 4), 60); } Midi_def::Midi_def (Midi_def const& s) @@ -50,22 +50,28 @@ Midi_def::~Midi_def() Real Midi_def::duration_to_seconds_f (Moment mom) { - if ( !mom) + if (!mom) return 0; return Moment (whole_seconds_f_) * mom; } Global_translator* -Midi_def::get_global_translator_p() const +Midi_def::get_global_translator_p() { - return itrans_p_->get_group_performer_p()->global_l (); + Global_translator *g = itrans_p_->get_group_performer_p()->global_l (); + + assert (g->is_type_b (Score_performer::static_name())); + Score_performer * perf = (Score_performer*)g; + perf->performance_p_ = new Audio_score; + perf->performance_p_->midi_l_ = this; + return g; } int Midi_def::get_tempo_i (Moment moment) { - return Moment (whole_seconds_f_) * Moment (60 ) * moment; + return Moment (whole_seconds_f_) * Moment (60) * moment; } void @@ -73,7 +79,7 @@ Midi_def::print() const { #ifndef NPRINT DOUT << "Midi {"; - DOUT << "4/min: " << Real (60) / ( whole_seconds_f_ * 4 ); + DOUT << "4/min: " << Real (60) / (whole_seconds_f_ * 4); DOUT << "out: " << outfile_str_; DOUT << "}\n"; #endif @@ -89,6 +95,7 @@ Midi_def::set (Input_translator* itrans_p) void Midi_def::set_tempo (Moment moment, int count_per_minute_i) { - whole_seconds_f_ = Moment (count_per_minute_i) / Moment (60 ) / moment; + whole_seconds_f_ = Moment (count_per_minute_i) / Moment (60) / moment; } +IMPLEMENT_IS_TYPE_B1( Midi_def, Music_output_def); diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 47af53eb3b..e7e914782d 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -71,7 +71,7 @@ Midi_duration::Midi_duration (Real seconds_f) String Midi_duration::str() const { - return String (""; + return String (""; } Midi_header::Midi_header (int format_i, int tracks_i, int clocks_per_4_i) @@ -270,14 +270,14 @@ String Midi_instrument::str() const { Byte program_byte = 0; - for ( int i = 0; instrument_name_sz_a_[i]; i++) - if ( instrument_str_ == String (instrument_name_sz_a_[ i ])) + for (int i = 0; instrument_name_sz_a_[i]; i++) + if (instrument_str_ == String (instrument_name_sz_a_[ i ])) { program_byte = (Byte)i; break; } - String str = String ((char)( 0xc0 + channel_i_) ); + String str = String ((char)(0xc0 + channel_i_)); str += String ((char)program_byte); return str; } @@ -298,7 +298,7 @@ String Midi_item::i2varint_str (int i) { int buffer_i = i & 0x7f; - while ( (i >>= 7) > 0) + while ((i >>= 7) > 0) { buffer_i <<= 8; buffer_i |= 0x80; @@ -306,10 +306,10 @@ Midi_item::i2varint_str (int i) } String str; - while ( 1) + while (1) { str += (char)buffer_i; - if ( buffer_i & 0x80) + if (buffer_i & 0x80) buffer_i >>= 8; else break; @@ -330,7 +330,7 @@ Midi_key::str() const int flats_i = k->flats_i(); // midi cannot handle non-conventional keys - if ( flats_i && sharps_i) + if (flats_i && sharps_i) return ""; int accidentals_i = sharps_i - flats_i; @@ -356,7 +356,7 @@ Midi_meter::str() const String str = "ff5804"; str += String_convert::i2hex_str (num_i, 2, '0'); - str += String_convert::i2hex_str (intlog2( den_i) , 2, '0' ); + str += String_convert::i2hex_str (intlog2(den_i) , 2, '0'); str += String_convert::i2hex_str (clocks_per_1_i_, 2, '0'); str += String_convert::i2hex_str (8, 2, '0'); return String_convert::hex2bin_str (str); @@ -383,16 +383,16 @@ Midi_note::pitch_i() const String Midi_note::str() const { - if ( pitch_i() == INT_MAX) + if (pitch_i() == INT_MAX) return String (""); - Byte status_byte = (char)( 0x90 + channel_i_); + Byte status_byte = (char)(0x90 + channel_i_); String str = String ((char)status_byte); - str += (char)( pitch_i() + c0_pitch_i_c_); + str += (char)(pitch_i() + c0_pitch_i_c_); // poor man's staff dynamics: - str += (char)( dynamic_byte_ - 0x10 * channel_i_); + str += (char)(dynamic_byte_ - 0x10 * channel_i_); return str; } @@ -414,13 +414,13 @@ Midi_note_off::pitch_i() const String Midi_note_off::str() const { - if ( pitch_i() == INT_MAX) + if (pitch_i() == INT_MAX) return String (""); - Byte status_byte = (char)( 0x80 + channel_i_); + Byte status_byte = (char)(0x80 + channel_i_); String str = String ((char)status_byte); - str += (char)( pitch_i() + Midi_note::c0_pitch_i_c_); + str += (char)(pitch_i() + Midi_note::c0_pitch_i_c_); str += (char)aftertouch_byte_; return str; } @@ -428,7 +428,7 @@ Midi_note_off::str() const Midi_tempo::Midi_tempo (Audio_item* audio_item_l) : Midi_item (audio_item_l) { - per_minute_4_i_ = ( (Audio_tempo*)audio_item_l_)->per_minute_4_i_; + per_minute_4_i_ = ((Audio_tempo*)audio_item_l_)->per_minute_4_i_; } Midi_tempo::Midi_tempo (int per_minute_4_i) @@ -449,8 +449,8 @@ Midi_tempo::str() const Midi_text::Midi_text (Audio_item* audio_item_l) : Midi_item (audio_item_l) { - text_str_ = ( (Audio_text*)audio_item_l_)->text_str_; - type_ = (Type)( (Audio_text*)audio_item_l_)->type_; + text_str_ = ((Audio_text*)audio_item_l_)->text_str_; + type_ = (Type)((Audio_text*)audio_item_l_)->type_; } Midi_text::Midi_text (Midi_text::Type type, String text_str) @@ -512,14 +512,14 @@ Midi_track::Midi_track() void Midi_track::add (int delta_time_i, String event_str) { - if ( delta_time_i < 0) + if (delta_time_i < 0) { - cout << String_convert::bin2hex_str (i2varint_str (delta_time_i) ) << endl; + cout << String_convert::bin2hex_str (i2varint_str (delta_time_i)) << endl; cout << String_convert::bin2hex_str (event_str) << endl; } assert (delta_time_i >= 0); assert(event_str.length_i()); - Midi_chunk::add (i2varint_str (delta_time_i) + event_str ); + Midi_chunk::add (i2varint_str (delta_time_i) + event_str); } void @@ -527,8 +527,8 @@ Midi_track::add (Moment delta_time_moment, Midi_item* mitem_l) { // use convention of 384 clocks per 4 // use Duration_convert - int delta_time_i = delta_time_moment * Moment (384) / Moment (1, 4 ); - // ? int ( delta_time_moment * 4 * 384) + int delta_time_i = delta_time_moment * Moment (384) / Moment (1, 4); + // ? int (delta_time_moment * 4 * 384) add (delta_time_i, mitem_l->str()); } diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index 5f1b3ee501..0521e87c75 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -28,31 +28,31 @@ Midi_stream::~Midi_stream() } Midi_stream& -Midi_stream::operator <<( String str) +Midi_stream::operator <<(String str) { - if ( check_debug) + if (check_debug) str = String_convert::bin2hex_str (str); *os_p_ << str; - if ( check_debug) + if (check_debug) *os_p_ << "\n"; return *this; } Midi_stream& -Midi_stream::operator <<( Midi_item const& mitem_c_r) +Midi_stream::operator <<(Midi_item const& mitem_c_r) { // *this << mitem_c_r.str(); mitem_c_r.output (this); - if ( check_debug) + if (check_debug) *os_p_ << "\n"; return *this; } Midi_stream& -Midi_stream::operator <<( int i) +Midi_stream::operator <<(int i) { // output binary string ourselves *this << Midi_item::i2varint_str (i); @@ -63,6 +63,6 @@ void Midi_stream::open() { os_p_ = new ofstream (filename_str_); - if ( !*os_p_) + if (!*os_p_) error ("can't open `" + filename_str_ + "\'"); } diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index aea8fcc0d7..36c8000024 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -27,7 +27,7 @@ compare (Midi_note_event const& left, Midi_note_event const& right) } Midi_walker::Midi_walker (Audio_staff* audio_staff_l, Midi_track* track_l) - : PCursor( audio_staff_l->audio_item_l_list_) + : PCursor(audio_staff_l->audio_item_l_list_) { track_l_ = track_l; last_mom_ = 0; @@ -36,7 +36,7 @@ Midi_walker::Midi_walker (Audio_staff* audio_staff_l, Midi_track* track_l) Midi_walker::~Midi_walker() { // ugh - do_stop_notes (last_mom_ + Moment (10, 1) ); + do_stop_notes (last_mom_ + Moment (10, 1)); } /** @@ -46,11 +46,11 @@ void Midi_walker::do_start_note (Midi_note* note_l) { Moment stop_mom = note_l->duration() + ptr ()->audio_column_l_->at_mom (); - for ( int i=0; i < stop_note_queue.size(); i++) + for (int i=0; i < stop_note_queue.size(); i++) { - if ( stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ()) + if (stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ()) { - if ( stop_note_queue[ i ].key < stop_mom) + if (stop_note_queue[ i ].key < stop_mom) stop_note_queue[ i ].ignore_b_ = true; else // skip the stopnote return; @@ -71,10 +71,10 @@ Midi_walker::do_start_note (Midi_note* note_l) void Midi_walker::do_stop_notes (Moment max_mom) { - while ( stop_note_queue.size() && stop_note_queue.front ().key <= max_mom) + while (stop_note_queue.size() && stop_note_queue.front ().key <= max_mom) { Midi_note_event e = stop_note_queue.get(); - if ( e.ignore_b_) + if (e.ignore_b_) continue; Moment stop_mom = e.key; @@ -101,11 +101,11 @@ Midi_walker::process() do_stop_notes (ptr()->audio_column_l_->at_mom ()); Midi_item* p = ptr()->midi_item_p (); - if ( !p ) + if (!p) return; p->channel_i_ = track_l_->number_i_; - if ( p->name() != Midi_note::static_name ()) + if (p->name() != Midi_note::static_name ()) output_event (ptr()->audio_column_l_->at_mom (), p); else do_start_note ((Midi_note*)p); diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index 56a6476ff6..ef36b59d14 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -1,26 +1,24 @@ /* - music-iterator.cc -- implement {Music,Chord,Voice}_iterator + music-iterator.cc -- implement Music_iterator source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys */ - +#include "debug.hh" #include "music-list.hh" #include "music-iterator.hh" +#include "voice-iterator.hh" +#include "chord-iterator.hh" +#include "request-iterator.hh" #include "translator.hh" -#include "request.hh" -#include "debug.hh" IMPLEMENT_IS_TYPE_B(Music_iterator); -Chord_iterator::~Chord_iterator() -{ -} void -Music_iterator::do_print()const +Music_iterator::do_print() const { } @@ -29,12 +27,15 @@ void Music_iterator::print() const { #ifndef NPRINT - if ( !check_debug) - return ; + if (!check_debug) + return ; DOUT << name() << "{"; DOUT << "report to " << - report_to_l() << " (" << report_to_l ()->name () << ")\n"; - DOUT << "next at " << next_moment() << " "; + report_to_l() << " (" << report_to_l ()->name () << ")\n"; + if (ok()) + DOUT << "next at " << next_moment() << " "; + else + DOUT << "not feeling well today.."; do_print(); DOUT << "}\n"; #endif @@ -45,7 +46,7 @@ Music_iterator::get_req_translator_l() { assert (report_to_l()); if (report_to_l()->is_bottom_engraver_b ()) - return report_to_l(); + return report_to_l(); set_translator (report_to_l()->get_default_interpreter ()); return report_to_l(); @@ -67,10 +68,10 @@ Music_iterator::pop_translator() } Translator* -Music_iterator::report_to_l()const +Music_iterator::report_to_l() const { if (! report_to_l_arr_.size()) - return 0; + return 0; return report_to_l_arr_.top(); } @@ -79,11 +80,11 @@ void Music_iterator::set_translator (Translator*trans) { if (report_to_l()==trans) - return; - if ( report_to_l()) - pop_translator(); + return; + if (report_to_l()) + pop_translator(); if (trans) - push_translator (trans); + push_translator (trans); } void @@ -98,7 +99,7 @@ Music_iterator::~Music_iterator() } Moment -Music_iterator::next_moment()const +Music_iterator::next_moment() const { return 0; } @@ -110,39 +111,39 @@ Music_iterator::process_and_next (Moment) } bool -Music_iterator::ok()const +Music_iterator::ok() const { return first_b_; } Music_iterator* Music_iterator::static_get_iterator_p (Music *m, - Translator *report_l) + Translator *report_l) { Music_iterator * p =0; if (m->is_type_b (Request_chord::static_name())) - p = new Request_chord_iterator ((Request_chord*) m); + p = new Request_chord_iterator ((Request_chord*) m); else if (m->is_type_b (Chord::static_name())) - p = new Chord_iterator ((Chord*) m); + p = new Chord_iterator ((Chord*) m); else if (m->is_type_b (Voice::static_name())) - p = new Voice_iterator ((Voice*) m); + p = new Voice_iterator ((Voice*) m); if (m -> type_str_ != "") { - Translator * a =report_l-> - find_get_translator_l (m-> type_str_, m->id_str_); - p->set_translator (a); + Translator * a =report_l-> + find_get_translator_l (m-> type_str_, m->id_str_); + p->set_translator (a); } if (! p->report_to_l()) - p ->set_translator (report_l); + p ->set_translator (report_l); return p; } Music_iterator* -Music_iterator::get_iterator_p (Music*m)const +Music_iterator::get_iterator_p (Music*m) const { Music_iterator*p = static_get_iterator_p (m,report_to_l()); p->daddy_iter_l_ = (Music_iterator*)this; @@ -156,252 +157,3 @@ Music_iterator::Music_iterator() first_b_ = true; } -/* ************** */ - -Chord_iterator::Chord_iterator (Chord const *chord_C) -{ - chord_C_ = chord_C; -} - -void -Chord_iterator::construct_children() -{ - int j = 0; - for (PCursor i (chord_C_->music_p_list_.top()); //, int j = 0; - i.ok(); j++, i++) - { - Music_iterator * mi = get_iterator_p (i.ptr()); - if ( mi->ok()) - { - set_translator (mi->report_to_l()->ancestor_l ( - chord_C_->multi_level_i_) ); - children_p_list_.bottom().add (mi); - } - else - delete mi; - } -} -void -Chord_iterator::do_print() const -{ -#ifndef NPRINT - for (PCursor i (children_p_list_.top()); i.ok (); i++) - { - i->print(); - } -#endif -} - -void -Chord_iterator::process_and_next (Moment until) -{ - for (PCursor i (children_p_list_.top()); i.ok ();) - { - if (i->next_moment() == until) - { - i->process_and_next (until); - } - if (!i->ok()) - delete i.remove_p(); - else - i++; - } - Music_iterator::process_and_next (until); -} - - -IMPLEMENT_IS_TYPE_B1(Chord_iterator,Music_iterator); - -Moment -Chord_iterator::next_moment()const -{ - Moment next_ = infinity_mom; - for (PCursor i (children_p_list_.top()); i.ok (); i++) - next_ = next_ next_moment() ; - return next_; -} - - - -bool -Chord_iterator::ok()const -{ - return children_p_list_.size(); -} - -/* ************** */ - -void -Voice_iterator::do_print()const -{ - if (iter_p_) - iter_p_->print(); -} - -Voice_iterator::Voice_iterator (Voice const*v) - : PCursor ( v->music_p_list_) -{ - here_mom_ = v->offset_mom_; - voice_C_ = v; - iter_p_ =0; -} - -void -Voice_iterator::construct_children() -{ - while (PCursor::ok()) - { - start_next_element(); - if ( !iter_p_->ok()) - { - leave_element(); - } - else - { - set_voice_translator(); - break; - } - } -} - -void -Voice_iterator::leave_element() -{ - delete iter_p_; - iter_p_ =0; - MInterval elt_time = ptr()->time_int (); - if (!elt_time.empty_b()) - here_mom_ += elt_time.length(); - PCursor::next(); -} - -void -Voice_iterator::start_next_element() -{ - assert (!iter_p_); - iter_p_ = get_iterator_p (ptr()); -} - -void -Voice_iterator::set_voice_translator() -{ - if (iter_p_->report_to_l()->depth_i () > report_to_l ()->depth_i ()) - set_translator (iter_p_->report_to_l()); -} - -Voice_iterator::~Voice_iterator() -{ - assert (! iter_p_); -} - - -IMPLEMENT_IS_TYPE_B1(Voice_iterator,Music_iterator); - -void -Voice_iterator::process_and_next (Moment until) -{ - while (1) - { - Moment local_until = until - here_mom_; - while ( iter_p_->ok()) - { - Moment here = iter_p_->next_moment(); - if (here != local_until) - goto loopexit; - - iter_p_->process_and_next (local_until); - } - - if (!iter_p_->ok()) - { - leave_element(); - if ( PCursor::ok()) - { - start_next_element(); - set_voice_translator(); - } - else - { - goto loopexit; - } - } - } - -loopexit: - - Music_iterator::process_and_next (until); -} - -Moment -Voice_iterator::next_moment()const -{ - return iter_p_->next_moment() + here_mom_; -} - -bool -Voice_iterator::ok()const -{ - return iter_p_; -} - - -IMPLEMENT_IS_TYPE_B1(Request_chord_iterator,Music_iterator); - -void -Request_chord_iterator::construct_children() -{ - get_req_translator_l(); -} - -Request_chord_iterator::Request_chord_iterator (Request_chord*el_l) -{ - elt_l_ = el_l; - elt_duration_ = el_l->time_int().length (); - last_b_ = false; -} - - -bool -Request_chord_iterator::ok()const -{ - return (elt_duration_ && !last_b_) || first_b_; -} - - - -Moment -Request_chord_iterator::next_moment()const -{ - Moment m (0); - if (!first_b_) - m = elt_duration_; - return m; -} - -void -Request_chord_iterator::do_print() const -{ -#ifndef NPRINT - DOUT << "duration: " << elt_duration_; -#endif -} -void -Request_chord_iterator::process_and_next (Moment mom) -{ - if ( first_b_) - { - for (PCursor i (elt_l_->music_p_list_); i.ok(); i++) - { - assert (i->is_type_b (Request::static_name())); - Request * req_l = (Request*)i.ptr(); - bool gotcha = report_to_l()->try_request (req_l); - if (!gotcha) - req_l->warning ("Junking request: " + String (req_l->name())); - - } - first_b_ = false; - } - - if ( mom >= elt_duration_) - last_b_ = true; -} diff --git a/lily/music-list.cc b/lily/music-list.cc index ad10bce46e..93a64e6a01 100644 --- a/lily/music-list.cc +++ b/lily/music-list.cc @@ -25,7 +25,7 @@ IMPLEMENT_IS_TYPE_B1(Voice,Music_list); IMPLEMENT_IS_TYPE_B1(Chord,Music_list); MInterval -Chord::time_int()const +Chord::time_int() const { MInterval m; for (iter (music_p_list_.top(), i); i.ok (); i++) @@ -62,7 +62,7 @@ Voice::time_int() const /* c4 <> c4 */ - if ( !interval.empty_b()) + if (!interval.empty_b()) last += interval.length(); } return offset_mom_ + MInterval (0,last); @@ -98,7 +98,7 @@ Music_list::transpose (Melodic_req const*rq) } void -Music_list::do_print()const +Music_list::do_print() const { #ifndef NPRINT for (iter (music_p_list_.top(),i); i.ok (); i++) diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc new file mode 100644 index 0000000000..5de256a365 --- /dev/null +++ b/lily/music-output-def.cc @@ -0,0 +1,12 @@ +/* + music-output-def.cc -- implement Music_output_def + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "music-output-def.hh" + +IMPLEMENT_IS_TYPE_B(Music_output_def); + diff --git a/lily/music.cc b/lily/music.cc index 6cd34fc2a0..7de77d1fc9 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -18,10 +18,10 @@ Music::time_int() const } void -Music::print()const +Music::print() const { #ifndef NPRINT - if ( ! check_debug) + if (! check_debug) return ; DOUT << name() << "{"; if (type_str_!="" || id_str_!="") @@ -43,7 +43,7 @@ Music::translate (Moment) } void -Music::do_print()const +Music::do_print() const { } diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 4924a934be..9ffd4f494c 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -14,29 +14,12 @@ #include "music-list.hh" -IMPLEMENT_IS_TYPE_B1(Stem_req,Rhythmic_req); - -void -Stem_req::do_print() const -{ -#ifndef NPRINT - Rhythmic_req::do_print(); - DOUT << "dir : " << dir_i_; -#endif -} - -Stem_req::Stem_req() -{ - dir_i_ = 0; -} - -/* ************** */ IMPLEMENT_IS_TYPE_B1(Musical_req,Request); void -Musical_req::do_print()const{} +Musical_req::do_print() const{} void -Tie_req::do_print()const{} +Tie_req::do_print() const{} /* *************** */ @@ -64,7 +47,7 @@ Spacing_req::Spacing_req() IMPLEMENT_IS_TYPE_B1(Spacing_req,Request); void -Spacing_req::do_print()const +Spacing_req::do_print() const { #ifndef NPRINT DOUT << "next " << next << "dist " << distance << "strength\n"; @@ -75,7 +58,7 @@ Spacing_req::do_print()const IMPLEMENT_IS_TYPE_B2(Blank_req,Spacing_req,Rhythmic_req); void -Blank_req::do_print()const +Blank_req::do_print() const { Spacing_req::do_print(); } @@ -114,7 +97,7 @@ Melodic_req::transpose (Melodic_req const & delta) IMPLEMENT_IS_TYPE_B1(Melodic_req,Musical_req); bool -Melodic_req::do_equal_b (Request*r)const +Melodic_req::do_equal_b (Request*r) const { Melodic_req* m= r->musical()->melodic (); return !compare (*m, *this); @@ -129,7 +112,7 @@ Melodic_req::compare (Melodic_req const &m1 , Melodic_req const&m2) if (o) return o; - if ( n) + if (n) return n; if (a) return a; @@ -170,7 +153,7 @@ Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2) } bool -Rhythmic_req::do_equal_b (Request*r)const +Rhythmic_req::do_equal_b (Request*r) const { Rhythmic_req* rh = r->musical()->rhythmic (); @@ -209,7 +192,7 @@ Lyric_req::Lyric_req (Text_def* def_p) :Text_req (0, def_p) { def_p->align_i_ = 0; // centre - dir_i_ = -1; // lyrics below (invisible) staff + dir_ = DOWN; // lyrics below (invisible) staff } @@ -224,7 +207,7 @@ Lyric_req::do_print() const /* *************** */ bool -Note_req::do_equal_b (Request*r)const +Note_req::do_equal_b (Request*r) const { return Rhythmic_req::do_equal_b (r) && Melodic_req::do_equal_b (r); } @@ -267,17 +250,17 @@ Beam_req::Beam_req() IMPLEMENT_IS_TYPE_B1(Beam_req,Span_req); void -Beam_req::do_print()const{} +Beam_req::do_print() const{} /* *************** */ IMPLEMENT_IS_TYPE_B1(Slur_req,Span_req); void -Slur_req::do_print()const{} +Slur_req::do_print() const{} /* *************** */ bool -Span_req:: do_equal_b (Request*r)const +Span_req:: do_equal_b (Request*r) const { Span_req * s = r->span(); return spantype - s->spantype; @@ -291,17 +274,17 @@ Span_req::Span_req() /* *************** */ Script_req::Script_req (Script_req const&s) { - dir_i_ = s.dir_i_; + dir_ = s.dir_; scriptdef_p_ = s.scriptdef_p_ ? s.scriptdef_p_->clone() : 0; } /* don't check dirs? - (d1.dir_i_ == d2.dir_i_) + (d1.dir_ == d2.dir_) */ bool -Script_req::do_equal_b (Request*r)const +Script_req::do_equal_b (Request*r) const { Script_req * s = r->script(); @@ -310,7 +293,7 @@ Script_req::do_equal_b (Request*r)const Script_req::Script_req() { - dir_i_ = 0; + dir_ = CENTER; scriptdef_p_ = 0; } @@ -321,7 +304,7 @@ void Script_req::do_print() const { #ifndef NPRINT - DOUT << " dir " << dir_i_ ; + DOUT << " dir " << dir_ ; scriptdef_p_->print(); #endif } @@ -352,12 +335,12 @@ Text_req::~Text_req() Text_req::Text_req (Text_req const& src) { tdef_p_ = new Text_def (*src.tdef_p_); - dir_i_ = src.dir_i_; + dir_ = src.dir_; } Text_req::Text_req (int dir_i, Text_def* tdef_p) { - dir_i_ = dir_i; + dir_ = Direction(dir_i); tdef_p_ = tdef_p; } @@ -368,7 +351,7 @@ void Text_req::do_print() const { #ifndef NPRINT - DOUT << " dir " << dir_i_ ; + DOUT << " dir " << dir_ ; tdef_p_->print(); #endif } @@ -435,18 +418,18 @@ Absolute_dynamic_req::Absolute_dynamic_req() Span_dynamic_req::Span_dynamic_req() { - dynamic_dir_i_ = 0; + dynamic_dir_ = CENTER; } IMPLEMENT_IS_TYPE_B1(Span_dynamic_req,Musical_req); void -Span_dynamic_req::do_print()const +Span_dynamic_req::do_print() const { #ifndef NPRINT Span_req::do_print(); - DOUT << "louder/louder: " <warning( "redeclaration of \\" + name_str); + old->warning("redeclaration of \\" + name_str); delete old; } (*identifier_assoc_p_)[name_str] = i; @@ -121,7 +121,7 @@ My_lily_lexer::~My_lily_lexer() delete identifier_assoc_p_; } void -My_lily_lexer::print_declarations (bool init_b)const +My_lily_lexer::print_declarations (bool init_b) const { for (Assoc_iter ai (*identifier_assoc_p_); ai.ok(); ai++) diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index eb5d2f0d82..0b1121190a 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -33,7 +33,7 @@ My_lily_parser::set_debug() #ifndef NPRINT String s = ""; if (init_parse_b_) - s = "Init"; + s = "Init"; set_yydebug (!monitor->silence (s+"Parser") && check_debug); lexer_p_->set_debug (!monitor->silence (s+"Lexer") && check_debug); #endif @@ -46,10 +46,10 @@ My_lily_parser::print_declarations() String s = ""; if (init_parse_b_) - s = "Init"; + s = "Init"; if (!monitor->silence (s+"Declarations") && check_debug) { - lexer_p_->print_declarations (init_parse_b_); + lexer_p_->print_declarations (init_parse_b_); } #endif } @@ -69,14 +69,14 @@ My_lily_parser::parse_file (String init, String s) print_declarations(); init_parse_b_ = false; - set_debug(); + set_debug(); lexer_p_->new_input (s , source_l_); do_yyparse(); print_declarations(); if (!define_spot_array_.empty()) - warning ("Braces don't match."); + warning ("Braces don't match."); } My_lily_parser::~My_lily_parser() @@ -92,7 +92,7 @@ My_lily_parser::remember_spot() } char const * -My_lily_parser::here_ch_C()const +My_lily_parser::here_ch_C() const { return lexer_p_->here_ch_C(); } @@ -101,8 +101,8 @@ void My_lily_parser::parser_error (String s) { here_input().error (s); - if ( fatal_error_i_) - exit (fatal_error_i_); + if (fatal_error_i_) + exit (fatal_error_i_); error_level_i_ = 1; } @@ -125,7 +125,7 @@ void My_lily_parser::set_last_duration (Duration const *d) { if (last_duration_mode_b_) - default_duration_ = *d; + default_duration_ = *d; } @@ -151,25 +151,22 @@ My_lily_parser::get_rest_element (String s, Duration * duration_p) Chord* velt_p = new Request_chord; velt_p->set_spot (here_input()); - if (s=="s") { /* Space */ - Skip_req * skip_p = new Skip_req; - skip_p->duration_ = *duration_p; + if (s=="s") + { /* Space */ + Skip_req * skip_p = new Skip_req; + skip_p->duration_ = *duration_p; - skip_p->set_spot (here_input()); - velt_p->add (skip_p); + skip_p->set_spot (here_input()); + velt_p->add (skip_p); } else { - Rest_req * rest_req_p = new Rest_req; - rest_req_p->duration_ = *duration_p; - rest_req_p->set_spot (here_input()); + Rest_req * rest_req_p = new Rest_req; + rest_req_p->duration_ = *duration_p; + rest_req_p->set_spot (here_input()); - velt_p->add (rest_req_p); + velt_p->add (rest_req_p); } - Stem_req * stem_p = new Stem_req; - stem_p->duration_ = *duration_p; - stem_p->set_spot ( here_input()); - velt_p->add (stem_p); delete duration_p; return velt_p; @@ -183,15 +180,6 @@ My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p) v->add (rq); - if (duration_p->durlog_i_ >= 1) - { - Stem_req * stem_req_p = new Stem_req(); - stem_req_p->duration_ = *duration_p; - - stem_req_p->set_spot (here_input()); - v->add (stem_req_p); - } - rq->set_duration (*duration_p); rq->set_spot (here_input()); delete duration_p ; @@ -205,57 +193,57 @@ My_lily_parser::get_parens_request (char c) switch (c) { - case '~': - req_p = new Tie_req; - break; - case '[': - case ']': - { + case '~': + req_p = new Tie_req; + break; + case '[': + case ']': + { Beam_req*b = new Beam_req; int p_i=plet_.type_i_ ; // ugh . Should junk? if (p_i!= 1) - b->nplet = p_i; + b->nplet = p_i; req_p = b; - } - break; - - case '>': - case '!': - case '<': - req_p = new Span_dynamic_req; - break; + } + break; + + case '>': + case '!': + case '<': + req_p = new Span_dynamic_req; + break; - case ')': - case '(': - req_p = new Slur_req; - break; - default: - assert (false); - break; + case ')': + case '(': + req_p = new Slur_req; + break; + default: + assert (false); + break; } switch (c) { - case '<': - case '>': - case '(': - case '[': - req_p->span()->spantype = Span_req::START; - break; - case '!': - case ')': - case ']': - req_p->span()->spantype = Span_req::STOP; - break; + case '<': + case '>': + case '(': + case '[': + req_p->span()->spantype = Span_req::START; + break; + case '!': + case ')': + case ']': + req_p->span()->spantype = Span_req::STOP; + break; - default: - break; + default: + break; } - if (req_p->musical()->span_dynamic ()) - { - Span_dynamic_req* s_l= (req_p->musical()->span_dynamic ()) ; - s_l->dynamic_dir_i_ = (c == '<') ? 1:-1; + if (req_p->musical()->span_dynamic ()) + { + Span_dynamic_req* s_l= (req_p->musical()->span_dynamic ()) ; + s_l->dynamic_dir_ = (c == '<') ? UP:DOWN; } req_p->set_spot (here_input()); @@ -281,12 +269,12 @@ My_lily_parser::add_requests (Chord*v) { for (int i = 0; i < pre_reqs.size(); i++) { - v->add (pre_reqs[i]); + v->add (pre_reqs[i]); } pre_reqs.clear(); for (int i = 0; i add (post_reqs[i]); + v->add (post_reqs[i]); } post_reqs.clear(); } @@ -298,7 +286,7 @@ My_lily_parser::pop_spot() } Input -My_lily_parser::here_input()const +My_lily_parser::here_input() const { Source_file * f_l= lexer_p_->source_file_l(); return Input (f_l, here_ch_C()); diff --git a/lily/note-column-grav.cc b/lily/note-column-grav.cc index 34e12316d0..a77557793e 100644 --- a/lily/note-column-grav.cc +++ b/lily/note-column-grav.cc @@ -14,19 +14,19 @@ #include "rest-column.hh" bool -Note_column_engraver::acceptable_elem_b (Score_elem const*elem_C)const +Note_column_engraver::acceptable_elem_b (Score_elem const*elem_C) const { char const*nC = elem_C->name(); return (nC == Script::static_name() || nC == Note_head::static_name () - || nC == Stem::static_name()); + || nC == Stem::static_name()); } Note_column* Note_column_engraver::note_col_l() { if (!ncol_p_) { - ncol_p_ = new Note_column; - announce_element (Score_elem_info (ncol_p_, 0)); + ncol_p_ = new Note_column; + announce_element (Score_elem_info (ncol_p_, 0)); } return ncol_p_; } @@ -36,8 +36,8 @@ Note_column_engraver::rest_col_l() { if (!restcol_p_) { - restcol_p_ = new Rest_column; - announce_element (Score_elem_info (restcol_p_,0)); + restcol_p_ = new Rest_column; + announce_element (Score_elem_info (restcol_p_,0)); } return restcol_p_; } @@ -46,49 +46,49 @@ void Note_column_engraver::acknowledge_element (Score_elem_info i) { if (!acceptable_elem_b (i.elem_l_)) - return; + return; char const*nC = i.elem_l_->name(); if (nC == Script::static_name() && i.req_l_ && i.req_l_->musical ()) { - script_l_arr_.push ((Script*)i.elem_l_->item()); + script_l_arr_.push ((Script*)i.elem_l_->item()); } else if (nC == Note_head::static_name()) { - Note_head * h_l = (Note_head*)i.elem_l_->item(); - if (h_l->rest_b_) - rest_col_l()->add (h_l); - else - note_col_l()->add (h_l); + Note_head * h_l = (Note_head*)i.elem_l_->item(); + if (h_l->rest_b_) + rest_col_l()->add (h_l); + else + note_col_l()->add (h_l); } else if (nC == Stem::static_name()) { - stem_l_ = (Stem*)i.elem_l_->item(); + stem_l_ = (Stem*)i.elem_l_->item(); } - if ( ncol_p_ || restcol_p_) + if (ncol_p_ || restcol_p_) { - if ( stem_l_) - { - if (restcol_p_&& !restcol_p_->stem_l_) - restcol_p_->set (stem_l_); - if (ncol_p_ && !ncol_p_->stem_l_) - ncol_p_->set (stem_l_); - } + if (stem_l_) + { + if (restcol_p_&& !restcol_p_->stem_l_) + restcol_p_->set (stem_l_); + if (ncol_p_ && !ncol_p_->stem_l_) + ncol_p_->set (stem_l_); + } - for (int i=0; i < script_l_arr_.size(); i++) - { - if (restcol_p_) - restcol_p_->add (script_l_arr_[i]); - if ( ncol_p_) - ncol_p_->add (script_l_arr_[i]); - } + for (int i=0; i < script_l_arr_.size(); i++) + { + if (restcol_p_) + restcol_p_->add (script_l_arr_[i]); + if (ncol_p_) + ncol_p_->add (script_l_arr_[i]); + } - script_l_arr_.clear(); + script_l_arr_.clear(); } } @@ -98,21 +98,21 @@ Note_column_engraver::do_pre_move_processing() { if (ncol_p_) { - if (! ncol_p_->h_shift_b_) - ncol_p_->h_shift_b_ = h_shift_b_; - if (! ncol_p_->dir_i_) - ncol_p_->dir_i_ = dir_i_; + if (! ncol_p_->h_shift_b_) + ncol_p_->h_shift_b_ = h_shift_b_; + if (! ncol_p_->dir_) + ncol_p_->dir_ = dir_; - typeset_element (ncol_p_); - ncol_p_ =0; + typeset_element (ncol_p_); + ncol_p_ =0; } if (restcol_p_) { - if (! restcol_p_->dir_i_) - restcol_p_->dir_i_ = dir_i_; + if (! restcol_p_->dir_) + restcol_p_->dir_ = dir_; - typeset_element (restcol_p_); - restcol_p_ =0; + typeset_element (restcol_p_); + restcol_p_ =0; } } @@ -126,15 +126,15 @@ Note_column_engraver::do_post_move_processing() void Note_column_engraver::set_feature (Feature i) { - if (i.type_ == "vdir") - dir_i_ = i.value_; - if (i.type_ == "hshift") - h_shift_b_ = (bool)(int)i.value_; + if (i.type_ == "vdir") + dir_ = (Direction) int(i.value_); + if (i.type_ == "hshift") + h_shift_b_ = (bool)(int)i.value_; } Note_column_engraver::Note_column_engraver() { - dir_i_ =0; + dir_ =CENTER; h_shift_b_ = false; ncol_p_=0; diff --git a/lily/note-column.cc b/lily/note-column.cc index 19cf429928..f310d0828c 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -14,13 +14,6 @@ IMPLEMENT_IS_TYPE_B1(Note_column,Head_column); -void -Note_column::set (Stem*s) -{ - stem_l_ = s; - add_support (s); -} - Note_column::Note_column() { h_shift_b_ =false; @@ -33,10 +26,10 @@ Note_column::sort() } Interval_t -Note_column::head_positions_interval()const +Note_column::head_positions_interval() const { ((Note_column*)this)->sort(); - return Interval_t ( head_l_arr_[0]->position_i_, + return Interval_t (head_l_arr_[0]->position_i_, head_l_arr_.top()->position_i_); } @@ -45,9 +38,9 @@ Note_column::head_positions_interval()const void Note_column::do_pre_processing() { - if (!dir_i_&& !stem_l_) + if (!dir_&& !stem_l_) { - dir_i_ = (head_positions_interval().center () >= 5) ? -1 : 1; + dir_ = (head_positions_interval().center () >= 5) ? DOWN:UP; } Head_column::do_pre_processing(); } diff --git a/lily/note-performer.cc b/lily/note-performer.cc index dd2ac9da14..9ae829f7ff 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -26,7 +26,7 @@ void Note_performer::do_print() const { #ifndef NPRINT - if ( note_req_l_) + if (note_req_l_) { note_req_l_->print(); } @@ -37,20 +37,20 @@ void Note_performer::process_requests() { // this is _really_ braindead, but it generates some output - if ( !note_req_l_ || !note_req_l_->melodic() || !note_req_l_->rhythmic ()) + if (!note_req_l_ || !note_req_l_->melodic() || !note_req_l_->rhythmic ()) return; - play (new Audio_note (note_req_l_) ); + play (new Audio_note (note_req_l_)); note_req_l_ = 0; } bool Note_performer::do_try_request (Request* req_l) { - if ( note_req_l_) + if (note_req_l_) return false; - if ( !req_l->musical() || !req_l->musical ()->note ()) + if (!req_l->musical() || !req_l->musical ()->note ()) return false; note_req_l_ = req_l->musical()->melodic (); diff --git a/lily/note.cc b/lily/note.cc index ec84dbba52..6bb466a5af 100644 --- a/lily/note.cc +++ b/lily/note.cc @@ -49,7 +49,7 @@ Request* get_script_req (int d , General_script_def*def) { Musical_script_req* script_req_p = new Musical_script_req; - script_req_p->dir_i_ =d; + script_req_p->dir_ =d; script_req_p->scriptdef_p_=def; return script_req_p; } diff --git a/lily/notehead.cc b/lily/notehead.cc index 6871240ff9..0afaabd49f 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -31,7 +31,7 @@ Note_head::Note_head (int ss) { - x_dir_i_ = 0; + x_dir_ = CENTER; staff_size_i_=ss; position_i_ = 0; balltype_i_ = 0; @@ -46,14 +46,14 @@ Note_head::do_pre_processing() { // 8 ball looks the same as 4 ball: if (balltype_i_ > 2 && !rest_b_) - balltype_i_ = 2; + balltype_i_ = 2; if (rest_b_) { - if (balltype_i_ == 0) - position_i_ += 6; - else if (balltype_i_ == 0) - position_i_ += 4; + if (balltype_i_ == 0) + position_i_ += 6; + else if (balltype_i_ == 0) + position_i_ += 4; } } @@ -68,13 +68,13 @@ Note_head::set_rhythmic (Rhythmic_req*r_req_l) IMPLEMENT_IS_TYPE_B1(Note_head,Item); void -Note_head::do_print()const +Note_head::do_print() const { #ifndef NPRINT if (rest_b_) - DOUT << "REST! "; + DOUT << "REST! "; DOUT << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_ - << "dots_i_ " << dots_i_; + << "dots_i_ " << dots_i_; #endif } @@ -89,9 +89,9 @@ void Note_head::set_dots() { if (!(position_i_ %2) && rest_b_ && balltype_i_ == 0) - dot_delta_y_i_ = -1; + dot_delta_y_i_ = -1; else if (!(position_i_ %2)) - dot_delta_y_i_ = 1; + dot_delta_y_i_ = 1; } /* @@ -110,39 +110,39 @@ Note_head::brew_molecule_p() const bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1); if (!rest_b_) - s = p->lookup_l()->ball (balltype_i_); + s = p->lookup_l()->ball (balltype_i_); else { - s = p->lookup_l()->rest (balltype_i_, streepjes_b); + s = p->lookup_l()->rest (balltype_i_, streepjes_b); } out = new Molecule (Atom (s)); - out->translate (x_dir_i_ * s.dim.x().length () , X_AXIS); + out->translate (x_dir_ * s.dim.x().length () , X_AXIS); if (dots_i_) { - Symbol d = p->lookup_l()->dots (dots_i_); - Molecule dm; - dm.add (Atom (d)); - dm.translate (inter_f * dot_delta_y_i_ , Y_AXIS); - out->add_right (dm); + Symbol d = p->lookup_l()->dots (dots_i_); + Molecule dm; + dm.add (Atom (d)); + dm.translate (inter_f * dot_delta_y_i_ , Y_AXIS); + out->add_right (dm); } if (rest_b_) { - streepjes_b = false; + streepjes_b = false; } if (streepjes_b) { - int dir = sign (position_i_); - int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2; + int dir = sign (position_i_); + int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2; - Symbol str = p->lookup_l()->streepjes (s); - Molecule sm; - sm.add (Atom (str)); - if (position_i_ % 2) - sm.translate (-inter_f* dir, Y_AXIS); - out->add (sm); + Symbol str = p->lookup_l()->streepjes (s); + Molecule sm; + sm.add (Atom (str)); + if (position_i_ % 2) + sm.translate (-inter_f* dir, Y_AXIS); + out->add (sm); } out->translate (inter_f*position_i_, Y_AXIS); diff --git a/lily/p-col.cc b/lily/p-col.cc index 9e5be11664..715adecd83 100644 --- a/lily/p-col.cc +++ b/lily/p-col.cc @@ -1,5 +1,5 @@ /* - p-col.cc -- implement PCol + p-col.cc -- implement Paper_column source file of the GNU LilyPond music typesetter @@ -8,157 +8,91 @@ #include "p-col.hh" #include "p-score.hh" - #include "debug.hh" -Interval -PCol::width() const -{ - Interval w; - - for (iter_top (its,i); i.ok(); i++) - w.unite (i->width()); - if (w.empty_b()) - w.unite (Interval (0,0)); - return w; -} - -void -PCol::clean_breakable_items() -{ - if (!line_l_) - { - its.junk_links(); - } - if (prebreak_p_) - prebreak_p_->clean_breakable_items(); - if (postbreak_p_) - postbreak_p_->clean_breakable_items(); -} int -PCol::rank_i() const +Paper_column::rank_i() const { return rank_i_; } void -PCol::set_rank (int i) +Paper_column::set_rank (int i) { rank_i_ = i; - if (prebreak_p_) - prebreak_p_->rank_i_ = i; - if (postbreak_p_) - postbreak_p_->rank_i_ = i; + if (prebreak_l()) + prebreak_l()->rank_i_ = i; + if (postbreak_l()) + postbreak_l()->rank_i_ = i; } void -PCol::print() const +Paper_column::do_print() const { #ifndef NPRINT - DOUT << "PCol {"; - DOUT << "rank: " << rank_i_ << '\n'; - - DOUT << "# symbols: " << its.size() ; - if (prebreak_p_){ - DOUT << "\npre: "; - prebreak_p_->print(); + if (prebreak_l()) + { + DOUT << "\npre: "; + prebreak_l()->print(); } - if (postbreak_p_) { + if (postbreak_l()) + { DOUT << "post: "; - postbreak_p_->print(); + postbreak_l()->print(); } - else if (daddy_l_) + if (break_status_i_) { - DOUT <<'\n' << ((this == daddy_l_->prebreak_p_) ? - "prebreak" : "postbreak"); - DOUT << '\n'; + DOUT <<'\n' << ((break_status_i_ == -1)? "prebreak" : "postbreak"); + DOUT << '\n'; } DOUT << "extent: " << width().str () << "\n"; - DOUT << "}\n"; #endif } int -PCol::compare (PCol const &c1, PCol const &c2) +Paper_column::compare (Paper_column const &c1, Paper_column const &c2) { return c1.rank_i() - c2.rank_i (); } -void -PCol::OK() const +Paper_column* +Paper_column::prebreak_l() const { -#ifndef NDEBUG - if (prebreak_p_ || postbreak_p_) - { - assert (prebreak_p_&&postbreak_p_); - assert (prebreak_p_->daddy_l_ == this); - assert (postbreak_p_->daddy_l_ == this); - } -#endif + return (Paper_column*)broken_to_drul_[LEFT]; } -void -PCol::set_breakable() +Paper_column* +Paper_column::postbreak_l() const { - if (breakable_b()) - return; - - do_set_breakable(); - prebreak_p_->pscore_l_ = pscore_l_; - postbreak_p_->pscore_l_ = pscore_l_; - - prebreak_p_->daddy_l_ = postbreak_p_->daddy_l_ = this; + return(Paper_column*) broken_to_drul_[RIGHT]; } -void -PCol::do_set_breakable() -{ - prebreak_p_ = new PCol; - postbreak_p_ = new PCol; -} - - bool -PCol::breakpoint_b() const +Paper_column::breakpoint_b() const { return !line_l_; } -bool -PCol::breakable_b() const -{ - return prebreak_p_||postbreak_p_||daddy_l_; -} - -PCol::PCol() +Paper_column::Paper_column() { used_b_ = false; error_mark_b_ = false; - daddy_l_ = 0; - prebreak_p_=0; - postbreak_p_=0; line_l_=0; - hpos_f_ = -1.0; - pscore_l_ = 0; rank_i_ = -1; } -PCol::~PCol() -{ - delete prebreak_p_; - delete postbreak_p_; -} - -void -PCol::add (Item *i) +Line_of_score* +Paper_column::line_l() const { - its.bottom().add (i); - i->pcol_l_ = this; + return line_l_; } bool -PCol::used_b()const +Paper_column::used_b() const { - return daddy_l_ || breakable_b() || its.size ()|| used_b_; + return linked_b(); } + +IMPLEMENT_IS_TYPE_B1(Paper_column, Horizontal_group_item); + diff --git a/lily/p-score.cc b/lily/p-score.cc index dbf5d84525..ffa0dcfc2b 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -15,55 +15,35 @@ #include "p-score.hh" #include "tex-stream.hh" #include "p-col.hh" - +#include "header.hh" #include "word-wrap.hh" #include "gourlay-breaking.hh" -Paper_score::Paper_score (Paper_def*p) +Paper_score::Paper_score () { - paper_l_ = p; super_elem_l_ = new Super_elem; typeset_element (super_elem_l_); } -Paper_score::~Paper_score() +Paper_score::~Paper_score () { - super_elem_l_->unlink_all(); + super_elem_l_->unlink_all (); + for (PCursor i(elem_p_list_.top()); i.ok(); i++) + assert(!i->linked_b()); } void Paper_score::typeset_element (Score_elem * elem_p) { - elem_p_list_.bottom().add (elem_p); + elem_p_list_.bottom ().add (elem_p); elem_p->pscore_l_ = this; - elem_p->add_processing(); -} - -void -Paper_score::typeset_item (Item *i, PCol *c) -{ - assert (c && i); - int breakstat = i->break_status_i_; - - if (breakstat == -1) - { - c = c->prebreak_p_; - }else if (breakstat == 1) - { - c = c->postbreak_p_; - } - - c->add (i); - typeset_element (i); + elem_p->add_processing (); } void Paper_score::typeset_broken_spanner (Spanner*span_p) { - span_p->left_col_l_->starters.bottom().add (span_p); - assert (span_p->left_col_l_->line_l_ == span_p->right_col_l_->line_l_); - typeset_element (span_p); } @@ -71,111 +51,82 @@ Paper_score::typeset_broken_spanner (Spanner*span_p) void Paper_score::typeset_unbroken_spanner (Spanner*span_p) { - span_p_list_.bottom().add (span_p); + span_p_list_.bottom ().add (span_p); span_p->pscore_l_=this; - if (span_p->left_col_l_) - span_p->left_col_l_->used_b_ = true; - if ( span_p->right_col_l_) - span_p->right_col_l_->used_b_ = true; // do not init start/stop fields. These are for broken spans only. - span_p->add_processing(); + span_p->add_processing (); } void -Paper_score::clean_cols() +Paper_score::clean_cols () { int rank_i = 0; - for (iter_top (col_p_list_,c); c.ok();) - if (!c->used_b()) - { - delete c.remove_p(); - } - else - { - c->set_rank (rank_i++); - c++; - } -} - -void -Paper_score::add (PCol *p) -{ - p->pscore_l_ = this; - if (p->breakable_b()) + for (iter_top (col_p_list_,c); c.ok ();) { - p->prebreak_p_->pscore_l_ = this; - p->postbreak_p_->pscore_l_ = this; + c->set_rank (rank_i++); + c++; } - col_p_list_.bottom().add (p); } void -Paper_score::output (Tex_stream &ts) +Paper_score::add_column (Paper_column *p) { - ts << "\n "<< paper_l_->lookup_l()->texsetting << "%(Tex id)\n"; - ts<< super_elem_l_->TeX_string(); - ts << "\n\\EndLilyPondOutput"; + col_p_list_.bottom ().add (p); + typeset_element(p); } + void -Paper_score::OK()const +Paper_score::OK () const { #ifndef NDEBUG - for (iter_top (col_p_list_,cc); cc.ok(); cc++) - cc->OK(); - for (PCursor i (elem_p_list_.top()); i.ok (); i++) - i->OK(); + for (PCursor i (elem_p_list_.top ()); i.ok (); i++) + i->OK (); #endif } void -Paper_score::print() const +Paper_score::print () const { #ifndef NPRINT - if ( !check_debug) - return ; + if (!check_debug) + return ; DOUT << "Paper_score { "; - paper_l_->print(); DOUT << "\n elements: "; - for (iter_top (elem_p_list_,cc); cc.ok(); cc++) - cc->print(); + for (iter_top (elem_p_list_,cc); cc.ok (); cc++) + cc->print (); DOUT << "\n unbroken spanners: "; - for (iter (span_p_list_.top(), i); i.ok (); i++) - i->print(); - DOUT << "\ncolumns: "; - for (iter_top (col_p_list_,cc); cc.ok(); cc++) - cc->print(); + for (iter (span_p_list_.top (), i); i.ok (); i++) + i->print (); DOUT << "}\n"; #endif } void -Paper_score::preprocess() +Paper_score::preprocess () { - super_elem_l_->breakable_col_processing(); - super_elem_l_->pre_processing(); + super_elem_l_->breakable_col_processing (); + super_elem_l_->pre_processing (); } void -Paper_score::postprocess() +Paper_score::postprocess () { - super_elem_l_->post_processing(); - super_elem_l_->molecule_processing(); + super_elem_l_->post_processing (); + super_elem_l_->molecule_processing (); } -PCursor -Paper_score::find_col (PCol const *c)const +PCursor +Paper_score::find_col (Paper_column const *c) const { - PCol const *what = c; - if (what->daddy_l_) - what = what->daddy_l_; + Paper_column const *what = c; - return col_p_list_.find ((PCol*)what); + return col_p_list_.find ((Paper_column*)what); } @@ -183,139 +134,158 @@ void Paper_score::set_breaking (Array const &breaking) { super_elem_l_->line_of_score_l_->set_breaking (breaking); - super_elem_l_->break_processing(); + super_elem_l_->break_processing (); - for (iter (span_p_list_.top(),i); i.ok ();) + for (iter (span_p_list_.top (),i); i.ok ();) { - Spanner *span_p = i.remove_p(); - if (span_p->broken_b()) - { - span_p->unlink(); - delete span_p; + Spanner *span_p = i.remove_p (); + if (span_p->broken_b ()) + { + span_p->unlink (); + delete span_p; }else { typeset_broken_spanner (span_p); } } - for (iter (elem_p_list_.top(),i); i.ok () ;) + for (iter (elem_p_list_.top (),i); i.ok () ;) { - Item *i_l =i->item(); - if ( i_l && !i_l->pcol_l_->line_l_) - { - i_l->unlink(); - delete i.remove_p(); - } - else - i++; + Item *i_l =i->item (); + if (i_l && !i_l->line_l ()) + { + i_l->unlink (); + delete i.remove_p (); + } + else + i++; } - - for (iter_top (col_p_list_, i); i.ok(); i++) - i->clean_breakable_items(); } void -Paper_score::calc_breaking() +Paper_score::calc_breaking () { - Break_algorithm *algorithm_p; + Break_algorithm *algorithm_p=0; Array sol; bool try_wrap = ! paper_l_->get_var ("castingalgorithm"); if (!try_wrap) { - algorithm_p = new Gourlay_breaking ; - algorithm_p->set_pscore (this); - sol = algorithm_p->solve(); - delete algorithm_p; - if ( ! sol.size()) - { - warning ("Can not solve this casting problem exactly; revert to Word_wrap"); - try_wrap = true; - } + algorithm_p = new Gourlay_breaking ; + algorithm_p->set_pscore (this); + sol = algorithm_p->solve (); + delete algorithm_p; + if (! sol.size ()) + { + warning ("Can not solve this casting problem exactly; revert to Word_wrap"); + try_wrap = true; + } } if (try_wrap) { - algorithm_p = new Word_wrap; - algorithm_p->set_pscore (this); - sol = algorithm_p->solve(); - delete algorithm_p; + algorithm_p = new Word_wrap; + algorithm_p->set_pscore (this); + sol = algorithm_p->solve (); + delete algorithm_p; } set_breaking (sol); } void -Paper_score::process() +Paper_score::process () { - clean_cols(); - print(); + clean_cols (); + print (); *mlog << "Preprocessing elements... " <outfile_str_ ; + if (outname == "") + outname = default_out_str_+ ".tex"; -#ifndef NDEBUGA - for (PCursor i (elem_p_list_.top()); i.ok (); i++) - assert (i->status() >= 9); -#endif + *mlog << "TeX output to " << outname << " ...\n"; + + Tex_stream the_output (outname); + + the_output << "% outputting Score, defined at: " << origin_str_ << "\n"; + if (header_l_) + { + the_output << header_l_->TeX_string(); + } + + the_output << "\n "<< paper_l_->lookup_l ()->texsetting << "%(Tex id)\n"; + the_output<< super_elem_l_->TeX_output_str (); + the_output << "\n\\EndLilyPondOutput"; } /** Get all breakable columns between l and r, (not counting l and r). */ -Link_array -Paper_score::breakable_col_range (PCol*l,PCol*r)const +Link_array +Paper_score::breakable_col_range (Paper_column*l,Paper_column*r) const { - Link_array ret; + Link_array ret; - PCursor start (l ? find_col (l)+1 : col_p_list_.top()); - PCursor stop (r ? find_col (r) : col_p_list_.bottom()); + PCursor start (l ? find_col (l)+1 : col_p_list_.top ()); + PCursor stop (r ? find_col (r) : col_p_list_.bottom ()); /* ugh! windows-suck-suck-suck. - */ - while ( PCursor::compare (start,stop) < 0) + */ + while (PCursor::compare (start,stop) < 0) { - if (start->breakable_b()) - ret.push (start); - start++; + if (start->breakable_b_) + ret.push (start); + start++; } return ret; } -Link_array -Paper_score::col_range (PCol*l,PCol*r)const +Link_array +Paper_score::col_range (Paper_column*l, Paper_column*r) const { - Link_array ret; + Link_array ret; - PCursor start (l ? find_col (l)+1 : col_p_list_.top()); - PCursor stop (r ? find_col (r) : col_p_list_.bottom()); + PCursor start (l ? find_col (l)+1 : col_p_list_.top ()); + PCursor stop (r ? find_col (r) : col_p_list_.bottom ()); ret.push (l); /* ugh! windows-suck-suck-suck. - */ - while ( PCursor::compare (start,stop) < 0) - ret.push (start++); + */ + while (PCursor::compare (start,stop) < 0) + ret.push (start++); ret.push (r); return ret; } -Link_array -Paper_score::broken_col_range (PCol*l,PCol*r)const +Link_array +Paper_score::broken_col_range (Item const*l_item_l, Item const*r_item_l) const { - Link_array ret; - - PCursor start (l ? find_col (l)+1 : col_p_list_.top()); - PCursor stop (r ? find_col (r) : col_p_list_.bottom()); + Link_array ret; + Item const*l=l_item_l; + Item const*r=r_item_l; + + while (! l->is_type_b(Paper_column::static_name ())) + l = l->axis_group_l_a_[X_AXIS]->item (); + + while (! r->is_type_b(Paper_column::static_name ())) + r = r->axis_group_l_a_[X_AXIS]->item (); + + PCursor start (l ? find_col ((Paper_column*)l)+1 : col_p_list_.top ()); + PCursor stop (r ? find_col ((Paper_column*)r) : col_p_list_.bottom ()); /* ugh! windows-suck-suck-suck. */ - while ( PCursor::compare (start,stop) < 0) + while (PCursor::compare (start,stop) < 0) { - if (start->breakable_b() && !start->line_l_) - ret.push (start); - start++; + if (start->breakable_b_ && !start->line_l_) + ret.push (start); + start++; } return ret; diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 8950d98723..8bf32b1490 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -15,20 +15,22 @@ #include "lookup.hh" #include "dimen.hh" #include "input-translator.hh" -#include "engraver-group.hh" #include "assoc-iter.hh" +#include "score-grav.hh" +#include "p-score.hh" +#include "main.hh" void Paper_def::set_var (String s, Real r) { - real_vars_p_->elem (s) = r; + real_vars_p_->elem (s) = r; } Real -Paper_def::get_var (String s)const +Paper_def::get_var (String s) const { if (! real_vars_p_->elt_b (s)) - error ( "unknown paper variable `" + s+"'"); + error ("unknown paper variable `" + s+"'"); return real_vars_p_->elem (s); } @@ -39,7 +41,7 @@ Paper_def::linewidth_f() const } Real -Paper_def::duration_to_dist (Moment d,Real k)const +Paper_def::duration_to_dist (Moment d,Real k) const { if (get_var("geometric")) return geometric_spacing(d); @@ -63,9 +65,9 @@ Paper_def::arithmetic_constant(Moment d) const } Real -Paper_def::arithmetic_spacing(Moment d ,Real k)const +Paper_def::arithmetic_spacing(Moment d ,Real k) const { - return (log_2(d) + k)* get_var( "arithmetic_multiplier"); + return (log_2(d) + k)* get_var("arithmetic_multiplier"); } Real @@ -122,7 +124,7 @@ Paper_def::interline_f() const Real -Paper_def::rule_thickness()const +Paper_def::rule_thickness() const { return get_var ("rule_thickness"); } @@ -139,7 +141,7 @@ Paper_def::internote_f() const } Real -Paper_def::note_width()const +Paper_def::note_width() const { return get_var ("notewidth"); } @@ -154,7 +156,7 @@ Paper_def::print() const itrans_p_->print(); for (Assoc_iter i (*real_vars_p_); i.ok(); i++) { - DOUT << i.key() << "= " << i.val () << "\n"; + DOUT << i.key() << "= " << i.val () << "\n"; } DOUT << "}\n"; #endif @@ -168,7 +170,19 @@ Paper_def::lookup_l() } Global_translator* -Paper_def::get_global_translator_p() const +Paper_def::get_global_translator_p() { - return itrans_p_->get_group_engraver_p()->global_l (); + if (only_midi) + { + return 0; + } + + Global_translator* g = itrans_p_->get_group_engraver_p()->global_l (); + assert (g->is_type_b (Score_engraver::static_name())); + Score_engraver*grav = (Score_engraver*) g; + grav->pscore_p_ = new Paper_score; + grav->pscore_p_->paper_l_ = this; + return g; } + +IMPLEMENT_IS_TYPE_B1(Paper_def, Music_output_def); diff --git a/lily/parser.y b/lily/parser.y index 288d1407f1..a8612c44d4 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -59,7 +59,7 @@ Box *box; Chord * chord; Duration *duration; - Identifier *id; + Identifier *id; Input_translator* itrans; Music *music; Music_list *musiclist; @@ -68,6 +68,7 @@ Interval *interval; Lookup*lookup; Melodic_req * melreq; + Music_output_def * outputdef; Midi_def* midi; Moment *moment; Note_req *notereq; @@ -88,12 +89,12 @@ } %{ -int +int yylex(YYSTYPE *s, void * v_l) { My_lily_parser *pars_l = (My_lily_parser*) v_l; My_lily_lexer * lex_l = pars_l->lexer_p_; - + lex_l->lexval_l = (void*) s; return lex_l->yylex(); } @@ -163,7 +164,7 @@ yylex(YYSTYPE *s, void * v_l) %token NOTENAME_ID %token DURATION_IDENTIFIER %token IDENTIFIER -%token MELODIC_REQUEST_IDENTIFIER +%token MELODIC_REQUEST_IDENTIFIER %token MUSIC_IDENTIFIER %token VOICE_IDENTIFIER %token POST_REQUEST_IDENTIFIER @@ -176,14 +177,14 @@ yylex(YYSTYPE *s, void * v_l) %token MIDI_IDENTIFIER %token PAPER_IDENTIFIER %token REQUEST_IDENTIFIER -%token REAL +%token REAL %token DURATION RESTNAME -%token STRING +%token STRING %token FIELDNAME RECORDLINE -%token POST_QUOTES +%token POST_QUOTES %token PRE_QUOTES - +%type output_def %type
mudela_header mudela_header_body %type box %type open_request_parens close_request_parens @@ -192,26 +193,26 @@ yylex(YYSTYPE *s, void * v_l) %type int %type script_dir %type identifier_init -%type explicit_steno_duration notemode_duration +%type explicit_steno_duration notemode_duration %type entered_notemode_duration explicit_duration %type dinterval %type intastint_list %type symtables symtables_body %type melodic_request steno_melodic_req %type steno_note_req -%type pitch_list +%type pitch_list %type midi_block midi_body %type duration_length %type Music transposed_music -%type Voice Voice_body +%type Voice Voice_body %type Chord Chord_body %type paper_block paper_body %type dim real %type unit -%type post_request pre_request command_req verbose_command_req +%type post_request pre_request command_req verbose_command_req %type abbrev_command_req -%type script_req dynamic_req +%type script_req dynamic_req %type score_block score_body %type