From cec6dfa6bf0fb931eb7f42b1ee44ca2ec19a9f34 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 11 Sep 1997 15:39:19 +0200 Subject: [PATCH] release: 0.1.13 --- .dstreamrc | 13 +- AUTHORS.text | 8 +- BUGS | 96 +++-- COPYING | 6 +- Documentation/AUTHORS.pod | 8 +- Documentation/CodingStyle.pod | 32 +- Documentation/faq.pod | 15 + Documentation/index.pod | 6 +- Documentation/lilypond.pod | 3 +- Documentation/mudela-course.doc | 130 ++++++- Documentation/mudela-man.doc | 8 +- Documentation/other-packages.pod | 39 +- Documentation/vocabulary-data | 57 +-- INSTALL.text | 12 +- NEWS | 46 ++- README | 57 +-- TODO | 76 ++-- VERSION | 4 +- bin/convert-mudela.in | 19 +- bin/make-website.in | 29 +- flower/NEWS | 3 + flower/choleski.cc | 2 +- flower/diagonal-storage.cc | 24 +- flower/directed-graph.cc | 2 +- flower/dstream.cc | 94 ++--- flower/flower-debug.cc | 2 +- flower/full-storage.cc | 2 +- flower/include/assoc.hh | 3 +- flower/include/cursor.hh | 10 +- flower/include/cursor.icc | 16 +- flower/include/cursor.tcc | 12 +- flower/include/dictionary-iter.hh | 27 ++ flower/include/dictionary.hh | 23 ++ flower/include/flower-debug.hh | 2 +- flower/include/fproto.hh | 4 +- flower/include/link.icc | 18 +- flower/include/list.hh | 2 +- flower/include/list.icc | 22 +- flower/include/list.tcc | 4 +- flower/include/nscalar.hh | 43 +++ flower/include/pcursor.hh | 2 +- flower/include/pqueue.hh | 2 +- flower/include/rational.hh | 2 +- flower/include/scalar.hh | 37 +- flower/include/string-data.hh | 2 +- flower/include/string-data.icc | 6 +- flower/include/string.hh | 11 +- flower/include/varray.hh | 2 +- flower/include/vector.hh | 2 +- flower/lgetopt.cc | 2 +- flower/matrix-storage.cc | 6 +- flower/matrix.cc | 10 +- flower/nscalar.cc | 8 + flower/path.cc | 4 +- flower/scalar.cc | 25 +- flower/string-convert.cc | 38 +- flower/string.cc | 28 +- flower/stringtest.cc | 4 +- init/engraver.ly | 124 ++++--- init/midi.ly | 3 +- init/paper16.ly | 12 +- init/paper20.ly | 2 +- init/performer.ly | 85 +++-- init/symbol.ly | 24 +- init/table16.ly | 3 + input/Makefile | 2 +- input/abbrev.ly | 2 +- input/beams.ly | 41 ++- input/cadenza.ly | 16 +- input/collisions.ly | 37 +- input/coriolan-alto.ly | 6 +- input/gallina.ly | 14 +- input/keys.ly | 2 +- input/kortjakje.ly | 4 +- input/multi.ly | 4 +- input/pedal.ly | 2 +- input/rhythm.ly | 52 ++- input/scales.ly | 2 +- input/scripts.ly | 2 +- input/scsii-menuetto.ly | 49 ++- input/slurs.ly | 6 +- input/standchen-16.tex | 10 +- input/standchen.ly | 46 +-- input/toccata-fuga-E.ly | 50 ++- input/twinkle-pop.ly | 9 +- input/twinkle.ly | 12 +- input/{fugue1.ly => wtk1-fugue1.ly} | 28 +- input/{wohltemperirt.ly => wtk1-fugue2.ly} | 21 +- input/{prelude1.ly => wtk1-prelude1.ly} | 27 +- input/wtk1-prelude2.ly.m4 | 88 +++++ lib/duration-convert.cc | 12 +- lib/includable-lexer.cc | 3 +- lib/include/binary-source-file.hh | 6 +- lib/include/duration-convert.hh | 26 +- lib/include/duration.hh | 2 +- lib/include/input.hh | 2 +- lib/include/source-file.hh | 10 +- lib/include/source.hh | 6 +- lib/include/warn.hh | 4 +- lib/simple-file-storage.cc | 16 +- lib/source-file.cc | 146 ++++---- lily/VERSION | 2 +- lily/abbreviation-beam-engraver.cc | 7 +- lily/atom.cc | 28 +- lily/audio-column.cc | 10 +- lily/audio-element.cc | 22 +- lily/audio-item.cc | 48 ++- lily/axis-group.cc | 12 +- lily/bar-column-grav.cc | 2 +- lily/bar-column.cc | 2 +- lily/bar-grav.cc | 7 +- lily/bar-number-grav.cc | 12 +- lily/bar.cc | 2 +- lily/beam-grav.cc | 2 +- lily/beam.cc | 3 +- lily/chord-iterator.cc | 2 +- lily/clef-grav.cc | 41 ++- lily/collision-grav.cc | 24 +- lily/collision.cc | 116 +++--- lily/command-request.cc | 11 - lily/dot-column-grav.cc | 8 + lily/dot-column.cc | 55 +++ lily/dots.cc | 37 ++ lily/dynamic-grav.cc | 32 +- lily/engraver-group.cc | 321 ++-------------- lily/engraver.cc | 103 +----- lily/global-gravs.cc | 93 ----- lily/global-performers.cc | 52 --- lily/global-translator.cc | 32 +- lily/head-column.cc | 82 ----- lily/head-grav.cc | 56 +-- lily/header.cc | 4 +- lily/identifier.cc | 8 +- lily/include/abbreviation-beam-engraver.hh | 3 +- lily/include/audio-column.hh | 2 +- lily/include/audio-element.hh | 8 +- lily/include/audio-item.hh | 74 ++-- lily/include/axes.hh | 3 +- lily/include/axis-group-administration.hh | 36 ++ lily/include/axis-group-element.hh | 36 ++ lily/include/axis-group-item.hh | 2 +- lily/include/axis-group-spanner.hh | 2 +- lily/include/axis-group.hh | 50 +-- lily/include/bar-column-grav.hh | 18 +- lily/include/bar-grav.hh | 17 +- lily/include/bar-number-grav.hh | 5 +- lily/include/beam-grav.hh | 1 + lily/include/clef-grav.hh | 51 +-- lily/include/collision-grav.hh | 11 +- lily/include/command-request.hh | 9 - lily/include/dot-column-grav.hh | 20 + lily/include/dot-column.hh | 31 ++ lily/include/dots.hh | 32 ++ lily/include/dynamic-grav.hh | 32 +- lily/include/elem-group.hh | 2 +- lily/include/engraver-group.hh | 70 +--- lily/include/engraver.hh | 152 ++------ lily/include/global-performers.hh | 33 -- lily/include/global-translator.hh | 13 +- lily/include/head-column.hh | 44 --- lily/include/head-grav.hh | 18 +- lily/include/header.hh | 4 +- lily/include/identifier.hh | 4 +- lily/include/input-translator.hh | 42 +-- lily/include/key-grav.hh | 32 +- lily/include/key-performer.hh | 15 +- lily/include/lily-proto.hh | 15 +- lily/include/line-group-grav.hh | 13 +- lily/include/local-key-grav.hh | 26 +- lily/include/lyric-engraver.hh | 1 + lily/include/lyric-performer.hh | 3 +- lily/include/main.hh | 1 - lily/include/meter-grav.hh | 1 + lily/include/meter-performer.hh | 15 +- lily/include/midi-def.hh | 8 +- lily/include/molecule.hh | 50 +-- lily/include/music-iterator.hh | 17 +- lily/include/music-output-def.hh | 19 +- lily/include/music.hh | 39 +- lily/include/my-lily-lexer.hh | 2 +- lily/include/note-column-grav.hh | 37 -- lily/include/note-column.hh | 27 +- lily/include/note-head.hh | 47 +-- lily/include/note-performer.hh | 13 +- lily/include/notename-table.hh | 4 +- lily/include/paper-def.hh | 7 +- lily/include/parseconstruct.hh | 2 - lily/include/performer-group-performer.hh | 36 +- lily/include/performer.hh | 30 +- lily/include/property-iterator.hh | 26 ++ lily/include/rest-collision-grav.hh | 13 +- lily/include/rest-collision.hh | 3 +- lily/include/rest-column.hh | 24 -- lily/include/rest-grav.hh | 30 ++ lily/include/rest.hh | 27 ++ lily/include/rhythmic-column-grav.hh | 33 ++ lily/include/rhythmic-head.hh | 32 ++ lily/include/score-align-grav.hh | 19 +- lily/include/score-elem-info.hh | 4 - lily/include/score-grav.hh | 4 +- lily/include/score-halign-grav.hh | 11 +- lily/include/score-performer.hh | 8 +- lily/include/script-grav.hh | 17 +- lily/include/slur-grav.hh | 30 +- lily/include/span-bar-grav.hh | 17 +- lily/include/span-score-bar-grav.hh | 10 +- lily/include/staff-info.hh | 2 - lily/include/staff-performer.hh | 17 +- lily/include/staff-sym-grav.hh | 13 +- lily/include/stem-grav.hh | 2 +- lily/include/stem.hh | 8 +- lily/include/swallow-grav.hh | 7 +- lily/include/swallow-perf.hh | 5 +- lily/include/symtable.hh | 6 +- lily/include/text-grav.hh | 29 -- lily/include/tie-grav.hh | 3 +- lily/include/timing-grav.hh | 22 +- lily/include/timing-translator.hh | 35 ++ lily/include/translation-property.hh | 30 ++ lily/include/translator-change.hh | 18 + lily/include/translator-group.hh | 74 ++++ lily/include/translator.hh | 111 +++++- lily/include/type-swallow-trans.hh | 38 ++ lily/include/vertical-align-grav.hh | 13 +- lily/include/voice-group-gravs.hh | 33 -- lily/ineq-constrained-qp.cc | 138 +++---- lily/input-translator.cc | 137 ------- lily/key-grav.cc | 2 +- lily/key-item.cc | 4 +- lily/key-performer.cc | 4 +- lily/line-group-grav.cc | 2 +- lily/local-key-grav.cc | 2 +- lily/local-key-item.cc | 54 +-- lily/lyric-grav.cc | 18 +- lily/lyric-performer.cc | 4 +- lily/main.cc | 6 +- lily/meter-grav.cc | 6 +- lily/meter-performer.cc | 4 +- lily/midi-def.cc | 30 +- lily/midi-stream.cc | 16 +- lily/molecule.cc | 72 +--- lily/music-iterator.cc | 27 +- lily/music-output-def.cc | 64 ++++ lily/music.cc | 4 +- lily/my-lily-lexer.cc | 59 ++- lily/my-lily-parser.cc | 5 + lily/note-column-grav.cc | 147 -------- lily/note-column.cc | 113 +++++- lily/note-performer.cc | 15 +- lily/note.cc | 58 ++- lily/notehead.cc | 101 +----- lily/p-score.cc | 2 +- lily/paper-def.cc | 71 ++-- lily/parser.y | 402 +++++++++++---------- lily/performer-group-performer.cc | 165 +-------- lily/performer.cc | 70 +--- lily/property-iterator.cc | 26 ++ lily/qlp.cc | 24 +- lily/qlpsolve.cc | 62 ++-- lily/request-iterator.cc | 2 +- lily/rest-collision-grav.cc | 42 +-- lily/rest-collision.cc | 88 ++--- lily/rest-column.cc | 28 -- lily/rest-grav.cc | 74 ++++ lily/rest.cc | 46 +++ lily/rhythmic-column-grav.cc | 104 ++++++ lily/rhythmic-head.cc | 66 ++++ lily/score-align-grav.cc | 34 +- lily/score-align-gravs.cc | 19 +- lily/score-elem.cc | 74 ++-- lily/score-grav.cc | 24 +- lily/score-halign-grav.cc | 32 +- lily/score-performer.cc | 44 +-- lily/score.cc | 1 + lily/scores.cc | 31 +- lily/script-grav.cc | 2 +- lily/slur-grav.cc | 10 +- lily/span-bar-grav.cc | 2 +- lily/span-bar.cc | 52 +-- lily/span-score-bar-grav.cc | 4 +- lily/spanner.cc | 5 + lily/staff-info.cc | 6 - lily/staff-performer.cc | 25 +- lily/staff-sym-grav.cc | 2 +- lily/stem-grav.cc | 10 +- lily/stem.cc | 134 +++---- lily/swallow-grav.cc | 2 +- lily/swallow-perf.cc | 2 +- lily/symtable.cc | 4 +- lily/template3.cc | 3 - lily/template4.cc | 7 +- lily/template6.cc | 8 +- lily/tex-slur.cc | 4 +- lily/tie-grav.cc | 79 ++-- lily/tie.cc | 5 +- lily/timing-grav.cc | 126 +------ lily/timing-translator.cc | 135 +++++++ lily/translation-property.cc | 20 + lily/translator-ctors.cc | 36 ++ lily/translator-group.cc | 328 +++++++++++++++++ lily/translator.cc | 150 +++++++- lily/type-swallow-trans.cc | 28 ++ lily/vertical-align-grav.cc | 2 +- lily/voice-group-gravs.cc | 59 --- lily/voice-iterator.cc | 2 +- make/lilypond.lsm | 8 +- make/lilypond.spec | 6 +- mf/Makefile | 2 +- mf/TODO | 11 + {tex => mf}/dimen.tex | 0 mf/dyn.tex | 28 +- mf/dyn10.mf | 30 +- mf/ital-f.mf | 5 +- mf/ital-m.mf | 2 +- mf/ital-p.mf | 2 +- mf/ital-s.mf | 2 +- mf/ital-z.mf | 2 +- tex/dyndefs.tex | 27 -- tex/lilyponddefs.tex | 37 +- tex/taupindefs.tex | 8 +- 320 files changed, 5027 insertions(+), 4501 deletions(-) create mode 100644 flower/include/dictionary-iter.hh create mode 100644 flower/include/dictionary.hh create mode 100644 flower/include/nscalar.hh create mode 100644 flower/nscalar.cc rename input/{fugue1.ly => wtk1-fugue1.ly} (90%) rename input/{wohltemperirt.ly => wtk1-fugue2.ly} (94%) rename input/{prelude1.ly => wtk1-prelude1.ly} (92%) create mode 100644 input/wtk1-prelude2.ly.m4 create mode 100644 lily/dot-column-grav.cc create mode 100644 lily/dot-column.cc create mode 100644 lily/dots.cc delete mode 100644 lily/global-gravs.cc delete mode 100644 lily/global-performers.cc delete mode 100644 lily/head-column.cc create mode 100644 lily/include/axis-group-administration.hh create mode 100644 lily/include/axis-group-element.hh create mode 100644 lily/include/dot-column-grav.hh create mode 100644 lily/include/dot-column.hh create mode 100644 lily/include/dots.hh delete mode 100644 lily/include/global-performers.hh delete mode 100644 lily/include/head-column.hh delete mode 100644 lily/include/note-column-grav.hh create mode 100644 lily/include/property-iterator.hh delete mode 100644 lily/include/rest-column.hh create mode 100644 lily/include/rest-grav.hh create mode 100644 lily/include/rest.hh create mode 100644 lily/include/rhythmic-column-grav.hh create mode 100644 lily/include/rhythmic-head.hh delete mode 100644 lily/include/text-grav.hh create mode 100644 lily/include/timing-translator.hh create mode 100644 lily/include/translation-property.hh create mode 100644 lily/include/translator-change.hh create mode 100644 lily/include/translator-group.hh create mode 100644 lily/include/type-swallow-trans.hh delete mode 100644 lily/include/voice-group-gravs.hh delete mode 100644 lily/input-translator.cc delete mode 100644 lily/note-column-grav.cc create mode 100644 lily/property-iterator.cc delete mode 100644 lily/rest-column.cc create mode 100644 lily/rest-grav.cc create mode 100644 lily/rest.cc create mode 100644 lily/rhythmic-column-grav.cc create mode 100644 lily/rhythmic-head.cc create mode 100644 lily/timing-translator.cc create mode 100644 lily/translation-property.cc create mode 100644 lily/translator-ctors.cc create mode 100644 lily/translator-group.cc create mode 100644 lily/type-swallow-trans.cc delete mode 100644 lily/voice-group-gravs.cc create mode 100644 mf/TODO rename {tex => mf}/dimen.tex (100%) delete mode 100644 tex/dyndefs.tex diff --git a/.dstreamrc b/.dstreamrc index 6e401c89cf..dd4016464d 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -11,12 +11,14 @@ Declarations 1 # FlexLexer debug InitLexer 1 Lexer 1 -Matrix 1 # flower lib File_path 1 +Matrix 0 +Vector 1 +# lily Atom 0 Bar 0 Beam 0 @@ -33,7 +35,7 @@ Engraver_group_engraver 0 Group_change_req 0 Head_column 0 Idealspacing 0 -Ineq_constrained_qp 0 +Ineq_constrained_qp 1 Input_translator 0 Item 0 Key_item 0 @@ -41,6 +43,7 @@ Lookup 1 Line_spacer 0 Melodic_req 0 Midi_def 0 +Midistrings 1 Mixed_qp 0 Music 0 Music_iterator 0 @@ -48,8 +51,8 @@ My_lily_lexer 1 Note_head 0 Note_performer 0 Note_req 0 -PCol 0 -PScore 0 +Paper_col 1 +Paper_score 1 Paper_def 0 Paperdef 0 Performer 0 @@ -84,8 +87,6 @@ Text_def 0 Text_req 0 Time_description 0 Voice 0 -Voice_element 0 -Voice_element_iterator 0 Voice_iterator 0 Word_wrap 0 delete_identifiers 1 diff --git a/AUTHORS.text b/AUTHORS.text index ce11d24663..3c7e95d0a0 100644 --- a/AUTHORS.text +++ b/AUTHORS.text @@ -24,15 +24,15 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS 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*, some input files + lily/rest-collision*, lily/*abbreviation*, conflily, + cygnus w32 stuff, lily/*perf*, some input files and corresponding header files. CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSSSS +o Mats Bengtsson , parts of clef- reg.cc, clef-item.cc swedish notenames, testing, - general comments. + general comments, duration logs/longa/brevis etc +o Werner Lemberg , misc bugfixes, some Beam and Stem code. @@ -61,6 +61,6 @@ CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSS -30/Aug/97 LilyPond 0.1.11 1 +11/Sep/97 LilyPond 0.1.13 1 diff --git a/BUGS b/BUGS index 31bb2b7211..5977e0d3ce 100644 --- a/BUGS +++ b/BUGS @@ -1,54 +1,42 @@ -Document reintroduced deficiencies. - -* placement of bar-numbers - -**************** -vi1=\melodic{ - \meter 4/4; - \octave c''; - - B8 G G G16 A B8 G G G16 A | - -} - -vi2=\melodic{ - \meter 4/4; - \octave c''; - - r16 -} - -%{ -bc=\melodic{ - \clef "bass"; - \meter 4/4; - \octave c; - - G1 | -} -%} - -\score{ - < \multi 3; - \vi1 - \vi2 - - > - - \paper{ - geometric=1.2; - unitspace=8.\mm; - linewidth=18.\cm; - gourlay_maxmeasures=4.; - gourlay_energybound = 70000.; - basicspace = 2.8\pt; - } -} -*************************** - - \score { < - \melodic { \id "Staff" ""; c'4 g'4 } - \lyric { \id "Lyric" ""; hello4 bye4 < a chord > } - \lyric { \id "Lyric" ""; bye4 hello4 } - \melodic { \id "Staff" ""; c'4 g'4 } - > } +Document Really Ugly Bugs (coredumps assert fails, etc) + +[Solaris] + +Stack frame overwrite on Solaris 2.x (this will produce a seg +fault, signal 11). Stacktrace + + Engraver_group_engraver::Engraver_group_engraver(int) + Score_engraver::Score_engraver( ) + get_group_engraver_p() + +We don't know a fix or workaround, but compiling without optimisation +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/COPYING b/COPYING index 792d014757..77b1b7108a 100644 --- a/COPYING +++ b/COPYING @@ -11,7 +11,7 @@ input files (which are in the subdirectory input/ ) Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -313,8 +313,8 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Also add information on how to contact you by electronic and paper mail. diff --git a/Documentation/AUTHORS.pod b/Documentation/AUTHORS.pod index 2d40fefc7f..c910644bfa 100644 --- a/Documentation/AUTHORS.pod +++ b/Documentation/AUTHORS.pod @@ -22,8 +22,9 @@ 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*, some input files +lib/source*, flower/*{list,cursor}*, lily/rest-collision*, +lily/*abbreviation*, conflily, cygnus w32 stuff, lily/*perf*, some +input files and corresponding header files. @@ -36,7 +37,8 @@ and corresponding header files. =item * Mats Bengtsson , parts of clef-reg.cc, clef-item.cc -swedish notenames, testing, general comments. +swedish notenames, testing, general comments, duration +logs/longa/brevis etc =item * diff --git a/Documentation/CodingStyle.pod b/Documentation/CodingStyle.pod index 5e0048a364..07dad8dfa3 100644 --- a/Documentation/CodingStyle.pod +++ b/Documentation/CodingStyle.pod @@ -4,7 +4,9 @@ CodingStyle - standards while programming for GNU LilyPond =head1 DESCRIPTION -We use these standards while doing programming for GNU LilyPond +We use these standards while doing programming for GNU LilyPond. If +you do some hacking, we appreciate it if you would follow this rules, +but if you don't, we still like you. Functions and methods do not return errorcodes, but use assert for checking status. @@ -297,6 +299,12 @@ use no, or pick less silly, abbrvs. use non-ambiguous postfixes C +=item * + +There is no need for Hungarian if the scope of the variable is small, +ie. local variables, arguments in function definitions (not +declarations). + =back Macros, Cs and Cs are all uppercase, @@ -396,6 +404,16 @@ reference =over 5 +=head2 Adjective + +Adjectives such as global and static should be spelled out in full. +They come before the noun that they refer to, just as in normal english. + +foo_global_i: a global variable of type int commonly called "foo". + +static class members do not need the static_ prefix in the name (the +Class::var notation usually makes it clear that it is static) + =item C Variable loop: an integer @@ -428,6 +446,18 @@ Variable bar: an C that you must not delete Generally default arguments are taboo, except for nil pointers. +The naming convention can be quite conveniently memorised, by +expressing the type in english, and abbreviating it + + static Array foo + +C can be described as "the static int-pointer user-array", so you get + + foo_static_l_arr + + + + =head1 MISCELLANEOUS For some tasks, some scripts are supplied, notably creating patches, a diff --git a/Documentation/faq.pod b/Documentation/faq.pod index 2a505782f0..db80b409cf 100644 --- a/Documentation/faq.pod +++ b/Documentation/faq.pod @@ -202,6 +202,21 @@ saves us a I of trouble. =head2 Running +Q: I don't get midi-output, even if I use B<-M> + +A: Your \score should include a \midi block, eg. + + \score { + \melodic { c c g g } + \paper {} + \midi { + \output "myfile.mid"; + \tempo 4=70; + } + +The B<-M> option was added to LilyPond because processing the \paper +block is so slow. + Q: I get can't load library 'libflower.so' diff --git a/Documentation/index.pod b/Documentation/index.pod index f1b1603b7e..9a36c9f3fb 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -9,7 +9,11 @@ visual or auditive output: it can typeset formatted sheet music to a TeX file and and (mechanical) performances to MIDI files. This is not a Fanmail/Hype page. These pages were entirely created from -the LilyPond package-sources +the LilyPond package-sources. + +B. You can look at the bottom if you want to +know which version this was. =head2 Examples diff --git a/Documentation/lilypond.pod b/Documentation/lilypond.pod index 1142476eb9..1b59db9997 100644 --- a/Documentation/lilypond.pod +++ b/Documentation/lilypond.pod @@ -22,7 +22,8 @@ add F to the search path for input files. =item B<-M,--midi> -do midi output only. +This disables TeX output. If you have a \midi definition, it will do +the midi output only. =item B<-d,--debug>, diff --git a/Documentation/mudela-course.doc b/Documentation/mudela-course.doc index da2be2526b..196ea9d1b0 100644 --- a/Documentation/mudela-course.doc +++ b/Documentation/mudela-course.doc @@ -7,6 +7,7 @@ \usepackage{a4wide} \title{Mudela and LilyPond crash course} \author{Han-Wen Nienhuys} +\def\file#1{{\texttt{#1}}} \begin{document} \maketitle @@ -17,30 +18,124 @@ \emph{This document is not complete yet. It's just a brief blurb which skimps some features of Mudela} +\section{Who is who} + +This document describes two different things +\begin{description} +\item[Mudela] A language for defining music. + +\item[LilyPond] A package (the only one existing :-) which can + read a mudela file and interpret it. + + The name ``LilyPond'' does not have much to do with the purpose of + the package, but we have a special emotional attachment with the + name. (Of course we are not telling why we chose it; this is an + excercise for the reader, most of the vital clues are contained in + the documentation and the source code. If you have guess, then let + me know) +\end{description} \section{Overview} -Mudela is a language for specifying music. LilyPond is a -program which converts such a specification into formatted sheet -music, or MIDI output. -Please note that some examples not only demonstrate features but also -some lurking bugs. If can't understand what is happening, it might -just be my (lack of) programming skills. +Let's start with a very simple example, we will enter ``twinkle twinkle +little star.'' We start with the most important part: the notes. +Imagine being in a music-lesson, and that you made an error playing +``twinkle twinkle''. Your teacher asks you to read out loud the +melody of the song, just to verify your eyesight. You would probably +say something like +\begin{quote} + A quarter note C, Another quarter note C, a quarter G, another one, etc. +\end{quote} -\begin[fragment,verbatim]{mudela} - { c4 e4 g4 } +Mudela tries to capture this verbal presentation of sheet music, in +the following way. The first line of twinkle twinkle is written in +as follows +\begin{verbatim} +c4 c4 g4 g4 a4 a4 g2 +f4 f4 e4 e4 d4 d4 c2 +\end{verbatim} + +The notes are entered with names (a, b, c) combined with numbers +(2,4). The names designate the pitches, the numbers the durations: 4 +is a quarter note, 2 a half note, etc. + +Now all we have to specify what should be done with the music. We +want a paper version, so we combine the music with a ``output this on +paper'' statement. These two are combined in ``score'' block. This +is the final result with its output. We add a comment (the line +starting with \verb+%+). +Put this into a file +called \file{twinkle.ly} + +\begin{verbatim} + +% twinkle, v1 +\score { + \melodic { + c4 c4 g4 g4 a4 a4 g2 + f4 f4 e4 e4 d4 d4 c2 + } + \paper {} +} +\end{verbatim} + +there are a few things to note about this example: + +The braces are grouping characters. In general, in mudela data entry +for a data section called ``foobar'' looks like this: + +\begin{verbatim} +\foobar { ...... } +\end{verbatim} + +To see if it actually works, we run it through LilyPond. Invoke the +command +\begin{verbatim} + lilypond twinkle.ly +\end{verbatim} +When LilyPond starts working it will produce various ``operator +pacification'' messages, which you can safely ignore for now. The run +should have left a file called \file{lelie.tex} in your working +directory. You can process that file with TeX, and it will look like +this: + +\begin{mudela} +\score { + \melodic { + c4 c4 g4 g4 a4 a4 g2 + f4 f4 e4 e4 d4 d4 c2 + } + \paper {} +} \end{mudela} +As you can see, this is the song that we wanted, albeit a little +low-pitched. You would probably want a version of the song which has +all notes an octave higher. This can be done by adding a +\verb+\octave+ command to the source. This sets the default octave +for all notes. Another convenience is the default duration: if you do +not specify a duration with the notename, the last explicitly entered +is used. The improved version reads thus -Basics: the \verb+%+ introduces a comment. All music is inside a -\verb+\score+ block which represents one movement, ie one contiguous -block of music. Voices are grouped by \verb+{+ and \verb+}+ and -chords by \verb+<+ and \verb+>+. \begin[verbatim]{mudela} + % twinkle v2 \score { + \melodic { + \octave c'; + c4 c g g a a g2 + f4 f e e d d c2 + } + \paper {} +} +\end{mudela} + + + +\begin[verbatim]{mudela} + \score { \melodic { % {...} is a voice c'4 g'4 % c and g are pitches, 4 is the duration % (crotchet/quarter note) @@ -50,6 +145,17 @@ chords by \verb+<+ and \verb+>+. } \end{mudela} + +\begin[fragment,verbatim]{mudela} + { c4 e4 g4 } +\end{mudela} + +Basics: the \verb+%+ introduces a comment. All music is inside a +\verb+\score+ block which represents one movement, ie one contiguous +block of music. Voices are grouped by \verb+{+ and \verb+}+ and +chords by \verb+<+ and \verb+>+. + + The \verb+\octave+ command controls the default pitch (octave). If you do not specify duration, the last one entered is used. The \verb+\paper+ block contains parameters for spacing and dimensions. diff --git a/Documentation/mudela-man.doc b/Documentation/mudela-man.doc index 7c28d71e34..185823924a 100644 --- a/Documentation/mudela-man.doc +++ b/Documentation/mudela-man.doc @@ -41,7 +41,8 @@ and up-to-date definition, see \file{lily/parser.y} and As a related note, you should take a look at the examples and the init files, as this document does not cover every aspect of mudela yet, and -may be out of date. +may be out of date.\footnote{Ok, I am being pessimistic here. This + just is a disclaimer. Docs usually are written after the program itself.} \section{Basic elements} @@ -49,7 +50,7 @@ may be out of date. \subsection{Files} The de-facto extension of Mudela is \file{.ly}. Files may be included by -entering \verb+include+ at the start of a line: +entering \verb+\include+ at the start of a line: \begin{verbatim} \include "a_file.ly" @@ -88,8 +89,7 @@ alphabetic characters only. Identifiers in their normal form consist start with a backslash, a alpha character, followed by alpha-numerics. Identifiers can contain any characters (except whitespace, -\verb+$+ and \verb+%+), if you use this -construct: + and \verb+%+), if you use this construct: \begin{verbatim} \$i'm_a_weird!!!identifier diff --git a/Documentation/other-packages.pod b/Documentation/other-packages.pod index 7850eb4316..26b645fe06 100644 --- a/Documentation/other-packages.pod +++ b/Documentation/other-packages.pod @@ -9,6 +9,8 @@ packages. Feel free to add info (and mail it to me). =head2 Free packages (with source) +=over 4 + =item Rosegarden, http://www.bath.ac.uk/~masjpf/rose.html A Notation editor/Sequencer for X (windows95 port underway). Outputs musictex. @@ -43,18 +45,20 @@ A Preprocessor for MusiXTeX by Don Simons =item Musictex, http://www.gmd.de/Misc/Music/ MusicTeX is a macro package for TeX to typeset polyphonic or -instrumental music. It is originally written by Daniel Taupin, Ross -Mitchell and Andreas Egler. +instrumental music. It was written by Daniel Taupin. Now obsoleted +by MusiXTeX and OpusTeX. It includes a full-featured set of fonts. =item MusiXTeX, http://www.gmd.de/Misc/Music/ -Daniel Taupin's branch of MusicTeX. +Newer version of MusicTeX. It also contains contributions by Ross +Mitchell and Andreas Egler. Daniel Taupin's branch still carries this +name. -=item OpusTeX, http://www.inf.ethz.ch/department/Department.html/achermann/opustex +=item OpusTeX, http://www.inf.ethz.ch/people/achermann/opustex -Andreas Egler's branch of MusicTeX. +Andreas Egler's branch of MusiXTeX. =item ABC2MTeX, http://www.gre.ac.uk/~c.walshaw/abc @@ -71,15 +75,23 @@ available on request. (?) A TeX macro package for typesetting single-staff music by Angelika Schofer & Andrea Steinbach. With some fonts +=back =head2 Free (zero cents) +=over 4 + =item Calliope, http://www.cl.cam.ac.uk/users/wfc/ A NeXT package by William F. Clocksin. Requires Adobe fonts. + +=back + =head2 Proprietary +=over 4 + =item Scribe, http://adu1.adu.lattrobe.edu.au/Music/Scribe.html A formatter for medieval scores. @@ -99,7 +111,8 @@ Notation editor for W95 and Mac =item Sibelius, http://www.acorn.co.uk/developers/sibelius/Home -Notation/engraving on Acorn machines. +Notation editor on Acorn machines. Their developers call it ``best +notation program available''. =item Finale @@ -117,6 +130,20 @@ A shareware windows package =item Musicator +=item WolfGang, http://www.unige.ch/lettres/armus/music/wolfgang.html + +=item Amadeus, Jerker.Elsgard@abc.se + +Professional and expensive (DM 4000,--) engraving. Designed as a +batch program (like LilyPond). It is aimed at publishers. Its history +is more than fifteen years and Amadeus has been running under +different Unix clones. It uses MIDI-keyboard input + + + +=back + + =head2 Unknown =item MusE diff --git a/Documentation/vocabulary-data b/Documentation/vocabulary-data index c2ed3f098f..4f11d9d8f6 100644 --- a/Documentation/vocabulary-data +++ b/Documentation/vocabulary-data @@ -31,6 +31,7 @@ b cadence:cadence:::: cadence harmonique:harmonic cadence:::: cadence mélodique:melodic cadence:::: +:cue-notes:Stichnoten::stichnoten: caractère:character:::: chaîne de trilles:chain of trills:::: chevron:chevron:::: @@ -45,7 +46,7 @@ cl comma:comma:::: comma enharmonique:::: comma pythagoricien:::: -comma syntonique:::: +comma syntonique: : : : : consonance:consonant interval; consonance:::consonant: contralto:contralto:::: contre-temps:contro-time:::: @@ -53,28 +54,28 @@ contre-temps irr contre-temps régulier:regular contro-time:::: coulé:slur:::binding, bindingsboog: courbe rythmique:rythmic curve:::: -cresendo:opening angular bracket:::: +:opening angular bracket::::cresendo croche:eighth note:::: -decrescendo:closing angular bracket:::: +:closing angular bracket::::decrescendo degré [de la gamme]:degree [of the scale]:::: demi-pause:half rest:::: -demi-soupir:eighth rest:::: -demi-ton:semitone:::: +demi-soupir:eighth rest:::achtste rust: +demi-ton:semitone:::halve toon: demi-ton chromatique:chromatic semitone:::: demi-ton diatonique:diatonic semitone:::: -diapason:pitch pipe; tuning fork:::: +diapason:pitch pipe; tuning fork:::stemfluitje; stemvork: diminué (intervalle):diminished (interval):::: dissonance:dissonant interval; dissonance:::: -dièse:sharp:::: +dièse:sharp:::kruis: do:C:::: do central:middle C::::: doigté::::: doigté de pédale::::: -dominante:dominant:::: +dominante:dominant:::dominant: double barre:double bar line:::: -double bémol:double flat:::: +double bémol:double flat:::dubbelmol: double croche:sixteenth note:::: -double dièse:double sharp:::: +double dièse:double sharp:::dubbelkruis: double triolet:double triplet:::: duolet:duplet:::: durée:duration:::: @@ -86,13 +87,13 @@ extension d'intervalle:extension of interval:::: fa:F:::: figure de note:kind of note:::: figure de silence:kind of rest:::: -fioriture:cadenza:::: +fioriture::::cadens: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:scale:::toonladder: +gamme chromatique:chromatic scale:::chromatische toonladder: +gamme diatonique majeure:diatonic major scale:::diatonische majeur toonladder: gamme diatonique mineure:diatonic minor scale:::: gammes enharmoniques:enharmonic scales:::: gammes relatives:relative scales:::: @@ -100,7 +101,7 @@ genre chromatique:chromatic type:::: genre diatonique:diatonic type:::: genre enharmonique:enharmonic type:::: groupe irrégulier:irregular group:::: -grupetto:turn; gruppetto:::: +grupetto:turn; gruppetto:::dubbelslag: hauteur:pitch:::: huitième de soupir:thirty-second rest:::: incise:motive:::: @@ -136,7 +137,8 @@ mode majeur:major mode:::: mode mineur:minor mode:::: modulation:modulation:::: mordant:mordent:::: -mouvement:tempo; movement:::: +::::: +mouvement:tempo; movement:::deel: mouvement conjoint:conjunct movement:::: mouvement disjoint:disjunct movement:::: mouvement lent:slow tempo:::: @@ -154,17 +156,18 @@ notes enharmoniques:enharmonic notes:::: nuance:shading:::: octave:octave:::: ornement:embellishment; accessory:::: -partition:score:::: +:part:::partij: +partition:score:::partituur: pause:whole rest:::: phrase:phrase:::: phrasé:phrasing:::: pizzicato:dash over/below:::: -point:dot:::: +point:dot:::punt: point d'orgue:pause:::: point et liaison combinés:dot and curved line combined:::: pointillés:::: portamento:underline over/below:::: -portée:staff:::: +portée:staff:::(noten)balk; partij: portées:staves:::: quadruple croche:sixty-fourth note:::: quart de soupir:sixteenth rest:::: @@ -176,13 +179,13 @@ renversement d'intervalle:inversion of interval:::: renvoi:return sign:::: respiration:artificial rest:::: :double whole note::breve:brevis:breve -ronde:whole note:::: -rythme:rythm:::: +ronde:whole note:::hele noot: +rythme:rythm:::ritme: ré:D:::: -seconde:second:::: +seconde:second::::secunde seizième de soupir:sixty-fourth rest:::: sensible:leading note:::: -septième:seventh:::: +septième:seventh:::septiem:septime sextolet:sextuplet:::: si:B:::: signes indicateurs de nuance:shading signs:::: @@ -190,17 +193,17 @@ silence:rest:::: sixain:sextuplet:::: sixte:sixth:::: sol:G:::: -soprano:soprano:::: +soprano:soprano:::sopraan: soupir:quarter rest:::: sous-dominante:subdominant:::: sous-tonique:subtonic:::: -staccato:dot over/below:::: +:dot over/below::::staccato sus-dominante:superdominant:::: sus-tonique:supertonic:::: -syncope:syncopation; upbeat:::: +syncope:syncopation; upbeat:::syncope: syncope irrégulière:irregular syncopation:::: syncope régulière:regular syncopation:::: -temps:beat:::: +temps:beat:::tel: temps binaire:binary beat:::: temps faible:weak beat:::: temps fort:strong beat:::: diff --git a/INSTALL.text b/INSTALL.text index 5329182265..2a831c9966 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG -8/Aug/97 LilyPond 0.1.11 1 +8/Aug/97 LilyPond 0.1.13 1 @@ -127,7 +127,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -8/Aug/97 LilyPond 0.1.11 2 +8/Aug/97 LilyPond 0.1.13 2 @@ -193,7 +193,7 @@ INSTALL(1) LilyPond documentation INSTALL(1) -8/Aug/97 LilyPond 0.1.11 3 +8/Aug/97 LilyPond 0.1.13 3 @@ -259,7 +259,7 @@ IIIINNNNSSSSTTTTAAAALLLLLLLLIIIINNNNGGGG -8/Aug/97 LilyPond 0.1.11 4 +8/Aug/97 LilyPond 0.1.13 4 @@ -325,7 +325,7 @@ RRRREEEEDDDDHHHHAAAATTTT LLLLIIIINNNNUUUUXXXX -8/Aug/97 LilyPond 0.1.11 5 +8/Aug/97 LilyPond 0.1.13 5 @@ -391,6 +391,6 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS -8/Aug/97 LilyPond 0.1.11 6 +8/Aug/97 LilyPond 0.1.13 6 diff --git a/NEWS b/NEWS index 8100d47a2e..6724d8e860 100644 --- a/NEWS +++ b/NEWS @@ -1,16 +1,49 @@ -pl 12.jcn4 - - fixed dynamic f, magstep bug + +pl 13 + - big Rest/notehead rewrite: + * separated Rest, Note_head and Dots + * Dot_column: dots are now chord-wise aligned + * Rhythmic_head is base for Rest, Note_head + * Merged Note_column and Rest_column + * Rest_engraver + - grand Engraver/Translator/Performer rewrite. + * properties: \property voice.dir = -1 (mudela 0.1.3) + * Input_translator junked, now Translators are generated +by the parser (mudela 0.1.4) + * Translator changing: \translator Staff=oboesolo + * Translator preselect: \type Staff=bla < c4 >. (mudela 0.1.5) + * Engraver/Performer now derived of Translator. + * Engraver_group_engraver/ Performer_group_performer derived of + Translator_group + * renamed: Voice -> Thread, Voice_group -> Voice + - renamed Audio_score to Performance + - junked mididef statics + - Audio debug output + - bf: excess [] in scsi + - bf: swallow \skips + - bf: don't crash on infinite dims + - renamed wohltemperirt to wtk1-fugue2 + - bf: address in GPL + - bf: errors in stdin + - bf: stop if errors in init files + - bf: move stem too when doing collisions + - Molecule::add_XXXX -> Molecule::add_at_edge () + - doco updeet: why no midi FAQ, index, CodingStyle hungarian pl 12.jcn3 - try at better dynamic font, copied from cmbxti10: mf/* - -pl 12.jcn2 - typesetting abbreviation beams; abbreviation-* - some simple abbrev fixes + code cleanup (dank je, lieverd) - -pl 12.jcn1 - typesetting simple abbreviations: c4:16 === [c16 c c c] +pl 11mb + - Support also for \longa in duration-convert.cc, init/ and tex/ + files. (MB) + +******** +sep 3 + + pl 12 - bf: don't redefine tex primitives like \textfont and \mathfont - nicer broken slurs (?) @@ -18,6 +51,7 @@ pl 12 - robustness in Lookup::*slur - bf: mi2mu: warn if 0-length string in midi-file - output id-footer + ******** sep 1 diff --git a/README b/README index d6881435f3..331108b90f 100644 --- a/README +++ b/README @@ -19,9 +19,9 @@ version, then this is version is *not* meant for producing nice output 2. REQUIREMENTS For the compilation and running of LilyPond you need some additional -packages. The most unusual one of this are the mf sources to -MusixTeX. Please refer to the installation instructions on how to -obtain and install them. +packages. The most unusual one of this are the metafont sources to +MusixTeX-fonts. Please refer to the installation instructions on how +to obtain and install them. 3. INSTALLATINON @@ -32,7 +32,7 @@ in the toplevel directory, as INSTALL.text 4. DOCUMENTATION -Please refer to the directory Documentation/ for the real doco. +The real documentation is the directory Documentation/ To generate the pretty-printed docs, you have to run configure first, and then do this: @@ -45,9 +45,9 @@ You can also simply read the .pod sources. They are ASCII text. 5. COMMENTS -LilyPond is a long way from finished and polished. I do appreciate -criticism, comments, bugreports, patches, etc. Please send e-mail to -the mailing lists. See Documentation/links.pod for more info +LilyPond is a long way from finished and polished. I do appreciate +criticism, comments, bugreports, patches, etc. Please send e-mail to +the mailing lists. See Documentation/links.pod for more info 6. DOZE @@ -64,46 +64,7 @@ The website also contains the complete documentation http://www.stack.nl/~hanwen/lilypond/index.html - 7. CAVEATS -Solaris - -Stack frame overwrite on Solaris 2.x (this will produce a seg -fault, signal 11). Stacktrace - - Engraver_group_engraver::Engraver_group_engraver(int) - Score_engraver::Score_engraver( ) - get_group_engraver_p() - -We don't know a fix or workaround, but compiling without optimisation -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. +Please read the file BUGS for some ugly bugs. This especially +applies to Solaris 2.x and Linux-Intel unix users. diff --git a/TODO b/TODO index 12aee1d8b0..ac8a74e7d6 100644 --- a/TODO +++ b/TODO @@ -6,9 +6,20 @@ 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 - - * move to OpusTeX fonts - + * use properties for: + - Text_style + - default_octave + - plet? + - default_duration? + - default abbreviation + - Staff_sym size + - default tempo. + - font size + - bartypes (get rid of derived Span_bar_engravers) + - cadenza mode? + - MIDI instrument + - staff title + * check out egcs * give Items/Spanners access to unbroken originals @@ -33,7 +44,7 @@ PROJECTS * Spring_spacer: - write a faster Spring_spacer ( without matrices if possible ) - relate energybound to linelen unitspace fontsize etc. - -used fixed fp + - used fixed point fp * \header - revise lexer mode @@ -79,6 +90,24 @@ languages: - ABC? - SMDL? + * robustification + - check write errors + - check read errors + + + * placement of bar-numbers + +****************** + + \score { < + \melodic { \id "Staff" ""; c'4 g'4 } + \lyric { \id "Lyric" ""; hello4 bye4 < a chord > } + \lyric { \id "Lyric" ""; bye4 hello4 } + \melodic { \id "Staff" ""; c'4 g'4 } + > } + +****************** + * add to MIDI output: - tempo change - repeat @@ -86,11 +115,12 @@ languages: - dynamics etc. * grace notes - - adapt for multiple font sizes. - make separate class for Grace_*_engravers (which is at Voice_gravs level) - make encapsulated spacing problems. + * On-demand loading of simple-engravers + * accidentals per Voice_group * Convert all ref/bib stuff into BibTeX. @@ -127,10 +157,6 @@ languages: - Doc (C) stuff of sheet music - a tutorial - * separate Score_elem settings in user-settable (properties - .. ) and non-user-settable part. Maybe use something like X-resources: - "Staff=oboe*dir: 0", "Staff=*.Voice_group=solo*dir: 1" - * TeX spanners , use texbeam.cc as an example (smallish) - Glissando - trill @@ -138,22 +164,16 @@ languages: * Rewrite Stem, Beam and Rhythmic_grouping (hairy) - [c8. c32 c32] - - interbeam height - - doc on Rhythmic_grouping + - doc on Rhythmic_grouping - general shaving on Beam and Stem - use plet grouping - - abbreviations [c2 c2]1/2 - separate visual from rhythmic info even more - beams over bars - - * Redo font - - rename mf fonts to avoid conflicts with musixtex - - use own fonts/update musixtex fonts/find older (c)-less fonts + * Redo fonts + - adapt for multiple font sizes. - hack up mf sources for decent spacing info (and then read AFM/TFM directly, for text too) - - use MF to generate rules. - - rewrite : make a metafont iso font * Font support: - mixed fontsizes @@ -165,7 +185,6 @@ languages: - beam stem showthrough, inter beam sizes (french vs german style) * Collisions - - bring Collision::do_pre_processing to haircutter - left/right note balls should be handled by Collision: < \multi 2; { \stem 1; } { } > @@ -204,7 +223,6 @@ SEVERELY LACKING: * markers - * abbreviations c4=16 INPUTLANGUAGE @@ -229,15 +247,12 @@ INPUTLANGUAGE * bracket (bracketplets) - * \duration 8; e*2/3 - * configure pitch_byte * rest name configurable * Raw request syntax - SMALLISH PROJECTS * progress when creating MIDI elts. @@ -250,9 +265,7 @@ SMALLISH PROJECTS * write Dynamic_line (to group dynamics horizontally) - * write Rest_collision - - * use Real for y positions. + * use Real for all y positions. * half-sharps, half-flats @@ -302,7 +315,7 @@ SMALLISH PROJECTS < a-4 c-2 g-1 > < c-\ltoe e-\lheel > - script-spacing - slur parts as a script - - stackparameterised scripts for fingering and footing: + - stack parameterised scripts for fingering and footing: % toe to bheel four to five % ^_u 4_5 @@ -322,11 +335,6 @@ SMALLISH PROJECTS * volta -DOC - * all errors - - * hacking-HOWTO - IDEAS * scoping in Lexer: do general id- assignments in mudela. @@ -389,9 +397,11 @@ IDEAS * - rewire acknowledge_element() logic with a process_acknowledged() - - construct Stem upon receiving Notehead. Junk Stem_req * pushgroup/popgroup * whole head on ledger line + * multi threading? + - 1 thread per element/ 1 thread per line + - 1 thread per Translator diff --git a/VERSION b/VERSION index 01eefc1f38..df34f2a4ae 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 1 -TOPLEVEL_PATCH_LEVEL = 12 +TOPLEVEL_PATCH_LEVEL = 13 # use to send patches, always empty for released version: -TOPLEVEL_MY_PATCH_LEVEL = .jcn4 +TOPLEVEL_MY_PATCH_LEVEL = diff --git a/bin/convert-mudela.in b/bin/convert-mudela.in index 98d858a308..530e7818f2 100644 --- a/bin/convert-mudela.in +++ b/bin/convert-mudela.in @@ -111,6 +111,20 @@ sub convert_0_1_0_to_0_1_1 s/\\tempo (.*):(.*);/\\tempo $1 = $2;/g } +sub convert_0_1_2_to_0_1_3 +{ + s/\\stem *(\\up|1) *;/\\stemup/g; + s/\\stem *(\\down|-1) *;/\\stemdown/g; + s/\\stem *0 *;/\\stemboth/g; + s/\\hshift ([^;]+) *;/\\property Voice.hshift = $1/g; +} + +sub convert_0_1_4_to_0_1_5 +{ + s/([<{]) *\\id "Piano" (.+);/\\type Grandstaff = $3 $1/; + s/([<{]) *\\id (.+) (.+);/\\type $2 = $3 $1/; +} + ############################################################### sub last_conversion @@ -152,7 +166,10 @@ my %minor_conversions = ("0.0.50" => \&no_conv, "0.0.60" => \&convert_0_0_59_to_0_0_60, "0.0.61" => \&convert_0_0_60_to_0_0_61, "0.1.1" => \&convert_0_1_0_to_0_1_1, - "0.1.2" => \&no_conv + "0.1.2" => \&no_conv, + "0.1.3" => \&convert_0_1_2_to_0_1_3, + "0.1.4" => \&no_conv, + "0.1.5" => \&convert_0_1_4_to_0_1_5 ); diff --git a/bin/make-website.in b/bin/make-website.in index 75fba55de0..aa1eda0b1d 100644 --- a/bin/make-website.in +++ b/bin/make-website.in @@ -3,11 +3,11 @@ use FileHandle; use Getopt::Long; + my $lily_version; my $footstr; my $mw_id = ""; my $id_str = "make-website 0.4"; - my $TAR="tar"; my $MAKE="make"; @@ -77,16 +77,16 @@ sub my_system local $base="lilypond/"; -local @examples=("twinkle-pop", "twinkle", "multi", "wohltemperirt", +local @examples=("twinkle-pop", "twinkle", "multi", "wtk1-fugue2", #"standchen-16", #"standchen-20", - "toccata-fuga-E", "scsii-menuetto", + "wtk1-prelude1", + "toccata-fuga-E", + "scsii-menuetto", "cadenza", "scales", #"rhythm", "gallina"); -# rhythm, scales, - sub gen_html { @@ -131,14 +131,19 @@ sub gen_list { print "generating HTML list\n"; open HTMLLIST, ">example_output.html"; + print HTMLLIST "Rendered Examples\n -These example files are taken from the LilyPond distribution.\n -LilyPond currently only outputs TeX and MIDI. The pictures and\n - PostScript files were generated using TeX, Ghostscript and some graphics tools. \n -The GIF files have been scaled to eliminate aliasing."; - foreach $a (@examples) { - $name=$a; - print HTMLLIST "

example file: $name

\n\n"; +These example files are taken from the LilyPond distribution. +LilyPond currently only outputs TeX and MIDI. The pictures and +PostScript files were generated using TeX, Ghostscript and some +graphics tools. The papersize used for these examples is A4. The GIF +files have been scaled to eliminate aliasing."; + + + + foreach $a (@examples) + { + $name=$a; print HTMLLIST "<h1>example file: $name</h1>\n<XMP>\n"; open IF, "$depth/input/$a.ly"; input_record_separator IF "%}"; diff --git a/flower/NEWS b/flower/NEWS index 803bfd6dbe..a53c1a4751 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,3 +1,6 @@ +pl 29 + - Dictionary_iter, Dictionary + pl 28 - String::bool () - GNU indentation. diff --git a/flower/choleski.cc b/flower/choleski.cc index 5932f10f97..187fb26901 100644 --- a/flower/choleski.cc +++ b/flower/choleski.cc @@ -146,7 +146,7 @@ Choleski_decomposition::band_matrix_decompose (Matrix const &P) D(i) = d; } L.try_set_band(); - assert ( L.band_i() == P.band_i ()); + assert (L.band_i() == P.band_i ()); } diff --git a/flower/diagonal-storage.cc b/flower/diagonal-storage.cc index 695819171a..090f308635 100644 --- a/flower/diagonal-storage.cc +++ b/flower/diagonal-storage.cc @@ -54,9 +54,9 @@ Diagonal_storage::set_band_size (int s) for (int i=0; i < dim(); i++) { int k=-s; - for ( ; k < -band_size_i(); k++) + for (; k < -band_size_i(); k++) f.elem (i,k + s) = 0.0; - for ( ; k <= band_size_i()&& k<=s ; k++) + for (; k <= band_size_i()&& k<=s ; k++) f.elem (i, k + s) = band_.elem (i,k+ band_size_i()); for (; k <= s; k++) f.elem (i, k + s) =0.0; @@ -123,7 +123,7 @@ Diagonal_storage::resize_dim (int d) Full_storage f (d, 2*band_size_i()+1); for (int i=0; i < d && i < dim(); i++) { - for ( int k=0; k < 2*band_size_i(); k++) + for (int k=0; k < 2*band_size_i(); k++) f.elem (i,k) = elem (i,k); } @@ -142,9 +142,9 @@ void Diagonal_storage::mult_next (int &i, int &j) const { j++; - if ( j < i - band_size_i()) + if (j < i - band_size_i()) j = i- band_size_i(); - if ( j > i + band_size_i() || j >= dim ()) + if (j > i + band_size_i() || j >= dim ()) { i++; j = 0 >? i - band_size_i(); @@ -161,10 +161,10 @@ void Diagonal_storage::trans_next (int &i, int& j) const { i++; - if ( i < j - band_size_i()) + if (i < j - band_size_i()) i = j-band_size_i(); - if ( i >= dim() || i > j + band_size_i ()) + if (i >= dim() || i > j + band_size_i ()) { j++; i = 0 >? j - band_size_i(); @@ -176,7 +176,7 @@ static Real nul_entry=0.0; Real Diagonal_storage::elem (int i, int j) const { - if (abs ( i-j) > band_size_i()) + if (abs (i-j) > band_size_i()) return 0; else return band_.elem (i, j - i +band_size_i()); @@ -190,7 +190,7 @@ Diagonal_storage::elem (int i, int j) */ assert (!nul_entry); - if (abs ( i-j) > band_size_i()) + if (abs (i-j) > band_size_i()) return nul_entry; else return band_.elem (i, j - i + band_size_i()); @@ -204,7 +204,7 @@ bool Diagonal_storage::try_right_multiply (Matrix_storage*dest, const Matrix_storage*right) const { - if ( right->name() != Diagonal_storage::static_name ()) + if (right->name() != Diagonal_storage::static_name ()) return false; const Diagonal_storage* right_diag = (Diagonal_storage const*)right; @@ -221,7 +221,7 @@ Diagonal_storage::try_right_multiply (Matrix_storage*dest, int stopk = i + band_size_i() <? n-1 <? j + band2; int relk = startk + band_size_i() -i; Real sum =0.0; - for ( int k = startk; k <= stopk; k++) + for (int k = startk; k <= stopk; k++) sum += band_.elem (i, relk++) * right_diag->elem (k, j); dest->elem (i, j) = sum; @@ -238,7 +238,7 @@ Diagonal_storage::Diagonal_storage (Matrix_storage*stor_l, int band_i) set_band_size (band_i); resize_dim (stor_l->dim()); - for ( int i=0,j=0; mult_ok (i,j); mult_next (i,j)) + for (int i=0,j=0; mult_ok (i,j); mult_next (i,j)) band_.elem (i, j + band_i -i) = stor_l->elem (i,j); } diff --git a/flower/directed-graph.cc b/flower/directed-graph.cc index 9a07629dab..b13203e4fa 100644 --- a/flower/directed-graph.cc +++ b/flower/directed-graph.cc @@ -118,7 +118,7 @@ Directed_graph_node::unlink() t.concat (edge_in_l_arr_); #endif - while ( edge_out_l_arr_.size()) + while (edge_out_l_arr_.size()) remove_edge_out_idx (0); while (edge_in_l_arr_.size()) diff --git a/flower/dstream.cc b/flower/dstream.cc index f11576d590..16d83d6890 100644 --- a/flower/dstream.cc +++ b/flower/dstream.cc @@ -25,11 +25,11 @@ strip_pretty (String pretty_str) { int i = pretty_str.index_i ('('); if (i>=0) - pretty_str = pretty_str.left_str (i); + pretty_str = pretty_str.left_str (i); int l = pretty_str.index_last_i (' '); // strip until last ' ' if (l>=0) - pretty_str = pretty_str.nomid_str (0,l+1); + pretty_str = pretty_str.nomid_str (0,l+1); return pretty_str; } @@ -38,7 +38,7 @@ strip_member (String pret) { int l=pret.index_last_i (':')-1; if (l>=0) - pret = pret.left_str (l); + pret = pret.left_str (l); return pret; } @@ -46,26 +46,26 @@ Dstream& Dstream::identify_as (String name) { if (!os_l_) - return *this; + return *this; String mem (strip_pretty (name)); String cl (strip_member (mem)); String idx = cl; if (silent_assoc_p_->elt_b (mem)) - idx = mem; + idx = mem; else if (silent_assoc_p_->elt_b (cl)) - idx = cl; + idx = cl; else { - (*silent_assoc_p_)[idx] = false; + (*silent_assoc_p_)[idx] = false; } local_silence_b_ = (*silent_assoc_p_)[idx]; if (current_classname_str_ != idx && !local_silence_b_) { - current_classname_str_=idx; - if (!(*silent_assoc_p_)["Dstream"]) - *os_l_ << "[" << current_classname_str_ << ":]"; // messy. + current_classname_str_=idx; + if (!(*silent_assoc_p_)["Dstream"]) + *os_l_ << "[" << current_classname_str_ << ":]"; // messy. } return *this; } @@ -74,7 +74,7 @@ bool Dstream::silence (String s) { if (!silent_assoc_p_->elt_b (s)) - return false; + return false; return (*silent_assoc_p_)[s]; } @@ -103,33 +103,33 @@ void Dstream::output (String s) { if (local_silence_b_|| !os_l_) - return ; + return ; for (char const *cp = s ; *cp; cp++) - switch (*cp) - { - case '{': - case '[': - case '(': indent_level_i_ += INDTAB; - *os_l_ << *cp; - break; + switch (*cp) + { + case '{': + case '[': + case '(': indent_level_i_ += INDTAB; + *os_l_ << *cp; + break; - case ')': - case ']': - case '}': - indent_level_i_ -= INDTAB; - *os_l_ << *cp ; + case ')': + case ']': + case '}': + indent_level_i_ -= INDTAB; + *os_l_ << *cp ; - assert (indent_level_i_>=0) ; - break; + assert (indent_level_i_>=0) ; + break; - case '\n': - *os_l_ << '\n' << String (' ', indent_level_i_) << flush; - break; - default: - *os_l_ << *cp; - break; - } + case '\n': + *os_l_ << '\n' << String (' ', indent_level_i_) << flush; + break; + default: + *os_l_ << *cp; + break; + } return ; } @@ -140,25 +140,25 @@ Dstream::Dstream (ostream *r, char const * cfg_nm) silent_assoc_p_ = new Assoc<String,bool>; indent_level_i_ = 0; if (!os_l_) - return; + return; char const * fn =cfg_nm ? cfg_nm : ".dstreamrc"; { - ifstream ifs (fn); // can't open - if (!ifs) - return; - } + ifstream ifs (fn); // can't open + if (!ifs) + return; + } Text_db cfg (fn); while (! cfg.eof()){ - Text_record r (cfg++); - if (r.size() != 2) - { - r.message ("not enough fields in Dstream init."); - continue; - } - (*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar (r[1])); - } + Text_record r (cfg++); + if (r.size() != 2) + { + r.message ("not enough fields in Dstream init."); + continue; + } + (*silent_assoc_p_)[r[0]] = (bool)(int)(Scalar (r[1])); + } } @@ -174,6 +174,6 @@ Dstream::clear_silence() { for (Assoc_iter<String, bool> i (*silent_assoc_p_); i.ok(); i++) { - i.val() = 0; + i.val() = false; } } diff --git a/flower/flower-debug.cc b/flower/flower-debug.cc index 52156f983a..86a9abb9f0 100644 --- a/flower/flower-debug.cc +++ b/flower/flower-debug.cc @@ -3,7 +3,7 @@ #include "dstream.hh" bool flower_check_debug=false; -ofstream null_device ( "/dev/null"); +ofstream null_device ("/dev/null"); Dstream default_flower_stream (&null_device ,"/dev/null"); Dstream *flower_dstream = &default_flower_stream; diff --git a/flower/full-storage.cc b/flower/full-storage.cc index 71aa74c10c..2b1ff48a54 100644 --- a/flower/full-storage.cc +++ b/flower/full-storage.cc @@ -179,7 +179,7 @@ Full_storage::resize_cols (int newh) Full_storage::Full_storage (Matrix_storage*m) { set_size (m->rows(), m->cols ()); - if ( !m->is_type_b ( Full_storage::static_name())) + if (!m->is_type_b (Full_storage::static_name())) for (int i=0; i<height_i_; i++) for (int j=0; j<width_i_; j++) els_p_p_[i][j]=0.0; diff --git a/flower/include/assoc.hh b/flower/include/assoc.hh index 2ca31125cf..86d28b0fd3 100644 --- a/flower/include/assoc.hh +++ b/flower/include/assoc.hh @@ -63,8 +63,7 @@ public: int i= find (key); arr[i].free = true; } - void - add (K key, V val) { + void add (K key, V val) { int i = find_creat (key); arr[i].val = val; } diff --git a/flower/include/cursor.hh b/flower/include/cursor.hh index f19f3ac62b..7aea72d334 100644 --- a/flower/include/cursor.hh +++ b/flower/include/cursor.hh @@ -32,13 +32,13 @@ public: /// return current T T& operator *() { return thing(); } operator T() { return thing(); } - Cursor<T> operator =( const Cursor<T>& c); + Cursor<T> operator =(const Cursor<T>& c); /// make cursor with #no# items back - Cursor<T> operator -( int no) const; + Cursor<T> operator -(int no) const; /// make cursor with #no# items further - Cursor<T> operator +( int no) const; + Cursor<T> operator +(int no) const; int operator -(Cursor<T> op) const; Cursor<T> operator -=(int); Cursor<T> operator +=(int); @@ -47,10 +47,10 @@ public: /// move one up. void previous(); /// return current and move one down - Cursor<T> operator ++( int); + Cursor<T> operator ++(int); /// return current and move one up - Cursor<T> operator --( int); + Cursor<T> operator --(int); /// point to link? bool ok() const; diff --git a/flower/include/cursor.icc b/flower/include/cursor.icc index b1004b600a..15549fb737 100644 --- a/flower/include/cursor.icc +++ b/flower/include/cursor.icc @@ -29,7 +29,7 @@ inline Cursor<T>::Cursor (const List<T>& list, Link<T>* pointer) : list_((List<T>&) list) { - if ( list.size()) + if (list.size()) pointer_ = pointer ? pointer : list.top_; else pointer_ = pointer; @@ -38,7 +38,7 @@ Cursor<T>::Cursor (const List<T>& list, Link<T>* pointer) : template<class T> inline Cursor<T>::Cursor (const Cursor<T>& cursor) : - list_( cursor.list_) + list_(cursor.list_) { pointer_ = cursor.pointer_; } @@ -53,7 +53,7 @@ Cursor<T>::thing() template<class T> Cursor<T> -Cursor<T>::operator =( const Cursor<T>& c) +Cursor<T>::operator =(const Cursor<T>& c) { assert (&list_ == &c.list_); pointer_ = c.pointer_; @@ -92,21 +92,21 @@ template<class T> inline bool Cursor<T>::backward() const { - return ( pointer_ != 0); + return (pointer_ != 0); } template<class T> inline bool Cursor<T>::forward() const { - return ( pointer_ != 0); + return (pointer_ != 0); } template<class T> inline bool Cursor<T>::ok() const { - return ( pointer_ != 0); + return (pointer_ != 0); } template<class T> inline void @@ -118,7 +118,7 @@ Cursor<T>::next() template<class T> inline Cursor<T> -Cursor<T>::operator ++( int) +Cursor<T>::operator ++(int) { Cursor<T> r (*this); next(); @@ -135,7 +135,7 @@ Cursor<T>::previous() template<class T> inline Cursor<T> -Cursor<T>::operator --( int) +Cursor<T>::operator --(int) { Cursor<T> r (*this); previous(); diff --git a/flower/include/cursor.tcc b/flower/include/cursor.tcc index 4bf6347a1d..84c60d836a 100644 --- a/flower/include/cursor.tcc +++ b/flower/include/cursor.tcc @@ -9,7 +9,7 @@ template<class T> Cursor<T>::backspace() { Cursor<T> c (*this); - if ( c.ok()) + if (c.ok()) c--; list_.remove (*this); } @@ -19,7 +19,7 @@ template<class T> Cursor<T>::del() { Cursor<T> c (*this); - if ( c.ok()) + if (c.ok()) c++; list_.remove (*this); *this = c; @@ -28,7 +28,7 @@ Cursor<T>::del() template<class T> Cursor<T> -Cursor<T>::operator -=( int j) +Cursor<T>::operator -=(int j) { while (j--) (*this)--; @@ -36,7 +36,7 @@ Cursor<T>::operator -=( int j) } template<class T> Cursor<T> -Cursor<T>::operator +=( int j) +Cursor<T>::operator +=(int j) { while (j++) (*this)++; @@ -45,7 +45,7 @@ Cursor<T>::operator +=( int j) template<class T> Cursor<T> -Cursor<T>::operator +( int i) const +Cursor<T>::operator +(int i) const { Cursor<T> r = *this; @@ -60,7 +60,7 @@ Cursor<T>::operator +( int i) const template<class T> Cursor<T> -Cursor<T>::operator -( int i) const +Cursor<T>::operator -(int i) const { Cursor<T> r = *this; if (i<0) diff --git a/flower/include/dictionary-iter.hh b/flower/include/dictionary-iter.hh new file mode 100644 index 0000000000..b80bb14924 --- /dev/null +++ b/flower/include/dictionary-iter.hh @@ -0,0 +1,27 @@ +/* + dictionary-iter.hh -- declare + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef DICTIONARY_ITER_HH +#define DICTIONARY_ITER_HH + +#include "string.hh" +#include "assoc-iter.hh" +#include "dictionary.hh" + +template<class V> +class Dictionary_iter : public Assoc_iter<String, V> +{ +public: + Dictionary_iter (Dictionary<V> const &d) + : Assoc_iter<String, V> (d) + { + } +}; + +#endif // DICTIONARY_ITER_HH diff --git a/flower/include/dictionary.hh b/flower/include/dictionary.hh new file mode 100644 index 0000000000..11bb27329b --- /dev/null +++ b/flower/include/dictionary.hh @@ -0,0 +1,23 @@ +/* + dictionary.hh -- declare Dictionary + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef DICTIONARY_HH +#define DICTIONARY_HH + +#include "string.hh" +#include "assoc.hh" + +template<class T> +class Dictionary : public Assoc<String, T> +{ +public: + +}; + +#endif // DICTIONARY_HH diff --git a/flower/include/flower-debug.hh b/flower/include/flower-debug.hh index de19d30630..b3855d1566 100644 --- a/flower/include/flower-debug.hh +++ b/flower/include/flower-debug.hh @@ -15,7 +15,7 @@ extern Dstream *flower_dstream; extern bool flower_check_debug; #ifdef NPRINT -#define fdebug if ( 0) *flower_dstream +#define fdebug if (0) *flower_dstream #else #define fdebug if (flower_check_debug) \ flower_dstream->identify_as (__PRETTY_FUNCTION__) diff --git a/flower/include/fproto.hh b/flower/include/fproto.hh index 740c38a7fe..e09f03e3c1 100644 --- a/flower/include/fproto.hh +++ b/flower/include/fproto.hh @@ -11,7 +11,7 @@ char const * flower_version_sz(); // what the F*** is "int" ? -// depreciate int, long, etc., use i32, i64, remember: linux-16/linux-64 ? +// deprecate int, long, etc., use i32, i64, remember: linux-16/linux-64 ? /// (i32) typedef int i32; /// (i64) @@ -20,6 +20,8 @@ typedef long long I64; template<class T> struct Array; template<class T> struct sstack; template<class T,class K> struct Assoc; +template<class T> struct Dictionary; +template<class T> struct Dictionary_iter; template<class T> struct List; template<class T> struct Link_list; template<class T> struct Pointer_list; diff --git a/flower/include/link.icc b/flower/include/link.icc index 7699f1dfbc..df560285f2 100644 --- a/flower/include/link.icc +++ b/flower/include/link.icc @@ -22,7 +22,7 @@ Link<T>::OK() const template<class T> inline Link<T>::Link (const T& thing) : - thing_( thing) + thing_(thing) { previous_ = next_ = 0; } @@ -30,7 +30,7 @@ Link<T>::Link (const T& thing) : template<class T> inline Link<T>::Link (Link<T>* previous, Link<T>* next, const T& thing) : - thing_( thing) + thing_(thing) { previous_ = previous; next_ = next; @@ -58,8 +58,8 @@ void Link<T>::add (const T& thing) { - Link<T>* l = new Link<T>( this, next_, thing); - if ( next_) + Link<T>* l = new Link<T>(this, next_, thing); + if (next_) next_->previous_ = l; next_ = l; } @@ -68,10 +68,10 @@ template<class T> inline void Link<T>::insert (const T& thing) { - // Link<T>* l = new Link<T>( next_, this, thing); + // Link<T>* l = new Link<T>(next_, this, thing); // bugfix hwn 16/9/96 - Link<T>* l = new Link<T>( previous_, this, thing); - if ( previous_) + Link<T>* l = new Link<T>(previous_, this, thing); + if (previous_) previous_->next_ = l; previous_ = l; } @@ -83,12 +83,12 @@ template<class T> inline void Link<T>::remove (List<T> &l) { - if ( previous_) + if (previous_) previous_->next_ = next_; else l.top_ = next_; - if ( next_) + if (next_) next_->previous_ = previous_; else l.bottom_ = previous_; diff --git a/flower/include/list.hh b/flower/include/list.hh index 0f6ae90ca2..9be31601a6 100644 --- a/flower/include/list.hh +++ b/flower/include/list.hh @@ -20,7 +20,7 @@ template<class T> class Link; {\bf note:} retrieving "invalid" cursors, i.e. #top()/bottom ()# from empty list, #find ()# without success, - results in a nonvalid Cursor ( #!ok()#) + results in a nonvalid Cursor (#!ok()#) INVARIANTEN! diff --git a/flower/include/list.icc b/flower/include/list.icc index 7612137e20..3f930f02b9 100644 --- a/flower/include/list.icc +++ b/flower/include/list.icc @@ -1,7 +1,16 @@ -// -*-c++-*- +/* + list.icc -- implement List inline functions -#ifndef LIST_INL -#define LIST_INL + source file of the Flower Library + + (c) 1996,1997 + Jan Nieuwenhuizen <jan@digicash.com> + Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef LIST_ICC +#define LIST_ICC template<class T> inline @@ -22,7 +31,7 @@ template<class T> inline void List<T>::remove (Cursor<T> me) { - if ( me.ok()) + if (me.ok()) { Link<T> *lp = me.pointer(); lp->remove (*this); @@ -42,7 +51,7 @@ template<class T> inline Cursor<T> List<T>::top() const { - return Cursor<T>( *this, top_); + return Cursor<T>(*this, top_); } @@ -50,8 +59,9 @@ template<class T> inline Cursor<T> List<T>::bottom() const { - return Cursor<T>( *this, bottom_); + return Cursor<T>(*this, bottom_); } #endif + diff --git a/flower/include/list.tcc b/flower/include/list.tcc index 06aa312bc3..db4f0fc964 100644 --- a/flower/include/list.tcc +++ b/flower/include/list.tcc @@ -80,7 +80,7 @@ void List<T>::add (T const & thing, Cursor<T> &after_me) { if (!size_) { // not much choice if list is empty - bottom_ = top_ = new Link<T>( thing); + bottom_ = top_ = new Link<T>(thing); if (!after_me.ok()) after_me = bottom(); } @@ -102,7 +102,7 @@ List<T>::insert (T const & thing, Cursor<T> &before_me) { if (!size_) { - bottom_ = top_ = new Link<T>( thing); + bottom_ = top_ = new Link<T>(thing); if (!before_me.ok()) before_me = top(); diff --git a/flower/include/nscalar.hh b/flower/include/nscalar.hh new file mode 100644 index 0000000000..d1b361b70d --- /dev/null +++ b/flower/include/nscalar.hh @@ -0,0 +1,43 @@ +/* + scalar.hh -- declare + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef SCALAR_HH +#define SCALAR_HH + +struct Scalar { + String str_; + // Real real_; + int int_; + // Rational rational_; + + + struct typebits { + string_bit: 1; + int_bit:1; + }; +private: + + + // operator Real(); + operator int(); + + /** perl -like string to bool conversion. + */ + // operator bool() const; + + //Scalar (Real r) : String (r) {} + Scalar (int i) : String (i) {} + // Scalar (char c) : String (c) {} + Scalar (char const *c) : String (c) {} + Scalar (String s):String (s) {} + //Scalar (Rational); + static Scalar undefined (); +}; + +#endif // SCALAR_HH diff --git a/flower/include/pcursor.hh b/flower/include/pcursor.hh index e338a09353..981b43a10f 100644 --- a/flower/include/pcursor.hh +++ b/flower/include/pcursor.hh @@ -46,7 +46,7 @@ public: PCursor<T> operator-=(int i) { return Cursor<void*>::operator-=(i); } PCursor<T> operator -(int no) const { return Cursor<void*>::operator-(no);} int operator -(PCursor<T> op) const { return Cursor<void*>::operator-(op);} - PCursor<T> operator +( int no) const {return Cursor<void*>::operator+(no);} PCursor (const Link_list<T> & l) : Cursor<void*> (l) {} + PCursor<T> operator +(int no) const {return Cursor<void*>::operator+(no);} PCursor (const Link_list<T> & l) : Cursor<void*> (l) {} PCursor() : Cursor<void*> () {} PCursor (const Cursor<void*>& cursor) : Cursor<void*>(cursor) { } void* vptr() const { return *((Cursor<void*> &) *this); } diff --git a/flower/include/pqueue.hh b/flower/include/pqueue.hh index 5f4a97fb47..cc352cb2da 100644 --- a/flower/include/pqueue.hh +++ b/flower/include/pqueue.hh @@ -85,7 +85,7 @@ public: int mini=2; int lasti=1; - while ( mini < size()) { + while (mini < size()) { if (compare (elt (mini + 1), elt (mini)) <0) mini++; if (compare (last,elt (mini)) < 0) diff --git a/flower/include/rational.hh b/flower/include/rational.hh index 51426dd063..fb75268d92 100644 --- a/flower/include/rational.hh +++ b/flower/include/rational.hh @@ -1,5 +1,5 @@ /* - rational.hh -- declare + rational.hh -- declare rational helpers source file of the Flower Library diff --git a/flower/include/scalar.hh b/flower/include/scalar.hh index d081b56fe6..b00e25fc20 100644 --- a/flower/include/scalar.hh +++ b/flower/include/scalar.hh @@ -1,33 +1,36 @@ /* - scalar.hh -- part of LilyPond + scalar.hh -- declare Scalar - (c) 1996 Han-Wen Nienhuys + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ + #ifndef SCALAR_HH #define SCALAR_HH + #include "string.hh" #include "real.hh" /// Perl -like scalar type. struct Scalar : public String { - Scalar (Real r) : String (r) {} - Scalar (int i) : String (i) {} - Scalar (char c) : String (c) {} - Scalar (char const *c) : String (c) {} - Scalar (String s):String (s) {} - Scalar (Rational); - operator Rational(); - Scalar() {} - bool isnum(); - operator Real(); - operator int(); - - /** perl -like string to bool conversion. - */ - operator bool() const; + Scalar (Real r) : String (r) {} + Scalar (int i) : String (i) {} + Scalar (char c) : String (c) {} + Scalar (char const *c) : String (c) {} + Scalar (String s):String (s) {} + Scalar (Rational); + operator Rational(); + Scalar() {} + bool isnum(); + operator Real(); + operator int(); + /** perl -like string to bool conversion. + */ + operator bool() const; }; #endif // SCALAR_HH diff --git a/flower/include/string-data.hh b/flower/include/string-data.hh index 4dfe5544b9..0b71643e98 100644 --- a/flower/include/string-data.hh +++ b/flower/include/string-data.hh @@ -61,7 +61,7 @@ friend class String_handle; /// concatenation. void append (Byte const* byte_C, int length_i); - void operator += ( char const* ch_C); + void operator += (char const* ch_C); char const* ch_C() const; diff --git a/flower/include/string-data.icc b/flower/include/string-data.icc index 599d25312d..7d62f1ffcb 100644 --- a/flower/include/string-data.icc +++ b/flower/include/string-data.icc @@ -89,7 +89,7 @@ String_data::remax (int j) if (j > maxlen) { Byte *p = new Byte[j + 1]; - memcpy (p, data_byte_p_, ( maxlen <? length_i_) + 1 ); + memcpy (p, data_byte_p_, (maxlen <? length_i_) + 1 ); maxlen = j; delete[] data_byte_p_; data_byte_p_ = p; @@ -143,7 +143,7 @@ String_data::append (Byte const* byte_C, int length_i) INLINE void -String_data::operator += ( char const* ch_C) +String_data::operator += (char const* ch_C) { append ((Byte const*)ch_C, strlen (ch_C) ); } @@ -189,7 +189,7 @@ INLINE bool String_data::is_binary_bo() const { // return !memchr (data_byte_p_, length_i_, 0); - return ( (int)strlen ((char const*)data_byte_p_) != length_i_ ); + return ((int)strlen ((char const*)data_byte_p_) != length_i_ ); } INLINE Byte& diff --git a/flower/include/string.hh b/flower/include/string.hh index 7682fa0bfb..b749b7ee06 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -72,7 +72,7 @@ public: String (char c, int n = 1); String (int i , char const *fmt=0); - String ( double f , char const* fmt =0); + String (double f , char const* fmt =0); /// 'true' or 'false' String (bool); @@ -87,20 +87,21 @@ public: /// deprecated; use ch_C() operator char const*() const { return ch_C(); } - String &operator =( String const & source); + String &operator =(String const & source); /// concatenate s void operator += (char const* s) { strh_ += s; } void operator += (String s); - operator bool () + /// is the string empty? + operator bool () const { return length_i (); } void append (String); void prepend (String); - char operator []( int n) const { return strh_[n]; } + char operator [](int n) const { return strh_[n]; } /// return n leftmost chars String left_str (int n) const; @@ -185,7 +186,7 @@ operator + (String s1, String s2) } inline ostream & -operator << ( ostream& os, String d) +operator << (ostream& os, String d) { d.print_on (os); return os; diff --git a/flower/include/varray.hh b/flower/include/varray.hh index 60b72d299a..191b9ca0b6 100644 --- a/flower/include/varray.hh +++ b/flower/include/varray.hh @@ -175,7 +175,7 @@ public: size_--; } // quicksort. - void sort (int (*compare)( T const&,T const&), + void sort (int (*compare)(T const&,T const&), int lower = -1, int upper = -1) { if (lower < 0) { lower = 0 ; diff --git a/flower/include/vector.hh b/flower/include/vector.hh index 2d2772336b..7ad3f655c1 100644 --- a/flower/include/vector.hh +++ b/flower/include/vector.hh @@ -101,7 +101,7 @@ operator*(Vector v, Real a) { } inline Vector -operator*( Real a,Vector v) { +operator*(Real a,Vector v) { v *= a; return v; } diff --git a/flower/lgetopt.cc b/flower/lgetopt.cc index f0a49ab360..d8f18fd5ab 100644 --- a/flower/lgetopt.cc +++ b/flower/lgetopt.cc @@ -184,7 +184,7 @@ Getopt_long::operator()() return 0; if (argument_C[1] == '-') {// what to do with "command -- bla" - if ( argument_C[2]) + if (argument_C[2]) return parselong(); else return 0; diff --git a/flower/matrix-storage.cc b/flower/matrix-storage.cc index 7556a2cdd5..7d2c8fbcad 100644 --- a/flower/matrix-storage.cc +++ b/flower/matrix-storage.cc @@ -18,7 +18,7 @@ Matrix_storage::set_addition_result (Matrix_storage *&dat, Matrix_storage *right Diagonal_storage *L = (Diagonal_storage*)dat; Diagonal_storage* R = (Diagonal_storage*) right; - if ( R->band_size_i() > L->band_size_i ()) + if (R->band_size_i() > L->band_size_i ()) { L->set_band_size (R->band_size_i()); } @@ -50,7 +50,7 @@ void Matrix_storage::set_product_result (Matrix_storage*&dest, Matrix_storage*left, Matrix_storage*right) { - if ( left->name() == Diagonal_storage::static_name () + if (left->name() == Diagonal_storage::static_name () && right->name() == Diagonal_storage::static_name ()) { Diagonal_storage *L = (Diagonal_storage*)left; @@ -69,7 +69,7 @@ Matrix_storage::set_product_result (Matrix_storage*&dest, } } - if ( dest && dest->name() == Full_storage::static_name ()) + if (dest && dest->name() == Full_storage::static_name ()) { dest->set_size (left->rows(), right->cols ()); } diff --git a/flower/matrix.cc b/flower/matrix.cc index 0641d8032f..f7cb37585d 100644 --- a/flower/matrix.cc +++ b/flower/matrix.cc @@ -19,7 +19,7 @@ Matrix::band_b() const void Matrix::set_full() const { - if ( dat->name() != Full_storage::static_name ()) + if (dat->name() != Full_storage::static_name ()) { Matrix_storage::set_full (((Matrix*)this)->dat); } @@ -32,7 +32,7 @@ Matrix::try_set_band() const return; int b = band_i(); - if ( b > dim()/2) + if (b > dim()/2) return; // it only looks constant Matrix*self = (Matrix*)this; @@ -109,7 +109,7 @@ Matrix::operator=(Matrix const &m) int Matrix::band_i() const { - if ( band_b()) + if (band_b()) { Diagonal_storage const * diag = (Diagonal_storage*) dat; return diag->band_size_i(); @@ -117,10 +117,10 @@ Matrix::band_i() const int starty = dim(); while (starty >= 0) { - for ( int i = starty, j = 0; i < dim(); i++, j++) + for (int i = starty, j = 0; i < dim(); i++, j++) if (dat->elem (i,j)) goto gotcha; - for ( int i=0, j = starty; j < dim(); i++,j++) + for (int i=0, j = starty; j < dim(); i++,j++) if (dat->elem (i,j)) goto gotcha; starty --; diff --git a/flower/nscalar.cc b/flower/nscalar.cc new file mode 100644 index 0000000000..c8b829dd15 --- /dev/null +++ b/flower/nscalar.cc @@ -0,0 +1,8 @@ +/* + scalar.cc -- implement + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + diff --git a/flower/path.cc b/flower/path.cc index bdfaf80b63..6625864f6e 100644 --- a/flower/path.cc +++ b/flower/path.cc @@ -58,13 +58,13 @@ File_path::find (String nm) const { fdebug << "looking for " << nm << ": "; - if ( !nm.length_i() || ( nm == "-") ) + if (!nm.length_i() || (nm == "-") ) return nm; for (int i=0; i < size(); i++) { String path = elem(i); - if ( path.length_i() ) + if (path.length_i() ) path += "/"; path += nm; diff --git a/flower/scalar.cc b/flower/scalar.cc index db0b9ddb8c..fdffabd360 100644 --- a/flower/scalar.cc +++ b/flower/scalar.cc @@ -1,3 +1,11 @@ +/* + scalar.cc -- implement + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include <assert.h> #include <stdio.h> #include "scalar.hh" @@ -12,7 +20,7 @@ Scalar::operator Rational() { int p = index_i ('/'); if (p == -1) - return int (*this); + return int (*this); String s2 = right_str (len()-p-1); String s1 = left_str (p); @@ -26,8 +34,8 @@ Scalar::isnum() int conv = false; if (len()) { - long l =0; - conv = sscanf (strh_.ch_C(), "%ld", &l); + long l =0; + conv = sscanf (strh_.ch_C(), "%ld", &l); } return len() && conv; } @@ -40,6 +48,9 @@ Scalar::operator Real() Scalar::operator int() { + if (!length_i ()) + return 0; // ugh + assert (isnum()); return value_i(); } @@ -48,11 +59,11 @@ Scalar::operator int() Scalar::operator bool() const { if (!len()) - return false; + return false; if (*this == "0") - return false; + return false; String u (*this); - if ( u.upper_str() == "FALSE") - return false; + if (u.upper_str() == "FALSE") + return false; return true; } diff --git a/flower/string-convert.cc b/flower/string-convert.cc index 5acdb4c88f..ab7c6ab3e6 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -29,7 +29,7 @@ String_convert::bin2hex_str (String bin_str) { String str; Byte const* byte_C = bin_str.byte_C(); - for ( int i = 0; i < bin_str.length_i(); i++) + for (int i = 0; i < bin_str.length_i(); i++) { str += (char)nibble2hex_byte (*byte_C >> 4); str += (char)nibble2hex_byte (*byte_C++); @@ -49,7 +49,7 @@ String_convert::bin2_u (String bin_str) assert (bin_str.length_i() <= (int)sizeof(unsigned)); unsigned result_u = 0; - for ( int i = 0; i < bin_str.length_i(); i++) + for (int i = 0; i < bin_str.length_i(); i++) { result_u <<= 8; result_u += (Byte)bin_str[ i ]; @@ -61,7 +61,7 @@ String_convert::bin2_u (String bin_str) int String_convert::dec2_i (String dec_str) { - if ( !dec_str.length_i()) + if (!dec_str.length_i()) return 0; long l = 0; @@ -84,7 +84,7 @@ String_convert::i64_str (I64 i64, char const* fmt) double String_convert::dec2_f (String dec_str) { - if ( !dec_str.length_i()) + if (!dec_str.length_i()) return 0; double d = 0; int conv = sscanf (dec_str.ch_C(), "%lf", &d); @@ -95,19 +95,19 @@ String_convert::dec2_f (String dec_str) int String_convert::hex2bin_i (String hex_str, String& bin_str_r) { - if ( hex_str.length_i() % 2) + if (hex_str.length_i() % 2) hex_str = "0" + hex_str; bin_str_r = ""; Byte const* byte_C= hex_str.byte_C(); int i = 0; - while ( i < hex_str.length_i()) + while (i < hex_str.length_i()) { int high_i = hex2nibble_i (*byte_C++); int low_i = hex2nibble_i (*byte_C++); - if ( high_i < 0 || low_i < 0) + if (high_i < 0 || low_i < 0) return 1; // illegal char - bin_str_r += String ((char)( high_i << 4 | low_i), 1 ); + bin_str_r += String ((char)(high_i << 4 | low_i), 1 ); i += 2; } return 0; @@ -127,11 +127,11 @@ String_convert::hex2bin_str (String hex_str) int String_convert::hex2nibble_i (Byte byte) { - if ( byte >= '0' && byte <= '9') + if (byte >= '0' && byte <= '9') return byte - '0'; - if ( byte >= 'A' && byte <= 'F') + if (byte >= 'A' && byte <= 'F') return byte - 'A' + 10; - if ( byte >= 'a' && byte <= 'f') + if (byte >= 'a' && byte <= 'f') return byte - 'a' + 10; return -1; } @@ -141,7 +141,7 @@ String String_convert::i2dec_str (int i, int length_i, char ch) { char fill_ch = ch; - if ( fill_ch) + if (fill_ch) fill_ch = '0'; // ugh @@ -157,13 +157,13 @@ String String_convert::u2hex_str (unsigned u, int length_i, char fill_ch) { String str; - if ( !u) + if (!u) str = "0"; #if 1 // both go... - while ( u) + while (u) { - str = String ((char)( ( u % 16)["0123456789abcdef"] ) ) + str; + str = String ((char)((u % 16)["0123456789abcdef"] ) ) + str; u /= 16; } #else @@ -171,7 +171,7 @@ String_convert::u2hex_str (unsigned u, int length_i, char fill_ch) #endif str = String (fill_ch, length_i - str.length_i()) + str; - while ( ( str.length_i() > length_i) && ( str[ 0 ] == 'f' ) ) + while ((str.length_i() > length_i) && (str[ 0 ] == 'f' ) ) str = str.mid_str (2, INT_MAX); return str; @@ -186,10 +186,10 @@ String_convert::i2hex_str (int i, int length_i, char fill_ch) Byte String_convert::nibble2hex_byte (Byte byte) { - if ( ( byte & 0x0f) <= 9 ) - return ( byte & 0x0f) + '0'; + if ((byte & 0x0f) <= 9 ) + return (byte & 0x0f) + '0'; else - return ( byte & 0x0f) - 10 + 'a'; + return (byte & 0x0f) - 10 + 'a'; } /** Convert an integer to a string diff --git a/flower/string.cc b/flower/string.cc index 6651475b37..a68afb5887 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -36,7 +36,7 @@ String::print_on (ostream& os) const if (!strh_.is_binary_bo()) os << ch_C(); else - for ( int i = 0; i < length_i(); i++) + for (int i = 0; i < length_i(); i++) os << (Byte)(*this)[ i ]; } @@ -147,7 +147,7 @@ String::compare_i (String const& s1, String const& s2) { Byte const* p1 = s1.byte_C(); Byte const* p2 = s2.byte_C(); - if ( p1 == p2) + if (p1 == p2) return 0; int i1 = s1.length_i(); @@ -161,12 +161,12 @@ String::compare_i (String const& s1, String const& s2) int String::index_last_i (char const c) const { - if ( !length_i()) + if (!length_i()) return -1; char const* me = strh_.ch_C(); char const* p = memrchr (me, length_i(), c); - if ( p) + if (p) return p - me; return -1; } @@ -176,11 +176,11 @@ String::index_last_i (char const* string) const // UGK! { assert (false); // broken int length = strlen (string); // ugrh - if ( !length_i() || !length) + if (!length_i() || !length) return -1; int next_i = index_i (string); - if ( next_i == -1) + if (next_i == -1) return -1; int index_i = 0; @@ -205,7 +205,7 @@ String::index_i (char c) const { char const* me = strh_.ch_C(); char const* p = (char const *) memchr (me,c, length_i()); - if ( p) + if (p) return p - me; return -1; } @@ -223,7 +223,7 @@ String::index_i (String searchfor) const char const* p = (char const *) memmem ( me, length_i(), searchfor.ch_C(), searchfor.length_i ()); - if ( p) + if (p) return p - me; else return -1; @@ -238,7 +238,7 @@ int String::index_any_i (String set) const { int n = length_i(); - if ( !n) + if (!n) return -1; void const * me_l = (void const *) strh_.ch_C(); @@ -274,7 +274,7 @@ String::right_str (int n) const if (n > length_i()) return *this; - if ( n < 1) + if (n < 1) return ""; return String (strh_.byte_C() + length_i() - n, n); @@ -284,12 +284,12 @@ String::right_str (int n) const String String::nomid_str (int index_i, int n) const { - if ( index_i < 0) + if (index_i < 0) { n += index_i; index_i = 0; } - if ( n <= 0) + if (n <= 0) return *this; return @@ -309,10 +309,10 @@ String::mid_str (int index_i, int n) const index_i=0; } - if ( !length_i() || ( index_i < 0) || ( index_i >= length_i () ) || ( n < 1 ) ) + if (!length_i() || (index_i < 0) || (index_i >= length_i () ) || (n < 1 ) ) return String(); - if ( ( n > length_i()) || ( index_i + n > length_i () ) ) + if ((n > length_i()) || (index_i + n > length_i () ) ) n = length_i() - index_i; return String (byte_C() + index_i, n); diff --git a/flower/stringtest.cc b/flower/stringtest.cc index bc431567b9..a5bc0c6036 100644 --- a/flower/stringtest.cc +++ b/flower/stringtest.cc @@ -95,14 +95,14 @@ main() cout << "up: " << str.upper_str() << " down: " << str.lower_str ()<<endl; - if ( str == String ("") ) + if (str == String ("") ) cout << str << " is empty" << endl; else cout << str << " is not empty"<<endl; String fn = ""; - if ( fn == "") + if (fn == "") cout << fn << " is empty" << endl; else assert (false); diff --git a/init/engraver.ly b/init/engraver.ly index 3c291a9113..ffb57a5dc5 100644 --- a/init/engraver.ly +++ b/init/engraver.ly @@ -2,81 +2,86 @@ % setup for Request->Element conversion. Guru-only % -staff_engraver = \requesttranslator { - Engraver "Engraver_group_engraver" - \alias "Staff"; - \consists "Bar_engraver"; - \consists "Clef_engraver"; - \consists "Key_engraver"; - \consists "Meter_engraver"; - \consists "Local_key_engraver"; - \consists "Staff_sym_engraver"; - \consists "Collision_engraver"; - \consists "Rest_collision_engraver"; - - \consists "Line_group_engraver"; - \contains \requesttranslator { - Engraver "Voice_group_engravers" - \alias "Voice_group"; - \consists "Dynamic_engraver"; - \consists "Stem_engraver"; - \consists "Beam_engraver"; - \consists "Abbreviation_beam_engraver"; - \consists "Script_engraver"; - \consists "Note_column_engraver"; - \consists "Slur_engraver"; - \contains \requesttranslator { - Engraver "Engraver_group_engraver" - \alias "Voice"; - \consists "Note_head_engraver" ; - \consists "Tie_engraver"; - } - } - } - -piano_staff_engraver = \requesttranslator { - Engraver "Engraver_group_engraver" - \alias "Piano"; - \alias "Hoenoemjedat"; +Staff = \translator { + \type "Engraver_group_engraver"; + defaultclef = violin; + + \consists "Bar_engraver"; + \consists "Clef_engraver"; + \consists "Key_engraver"; + \consists "Meter_engraver"; + \consists "Local_key_engraver"; + \consists "Staff_sym_engraver"; + \consists "Collision_engraver"; + \consists "Rest_collision_engraver"; + + \consists "Line_group_engraver"; + \accepts "Voice"; +} + +Voice = \translator { + \type "Engraver_group_engraver"; + \consists "Dynamic_engraver"; + \consists "Rest_engraver"; + \consists "Stem_engraver"; + \consists "Beam_engraver"; + \consists "Abbreviation_beam_engraver"; + \consists "Script_engraver"; + \consists "Rhythmic_column_engraver"; + \consists "Slur_engraver"; + \accepts "Thread"; +} + +Thread = \translator { + \type "Engraver_group_engraver"; + \consists "Skip_req_swallow_translator"; + \consists "Note_head_engraver" ; + \consists "Tie_engraver"; +} + +Grandstaff = \translator { + \type "Engraver_group_engraver"; + \consists "Span_bar_engraver"; \consists "Vertical_align_engraver"; \consists "Piano_bar_engraver"; % This should come last \consists "Line_group_engraver"; - \contains\requesttranslator { \staff_engraver } + \accepts "Staff"; } -staff_group_engraver = \requesttranslator { - Engraver "Engraver_group_engraver" - \alias "Staff_group"; +Staff_group = \translator { + \type "Engraver_group_engraver"; \consists "Span_bar_engraver"; \consists "Vertical_align_engraver"; \consists "Line_group_engraver"; - \contains\requesttranslator { \staff_engraver } + \accepts "Staff"; + \accepts "Grandstaff"; } -lyric_engraver = \requesttranslator { - Engraver "Engraver_group_engraver" - \alias "Lyric"; +Lyric_voice = +\translator{ + \type "Engraver_group_engraver"; + + \consists "Lyric_engraver"; + \consists "Line_group_engraver"; + \consists "Swallow_engraver"; +} - \contains\requesttranslator{ - Engraver "Engraver_group_engraver" - \consists "Lyric_engraver"; - \consists "Line_group_engraver"; - \consists "Swallow_engraver"; - } +Lyrics = \translator { + \type "Engraver_group_engraver"; \consists "Vertical_align_engraver"; \consists "Line_group_engraver"; + \accepts "Lyric_voice"; } -orchestral_score_translator = \requesttranslator { - Engraver Score_engraver - \alias "Score"; +Score = \translator { + \type Score_engraver; \consists "Timing_engraver"; \consists "Bar_column_engraver"; - \consists "Bar_number_grav"; + \consists "Bar_number_engraver"; \consists "Bar_align_engraver"; \consists "Clef_align_engraver"; @@ -87,13 +92,14 @@ orchestral_score_translator = \requesttranslator { \consists "Span_score_bar_engraver"; - \contains \requesttranslator { \staff_group_engraver } - \contains \requesttranslator { \lyric_engraver } - \contains \requesttranslator { \piano_staff_engraver } + \accepts "Staff_group"; + \accepts "Staff"; + \accepts "Lyrics"; + \accepts "Grandstaff"; } -stupid_engraver = \requesttranslator { - Engraver Score_engraver +Stupid_score = \translator { + \type Score_engraver; \consists "Staff_sym_engraver"; } diff --git a/init/midi.ly b/init/midi.ly index 95602c3235..103028cf20 100644 --- a/init/midi.ly +++ b/init/midi.ly @@ -1,6 +1,5 @@ -\include "performer.ly" default_midi = \midi { \tempo 4=60; - \requesttranslator{ \default_midi_perf } + \include "performer.ly" } diff --git a/init/paper16.ly b/init/paper16.ly index a69105a29a..51aff437e8 100644 --- a/init/paper16.ly +++ b/init/paper16.ly @@ -3,8 +3,16 @@ \include "table16.ly" +%{ + +TODO make this somehow parametric. for example the linewidth was +chosen to look good on A4 paper. This probably looks less good on US +paper sizes. + + +%} paper_sixteen = \paper { - linewidth = 15.0 \cm; + linewidth = 15.5 \cm; rule_thickness = 0.4\pt; bar_size = 16.0 \pt; interline = 4.\pt; @@ -25,5 +33,5 @@ paper_sixteen = \paper { gourlay_maxmeasures = 14.; castingalgorithm = \Gourlay; \symboltables { \table_sixteen } - \requesttranslator { \orchestral_score_translator } + \include "engraver.ly" } diff --git a/init/paper20.ly b/init/paper20.ly index 159628e570..ff27bac5a8 100644 --- a/init/paper20.ly +++ b/init/paper20.ly @@ -25,6 +25,6 @@ paper_twenty = \paper { castingalgorithm = \Gourlay; \symboltables { \table_twenty } - \requesttranslator { \orchestral_score_translator } +\include "engraver.ly" } diff --git a/init/performer.ly b/init/performer.ly index 27fbcea67e..a45e0ce271 100644 --- a/init/performer.ly +++ b/init/performer.ly @@ -1,46 +1,51 @@ % % setup for Request->Element conversion. Guru-only % -staff_perf = \requesttranslator { - Performer "Staff_performer" - \alias "Staff"; - - \contains\requesttranslator{ - Performer "Performer_group_performer" - \alias "Voice_group"; - \contains\requesttranslator{ - Performer "Performer_group_performer" - \consists "Note_performer"; - } - } - \consists "Key_performer"; - \consists "Meter_performer"; - } - -default_midi_perf = \requesttranslator { - Performer "Score_performer" - \alias "Score"; - -% \consists "Tempo_performer"; - - \contains \requesttranslator{ \staff_perf } - \contains\requesttranslator{ - Performer "Performer_group_performer" - \alias "Piano"; - \contains\requesttranslator{\staff_perf} - } - \contains\requesttranslator{ - Performer "Staff_performer" - \alias "Lyric"; - \contains\requesttranslator { - Performer "Performer_group_performer" - \contains\requesttranslator{ - Performer "Performer_group_performer" - \consists "Lyric_performer"; - } - } - \consists "Meter_performer"; - } + +Staff = \translator { + \type "Staff_performer"; + \accepts Voice; + \consists "Key_performer"; + \consists "Meter_performer"; +} + + +Thread =\translator +{ + \type "Performer_group_performer"; + \consists "Note_performer"; +} + +Voice = \translator +{ + \type "Performer_group_performer"; + \accepts Thread; +} + +Grandstaff = \translator +{ + \type "Performer_group_performer"; + \accepts Staff; +} + +Lyric_voice = \translator { + \type "Performer_group_performer"; + \consists "Lyric_performer"; +} + + +Lyrics = \translator { + \type "Staff_performer"; + \accepts Lyric_voice; + \consists "Meter_performer"; +} + +Score = \translator { + \type "Score_performer"; + instrument = piano; + \accepts Staff; + \accepts Grandstaff; + \accepts Lyrics; \consists "Swallow_performer"; } diff --git a/init/symbol.ly b/init/symbol.ly index 3062d2d961..445a8a7a64 100644 --- a/init/symbol.ly +++ b/init/symbol.ly @@ -1,6 +1,6 @@ % symbol.ly -\version "0.1.2"; +\version "0.1.5"; breve = \duration { -1 0 } longa = \duration { -2 0 } @@ -8,7 +8,7 @@ longa = \duration { -2 0 } \include "dynamic.ly" \include "dutch.ly" \include "script.ly" -\include "engraver.ly" + Gourlay = 1.0 Wordwrap = 0.0 @@ -29,6 +29,24 @@ left = -1 right = 1 up = 1 down = -1 - +center=0 + + +stemup = { + \skip 1*0; + % Stupid hack to make < { \stemup } > work +% \property Thread.cocktailbar = 1 + \property Voice.ydirection = \up + } +stemboth= { + \skip 1*0; + % \property Thread.cocktailbar = 0 + \property Voice.ydirection = \center +} +stemdown = { + \skip 1*0; + %\property Thread.cocktailbar = -1 + \property Voice.ydirection = \down +} diff --git a/init/table16.ly b/init/table16.ly index 290318e7cd..0642176070 100644 --- a/init/table16.ly +++ b/init/table16.ly @@ -75,6 +75,7 @@ table_sixteen= } "balls" = \table { + "-2" "\longaball" 0.0\pt 6.0\pt -2.0\pt 2.0\pt "-1" "\breveball" 0.0\pt 6.0\pt -2.0\pt 2.0\pt "0" "\wholeball" 0.0\pt 6.0\pt -2.0\pt 2.0\pt "1" "\halfball" 0.0\pt 5.0\pt -2.0\pt 2.0\pt @@ -112,6 +113,8 @@ table_sixteen= } "rests" = \table { + "-2o" "\longarest" 0.0\pt 6.0\pt 0.0\pt 4.0\pt + "-2" "\longarest" 0.0\pt 6.0\pt 0.0\pt 4.0\pt "-1o" "\breverest" 0.0\pt 6.0\pt 0.0\pt 4.0\pt "-1" "\breverest" 0.0\pt 6.0\pt 0.0\pt 4.0\pt "0o" "\outsidewholerest" 0.0\pt 6.0\pt 0.0\pt 2.0\pt diff --git a/input/Makefile b/input/Makefile index 94a5042a3f..76a5363cbb 100644 --- a/input/Makefile +++ b/input/Makefile @@ -16,6 +16,6 @@ include ./$(depth)/make/Include.make # LYFILES = $(wildcard *.ly) TEXFILES = $(wildcard *.tex) -DISTFILES = Makefile $(LYFILES) $(TEXFILES) +DISTFILES = Makefile $(LYFILES) $(TEXFILES) $(wildcard *.m4) # diff --git a/input/abbrev.ly b/input/abbrev.ly index d417267205..b25a386f03 100644 --- a/input/abbrev.ly +++ b/input/abbrev.ly @@ -11,7 +11,7 @@ EndMudelaHeader %} -\version "0.1.2"; +\version "0.1.5"; \score{ \melodic{ diff --git a/input/beams.ly b/input/beams.ly index 7b18bfbf52..2b815e3b47 100644 --- a/input/beams.ly +++ b/input/beams.ly @@ -10,58 +10,59 @@ Tested Features: beams and beamflags EndMudelaHeader %} +\version "0.1.5" \score{ \melodic <\multi 3; { \octave c'; \meter 8/4; \duration8; - \stem \up; [c c'' a' f'] + \stemup [c c'' a' f'] \duration16; - \stem \up; [c c'' a' f'] + \stemup [c c'' a' f'] \duration32; - \stem \up; [c c'' a' f'] + \stemup [c c'' a' f'] \duration64; - \stem \up; [c c'' a' f'] + \stemup [c c'' a' f'] \duration128; - \stem \up; [c c'' a' f'] + \stemup [c c'' a' f'] \duration 8; - \stem \up; ['g 'g 'g 'g] + \stemup ['g 'g 'g 'g] \duration 16; - \stem \up; ['g 'g 'g 'g] + \stemup ['g 'g 'g 'g] \duration 32; - \stem \up; ['g 'g 'g 'g] + \stemup ['g 'g 'g 'g] \duration 64; - \stem \up; ['g 'g 'g 'g] + \stemup ['g 'g 'g 'g] \duration 128; - \stem \up; ['g 'g 'g 'g] + \stemup ['g 'g 'g 'g] } { \octave c'; \meter 8/4; \duration8; - \stem \down; [a' 'a c e] + \stemdown [a' 'a c e] \duration16; - \stem \down; [a' 'a c e] + \stemdown [a' 'a c e] \duration32; - \stem \down; [a' 'a c e] + \stemdown [a' 'a c e] \duration64; - \stem \down; [a' 'a c e] + \stemdown [a' 'a c e] \duration128; - \stem \down; [a' 'a c e] + \stemdown [a' 'a c e] \octave c; \duration 8; - \stem \down; [d'' d'' d'' d''] + \stemdown [d'' d'' d'' d''] \duration 16; - \stem \down; [d'' d'' d'' d''] + \stemdown [d'' d'' d'' d''] \duration 32; - \stem \down; [d'' d'' d'' d''] + \stemdown [d'' d'' d'' d''] \duration 64; - \stem \down; [d'' d'' d'' d''] + \stemdown [d'' d'' d'' d''] \duration 128; - \stem \down; [d'' d'' d'' d''] + \stemdown [d'' d'' d'' d''] } >} diff --git a/input/cadenza.ly b/input/cadenza.ly index d817aea062..fc143d0287 100644 --- a/input/cadenza.ly +++ b/input/cadenza.ly @@ -11,12 +11,16 @@ copyright public domain Tested Features: cadenza mode %} -\version "0.1.2"; +\version "0.1.5"; -cad = \melodic {\id "Staff" "french horn"; - \cadenza 1; - \grouping 1*4;\duration 8;\octave c'; +cad = \melodic { + \property Score.instrument = "french horn" + \type Staff { + \cadenza 1; + \grouping 1*4; + \duration 8; + \octave c'; \clef "violin"; c'4.\mf g8 @@ -54,10 +58,10 @@ cad = \melodic {\id "Staff" "french horn"; a4. g8 [f8 e8 d8 c8] 'g2 d2^"\tr" c4 - } + }} \score { \melodic { \cad } + \midi { \tempo 4 = 90; } \paper { } - \midi { \tempo 4 = 90; } } diff --git a/input/collisions.ly b/input/collisions.ly index 4bf20ce8c8..c65800b961 100644 --- a/input/collisions.ly +++ b/input/collisions.ly @@ -10,47 +10,48 @@ Tested Features:test the Collision resolution EndMudelaHeader %} -\version "0.1.2"; +\version "0.1.5"; two_voice = \melodic < \multi 2; - { \octave c'; \stem \down; + { \stemdown \octave c'; c4 d e f g2~ g4 a [c8 d e f] c2| } - { \stem \up; + { \stemup g4 f e g ~ g2 g2 c4 g4 g2 } > two_voice_steminvert = \melodic < \multi 2; - { \octave c'; \stem \up; + { + \octave c'; \stemup % the f and g on 4th beat are exceptionally ugh. c4 d e f g2 g4 a | } - { \stem \down; + { \stemdown g4 f e g g2 g2 } > three_voice = \melodic < \multi 2; - { \stem \up; + { \stemup g4 f e f g a g2 } - { \hshift 1; \stem \up; + { \stemup \property Voice.hshift = 1 e2 e2 e2 e2 } - { \stem \down; + { \stemdown c4 d e d c d es } > rests = \melodic < \multi 2; - { \stem \up; + { \stemup | r8 r r r r r r r [c' b a g] [f e d c] } - { \stem \down; + { \stemdown [c8 d e f] [g a b c'] r r r r r r r r } @@ -59,12 +60,12 @@ rests = \melodic restsII = \melodic { \octave c'; < \multi2; - { \stem \up; g' f' e' d' c' b a g f e d c } - { \stem \down; r r r r r r r r r r r r } + { \stemup g' f' e' d' c' b a g f e d c } + { \stemdown r r r r r r r r r r r r } > < \multi2; - { \stem \up; r r r r r r r r r r r r } - { \stem \down; c d e f g a b c' d' e' f' g' } + { \stemup r r r r r r r r r r r r } + { \stemdown c d e f g a b c' d' e' f' g' } > r8 r4 < \multi2; r8 r8 > @@ -72,17 +73,17 @@ restsII = \melodic { < \multi2; r8 r8 r8 r8 > < \multi2; r r > < \multi2; r r r > - \stem \up; + \stemup [c''8 r8 c''8 c''8] [c8 r8 c8 c8] - \stem \down; + \stemdown [c8 r8 c8 c8] [c''8 r8 c''8 c''8] } \score{ - \melodic { \$two_voice \$two_voice_steminvert - \$three_voice \rests \restsII } + { \two_voice \two_voice_steminvert + \three_voice \rests \restsII } diff --git a/input/coriolan-alto.ly b/input/coriolan-alto.ly index ffee788c29..62d21690ba 100644 --- a/input/coriolan-alto.ly +++ b/input/coriolan-alto.ly @@ -17,7 +17,7 @@ EndMudelaHeader % (maybe even sooner :-) % -\version "0.1.2"; +\version "0.1.5"; alto = \melodic{ @@ -39,7 +39,7 @@ alto = \melodic{ %33 [ ) c8 c-. ] c4. c-. c4 \group "+bla"; - \stem 1 ;[ c16^"div." c16 c16 c16 ] c4 c2 + \stemup[ c16^"div." c16 c16 c16 ] c4 c2 \group "-"; } %30:2 @@ -68,7 +68,7 @@ alto = \melodic{ % \octave 'c ; \textstyle "italic"; - \stem -1 ; + \stemdown [ as16 \ff as16 as16 as16 ] as4_"simile" as2 \textstyle "roman"; \group "-"; diff --git a/input/gallina.ly b/input/gallina.ly index 6509c9cd06..9c0498c412 100644 --- a/input/gallina.ly +++ b/input/gallina.ly @@ -39,6 +39,8 @@ part of the basso continuo %} +\version "0.1.5"; + vi1=\melodic{ \meter 4/4; \octave c''; @@ -198,11 +200,11 @@ bc=\melodic{ \meter 3/2; g1. | c | % 30 - f | d^"\sharp" | + f | d^"\textsharp" | g | c | - A | d^"\sharp" | + A | d^"\textsharp" | G | c | - d^"\sharp" | e | + d^"\textsharp" | e | f | g1 B2 | d1.^"3 4 3" | \meter 4/4; @@ -211,7 +213,7 @@ bc=\melodic{ g1^"3 4 3" | c | G^"3 4 3" | c2 G | d1^"3 4 3" | G^"3 4 3" | - c2 G | d1^"\sharp" ( | + c2 G | d1^"\textsharp" ( | ) d^"3 4 3" | \cadenza 1; G\breve @@ -229,9 +231,9 @@ bc=\melodic{ \output "gallina.out"; gourlay_maxmeasures=7.; } - \midi{ + \midi{ \tempo 4=90; -} + } } diff --git a/input/keys.ly b/input/keys.ly index 1b82f12361..1c3b99bd6d 100644 --- a/input/keys.ly +++ b/input/keys.ly @@ -10,7 +10,7 @@ Tested Features: local key, key, forced accidentals EndMudelaHeader %} -\version "0.1.2"; +\version "0.1.5"; blah = \melodic{ diff --git a/input/kortjakje.ly b/input/kortjakje.ly index 236d53ad36..924c84a979 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -11,7 +11,7 @@ copyright public domain Tested Features: example file with comments %} -\version "0.1.2"; +\version "0.1.5"; % the % is a comment. @@ -59,7 +59,7 @@ begeleiding = \melodic{ } \score{ - \melodic < \id "Piano" ""; \multi 3; + \melodic \type Grandstaff = < \melodie \begeleiding > diff --git a/input/multi.ly b/input/multi.ly index de46690d5b..8270bfd809 100644 --- a/input/multi.ly +++ b/input/multi.ly @@ -10,13 +10,13 @@ Tested Features: \multi %} -\version "0.1.2"; +\version "0.1.5"; \score{ \melodic { \octave c'; c4 c4 < \multi 1; { c2 c2 } { c'2 c'2 } > - < \multi 2; { \stem \down; c2 c2 } { \stem \up; c'2 c'2 } > + < \multi 2; { \stemdown c2 c2 } { \stemup c'2 c'2 } > < \multi 3; { \clef "bass"; c2 c2 } { \meter 2/4;\bar "||"; \key fis cis gis; c'2 c'2 } > c2 c1 c1 c1 diff --git a/input/pedal.ly b/input/pedal.ly index 60ad7e1244..2827ed2bed 100644 --- a/input/pedal.ly +++ b/input/pedal.ly @@ -24,7 +24,7 @@ % \lbheel \lbheel \lfheel \lftoe % \rbheel \rbtoe \rfheel \rftoe -\version "0.1.2"; +\version "0.1.5"; \score{ \melodic { diff --git a/input/rhythm.ly b/input/rhythm.ly index 75c5f54e05..ef4481d1f8 100644 --- a/input/rhythm.ly +++ b/input/rhythm.ly @@ -1,18 +1,13 @@ - \header{ - filename rhythm.ly - entered-by HWN - copyright public domain - Tested Features multiple meters, beaming - unsynced bars +filename rhythm.ly +enteredby HWN +copyright public domain +TestedFeatures multiple meters, beaming, unsynced bars, userdefd engravers } -%{ -has to be revised for 0.1.12 -%} -\version "0.1.2"; +\version "0.1.5"; ritme = \melodic{ %\octave ; \partial 8; @@ -61,5 +56,42 @@ yanother = > \paper{ + + %% remove Timing_engraver and Bar_number_engraver + Score = \translator { + \type Score_engraver; + + \consists "Bar_align_engraver"; + \consists "Clef_align_engraver"; + \consists "Key_align_engraver"; + \consists "Meter_align_engraver"; + \consists "Score_horizontal_align_engraver"; + \consists "Vertical_align_engraver"; + \consists "Span_score_bar_engraver"; + + + \accepts "Staff_group"; + \accepts "Staff"; + \accepts "Lyrics"; + \accepts "Grandstaff"; + } + + %% add Timing_engraver to the staff + Staff = \translator { + \type "Engraver_group_engraver"; + + \consists "Timing_engraver"; + \consists "Bar_engraver"; + \consists "Clef_engraver"; + \consists "Key_engraver"; + \consists "Meter_engraver"; + \consists "Local_key_engraver"; + \consists "Staff_sym_engraver"; + \consists "Collision_engraver"; + \consists "Rest_collision_engraver"; + + \consists "Line_group_engraver"; + \accepts "Voice"; + } } } diff --git a/input/scales.ly b/input/scales.ly index 86a8721c39..64acc42bea 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -12,7 +12,7 @@ EndMudelaHeader % scales with accents. % -\version "0.1.2"; +\version "0.1.5"; blah = \melodic { \meter 6/8; \octave 'c ; diff --git a/input/scripts.ly b/input/scripts.ly index 9e2cf7ab60..b4e95203c4 100644 --- a/input/scripts.ly +++ b/input/scripts.ly @@ -10,7 +10,7 @@ Tested Features: scripts, text. EndMudelaHeader %} -\version "0.1.2"; +\version "0.1.5"; blah = \melodic { diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly index 36af5c2cb7..247cf7901b 100644 --- a/input/scsii-menuetto.ly +++ b/input/scsii-menuetto.ly @@ -13,7 +13,7 @@ copyright public domain Tested Features:breaking algorithm, chords, multivoice, accents %} -\version "0.1.2"; +\version "0.1.5"; %% Stuff from MPP version % \lefttitle{Menuetto} @@ -27,6 +27,7 @@ copyright public domain IImenuetto = \melodic{ \clef"alto"; + \property Staff.instrument = cello \meter 3/4; \key bes; \octave c'; @@ -34,16 +35,16 @@ IImenuetto = \melodic{ \duration 8; < a2 f2 d2 \f > bes4-. | %%2 - < [ bes8^"1" e c_"2"_"4" > - a bes-. g-. ] a4-.^"4" | + < [ bes8^"1" e8 c8_"2"_"4" > + a8 bes8-. g8-. ] a4-.^"4" | %%3 - < d4 'bes4-. > g4-. [ f8-. e-. ] | + < d4 'bes4-. > g4-. [ f8-. e8-. ] | %%4 - < [ f 'a > e d cis-. 'b-. 'a-. ] + < [ f8 'a > e8 d8 cis8-. 'b8-. 'a8-. ] %%5 < a2 f2 d2 > bes!4-. | %%6 - < [ bes8 e > a bes-. g-. ] + < [ bes8 e8 > a8 bes8-. g8-. ] c'!4-. | %%7 < a4-. f4> @@ -57,52 +58,50 @@ IImenuetto = \melodic{ < e'2 a2 \f > [ d'8( e'16 )f'16 ] | %%10 - < [ e'8 g > d' cis'_"2" e' a~ g ] | + < [ e'8 g8 > d' cis'_"2" e' a~ g8 ] | %%11 < \multi 2; - {\stem \up; a4~ d'4 cis'4-. } - { \stem \down; f2 e4 } > | + {\stemup a4~ d'4 cis'4-. } + { \stemdown f2 e4 } > | %%12 - < [ g'8^"4" d > f' e' f' d'^"3"~ c' ] | + < [ g'8^"4" d8 > f' e' f' d'^"3"~ c' ] | %%13 \clef "alto"; < \multi 2; - { \stem \up; bes2 c'4 } - { \stem \down; g4~ f4 e4 }% ugh + { \stemup bes2 c'4 } + { \stemdown g4~ f4 e4 }% ugh > | %%14 - < [ a8 f > g a f ] < d'4-\upbow e4 'bes4 > | + < [ a8 f8 > g8 a8 f8 ] < d'4-\upbow e4 'bes4 > | %%15 - < c'4-\downbow f4 'a4 > [ bes8~ a g a ] | + < c'4-\downbow f4 'a4 > [ bes8~ a8 g8 a8 ] | %%16 - [ f( e )f a-. g-. bes-. ] | + [ f( e8 )f a8-. g8-. bes8-. ] | %%17 < a2^"0" fis2_"3" > bes4 | %%18 - < { [ c'8~ bes c' a ] } { [ es ] } > fis4 | + < { [ c'8~ bes8 c' a8 ] } es8 > fis4 | %%19 - < d'4-\downbow g4 'bes4 > < c'4-\upbow g4 c4 > < [ bes8 d > a ] | + < d'4-\downbow g4 'bes4 > < c'4-\upbow g4 c4 > < [ bes8 d8 > a8 ] | %%20 - < { [ c'8 ( bes a )bes g~ bes ] } { [ d ] } { [ g ] } > | + < { [ c'8 ( bes8 a8 )bes g~ bes8 ] } d8 g8 > | %%21 < \multi 2; - {\stem \up; d'4 (\stem \up; ) cis'4 d'4 } - { \stem \down; g2 f4 } + {\stemup d'4 (\stemup ) cis'4 d'4 } + { \stemdown g2 f4 } > | %%22 - < { [ g8 ~ f g e ] } { [ cis ] } > < f4 d4 > | + < { [ g8 ~ f8 g8 e8 ] } cis8 > < f4 d4 > | %%23 - [ 'g8 g ] < e4. 'a4. > d-\upbow | + [ 'g8 g8 ] < e4. 'a4. > d8-\upbow | %%24 < d2.^"fine" 'a2. 'd2._"3 mins."> \bar ":|"; -%% \tighten % use one line less - } \score{ \melodic{ - \id "Staff" "cello"; \IImenuetto + \IImenuetto } \paper{ linewidth= 150.0\mm; diff --git a/input/slurs.ly b/input/slurs.ly index 0113beffe2..4fe7e54186 100644 --- a/input/slurs.ly +++ b/input/slurs.ly @@ -11,7 +11,7 @@ EndMudelaHeader %} -\version "0.1.2"; +\version "0.1.5"; \score{ \melodic{\octave c'; @@ -29,8 +29,8 @@ EndMudelaHeader { e ~ f } > < \multi 2; - { \stem \up; c'8 ~g ~e( ~c~ [c'~ g' e' )c'] c'' ~ c'' c~c } - { \stem \down; c (e g )c'~( [b a g )d] r2 } + { \stemup c'8 ~g ~e( ~c~ [c'~ g' e' )c'] c'' ~ c'' c~c } + { \stemdown c (e g )c'~( [b a g )d] r2 } > } diff --git a/input/standchen-16.tex b/input/standchen-16.tex index b30bb00318..ae3ccc33ba 100644 --- a/input/standchen-16.tex +++ b/input/standchen-16.tex @@ -1,12 +1,12 @@ \documentclass{article} %UGH \usepackage{a4} -\oddsidemargin0mm +\oddsidemargin-1in\advance\oddsidemargin7.5mm \evensidemargin\oddsidemargin \hsize210mm\vsize297mm % so what does a4 do, anyway? -\textwidth160mm -\topmargin0mm%\advance\topmargin10mm -\textheight\vsize\advance\textheight-50mm -%\pagestyle{empty} +\textwidth\hsize\advance\textwidth-15mm +\topmargin-1in\advance\topmargin10mm +\textheight\vsize\advance\textheight-35mm +\pagestyle{empty} \begin{document} \input lilyponddefs \input titledefs diff --git a/input/standchen.ly b/input/standchen.ly index 53ad10aa95..ba5f3d8241 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -13,7 +13,7 @@ copyright public domain multiple \paper{}s in one \score %} -\version "0.1.2"; +\version "0.1.5"; commands = \melodic{ \skip 2.*4; @@ -154,8 +154,8 @@ melodie = \melodic{ < { fis2.~ %\group "+1"; - \stem \down; f2. } - { d'2. ~ \stem \up; + \stemdown f2. } + { d'2. ~ \stemup d'4 r4_"decresc." d'4 } > \textstyle "roman"; | @@ -202,71 +202,71 @@ begeleiding = \melodic{ ''a r4 | %%5 \duration 8; - < \multi 2; { \stem \up; + < \multi 2; { \stemup [ 'f 'a d 'a d 'a ] [ 'd 'e 'g 'e 'g 'e ] [ 'cis 'e 'g 'e 'g 'e ] [ 'd 'a d 'a d 'a ] } - { \stem \down; + { \stemdown 'd2 r4 ''bes2 r4 ''a2 r4 'd2 r4 } > %%9 - \stem 0; + \stemboth [ 'a e g e g e ] | %%10 [ 'd 'a d 'a d 'a ] | %%11 < \multi 2; - { \stem \up; + { \stemup [ 'f 'a d 'a d 'a ] [ 'd 'e 'g 'e 'g 'e ] [ 'e 'g 'bes 'g 'bes 'g ] [ 'a c f c f c ] - } { \stem \down; + } { \stemdown 'd2 r4 ''bes2 r4 'c2 r4 'f2 r4 } > %%15 - \stem 0; + \stemboth [ 'c 'g 'bes 'g 'bes 'g ] | %%16 [ ''f 'c 'f 'c 'f 'c ] | < \multi 2; - { \stem \up; + { \stemup [ ''a 'e 'g 'e 'g 'e ][ 'd 'a d 'a d 'a ] [ ''bes 'f 'bes 'f 'bes 'f ][ ''f 'c 'f 'c 'f 'c ] } - { \stem \down; + { \stemdown ''a2 r4 'd2 r4 ''bes2 r4 ''f2 r4 } > %%21 - \stem 0; + \stemboth < [ 'e 'c > 'g c 'g c 'g ] | %%22 [ 'f 'a c 'a 'f 'c ] | < \multi 2; { - \stem \up; + \stemup [ ''a 'e 'g 'e 'g 'e ] [ 'd 'fis 'a 'fis 'a 'fis ] [ ''g 'd 'b 'd 'b 'd ] [ 'd 'a d 'a d 'a ] } - {\stem \down; + {\stemdown ''a2 r4 'd2 r4 ''g2 r4 'd2 r4 } > - \stem 0; + \stemboth < [ 'cis ''a > 'e 'a 'e 'a 'e ] | %%28 [ 'd 'a d 'a d 'a ] | @@ -305,17 +305,17 @@ begeleiding = \melodic{ %%44 < [ 'd ''b > 'fis 'b 'fis 'b 'fis ] | %%45 - < \multi 2; { \stem \up; + < \multi 2; { \stemup [ ''g 'd 'b 'd 'b 'd ] [ 'd 'a d 'a d 'a ] } { - \stem \down; + \stemdown ''g2 r4 'd2 r4 } > %%47 - \stem 0; + \stemboth < [ 'cis ''a > 'e 'a 'e 'a 'e ] | %%48 [ 'd 'fis 'a 'fis 'a 'fis ] | @@ -474,11 +474,11 @@ tekstII = \lyric{ themusic = < - < \id "Lyric" "1"; + \type Lyrics < \tekstI \tekstII > - < \id "Piano" ""; + \type Grandstaff < \multi 2; \melodic < \melodie \commands > \melodic < \begeleiding \commands > @@ -488,6 +488,9 @@ themusic = \score{ \themusic + \midi{ + \tempo 4 = 54; + } \paper{ \paper_twenty % 20pt music uses whole pagewidth @@ -506,7 +509,4 @@ themusic = gourlay_maxmeasures = 9.; \output "standchen-16.out"; } - \midi{ - \tempo 4 = 54; - } } diff --git a/input/toccata-fuga-E.ly b/input/toccata-fuga-E.ly index 15aa64a7c0..1702aef9d0 100644 --- a/input/toccata-fuga-E.ly +++ b/input/toccata-fuga-E.ly @@ -21,7 +21,7 @@ copyright public domain %} -\version "0.1.2"; +\version "0.1.5"; toccata_commands = \melodic{ \meter 4/4; @@ -33,9 +33,9 @@ toccata_right = \melodic{ % 13 -- how to type -- where to split -- this more neatly ? \octave c'; <\multi 2; - { \stem \up; r4 dis'4 e'4.-. e'8( | \hshift 1; )e'4 [d'8 fis'8] \hshift 0; gis'4 [gis'8 fis'16 e'16] | fis'4~ [fis'8 e'16 dis'16] e'4 r8 e'8 } - { \stem \up; \hshift 1; r4 bis4 cis'4-. cis'4 | \hshift 0; a'4~ [a'16 gis'16 a'16 b'16] \hshift 1; dis'4 cis'4~ [cis'8 dis'16 a16] bis4 cis'4 r8 b8 } - { \stem \down; r4 < gis4 fis4 dis4 > gis4-. gis4 | a4. cis'8 gis2 | fis4 gis4 gis4 r8 e8 } + { \stemup r4 dis'4 e'4.-. e'8( | \property Voice.hshift = 1 )e'4 [d'8 fis'8] \property Voice.hshift = 0 gis'4 [gis'8 fis'16 e'16] | fis'4~ [fis'8 e'16 dis'16] e'4 r8 e'8 } + { \stemup \property Voice.hshift = 1 r4 bis4 cis'4-. cis'4 | \property Voice.hshift = 0 a'4~ [a'16 gis'16 a'16 b'16] \property Voice.hshift = 1 dis'4 cis'4~ [cis'8 dis'16 a16] bis4 cis'4 r8 b8 } + { \stemdown r4 < gis4 fis4 dis4 > gis4-. gis4 | a4. cis'8 gis2 | fis4 gis4 gis4 r8 e8 } > | % 16 } @@ -46,9 +46,9 @@ toccata_left = \melodic{ \clef bass; % 13 <\multi 2; - { \stem \up; bis2 cis'4-. cis'4~ [cis'8 a8 d'8 cis'8] [bis8 gis8] cis'4 | dis'2 cis'4 r8 cis'8 } - { \stem \up; \hshift 1; r4 gis4. gis8~ gis4 | \stem \down; \hshift 0; a4. fis8 gis4. a8~ a4 gis4-. gis4 r8 gis8 } - { \stem \down; r4 < dis4 fis4 > < cis4 e4 > } + { \stemup bis2 cis'4-. cis'4~ [cis'8 a8 d'8 cis'8] [bis8 gis8] cis'4 | dis'2 cis'4 r8 cis'8 } + { \stemup \property Voice.hshift = 1 r4 gis4. gis8~ gis4 | \stemdown \property Voice.hshift = 0 a4. fis8 gis4. a8~ a4 gis4-. gis4 r8 gis8 } + { \stemdown r4 < dis4 fis4 > < cis4 e4 > } > | % 16 } @@ -77,8 +77,8 @@ fuga2_right = \melodic{ % 15 \octave c'; <\multi 2; - { \stem \up; [b8 fis8] b4 } - { \stem \down; fis2 } + { \stemup [b8 fis8] b4 } + { \stemdown fis2 } > %{ this chord is usually set like this: | @@ -89,16 +89,16 @@ fuga2_right = \melodic{ | %} < \multi 2; - { \stem \up; \hshift 0; e'4 } - { \stem \up; \hshift 1; cis'4 } - { \stem \up; \hshift 2; ais4 } - { \stem \down; fis4 } + { \stemup \property Voice.hshift = 0 e'4 } + { \stemup \property Voice.hshift = 1 cis'4 } + { \stemup \property Voice.hshift = 2 ais4 } + { \stemdown fis4 } > | % 16 <\multi 2; - { \stem \up; dis'2 dis'4 | cis'2 cis'4 | b4~ [b8 cis'8 dis'8 e'8] } - { \stem \up; \hshift 1; [b8 fis8] b2~ [b8 a16 g16] a2 | a4 gis2 } - { \stem \down; fis2.~ fis2.~ fis4 e2 } + { \stemup dis'2 dis'4 | cis'2 cis'4 | b4~ [b8 cis'8 dis'8 e'8] } + { \stemup \property Voice.hshift = 1 [b8 fis8] b2~ [b8 a16 g16] a2 | a4 gis2 } + { \stemdown fis2.~ fis2.~ fis4 e2 } > | % 19 } @@ -110,8 +110,8 @@ fuga2_left = \melodic{ % 15 b2 <\multi 2; - { \stem \up; ais4 | bes2. } - { \stem \down; e4 | fis2 fis4 } + { \stemup ais4 | bes2. } + { \stemdown e4 | fis2 fis4 } > % 17 cis'2 e'4 | @@ -140,16 +140,12 @@ break = \melodic{ % these should be two separate scores... \score{ - \melodic < \multi 1; - - < \id Piano ""; \multi 3; - {\$toccata_right \break \$fuga2_right } - { \$toccata_left \break \$fuga2_left } + < \multi 1; + \type Grandstaff = "" < \multi 3; + {\toccata_right \break \fuga2_right } + { \toccata_left \break \fuga2_left } > - - { \$toccata_pedal \break \$fuga2_pedal } - - + { \toccata_pedal \break \fuga2_pedal } > \paper{} \midi{ diff --git a/input/twinkle-pop.ly b/input/twinkle-pop.ly index 0d2af26e6c..3f3fffccea 100644 --- a/input/twinkle-pop.ly +++ b/input/twinkle-pop.ly @@ -12,7 +12,7 @@ copyright public domain Tested Features lyrics and chords %} -\version "0.1.2"; +\version "0.1.5"; melodie = \melodic { \clef"violin"; @@ -27,8 +27,7 @@ melodie = \melodic { f4^"F" f | e^"C" e | d^"G7" d | c2^"C" | } -texte = \lyric{ - +text = \lyric{ \textstyle "italic"; Ah!4 vous dir- ai_- je ma man2 Ce4 qui cau- se mon tour- ment2 @@ -40,8 +39,8 @@ texte = \lyric{ } \score { - < \melodic < \id "Piano" ""; \melodie > - \lyric < \id "Lyric" ""; \texte > + < \melodic \type Staff \melodie + \lyric \type Lyrics \text > \paper { } } diff --git a/input/twinkle.ly b/input/twinkle.ly index 0a77e1fcb4..52625da9bc 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -14,7 +14,7 @@ copyright public domain Tested Features: lyrics %} -\version "0.1.2"; +\version "0.1.5"; melody = \melodic{ \clef violin; @@ -122,19 +122,19 @@ textiii = \lyric{ \score{ < \melodic < - \id "Piano" "";\multi 2; - < \global + \type Grandstaff + < \multi 2; \global \melody > < \global \accompany > > % ugh - \lyric < \id "Lyric" "1"; + \lyric \type Lyrics < \global \tekst > - \lyric < \id "Lyric" "2"; \global + \lyric \type Lyrics < \global \texte > - \lyric < \id "Lyric" "3"; \global + \lyric \type Lyrics < \global \texti \textii \textiii > > diff --git a/input/fugue1.ly b/input/wtk1-fugue1.ly similarity index 90% rename from input/fugue1.ly rename to input/wtk1-fugue1.ly index bc1ac70735..d1c21d8aeb 100644 --- a/input/fugue1.ly +++ b/input/wtk1-fugue1.ly @@ -11,7 +11,7 @@ copyright Public Domain %{ %} -\version "0.1.2"; +\version "0.1.5"; global = @@ -24,7 +24,7 @@ tenor = \clef "violin"; \octave c'; - \stem \down; + \stemdown 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] | @@ -40,20 +40,20 @@ tenor = [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] | + r8 [c8 d e] \stemup [f. g32 f] [e8 a] | %% 15 - [d g] ~ [g16 a g f] e8 \stem -1; [e fis g] ~ | + [d g] ~ [g16 a g f] e8 \stemdown [e fis g] ~ | [g8 fis] [gis8 a] ~ [a g! a b] | - \stem 0; + \stemboth [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] | + \stemdown a8 r8 r e [fis g] \stemboth[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] | + [g8 c' fis b] ~ [b16 c' b a] \stemdown [g fis e d] \stemboth| + e4 \stemdown 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] | + \stembothg4. f8 ~ [f e] d4 | + \stemdown 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] | @@ -64,7 +64,7 @@ tenor = soprane = \melodic { \octave c'; - \stem \up; + \stemup r1 | r2 r8 [g8 a b] | [c'. d'32 c'] [b8 e'] [a d'] ~ [d'16 e' d' c'] | @@ -105,7 +105,7 @@ alt = \clef "bass"; \octave c; - \stem 1; + \stemup r1 | r | r | @@ -145,7 +145,7 @@ bass = \clef "bass"; \octave c; - \stem -1; + \stemdown r1 | r | r | @@ -182,7 +182,7 @@ bass = \score { - \melodic < \id "Piano" ""; + \melodic \type Grandstaff < \multi 1; < \multi 2; \global diff --git a/input/wohltemperirt.ly b/input/wtk1-fugue2.ly similarity index 94% rename from input/wohltemperirt.ly rename to input/wtk1-fugue2.ly index 9159ed93bf..92ce1d3a12 100644 --- a/input/wohltemperirt.ly +++ b/input/wtk1-fugue2.ly @@ -12,7 +12,7 @@ copyright Public Domain Tested Features: stem direction, multivoice, forced accidentals. %} -\version "0.1.2"; +\version "0.1.5"; % should add \need{dutch.ini} for % correct parsing of note names @@ -28,7 +28,7 @@ dux = \clef "violin"; \octave c'; - \stem \down; + \stemdown r8 [c'16 b] [c'8 g] [as c'16 b] [c'8 d'] | [g c'16 b] [c'8 d'] [f16 g] as4 [g16 f] | [es c' b a] [g f! es d] [c8 es' d' c'] | @@ -43,10 +43,12 @@ dux = %% 10 as4 r8 a [bes bes16 a] [bes8 f] | g4 r8 g [as as g f] | + \translator Staff=bass \stemup \octave c; r8 [as bes c'] r8 [as16 g] [as8 f8] | [bes8 c' bes as] [bes g f es] | [f des' c' bes] [c' as g f] | %% 15 + \translator Staff=treble \stemdown g8 \octave c'; [g16 fis] [g8 c] [es g16 fis!] [g8 a] | [d g16 fis] [g8 a!] [c16 d] es4 [d16 c] | % forced accident! @@ -74,7 +76,7 @@ dux = comes = \melodic { \octave c''; - \stem \up; + \stemup r1 | r1 | r8 [g16 fis] [g8 c] [es g16 fis] [g8 a] | @@ -156,25 +158,24 @@ bassdux = [d c g G] %% 30 < \multi 2; - { \stem \up; c2~ | c1~ | c1 } - { \stem \down; C2~ | C1~ | C1 } + { \stemup c2~ | c1~ | c1 } + { \stemdown C2~ | C1~ | C1 } > } \score { - \melodic < \id "Piano" ""; - \multi 1; - < \multi 2; + \melodic \type Grandstaff < + \type Staff=treble < \multi 2; \global \dux \comes > - < \multi 2; + \type Staff=bass < \multi 2; \global \bassdux > - > + > \paper{ gourlay_maxmeasures =5.; diff --git a/input/prelude1.ly b/input/wtk1-prelude1.ly similarity index 92% rename from input/prelude1.ly rename to input/wtk1-prelude1.ly index a032b943fa..49ae054af7 100644 --- a/input/prelude1.ly +++ b/input/wtk1-prelude1.ly @@ -1,18 +1,14 @@ \header{ filename prelude1.ly -title Preludium +title Preludium description Das Wohltemperierte Clavier I, Prelude I (c-major) -opus BWV 846 -source +opus BWV 846 composer Johann Sebastian Bach (1685-1750) enteredby Shay Rojansky -copyright Public Domain" +copyright Public Domain } -\version "0.1.2"; - - % should add \need{dutch.ini} for - % correct parsing of note names +\version "0.1.5"; global = \melodic { @@ -29,7 +25,7 @@ soprane = <\multi 2; % Real soprane - {\stem 1; + {\stemup 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'] | @@ -40,7 +36,7 @@ soprane = 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; + {\stemdown r16 e8. ~ e4 r16 e8. ~ e4 | r16 d8. ~ d4 r16 d8. ~ d4 | r16 d8. ~ d4 r16 d8. ~ d4 | @@ -87,7 +83,7 @@ bass = \clef "bass"; \octave c; - \stem -1; + \stemdown c'2 c' | c' c' | b b | @@ -100,7 +96,7 @@ bass = %% 10 <\multi 2; % Alt - {\stem 1; + {\stemup r16 a8. ~ a4 r16 a8. ~ a4 | r16 b8. ~ b4 r16 b8. ~ b4 | r16 bes8. ~ bes4 r16 bes8. ~ bes4 | @@ -132,7 +128,7 @@ bass = c1 ||} % Bass - {\stem -1; + {\stemdown d2 d | g g | g g | @@ -166,7 +162,7 @@ bass = \score { - \melodic < \id "Piano" ""; + \melodic \type Grandstaff < \multi 1; < \multi 2; \global @@ -179,8 +175,7 @@ bass = > \paper{ - gourlay_maxmeasures =5.; - + gourlay_maxmeasures =5.; } \midi { \tempo 4 = 84; diff --git a/input/wtk1-prelude2.ly.m4 b/input/wtk1-prelude2.ly.m4 new file mode 100644 index 0000000000..98f6c8a309 --- /dev/null +++ b/input/wtk1-prelude2.ly.m4 @@ -0,0 +1,88 @@ +%% under construction + +define(preludepattern, `[' $1 $2 $3 $2 `]') +define(preludehalfmeasure, preludepattern($1, $2, $3) + preludepattern($4, $2, $3)) + +define(intromeasure, + preludehalfmeasure($1, $2, $3, $4) + preludehalfmeasure($1, $2, $3, $4)| +) +define(handymeasure, `intromeasure(translit($*,` ', `,'))') + + + +trebleIntro=\melodic { +\octave c'; +handymeasure(c' es d c) +handymeasure(as f e c) +handymeasure(b f es d) +handymeasure(c g f es) +handymeasure(es' as g es) +handymeasure(d' fis e d) +handymeasure(d' g fis d) +handymeasure(c' e d c) +handymeasure(c' f e c) +handymeasure(bes f es d) +handymeasure(bes g f es) +handymeasure(as g f es) +handymeasure(as d c Bes) +handymeasure(g Bes As es) +handymeasure(f c Bes A) +handymeasure(f d c B) +handymeasure(es c B G) +handymeasure(F es d f) +handymeasure(Fis c b es) +handymeasure(es c B G) +handymeasure(fis c B A) +handymeasure(g c B d) +handymeasure(as c B d) +} + +bassIntro = \melodic { +\octave c; +handymeasure(c g f es) +handymeasure(c as g f) +handymeasure(c as g f) +handymeasure(c es d g) +handymeasure(c c' bes as) +handymeasure(c a g fis) +handymeasure(Bes bes a g) +handymeasure(Bes g f e) +handymeasure(As as g f) +handymeasure(As d c f) +handymeasure(G es d g) +handymeasure(c es d As) +handymeasure(d f es as) +handymeasure(es g f as) +handymeasure(es a g f) +handymeasure(d f es as) +handymeasure(c f e as) +preludehalfmeasure(c, es, d, f) +preludehalfmeasure(bes, es, d, f)| +handymeasure(As c b d) +handymeasure(A es d c) +handymeasure(G es d f) +handymeasure(G es d c) +handymeasure(G es d f) +handymeasure(G es d f) +} + + +middlepiece = \melodic +{ + \octave c; + \stemdown + [G B d] + \stemup f [as f ef] [b f d' b'] [as f e f] | + \stemdown [G c es]] + \stemup g [c' g fis g ] [es' c' g' es'] [c' as g as]| + \stemdown [G A fis] + \translator Staff=treble + \stemsboth \octave c'; + c [es c B c] [fis c a fis] [es c B c] | +} + + + +} diff --git a/lib/duration-convert.cc b/lib/duration-convert.cc index 9969e76341..31ac07fa71 100644 --- a/lib/duration-convert.cc +++ b/lib/duration-convert.cc @@ -23,12 +23,14 @@ Duration_convert::dur2_str(Duration dur) { 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_)); + if (dur.durlog_i_ >= 0) + str = String( type2_i(dur.durlog_i_) ); + else if (dur.durlog_i_ == -1) + str = "\\breve"; + else if (dur.durlog_i_ == -2) + str = "\\longa"; str += String('.', dur.dots_i_); if (dur.plet_b()) str += String("*") + String(dur.plet_.iso_i_) diff --git a/lib/includable-lexer.cc b/lib/includable-lexer.cc index 4e15405164..05d9d9aa42 100644 --- a/lib/includable-lexer.cc +++ b/lib/includable-lexer.cc @@ -60,7 +60,8 @@ Includable_lexer::close_input() if (state_stack_.empty()) { return false; - }else + } + else { yy_switch_to_buffer(state_stack_.pop()); return true; diff --git a/lib/include/binary-source-file.hh b/lib/include/binary-source-file.hh index 63127ea9ad..9733c1b86b 100644 --- a/lib/include/binary-source-file.hh +++ b/lib/include/binary-source-file.hh @@ -10,11 +10,11 @@ class Binary_source_file : public Source_file { public: - Binary_source_file( String& filename_str ); + Binary_source_file(String& filename_str ); virtual ~Binary_source_file(); - virtual String error_str( char const* pos_ch_c_l ) const; - virtual int line_i( char const* pos_ch_c_l ) const; + virtual String error_str(char const* pos_ch_c_l ) const; + virtual int line_i(char const* pos_ch_c_l ) const; }; #endif // BINARY_SOURCE_FILE_HH // diff --git a/lib/include/duration-convert.hh b/lib/include/duration-convert.hh index d321c4598e..3f8bda96a4 100644 --- a/lib/include/duration-convert.hh +++ b/lib/include/duration-convert.hh @@ -45,10 +45,10 @@ struct Duration_convert { // static int const division_1_c_i = 384; // /// Return (integer, division) representation. -// static int dur2_i( Duration dur, int division_1_i = division_1_c_i ); +// static int dur2_i(Duration dur, int division_1_i = division_1_c_i ); /// Return number of ticks in (ticks, division_1) representation - static int dur2ticks_i( Duration dur ); + static int dur2ticks_i(Duration dur ); /// Return the type_i representation of note length i static int i2_type(int i); @@ -58,38 +58,38 @@ struct Duration_convert { static int type2_i(int type); /// Return Moment representation (fraction of whole note). - static Moment dur2_mom( Duration dur ); + static Moment dur2_mom(Duration dur ); /// Return Mudela string representation. - static String dur2_str( Duration dur ); + static String dur2_str(Duration dur ); // /// Return Moment from (integer, division) representation. -// static Moment i2_mom( int i, int division_1_i = division_1_c_i ); +// static Moment i2_mom(int i, int division_1_i = division_1_c_i ); // /// Return Moment (fraction of whole) representation, best guess. -// static Duration mom2_dur( Moment mom ); +// static Duration mom2_dur(Moment mom ); /// Return duration from Moment (fraction of whole) representation. - static Duration mom2_dur( Moment mom ); + static Duration mom2_dur(Moment mom ); /// Return standardised duration, best guess if not exact. - static Duration mom2standardised_dur( Moment mom ); + static Duration mom2standardised_dur(Moment mom ); /// Return plet factor (not a Moment: should use Rational?). - static Moment plet_factor_mom( Duration dur ); + static Moment plet_factor_mom(Duration dur ); static void set_array(); /** Return synchronisation factor for mom, so that - mom2_dur( mom / sync_f ) will return the duration dur. + mom2_dur(mom / sync_f ) will return the duration dur. */ - static Real sync_f( Duration dur, Moment mom ); + static Real sync_f(Duration dur, Moment mom ); /// Return exact duration, in midi-ticks if not-exact. - static Duration ticks2_dur( int ticks_i ); + static Duration ticks2_dur(int ticks_i ); /// Return standardised duration, best guess if not exact. - static Duration ticks2standardised_dur( int ticks_i ); + static Duration ticks2standardised_dur(int ticks_i ); }; /// (iter_dur) diff --git a/lib/include/duration.hh b/lib/include/duration.hh index 293c9681fd..49d5819bd9 100644 --- a/lib/include/duration.hh +++ b/lib/include/duration.hh @@ -35,7 +35,7 @@ struct Duration { void set_plet(int,int ); void set_plet(Duration ); static bool duration_type_b(int t); - void set_ticks( int ticks_i ); + void set_ticks(int ticks_i ); Moment length() const ; // zo naai mij static int division_1_i_s; diff --git a/lib/include/input.hh b/lib/include/input.hh index 2fdb97615a..579f829c14 100644 --- a/lib/include/input.hh +++ b/lib/include/input.hh @@ -28,7 +28,7 @@ public: String location_str() const; Input(Source_file*, char const*); Input(); - Input( Input const& ); + Input(Input const& ); }; #endif // INPUT_HH diff --git a/lib/include/source-file.hh b/lib/include/source-file.hh index 5991a2e804..9b084a3280 100644 --- a/lib/include/source-file.hh +++ b/lib/include/source-file.hh @@ -18,17 +18,17 @@ class Source_file public: /** Ugh! filename gets changed! The path to the opened file may change, since it might be searched in multiple directories. */ - Source_file( String filename_str_r ); + 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; + virtual String error_str(char const* pos_ch_c_l ) const; istream * istream_l(); - bool in_b( char const* pos_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; + 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; + String file_line_no_str(char const* ch_c_l ) const; private: String name_str_; diff --git a/lib/include/source.hh b/lib/include/source.hh index fc0ca2728d..357647b9a1 100644 --- a/lib/include/source.hh +++ b/lib/include/source.hh @@ -14,14 +14,14 @@ class Sources public: Sources(); - Source_file * get_file_l( String &filename ); - Source_file* sourcefile_l( char const* ch_C ); + Source_file * get_file_l(String &filename ); + Source_file* sourcefile_l(char const* ch_C ); void set_path(File_path*p_C); void set_binary(bool); private: const File_path * path_C_; - void add( Source_file* sourcefile_p ); + void add(Source_file* sourcefile_p ); Pointer_list<Source_file*> sourcefile_p_list_; bool binary_b_ ; }; diff --git a/lib/include/warn.hh b/lib/include/warn.hh index 6d64cc0d07..61ab2e6972 100644 --- a/lib/include/warn.hh +++ b/lib/include/warn.hh @@ -12,6 +12,6 @@ #include "string.hh" -void warning( String message_str ); -void error( String message_str); +void warning(String message_str ); +void error(String message_str); #endif // WARN_HH diff --git a/lib/simple-file-storage.cc b/lib/simple-file-storage.cc index ed1784ba63..b618e11634 100644 --- a/lib/simple-file-storage.cc +++ b/lib/simple-file-storage.cc @@ -29,14 +29,16 @@ Simple_file_storage::Simple_file_storage(String s) { 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"); + FILE * f = (s) ? fopen (s.ch_C(), "rb") : stdin; + if (!f) { - warning("can't open file\n"); + warning("can't open file `" + s + "'"); return ; } @@ -48,10 +50,12 @@ Simple_file_storage::Simple_file_storage(String s) ret = fread(data_p_, sizeof(char), len_i_, f); -#if 1 // ugh, \r\n -> \n translation - assert (ret==len_i_); -#endif - fclose(f); + if (ret!=len_i_) + warning ("Huh? got " + String(ret) + ", expected " + + String(len_i_) + " characters"); + + if (f != stdin) + fclose(f); } char const* diff --git a/lib/source-file.cc b/lib/source-file.cc index 7d912edd63..dc6c092519 100644 --- a/lib/source-file.cc +++ b/lib/source-file.cc @@ -1,5 +1,5 @@ /* - source-file.cc -- implement + source-file.cc -- implement Source_file source file of the GNU LilyPond music typesetter @@ -21,28 +21,30 @@ Source_file::Source_file(String filename_str) { - name_str_ = filename_str; - istream_p_ = 0; - storage_p_ = new Simple_file_storage(filename_str); + name_str_ = filename_str; + istream_p_ = 0; + storage_p_ = new Simple_file_storage(filename_str); } istream* Source_file::istream_l() { + /* if (!name_str_.length_i()) - return &cin; - - if (!istream_p_) - { - 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_->set(ios::eofbit); - } - } - return istream_p_; + return &cin; + */ + + if (!istream_p_) + { + 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_->set(ios::eofbit); + } + } + return istream_p_; } String @@ -52,99 +54,99 @@ Source_file::file_line_no_str(char const *context_ch_C) const return "(unknown)"; else return name_str() + ": " - + String(line_i(context_ch_C)); + + String(line_i(context_ch_C)); } String Source_file::name_str() const { - return name_str_; + return name_str_; } Source_file::~Source_file() { - delete istream_p_; - istream_p_ = 0; - delete storage_p_; + delete istream_p_; + istream_p_ = 0; + delete storage_p_; } String 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)) - return "(position unknown)"; + char const* data_ch_C = ch_C(); + char const * eof_C_ = data_ch_C + length_i(); + if (!in_b(pos_ch_C)) + return "(position unknown)"; - 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') - { - begin_ch_C++; - break; - } - - char const* end_ch_C = pos_ch_C; - while (end_ch_C < eof_C_) - if (*end_ch_C++ == '\n') - { - end_ch_C--; - break; - } + 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') + { + begin_ch_C++; + break; + } + + char const* end_ch_C = pos_ch_C; + 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); - - 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; - 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.. - return str; + // 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; + 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.. + return str; } bool 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 { - if (!in_b(pos_ch_C)) - return 0; + if (!in_b(pos_ch_C)) + return 0; - int i = 1; - char const* scan_ch_C = ch_C(); - if (!scan_ch_C) - return 0; + int i = 1; + char const* scan_ch_C = ch_C(); + if (!scan_ch_C) + return 0; - while (scan_ch_C < pos_ch_C) - if (*scan_ch_C++ == '\n') - i++; - return i; + while (scan_ch_C < pos_ch_C) + if (*scan_ch_C++ == '\n') + i++; + return i; } int Source_file::length_i() const { - return storage_p_->length_i(); + return storage_p_->length_i(); } char const * Source_file::ch_C() const { - return storage_p_->ch_C(); + return storage_p_->ch_C(); } diff --git a/lily/VERSION b/lily/VERSION index 4d5a2603a5..deb594da78 100644 --- a/lily/VERSION +++ b/lily/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 1 -PATCH_LEVEL = 12 +PATCH_LEVEL = 13 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf diff --git a/lily/abbreviation-beam-engraver.cc b/lily/abbreviation-beam-engraver.cc index 76d4e7e3ef..89952d24fa 100644 --- a/lily/abbreviation-beam-engraver.cc +++ b/lily/abbreviation-beam-engraver.cc @@ -15,8 +15,8 @@ #include "musical-request.hh" #include "misc.hh" -IMPLEMENT_IS_TYPE_B1 (Abbreviation_beam_engraver, Engraver); -ADD_THIS_ENGRAVER (Abbreviation_beam_engraver); +IMPLEMENT_IS_TYPE_B1(Abbreviation_beam_engraver, Engraver); +ADD_THIS_TRANSLATOR(Abbreviation_beam_engraver); Abbreviation_beam_engraver::Abbreviation_beam_engraver () { @@ -87,8 +87,7 @@ Abbreviation_beam_engraver::acknowledge_element (Score_elem_info i) return; Stem* s = (Stem*)i.elem_l_->item (); -// Rhythmic_req *rhythmic_req = i.req_l_->musical ()->rhythmic (); -// s->flag_i_ = Duration_convert::type2_i (rhythmic_req->duration_.durlog_i_); + int type_i = span_reqs_drul_[LEFT]->type_i_; s->flag_i_ = intlog2 (type_i) - 2; if (span_reqs_drul_[RIGHT]) diff --git a/lily/atom.cc b/lily/atom.cc index fbb6e973f8..00660aac55 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -38,15 +38,25 @@ Atom::Atom (Symbol s) String Atom::TeX_string() const { + String tex_str = sym_.tex; + Offset off = off_; + /* infinity checks. */ - assert (abs (off_.x()) < 100 CM); - assert (abs (off_.y()) < 100 CM); - + for (int a =X_AXIS; a < NO_AXES; a++) + { + Axis ax = (Axis)a; + if (abs (off[ax]) >= 100 CM) + { + warning ("ridiculous dimension " + axis_name_str (ax) + ", " + +print_dimen(off[ax])); + off[ax] = 0.0; + tex_str += "\errormark"; + } + } // whugh.. Hard coded... - String s ("\\placebox{%}{%}{%}"); - Array<String> a; - a.push (print_dimen (off_.y())); - a.push (print_dimen (off_.x())); - a.push (sym_.tex); - return substitute_args (s, a); + String s ("\\placebox{"); + s += print_dimen (off[Y_AXIS])+"}{"; + s += print_dimen (off[X_AXIS]) + "}{"; + s += tex_str + "}"; + return s; } diff --git a/lily/audio-column.cc b/lily/audio-column.cc index 1df586be62..e0dbd2efff 100644 --- a/lily/audio-column.cc +++ b/lily/audio-column.cc @@ -8,14 +8,14 @@ #include "audio-column.hh" #include "audio-item.hh" -#include "audio-score.hh" +#include "performance.hh" #include "debug.hh" Audio_column::Audio_column (Moment at_mom) { at_mom_ = at_mom; - audio_score_l_ = 0; + performance_l_ = 0; } void @@ -36,8 +36,10 @@ Audio_column::print() const { #ifndef NPRINT DOUT << "Audio_column {"; - DOUT << "at: " << at_mom_ << "\n"; - DOUT << "}\n"; + DOUT << "at: " << at_mom_ << ". Contains:"; + for (PCursor<Audio_item*> i (audio_item_l_list_.top ()); i.ok (); i++) + DOUT << i->name () << ", "; + DOUT << "\n}\n"; #endif } diff --git a/lily/audio-element.cc b/lily/audio-element.cc index 6ab6c02d58..77aaeb44f5 100644 --- a/lily/audio-element.cc +++ b/lily/audio-element.cc @@ -7,7 +7,25 @@ */ #include "audio-element.hh" - +#include "debug.hh" + IMPLEMENT_IS_TYPE_B(Audio_element); + Audio_element::~Audio_element() -{} +{ +} + +void +Audio_element::print () const +{ +#ifndef NPRINT + DOUT << name () << "{ "; + do_print (); + DOUT << "}"; +#endif +} + +void +Audio_element::do_print ()const +{ +} diff --git a/lily/audio-item.cc b/lily/audio-item.cc index 55367026fa..60a6badc8d 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -5,12 +5,14 @@ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com> */ - +#include "debug.hh" #include "audio-item.hh" #include "midi-item.hh" +#include "request.hh" +#include "audio-column.hh" Audio_instrument::Audio_instrument (String instrument_str) - : Audio_item (0) + : Audio_item (0) { str_ = instrument_str; } @@ -20,7 +22,8 @@ Audio_instrument::midi_item_p() { return str_.length_i() ? new Midi_instrument(0, str_) : 0; } - +IMPLEMENT_IS_TYPE_B1(Audio_instrument, Audio_item); + Audio_item::Audio_item (Request* req_l) { audio_column_l_ = 0; @@ -28,7 +31,7 @@ Audio_item::Audio_item (Request* req_l) } Audio_key::Audio_key (Request* req_l) - : Audio_item (req_l) + : Audio_item (req_l) { } @@ -37,10 +40,10 @@ Audio_key::midi_item_p() { return new Midi_key (this); } - +IMPLEMENT_IS_TYPE_B1 (Audio_key, Audio_item); Audio_note::Audio_note (Request* req_l) - : Audio_item (req_l) + : Audio_item (req_l) { } @@ -50,8 +53,10 @@ Audio_note::midi_item_p() return new Midi_note (this); } +IMPLEMENT_IS_TYPE_B1(Audio_note, Audio_item); + Audio_tempo::Audio_tempo (int per_minute_4_i) - : Audio_item (0) + : Audio_item (0) { per_minute_4_i_ = per_minute_4_i; } @@ -62,8 +67,10 @@ Audio_tempo::midi_item_p() return new Midi_tempo (this); } +IMPLEMENT_IS_TYPE_B1(Audio_tempo, Audio_item); + Audio_meter::Audio_meter (Request* req_l) - : Audio_item (req_l) + : Audio_item (req_l) { } @@ -72,12 +79,13 @@ Audio_meter::midi_item_p() { return new Midi_meter (this); } +IMPLEMENT_IS_TYPE_B1(Audio_meter, Audio_item); Audio_text::Audio_text (Audio_text::Type type, String text_str) - : Audio_item (0) + : Audio_item (0) { - text_str_ = text_str; - type_ = type; + text_str_ = text_str; + type_ = type; } Midi_item* @@ -86,5 +94,23 @@ Audio_text::midi_item_p() return text_str_.length_i() ? new Midi_text(this) : 0; } +IMPLEMENT_IS_TYPE_B1(Audio_text, Audio_item); IMPLEMENT_IS_TYPE_B1(Audio_item, Audio_element); + +void +Audio_item::do_print () const +{ +#ifndef NPRINT + if (audio_column_l_) + { + DOUT << "at: "<< audio_column_l_->at_mom (); + } + if (req_l_) + { + DOUT << "from: "; + req_l_->print (); + } +#endif +} + diff --git a/lily/axis-group.cc b/lily/axis-group.cc index 74edd84529..b0161fa2a4 100644 --- a/lily/axis-group.cc +++ b/lily/axis-group.cc @@ -6,7 +6,7 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ #include "interval.hh" -#include "axis-group.hh" +#include "axis-group-administration.hh" #include "score-elem.hh" #include "debug.hh" @@ -35,9 +35,13 @@ void Axis_group_administration::add_element (Score_elem*e, 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; + Axis_group_element *& g1=e->axis_group_l_a_[a1]; + Axis_group_element *& g2 = e->axis_group_l_a_[a2]; + + assert (!g1 || g1 == g); + assert (!g2 || g2 == g); + g1 = g; + g2 = g; elem_l_arr_.push (e); } diff --git a/lily/bar-column-grav.cc b/lily/bar-column-grav.cc index ac3e868a52..e86a8cee62 100644 --- a/lily/bar-column-grav.cc +++ b/lily/bar-column-grav.cc @@ -73,4 +73,4 @@ Bar_column_engraver::do_post_move_processing() } IMPLEMENT_IS_TYPE_B1(Bar_column_engraver, Engraver); -ADD_THIS_ENGRAVER(Bar_column_engraver); +ADD_THIS_TRANSLATOR(Bar_column_engraver); diff --git a/lily/bar-column.cc b/lily/bar-column.cc index c9a0025208..05710d8706 100644 --- a/lily/bar-column.cc +++ b/lily/bar-column.cc @@ -28,7 +28,7 @@ Bar_column::do_substitute_dependency (Score_elem*o,Score_elem*n) Script_column::do_substitute_dependency (o,n); if (o == bar_l_) { - bar_l_ = n ? (Bar*)n->item() : 0; + bar_l_ = n ? (Bar*)n->item() : 0; } } diff --git a/lily/bar-grav.cc b/lily/bar-grav.cc index c11a7debee..0e34557667 100644 --- a/lily/bar-grav.cc +++ b/lily/bar-grav.cc @@ -35,6 +35,9 @@ Bar_engraver::do_try_request (Request*r_l) void Bar_engraver::do_process_requests() { + if (bar_p_) + return ; + if (bar_req_l_) { bar_p_ = new Bar; @@ -54,7 +57,7 @@ Bar_engraver::do_process_requests() else { Disallow_break_req r; - daddy_grav_l_->try_request (&r); + daddy_grav_l()->try_request (&r); } } @@ -78,6 +81,6 @@ Bar_engraver::do_post_move_processing() IMPLEMENT_IS_TYPE_B1(Bar_engraver,Engraver); -ADD_THIS_ENGRAVER(Bar_engraver); +ADD_THIS_TRANSLATOR(Bar_engraver); diff --git a/lily/bar-number-grav.cc b/lily/bar-number-grav.cc index 1414f7b7de..03e5fece81 100644 --- a/lily/bar-number-grav.cc +++ b/lily/bar-number-grav.cc @@ -1,5 +1,5 @@ /* - bar-number-grav.cc -- implement Bar_number_grav + bar-number-grav.cc -- implement Bar_number_engraver source file of the GNU LilyPond music typesetter @@ -14,7 +14,7 @@ #include "bar.hh" #include "time-description.hh" -Bar_number_grav::Bar_number_grav() +Bar_number_engraver::Bar_number_engraver() { script_p_ =0; } @@ -22,7 +22,7 @@ Bar_number_grav::Bar_number_grav() static Command_script_req dummy; void -Bar_number_grav::acknowledge_element (Score_elem_info i) +Bar_number_engraver::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_) @@ -44,7 +44,7 @@ Bar_number_grav::acknowledge_element (Score_elem_info i) } void -Bar_number_grav::do_pre_move_processing() +Bar_number_engraver::do_pre_move_processing() { if (script_p_) { @@ -53,5 +53,5 @@ Bar_number_grav::do_pre_move_processing() } } -IMPLEMENT_IS_TYPE_B1(Bar_number_grav,Engraver); -ADD_THIS_ENGRAVER(Bar_number_grav); +IMPLEMENT_IS_TYPE_B1(Bar_number_engraver,Engraver); +ADD_THIS_TRANSLATOR(Bar_number_engraver); diff --git a/lily/bar.cc b/lily/bar.cc index cbf8438869..7ba3f2d77b 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -65,7 +65,7 @@ Bar::do_pre_processing() /* span_score_bar needs dims, so don't do - transparent_b_ = empty_b_ = (type_str_ == ""); + transparent_b_ = empty_b_ = (!type_str_); */ } diff --git a/lily/beam-grav.cc b/lily/beam-grav.cc index d3fa191a6c..bfaf3e12ac 100644 --- a/lily/beam-grav.cc +++ b/lily/beam-grav.cc @@ -125,4 +125,4 @@ Beam_engraver::acknowledge_element (Score_elem_info i) } IMPLEMENT_IS_TYPE_B1(Beam_engraver, Engraver); -ADD_THIS_ENGRAVER(Beam_engraver); +ADD_THIS_TRANSLATOR(Beam_engraver); diff --git a/lily/beam.cc b/lily/beam.cc index b2b2bc4f4f..02dde804a0 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -47,7 +47,8 @@ Beam::add (Stem*s) if (!spanned_drul_[LEFT]) set_bounds(LEFT,s); - set_bounds(RIGHT,s); + else + set_bounds(RIGHT,s); } Molecule* diff --git a/lily/chord-iterator.cc b/lily/chord-iterator.cc index 2bca2b16ed..80db90709c 100644 --- a/lily/chord-iterator.cc +++ b/lily/chord-iterator.cc @@ -6,7 +6,7 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "translator.hh" +#include "translator-group.hh" #include "debug.hh" #include "chord-iterator.hh" diff --git a/lily/clef-grav.cc b/lily/clef-grav.cc index a9bea179f0..ad4814202c 100644 --- a/lily/clef-grav.cc +++ b/lily/clef-grav.cc @@ -18,8 +18,8 @@ Clef_engraver::Clef_engraver() { clef_p_ = 0; clef_req_l_ =0; - - set_type ("violin"); + clef_type_str_ = 0; + c0_position_i_ =0; } bool @@ -28,22 +28,22 @@ Clef_engraver::set_type (String s) clef_type_str_ = s; if (clef_type_str_ == "violin") { - c0_position_i_= -2; + c0_position_i_= -2; } else if (clef_type_str_ == "alto") { - c0_position_i_= 4; + c0_position_i_= 4; } else if (clef_type_str_ == "tenor") { - c0_position_i_= 6; + c0_position_i_= 6; } else if (clef_type_str_ == "bass") { - c0_position_i_= 10; + c0_position_i_= 10; } else - return false; + return false; return true; } @@ -58,23 +58,28 @@ void Clef_engraver::read_req (Clef_change_req*c_l) { if (!set_type (c_l->clef_str_)) - c_l->error ("unknown clef type "); + c_l->error ("unknown clef type "); } void Clef_engraver::acknowledge_element (Score_elem_info info) { if (info.elem_l_->name() == Bar::static_name ()) { - create_clef(); - if (!clef_req_l_) - clef_p_->default_b_ = true; + create_clef(); + if (!clef_req_l_) + clef_p_->default_b_ = true; } } void Clef_engraver::do_creation_processing() { - create_clef(); + Scalar def = get_property ("defaultclef"); + if (def) + set_type (def); + else + set_type ("violin"); + create_clef(); clef_p_->default_b_ = false; } @@ -83,7 +88,7 @@ Clef_engraver::do_try_request (Request * r_l) { Command_req* creq_l= r_l->command(); if (!creq_l || !creq_l->clefchange()) - return false; + return false; clef_req_l_ = creq_l->clefchange(); @@ -96,7 +101,7 @@ Clef_engraver::create_clef() { if (!clef_p_) { - clef_p_ = new Clef_item; + clef_p_ = new Clef_item; announce_element (Score_elem_info (clef_p_,clef_req_l_)); } clef_p_->read (*this); @@ -107,8 +112,8 @@ Clef_engraver::do_process_requests() { if (clef_req_l_) { - create_clef(); - clef_p_->default_b_ = false; + create_clef(); + clef_p_->default_b_ = false; } } @@ -116,7 +121,7 @@ void Clef_engraver::do_pre_move_processing() { if (!clef_p_) - return; + return; typeset_element (clef_p_); clef_p_ = 0; } @@ -136,4 +141,4 @@ Clef_engraver::do_removal_processing() IMPLEMENT_IS_TYPE_B1(Clef_engraver,Engraver); -ADD_THIS_ENGRAVER(Clef_engraver); +ADD_THIS_TRANSLATOR(Clef_engraver); diff --git a/lily/collision-grav.cc b/lily/collision-grav.cc index e25f249493..f1b7112390 100644 --- a/lily/collision-grav.cc +++ b/lily/collision-grav.cc @@ -13,24 +13,26 @@ void Collision_engraver::acknowledge_element (Score_elem_info i) { - if (!(i.elem_l_->name() == Note_column::static_name ())) - return; - - if (!col_p_) + if (i.elem_l_->is_type_b (Note_column::static_name ())) { - col_p_ = new Collision; - announce_element (Score_elem_info (col_p_,0)); + Note_column * c = (Note_column*) i.elem_l_->item (); + if (c->rest_b ()) + return ; + if (!col_p_) + { + col_p_ = new Collision; + announce_element (Score_elem_info (col_p_,0)); + } + col_p_->add (c); } - col_p_->add ((Note_column*)i.elem_l_->item()); } - void Collision_engraver::do_pre_move_processing() { if (col_p_) { - typeset_element (col_p_); - col_p_ =0; + typeset_element (col_p_); + col_p_ =0; } } Collision_engraver::Collision_engraver() @@ -40,4 +42,4 @@ Collision_engraver::Collision_engraver() IMPLEMENT_IS_TYPE_B1(Collision_engraver,Engraver); -ADD_THIS_ENGRAVER(Collision_engraver); +ADD_THIS_TRANSLATOR(Collision_engraver); diff --git a/lily/collision.cc b/lily/collision.cc index 881c561e95..9d9cf84e58 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -51,40 +51,41 @@ Collision::do_pre_processing() /* [stem up, stem up shifted, stem down shifted, stem down] - */ + */ Array<Note_column*> clash_group_arr_a[4]; for (int i=0; i < clash_l_arr_.size(); i++) { - Note_column* c_l = clash_l_arr_[i]; - if (! c_l->dir_) - { - warning ("No stem direction set. Ignoring column in clash. "); - continue; - } - int d = (c_l->dir_); + Note_column* c_l = clash_l_arr_[i]; + if (! c_l->dir_) + { + warning ("No stem direction set. Ignoring column in clash. "); + continue; + } + int d = (c_l->dir_); - clash_group_arr_a[idx (d, c_l->h_shift_b_)].push (c_l); + clash_group_arr_a[idx (d, c_l->h_shift_b_)].push (c_l); } for (int j=0; j < 4; j++) { - if (clash_group_arr_a[j].size() > 1) - { - warning ("Too many clashing notecolumns. Ignoring them."); - return; - } + if (clash_group_arr_a[j].size() > 1) + { + warning ("Too many clashing notecolumns. Ignoring them."); + return; + } } int d = 1; do { - if (!clash_group_arr_a[idx (d, false)].size()) - { - clash_group_arr_a[idx (d, false)] = clash_group_arr_a[idx (d, true)]; - clash_group_arr_a[idx (d, true)].clear(); - } - } while ((d *= -1) != 1); + if (!clash_group_arr_a[idx (d, false)].size()) + { + clash_group_arr_a[idx (d, false)] = clash_group_arr_a[idx (d, true)]; + clash_group_arr_a[idx (d, true)].clear(); + } + } + while ((d *= -1) != 1); Interval_t<int> y_extent[4]; @@ -94,66 +95,67 @@ Collision::do_pre_processing() for (int j =0 ; j < 4; j++) { - if (clash_group_arr_a[j].size()) - col_l_a[j] = clash_group_arr_a[j][0]; - else - col_l_a[j] = 0; + if (clash_group_arr_a[j].size()) + col_l_a[j] = clash_group_arr_a[j][0]; + else + col_l_a[j] = 0; - if (col_l_a[j]) - { - y_extent[j] = col_l_a[j]->head_positions_interval(); - } + if (col_l_a[j]) + { + y_extent[j] = col_l_a[j]->head_positions_interval(); + } - x_off [j] = 0.0; - y_off[j] = 0; + x_off [j] = 0.0; + y_off[j] = 0; } do { - x_off[idx (d, true)] = d*0.5; - } while ((d *= -1) != 1); + x_off[idx (d, true)] = d*0.5; + } + while ((d *= -1) != 1); // y_extent: smallest y-pos noteball interval containing all balls // 4 (0..3) groups: stem up/down; shift on/off; Interval_t<int> middle (y_extent[idx (-1,0)].max(), - y_extent[idx (1,0)].min()); + y_extent[idx (1,0)].min()); Interval_t<int> open_middle (y_extent[idx (-1,0)].max()+1, y_extent[idx (1,0)].min ()-1); do { - if (!open_middle.contains_b (y_extent[idx (d,true)])) - x_off[idx (d, true)] = d *1.0 ; - } while ((d *= -1) != 1); + if (!open_middle.contains_b (y_extent[idx (d,true)])) + x_off[idx (d, true)] = d *1.0 ; + } while ((d *= -1) != 1); if (!middle.empty_b() - && middle.length() < 2 && col_l_a[idx (1,0)] && col_l_a[idx (-1,0)]) { -// reproduction of bugfix at 3am ? - Note_head * nu_l= col_l_a[idx (1,0)]->head_l_arr_[0]; - Note_head * nd_l = col_l_a[idx (-1,0)]->head_l_arr_.top(); - if (! (nu_l->balltype_i_ == nd_l->balltype_i_ - && nu_l->dots_i_ == nd_l->dots_i_ && middle.length() == 0)) - { - x_off[idx (1,0)] -= 0.5; - x_off[idx (1,1)] -= 0.5; - x_off[idx (-1,1)] += 0.5; - x_off[idx (-1,0)] += 0.5; - } + && middle.length() < 2 && col_l_a[idx (1,0)] && col_l_a[idx (-1,0)]) { + // reproduction of bugfix at 3am ? + Note_head * nu_l= col_l_a[idx (1,0)]->head_l_arr_[0]; + Note_head * nd_l = col_l_a[idx (-1,0)]->head_l_arr_.top(); + if (! (nu_l->balltype_i_ == nd_l->balltype_i_ + && nu_l->dots_i_ == nd_l->dots_i_ && middle.length() == 0)) + { + x_off[idx (1,0)] -= 0.5; + x_off[idx (1,1)] -= 0.5; + x_off[idx (-1,1)] += 0.5; + x_off[idx (-1,0)] += 0.5; + } - } + } Real inter_f = paper()->internote_f (); Real wid_f = paper()->note_width (); for (int j=0; j < 4; j++) { - if (col_l_a[j]) - { - /* collision.cc:138: request for method `translate' is ambiguous + if (col_l_a[j]) + { + /* collision.cc:138: request for method `translate' is ambiguous - (shaddup) + (shaddup) */ - Offset o (x_off[j] * wid_f, y_off[j] * inter_f); - ((Score_elem*)col_l_a[j])->translate (o); - } + Offset o (x_off[j] * wid_f, y_off[j] * inter_f); + ((Score_elem*)col_l_a[j])->translate (o); + } } } @@ -164,5 +166,5 @@ void Collision::do_substitute_dependency (Score_elem*o_l,Score_elem*n_l) { clash_l_arr_.substitute ((Note_column*)o_l->item(), - (Note_column*)(n_l?n_l->item():0)); + (Note_column*)(n_l?n_l->item():0)); } diff --git a/lily/command-request.cc b/lily/command-request.cc index 69e7f4b7db..0a655351fb 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -123,17 +123,6 @@ Clef_change_req::Clef_change_req (String s) { clef_str_ = s; } -/* *************** */ - -IMPLEMENT_IS_TYPE_B1(Group_feature_req,Command_req); - -void -Group_feature_req::do_print() const -{ -#ifndef NPRINT - DOUT << type_str_ << "=" << value_str_; -#endif -} /* *************** */ diff --git a/lily/dot-column-grav.cc b/lily/dot-column-grav.cc new file mode 100644 index 0000000000..4383eb876d --- /dev/null +++ b/lily/dot-column-grav.cc @@ -0,0 +1,8 @@ +/* + dot-column-grav.cc -- implement + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + diff --git a/lily/dot-column.cc b/lily/dot-column.cc new file mode 100644 index 0000000000..6da5e0bbce --- /dev/null +++ b/lily/dot-column.cc @@ -0,0 +1,55 @@ +/* + dot-column.cc -- implement Dot_column + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "dots.hh" +#include "dot-column.hh" +#include "rhythmic-head.hh" + +void +Dot_column::add (Dots *d) +{ + dot_l_arr_.push (d); + add_dependency (d); + add_element (d); +} + +void +Dot_column::add (Rhythmic_head *r) +{ + if (!r->dots_l_) + return ; + + head_l_arr_.push (r); + add_dependency (r); + add (r->dots_l_); +} + +void +Dot_column::do_substitute_dependency (Score_elem*o,Score_elem*n) +{ + Item *oi =o->item (); + Item *ni = n?n->item ():0; + + if (oi&&oi->is_type_b (Rhythmic_head::static_name ())) + head_l_arr_.substitute ((Rhythmic_head*)oi, (Rhythmic_head*)ni); + else if (oi && oi->is_type_b (Dots::static_name ())) + dot_l_arr_.substitute ((Dots*) oi, (Dots*) ni); +} + +void +Dot_column::do_pre_processing () +{ + Interval w; + for (int i=0; i < head_l_arr_.size (); i++) + w.unite (head_l_arr_[i]->width ()); + + if (!w.empty_b ()) + translate (w[RIGHT] - width() [LEFT],X_AXIS); +} + +IMPLEMENT_IS_TYPE_B1(Dot_column, Horizontal_group_item); diff --git a/lily/dots.cc b/lily/dots.cc new file mode 100644 index 0000000000..0525aa1dda --- /dev/null +++ b/lily/dots.cc @@ -0,0 +1,37 @@ +/* + dots.cc -- implement Dots + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "dots.hh" +#include "molecule.hh" +#include "paper-def.hh" +#include "lookup.hh" + +Dots::Dots () +{ + no_dots_i_ =0; + position_i_ =0; +} + +void +Dots::do_post_processing () +{ + if (!(position_i_ % 2)) + position_i_ ++; +} + +Molecule* +Dots::brew_molecule_p () const +{ + Symbol d = paper ()->lookup_l ()->dots (no_dots_i_); + Molecule *out = new Molecule (Atom (d)); + Real inter_f = paper ()->internote_f (); + out->translate (inter_f * position_i_, Y_AXIS); + return out; +} + +IMPLEMENT_IS_TYPE_B1(Dots, Item); diff --git a/lily/dynamic-grav.cc b/lily/dynamic-grav.cc index 9da5b1386c..241737cf32 100644 --- a/lily/dynamic-grav.cc +++ b/lily/dynamic-grav.cc @@ -18,8 +18,8 @@ Dynamic_engraver::Dynamic_engraver() { - dir_ = CENTER; do_post_move_processing(); + dir_ = CENTER; dynamic_p_ =0; to_end_cresc_p_ = cresc_p_ = 0; cresc_req_l_ = 0; @@ -123,27 +123,31 @@ Dynamic_engraver::do_pre_move_processing() } } -void -Dynamic_engraver::set_feature (Feature i) -{ - if (i.type_ == "vdir") - dir_ = (Direction) int(i.value_); -} - IMPLEMENT_IS_TYPE_B1(Dynamic_engraver,Engraver); -ADD_THIS_ENGRAVER(Dynamic_engraver); +ADD_THIS_TRANSLATOR(Dynamic_engraver); -Dynamic_engraver::~Dynamic_engraver() +void +Dynamic_engraver::do_removal_processing () { - delete dynamic_p_; - delete to_end_cresc_p_; - if (cresc_p_) + if (cresc_p_) { + typeset_element (cresc_p_ ); + cresc_p_ =0; + } + if (to_end_cresc_p_) + { + typeset_element (to_end_cresc_p_); cresc_req_l_->warning ("unended crescendo"); + to_end_cresc_p_ =0; + } + if (dynamic_p_) + { + typeset_element (dynamic_p_); + dynamic_p_ =0; } - delete cresc_p_; } + void Dynamic_engraver::acknowledge_element (Score_elem_info i) { diff --git a/lily/engraver-group.cc b/lily/engraver-group.cc index 3c7e7ca86b..a50b078062 100644 --- a/lily/engraver-group.cc +++ b/lily/engraver-group.cc @@ -13,253 +13,9 @@ #include "debug.hh" #include "p-score.hh" #include "score-elem.hh" -#include "input-translator.hh" -Engraver* get_engraver_p (String); - -void -Engraver_group_engraver::print() const -{ - Engraver::print(); -} - -Engraver_group_engraver::~Engraver_group_engraver() -{ - assert (removable_b()); -} - -void -Engraver_group_engraver::check_removal() -{ - for (int i =0; i < group_l_arr_.size();) - { - group_l_arr_[i]->check_removal(); - if (group_l_arr_[i]->removable_b()) - terminate_engraver (group_l_arr_[i]); - else - i++; - } -} - -bool -Engraver_group_engraver::removable_b() const -{ - return !iterator_count_&& !group_l_arr_.size() ; -} - -Engraver_group_engraver::Engraver_group_engraver() -{ - itrans_l_ = 0; -} - -void -Engraver_group_engraver::set_feature (Feature d) -{ - PCursor<Engraver*> i (grav_list_.top()); - // why the while construct? - while (i.ok()) - { - // this construction to ensure clean deletion - Engraver *grav_l = i++; - grav_l->set_feature (d); - } -} - -void -Engraver_group_engraver::sync_features() -{ - PCursor<Engraver*> i (grav_list_.top()); - while (i.ok()) - { - Engraver *grav_l = i++; - grav_l->sync_features(); - } -} - -void -Engraver_group_engraver::do_pre_move_processing() -{ - PCursor<Engraver*> i (grav_list_.top()); - while (i.ok()) - { - Engraver *grav_l = i++; - grav_l->pre_move_processing(); - } -} - -void -Engraver_group_engraver::do_process_requests() -{ - PCursor<Engraver*> i (grav_list_.top()); - while (i.ok()) - { - Engraver *grav_l = i++; - grav_l->process_requests(); - } -} - - -void -Engraver_group_engraver::do_post_move_processing() -{ - PCursor<Engraver*> i (grav_list_.top()); - while (i.ok()) - { - // 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 -{ - bool parent_b = Engraver::contains_b (grav_l); - - if (parent_b) - return true; - for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++) - if (i->contains_b (grav_l)) - return true; - return false; -} - - - -bool -Engraver_group_engraver::do_try_request (Request*req_l) -{ - bool hebbes_b =false; - for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++) - hebbes_b =nongroup_l_arr_[i]->try_request (req_l); - if (!hebbes_b && daddy_grav_l_) - hebbes_b = daddy_grav_l_->try_request (req_l); - return hebbes_b ; -} - -bool -Engraver_group_engraver::try_request (Request* r) -{ - return Engraver::try_request (r); -} - -void -Engraver_group_engraver::add (Engraver *grav_p) -{ - grav_list_.bottom().add (grav_p); - grav_p->daddy_grav_l_ = this; - - if (grav_p->is_type_b (Engraver_group_engraver::static_name())) - { - group_l_arr_.push ((Engraver_group_engraver*)grav_p); - } - else - { - nongroup_l_arr_ .push (grav_p); - } -} - - -Engraver * -Engraver_group_engraver::remove_engraver_p (Engraver*grav_l) -{ - group_l_arr_.substitute ((Engraver_group_engraver*)grav_l,0); - nongroup_l_arr_.substitute (grav_l,0); - PCursor<Engraver*> grav_cur (grav_list_.find (grav_l)); - - return grav_cur.remove_p(); -} - -void -Engraver_group_engraver::terminate_engraver (Engraver*r_l) -{ - DOUT << "Removing " << r_l->name() << " at " << get_staff_info ().when () << "\n"; - r_l->removal_processing(); - Engraver * grav_p =remove_engraver_p (r_l); - - delete grav_p; -} - -IMPLEMENT_IS_TYPE_B2(Engraver_group_engraver,Engraver, Translator); - -ADD_THIS_ENGRAVER(Engraver_group_engraver); - -void -Engraver_group_engraver::do_print() const -{ -#ifndef NPRINT - if (!check_debug) - return ; - DOUT << "ID: " << id_str_ ; - DOUT << " iterators: " << iterator_count_<< "\n"; - for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++) - i->print(); -#endif -} - - -Engraver_group_engraver* -Engraver_group_engraver::find_engraver_l (String n, String id) -{ - if (name() == n && id_str_ == id) - return this; - Engraver_group_engraver * r = 0; - for (int i =0; !r && i< group_l_arr_.size(); i++) - { - r = group_l_arr_[i]->find_engraver_l (n,id); - } - - return r; -} - -Translator* -Engraver_group_engraver::find_get_translator_l (String n,String id) -{ - Translator * ret=0; - Input_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(); - - 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); - - } - } - else if (daddy_grav_l_) - ret =daddy_grav_l_->find_get_translator_l (n,id); - else - { - warning ("Can't find or create `" + n + "' called `" + id + "'\n"); - ret =0; - } - return ret; -} - -int -Engraver_group_engraver::depth_i() const -{ - return daddy_grav_l_->depth_i() + 1; -} - -Translator* -Engraver_group_engraver::ancestor_l (int l) -{ - if (!l || !daddy_grav_l_) - return this; - - return daddy_grav_l_->ancestor_l (l-1); -} +IMPLEMENT_IS_TYPE_B2(Engraver_group_engraver,Engraver, Translator_group); +ADD_THIS_TRANSLATOR(Engraver_group_engraver); void Engraver_group_engraver::announce_element (Score_elem_info info) @@ -271,78 +27,59 @@ Engraver_group_engraver::announce_element (Score_elem_info info) void Engraver_group_engraver::do_announces() { - for (int i=0; i < group_l_arr_.size(); i++) + Link_array<Translator_group> groups = group_l_arr (); + for (int i=0; i < groups.size(); i++) { - group_l_arr_[i]->do_announces(); + Engraver * eng = groups[i]->engraver_l (); + if (eng) + { + Engraver_group_engraver * group = + (Engraver_group_engraver*) eng; + group->do_announces(); + } } Request dummy_req; - + + Link_array<Translator> nongroups = nongroup_l_arr (); for (int j =0; j < announce_info_arr_.size(); j++) { Score_elem_info info = announce_info_arr_[j]; - + if (!info.req_l_) info.req_l_ = &dummy_req; - for (int i=0; i < nongroup_l_arr_.size(); i++) { // Is this good enough?6 - if (nongroup_l_arr_[i] != info.origin_grav_l_arr_[0]) - nongroup_l_arr_[i]->acknowledge_element (info); - } + for (int i=0; i < nongroups.size(); i++) + { // Is this good enough? + Engraver * eng = nongroups[i]->engraver_l (); + if (eng && eng!= info.origin_grav_l_arr_[0]) + eng->acknowledge_element (info); + } } announce_info_arr_.clear(); } -void -Engraver_group_engraver::do_removal_processing() -{ - for (PCursor<Engraver*> i (grav_list_.top()); i.ok (); i++) - i->removal_processing(); -} - Staff_info 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); - + Link_array<Translator> simple_translators = nongroup_l_arr (); + for (int i=0; i < simple_translators.size(); i++) + { + Engraver * eng = simple_translators[i]->engraver_l (); + if (eng) + eng->fill_staff_info (inf); + } return inf; } -Translator* -Engraver_group_engraver::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 (); - add (grav_p); - if (grav_p->is_bottom_engraver_b()) - return grav_p; - else - return grav_p->get_default_interpreter(); -} -bool -Engraver_group_engraver::is_bottom_engraver_b() const +Engraver_group_engraver::~Engraver_group_engraver () { - return !itrans_l_->get_default_itrans_l(); } -Engraver* -Engraver_group_engraver::get_simple_engraver (char const *type) const +Engraver_group_engraver::Engraver_group_engraver () { - for (int i=0; i < nongroup_l_arr_.size(); 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); - return 0; } - diff --git a/lily/engraver.cc b/lily/engraver.cc index 11ac18d61e..57bd126d6c 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -12,131 +12,50 @@ #include "engraver-group.hh" #include "debug.hh" -void -Engraver::post_move_processing() -{ - if (status < CREATION_INITED) - { - do_creation_processing(); - status = CREATION_INITED; - } - if (status >= MOVE_INITED) - return; - - do_post_move_processing(); - status = MOVE_INITED; -} - -void -Engraver::removal_processing() -{ - if (status < CREATION_INITED) - do_creation_processing(); - - do_removal_processing(); -} - -bool -Engraver::try_request (Request * r) -{ - if (status < MOVE_INITED) - post_move_processing(); - - return do_try_request (r); -} - -void -Engraver::process_requests() -{ - if (status < PROCESSED_REQS) - post_move_processing(); - else if (status >= PROCESSED_REQS) - return; - - status = PROCESSED_REQS; - do_process_requests(); -} - -void -Engraver::pre_move_processing() -{ - do_pre_move_processing(); - status = CREATION_INITED; -} - void Engraver::fill_staff_info (Staff_info&) { } -Scalar -Engraver::get_feature (String t) -{ - return daddy_grav_l_->get_feature (t); -} - -bool -Engraver::do_try_request (Request*) -{ - return false; -} - -Engraver::Engraver() -{ - status = VIRGIN; - daddy_grav_l_ = 0; -} void Engraver::announce_element (Score_elem_info i) { i.origin_grav_l_arr_.push (this); - daddy_grav_l_->announce_element (i); + daddy_grav_l()->announce_element (i); } void Engraver::typeset_element (Score_elem*p) { - daddy_grav_l_->typeset_element (p); + daddy_grav_l()->typeset_element (p); } Paper_def* Engraver::paper() const { - return daddy_grav_l_->paper(); + return (Paper_def*)output_def_l_; } -bool -Engraver::contains_b (Engraver *grav_l) const -{ - return this == grav_l; -} Staff_info Engraver::get_staff_info() const { - if (daddy_grav_l_) - return daddy_grav_l_->get_staff_info(); + if (daddy_grav_l()) + return daddy_grav_l()->get_staff_info(); Staff_info info; return info; } -void -Engraver::print() const -{ -#ifndef NPRINT - DOUT << "\n" << name() << " {"; - do_print(); - DOUT << "}"; -#endif -} +IMPLEMENT_IS_TYPE_B1(Engraver, Translator); -IMPLEMENT_IS_TYPE_B(Engraver); -void -Engraver::do_print() const +Engraver_group_engraver* +Engraver::daddy_grav_l () const { + return (daddy_trans_l_ ) + ? (Engraver_group_engraver*) daddy_trans_l_->engraver_l () + : 0; } - diff --git a/lily/global-gravs.cc b/lily/global-gravs.cc deleted file mode 100644 index 784c193939..0000000000 --- a/lily/global-gravs.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* - global-gravs.cc -- implement Engraver,Performer ctors - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "proto.hh" -#include "plist.hh" -#include "input-translator.hh" -#include "debug.hh" -#include "engraver.hh" - -struct Engraver_table_entry { - String name_str_; - Grav_ctor ctor_l_; - Engraver_table_entry (String s, Grav_ctor f) - { - name_str_ =s; - ctor_l_ = f; - } - Engraver_table_entry() - { - ctor_l_ =0; - } -}; - -static Array<Engraver_table_entry> *grav_table=0; - -void -add_engraver (String s, Grav_ctor f) -{ - if (!grav_table) - grav_table = new Array<Engraver_table_entry>; - - grav_table->push (Engraver_table_entry (s, f)); -} - - -Engraver* -get_engraver_p (String s) -{ - for (int i=0; i < grav_table->size(); i++) - { - if ((*grav_table)[i].name_str_ == s) - return (*(*grav_table)[i].ctor_l_)(); - } - error ("Unknown engraver `" + s +"\'"); - return 0; -} - -#if 0 - -struct Performer_table_entry -{ - String name_str_; - Perf_ctor ctor_l_; - Performer_table_entry (String s, Perf_ctor f) - { - name_str_ =s; - ctor_l_ = f; - } - Performer_table_entry() - { - ctor_l_ =0; - } -} - -static Array<Performer_table_entry> *perf_table=0; - -void -add_performer (String s, Perf_ctor f) -{ - if (!perf_table) - perf_table = new Array<Performer_table_entry>; - - perf_table->push (Performer_table_entry (s, f)); -} - - -Performer* -get_performer_p (String s) -{ - for (int i=0; i < perf_table->size(); i++) - { - if ((*perf_table)[i].name_str_ == s) - return (*(*perf_table)[i].ctor_l_)(); - } - error ("Unknown performer `" + s +"\'"); - return 0; -} -#endif diff --git a/lily/global-performers.cc b/lily/global-performers.cc deleted file mode 100644 index 69102aaf23..0000000000 --- a/lily/global-performers.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - global-performers.cc -- implement - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> - Jan Nieuwenhuizen <jan@digicash.com> -*/ - -#include "proto.hh" -#include "plist.hh" -#include "input-translator.hh" -#include "debug.hh" -#include "performer.hh" - -struct Performer_table_entry { - String name_str_; - Perf_ctor ctor_l_; - Performer_table_entry (String s, Perf_ctor f) - { - name_str_ =s; - ctor_l_ = f; - } - Performer_table_entry() - { - ctor_l_ =0; - } -}; - -static Array<Performer_table_entry> *perf_table=0; - -void -add_Performer (String s, Perf_ctor f) -{ - if (!perf_table) - perf_table = new Array<Performer_table_entry>; - - perf_table->push (Performer_table_entry (s, f)); -} - - -Performer* -get_performer_p (String s) -{ - for (int i=0; i < perf_table->size(); i++) - { - if ((*perf_table)[i].name_str_ == s) - return (*(*perf_table)[i].ctor_l_)(); - } - error ("Unknown performer `" + s +"\'"); - return 0; -} diff --git a/lily/global-translator.cc b/lily/global-translator.cc index f4213dd6a6..33ff9f81a1 100644 --- a/lily/global-translator.cc +++ b/lily/global-translator.cc @@ -13,37 +13,25 @@ Global_translator::Global_translator() last_mom_ = 0; } -Translator* -Global_translator::ancestor_l (int) -{ - return this; -} - void Global_translator::add_moment_to_process (Moment m) { if (m > last_mom_) - return; + return; for (int i=0; i < extra_mom_pq_.size(); i++) - if (extra_mom_pq_[i] == m) - return; + if (extra_mom_pq_[i] == m) + return; extra_mom_pq_.insert (m); } -int -Global_translator::depth_i() const -{ - return 0; -} - void Global_translator::modify_next (Moment &w) { while (extra_mom_pq_.size() && - extra_mom_pq_.front() <= w) + extra_mom_pq_.front() <= w) - w =extra_mom_pq_.get(); + w =extra_mom_pq_.get(); } int @@ -53,12 +41,18 @@ Global_translator::moments_left_i() const } void -Global_translator::prepare (Moment) +Global_translator::prepare (Moment m) { + now_mom_ = m; } +Moment +Global_translator::now_moment () const +{ + return now_mom_; +} -IMPLEMENT_IS_TYPE_B1(Global_translator, Translator); +IMPLEMENT_IS_TYPE_B1(Global_translator, Translator_group); Music_output* Global_translator::get_output_p() diff --git a/lily/head-column.cc b/lily/head-column.cc deleted file mode 100644 index b8707965a6..0000000000 --- a/lily/head-column.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - head-column.cc -- implement Head_column - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "debug.hh" -#include "head-column.hh" -#include "note-head.hh" -#include "stem.hh" -#include "script.hh" - -Head_column::Head_column() -{ - stem_l_ = 0; - dir_ =CENTER; -} - -void -Head_column::do_substitute_dependency (Score_elem*o, - 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); - } - if (stem_l_ == o) - { - stem_l_ = n ? (Stem*)n->item():0; - } -} - - -void -Head_column::set (Stem*stem_l) -{ - stem_l_ = stem_l; - Score_elem::add_dependency (stem_l); - for (int i=0; i < script_l_arr_.size(); i++) - script_l_arr_[i]->set_stem (stem_l); -} - -void -Head_column::add (Script *script_l) -{ - Script_column::add (script_l) ; - if (stem_l_) - script_l->set_stem (stem_l_); -} -void -Head_column::add (Note_head *n_l) -{ - add_support (n_l); - head_l_arr_.push (n_l); -} - - - -IMPLEMENT_IS_TYPE_B1(Head_column,Script_column); - -void -Head_column::do_print() const -{ -#ifndef NPRINT - DOUT << "heads: " << head_l_arr_.size(); -#endif -} - -void -Head_column::do_pre_processing() -{ - if (!dir_) - { - if (stem_l_) - dir_ = stem_l_->dir_; - } - Script_column::do_pre_processing(); -} diff --git a/lily/head-grav.cc b/lily/head-grav.cc index 29da2be66e..d564b58e6e 100644 --- a/lily/head-grav.cc +++ b/lily/head-grav.cc @@ -8,49 +8,52 @@ #include "head-grav.hh" #include "paper-def.hh" #include "musical-request.hh" +#include "dots.hh" Note_head_engraver::Note_head_engraver() { + dot_p_=0; note_p_ = 0; - do_post_move_processing(); + note_req_l_ =0; } bool Note_head_engraver::do_try_request (Request *req_l) { if (note_req_l_) - return false; + return false; - if (req_l->musical() && (req_l->musical ()->note () || req_l->musical ()->rest ())) - note_req_l_=req_l->musical()->rhythmic (); - else - return false; + if (!(req_l->musical() && req_l->musical ()->note ())) + return false; + + note_req_l_=req_l->musical()->rhythmic (); return true; } void Note_head_engraver::do_process_requests() { - if (!note_req_l_) - return; + if (!note_req_l_ || note_p_) + return; - Note_head*n_p = new Note_head (8); // ugh - note_p_ = n_p; - n_p->set_rhythmic (note_req_l_->rhythmic()); - - if (note_req_l_->note()) + note_p_ = new Note_head; + note_p_->balltype_i_ = note_req_l_->duration_.durlog_i_; + note_p_->dots_i_ = note_req_l_->duration_.dots_i_; + if (note_p_->dots_i_) { - n_p->position_i_ = note_req_l_->note()->height (); - Staff_info inf = get_staff_info(); - if (inf.c0_position_i_l_) - n_p->position_i_ += *inf.c0_position_i_l_; - } - else if (note_req_l_->rest()) - { - n_p->rest_b_ = true; + dot_p_ = new Dots; + note_p_->dots_l_ = dot_p_; + announce_element (Score_elem_info (dot_p_,0)); } + note_p_->position_i_ = note_req_l_->note()->height (); + + Staff_info inf = get_staff_info(); + if (inf.c0_position_i_l_) + note_p_->position_i_ += *inf.c0_position_i_l_; + + Score_elem_info itinf (note_p_,note_req_l_); announce_element (itinf); } @@ -60,8 +63,13 @@ Note_head_engraver::do_pre_move_processing() { if (note_p_) { - typeset_element (note_p_); - note_p_ = 0; + typeset_element (note_p_); + note_p_ = 0; + } + if (dot_p_) + { + typeset_element (dot_p_); + dot_p_ =0; } } void @@ -72,4 +80,4 @@ Note_head_engraver::do_post_move_processing() IMPLEMENT_IS_TYPE_B1(Note_head_engraver,Engraver); -ADD_THIS_ENGRAVER(Note_head_engraver); +ADD_THIS_TRANSLATOR(Note_head_engraver); diff --git a/lily/header.cc b/lily/header.cc index b64be42fee..fb1e02205b 100644 --- a/lily/header.cc +++ b/lily/header.cc @@ -7,7 +7,7 @@ */ #include "string.hh" -#include "assoc-iter.hh" +#include "dictionary-iter.hh" #include "header.hh" String @@ -17,7 +17,7 @@ Header::TeX_string() const s+= "\\def\\LilyIdString{" + lily_id_str_ + "}"; - for (Assoc_iter<String, String> i(*this); i.ok(); i++) + for (Dictionary_iter<String> i(*this); i.ok(); i++) { s += "\\def\\mudela" + i.key() + "{" + i.val() + "}"; } diff --git a/lily/identifier.cc b/lily/identifier.cc index 035c93b244..921f13d90e 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -17,7 +17,7 @@ #include "lookup.hh" #include "script-def.hh" #include "request.hh" -#include "input-translator.hh" +#include "translator.hh" IMPLEMENT_IS_TYPE_B(Identifier); @@ -60,7 +60,7 @@ class Class DEFAULT_PRINT(Script_id, General_script_def, script); DEFAULT_PRINT(Lookup_id, Lookup, lookup); -DEFAULT_PRINT(Input_translator_id, Input_trans, input_translator); +DEFAULT_PRINT(Translator_id, Translator, translator); DEFAULT_PRINT(Symtables_id, Symtables, symtables); DEFAULT_PRINT(Music_id,Music , music); DEFAULT_PRINT(Request_id, Request, request); @@ -106,7 +106,7 @@ Idclass::accessor () {\ Idclass::Idclass (Class*st, int code):Identifier (code) { data_p_ = st; }\ IMPLEMENT_ID_CLASS(Duration_id, Duration, duration); -IMPLEMENT_ID_CLASS(Input_translator_id, Input_translator, input_translator); +IMPLEMENT_ID_CLASS(Translator_id, Translator, translator); IMPLEMENT_ID_CLASS(Int_id, int, intid); IMPLEMENT_ID_CLASS(Real_id, Real, real); IMPLEMENT_ID_CLASS(Script_id, General_script_def, script); @@ -124,7 +124,7 @@ Identifier::Identifier (Identifier const&) } DEFAULT_ACCESSOR(Duration_id, Duration, duration); -DEFAULT_ACCESSOR(Input_translator_id,Input_translator, input_translator); +VIRTUAL_ACCESSOR(Translator_id,Translator, translator); DEFAULT_ACCESSOR(Int_id, int, intid); DEFAULT_ACCESSOR(Real_id, Real, real); VIRTUAL_ACCESSOR(Script_id, General_script_def, script); diff --git a/lily/include/abbreviation-beam-engraver.hh b/lily/include/abbreviation-beam-engraver.hh index ddea124250..3a9afc14dc 100644 --- a/lily/include/abbreviation-beam-engraver.hh +++ b/lily/include/abbreviation-beam-engraver.hh @@ -14,14 +14,13 @@ #include "engraver.hh" #include "drul-array.hh" -class Abbreviation_beam; // move me to lily-proto - /** Generate an abbreviation beam. Eat stems. */ class Abbreviation_beam_engraver : public Engraver { public: + TRANSLATOR_CLONE(Abbreviation_beam_engraver); DECLARE_MY_RUNTIME_TYPEINFO; Abbreviation_beam_engraver(); diff --git a/lily/include/audio-column.hh b/lily/include/audio-column.hh index b5f09403f8..273675f611 100644 --- a/lily/include/audio-column.hh +++ b/lily/include/audio-column.hh @@ -26,7 +26,7 @@ public: void print() const; Link_list<Audio_item *> audio_item_l_list_; - Audio_score * audio_score_l_; + Performance * performance_l_; private: Audio_column (Audio_column const&); diff --git a/lily/include/audio-element.hh b/lily/include/audio-element.hh index 6deaf15713..c870887c6f 100644 --- a/lily/include/audio-element.hh +++ b/lily/include/audio-element.hh @@ -13,7 +13,11 @@ #include "virtual-methods.hh" struct Audio_element { - virtual ~Audio_element(); - DECLARE_MY_RUNTIME_TYPEINFO; + void print ()const; + + virtual ~Audio_element(); + DECLARE_MY_RUNTIME_TYPEINFO; +protected: + virtual void do_print () const; }; #endif // AUDIO_ELEMENT_HH diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index 61c24d3a49..3e3c00c4fb 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -23,61 +23,69 @@ virtual CSound_item* score_item_p() = 0; */ struct Audio_item : public Audio_element { - Audio_item (Request* req_l); + Audio_item (Request* req_l); - /// Create a midi-item from myself. - virtual Midi_item* midi_item_p() = 0; + /// Create a midi-item from myself. + virtual Midi_item* midi_item_p() = 0; - Audio_column* audio_column_l_; - Request* req_l_; + Audio_column* audio_column_l_; + /* + THIS SUX. This ties the output system to the input system. Bad move. + */ + Request* req_l_; - DECLARE_MY_RUNTIME_TYPEINFO; - + DECLARE_MY_RUNTIME_TYPEINFO; +protected: + virtual void do_print () const; + private: - Audio_item (Audio_item const&); - Audio_item& operator=( Audio_item const&); + Audio_item (Audio_item const&); + Audio_item& operator=( Audio_item const&); }; struct Audio_key : public Audio_item { - Audio_key (Request* req_l); - - virtual Midi_item* midi_item_p(); + Audio_key (Request* req_l); + DECLARE_MY_RUNTIME_TYPEINFO; + virtual Midi_item* midi_item_p(); }; struct Audio_instrument : public Audio_item { - Audio_instrument (String instrument_str); - virtual Midi_item* midi_item_p(); - String str_; + Audio_instrument (String instrument_str); + virtual Midi_item* midi_item_p(); + String str_; + DECLARE_MY_RUNTIME_TYPEINFO; }; struct Audio_note : public Audio_item { - Audio_note (Request* req_l); - virtual Midi_item* midi_item_p(); + DECLARE_MY_RUNTIME_TYPEINFO; + Audio_note (Request* req_l); + virtual Midi_item* midi_item_p(); }; struct Audio_text : Audio_item { - enum Type { - TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC, - MARKER, CUE_POINT - }; - - Audio_text (Audio_text::Type type, String text_str); - virtual Midi_item* midi_item_p(); - - Type type_; - String text_str_; + enum Type { + TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC, + MARKER, CUE_POINT + }; + DECLARE_MY_RUNTIME_TYPEINFO; + Audio_text (Audio_text::Type type, String text_str); + virtual Midi_item* midi_item_p(); + + Type type_; + String text_str_; }; struct Audio_tempo : Audio_item { - Audio_tempo (int per_minute_4_i); - virtual Midi_item* midi_item_p(); - - int per_minute_4_i_; + Audio_tempo (int per_minute_4_i); + virtual Midi_item* midi_item_p(); + DECLARE_MY_RUNTIME_TYPEINFO; + int per_minute_4_i_; }; struct Audio_meter : Audio_item { - Audio_meter (Request* req_l); - virtual Midi_item* midi_item_p(); + Audio_meter (Request* req_l); + virtual Midi_item* midi_item_p(); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // AUDIO_ITEM_HH diff --git a/lily/include/axes.hh b/lily/include/axes.hh index a9dbb3c5e1..812d983faa 100644 --- a/lily/include/axes.hh +++ b/lily/include/axes.hh @@ -1,6 +1,5 @@ - /* - axes.hh -- declare + axes.hh -- declare Axis source file of the GNU LilyPond music typesetter diff --git a/lily/include/axis-group-administration.hh b/lily/include/axis-group-administration.hh new file mode 100644 index 0000000000..77007f8ff1 --- /dev/null +++ b/lily/include/axis-group-administration.hh @@ -0,0 +1,36 @@ +/* + axis-group-administration.hh -- declare Axis_group_administration + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef AXIS_GROUP_ADMINISTRATION_HH +#define AXIS_GROUP_ADMINISTRATION_HH + + +#include "parray.hh" +#include "axes.hh" +#include "real.hh" +#include "lily-proto.hh" + +/** + Do the dirty work for Axis_group_element. + */ +struct Axis_group_administration { + Link_array<Score_elem> 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); + + 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); +}; + +#endif // AXIS_GROUP_ADMINISTRATION_HH diff --git a/lily/include/axis-group-element.hh b/lily/include/axis-group-element.hh new file mode 100644 index 0000000000..42a31fd423 --- /dev/null +++ b/lily/include/axis-group-element.hh @@ -0,0 +1,36 @@ +/* + axis-group-element.hh -- declare Axis_group_element + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef AXIS_GROUP_ELEMENT_HH +#define AXIS_GROUP_ELEMENT_HH + +#include "score-elem.hh" +#include "axis-group-administration.hh" +/** + Treat a group of elements a unity in either or both axis sense . + This is a wrapper around 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<Score_elem> get_extra_dependencies() const; + virtual void do_unlink(); + virtual void do_junk_links(); + +public: + 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_ELEMENT_HH diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh index 526d3ccd26..1059bdaeed 100644 --- a/lily/include/axis-group-item.hh +++ b/lily/include/axis-group-item.hh @@ -10,7 +10,7 @@ #ifndef AXIS_ITEM_HH #define AXIS_ITEM_HH -#include "axis-group.hh" +#include "axis-group-element.hh" #include "item.hh" /** diff --git a/lily/include/axis-group-spanner.hh b/lily/include/axis-group-spanner.hh index 028529a6ef..15b132d366 100644 --- a/lily/include/axis-group-spanner.hh +++ b/lily/include/axis-group-spanner.hh @@ -11,7 +11,7 @@ #define SPAN_AXIS_GROUP_HH #include "spanner.hh" -#include "axis-group.hh" +#include "axis-group-element.hh" /** An element which groups a line in a certain direction. The most useful example of this is the Vertical_group_spanner */ diff --git a/lily/include/axis-group.hh b/lily/include/axis-group.hh index e2e030f0b9..152688ce69 100644 --- a/lily/include/axis-group.hh +++ b/lily/include/axis-group.hh @@ -1,5 +1,5 @@ /* -axis-group.hh -- declare Axis_group_administration, Axis_group_element +axis-group-element.hh -- declare Axis_group_administration, Axis_group_element source file of the GNU LilyPond music typesetter @@ -7,50 +7,6 @@ axis-group.hh -- declare Axis_group_administration, Axis_group_element */ +#error #ifndef Axis_group_administration_HH -#define Axis_group_administration_HH - -#include "parray.hh" -#include "axes.hh" -#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<Score_elem> 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); - - 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); -}; - -/** - Treat a group of elements a unity in either or both axis sense . - This is a wrapper around 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<Score_elem> get_extra_dependencies() const; - virtual void do_unlink(); - virtual void do_junk_links(); - -public: - 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 +#define Axis_group_administration_HH#endif // Axis_group_administration_HH diff --git a/lily/include/bar-column-grav.hh b/lily/include/bar-column-grav.hh index d7d8ba2c43..c05b2a5414 100644 --- a/lily/include/bar-column-grav.hh +++ b/lily/include/bar-column-grav.hh @@ -11,21 +11,23 @@ #define BAR_COLUMN_GRAV_HH #include "engraver.hh" +#include "parray.hh" /// couple bars and appropriate scripts class Bar_column_engraver :public Engraver { - Bar_column *barcol_p_; - Array< Script * > script_l_arr_; + Bar_column *barcol_p_; + Link_array<Script> script_l_arr_; - Bar *bar_l_; + Bar *bar_l_; protected: - virtual void acknowledge_element (Score_elem_info); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); public: - Bar_column_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Bar_column_engraver); + Bar_column_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // BAR_COLUMN_GRAV_HH diff --git a/lily/include/bar-grav.hh b/lily/include/bar-grav.hh index bb7cfb061b..4bb7c9d33a 100644 --- a/lily/include/bar-grav.hh +++ b/lily/include/bar-grav.hh @@ -15,18 +15,19 @@ generate bars. Either user ("|:"), or default (new measure) */ class Bar_engraver : public Engraver { - Bar_req * bar_req_l_; - Bar * bar_p_; + Bar_req * bar_req_l_; + Bar * bar_p_; public: - Bar_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Bar_engraver); + Bar_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual bool do_try_request (Request *req_l); - virtual void do_process_requests(); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); + virtual bool do_try_request (Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); }; #endif // BARGRAV_HH diff --git a/lily/include/bar-number-grav.hh b/lily/include/bar-number-grav.hh index fcce6d53a6..5db9c041a2 100644 --- a/lily/include/bar-number-grav.hh +++ b/lily/include/bar-number-grav.hh @@ -15,14 +15,15 @@ /** catch bars, and put a number over them. */ -class Bar_number_grav : public Engraver { +class Bar_number_engraver : public Engraver { Script * script_p_; protected: void acknowledge_element (Score_elem_info); void do_pre_move_processing(); public: - Bar_number_grav(); + TRANSLATOR_CLONE(Bar_number_engraver); + Bar_number_engraver(); DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // BAR_NUMBER_GRAV_HH diff --git a/lily/include/beam-grav.hh b/lily/include/beam-grav.hh index 3db08fc073..81b68adfc1 100644 --- a/lily/include/beam-grav.hh +++ b/lily/include/beam-grav.hh @@ -23,6 +23,7 @@ class Beam_engraver : public Engraver Rhythmic_grouping *current_grouping_p_; public: + TRANSLATOR_CLONE(Beam_engraver); DECLARE_MY_RUNTIME_TYPEINFO; Beam_engraver(); protected: diff --git a/lily/include/clef-grav.hh b/lily/include/clef-grav.hh index 624e7bdf20..ffd499920a 100644 --- a/lily/include/clef-grav.hh +++ b/lily/include/clef-grav.hh @@ -1,11 +1,14 @@ /* - clef.hh -- part of GNU LilyPond + clef-grav.hh -- declare Clef_engraver - (c) 1996,97 Han-Wen Nienhuys + source file of the GNU LilyPond music typesetter + + (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#ifndef CLEF_HH -#define CLEF_HH + +#ifndef CLEF_GRAV_HH +#define CLEF_GRAV_HH #include "scalar.hh" #include "varray.hh" @@ -13,29 +16,29 @@ /// where is c-0 in the staff? class Clef_engraver : public Engraver { - Clef_item *clef_p_; - Clef_change_req * clef_req_l_; - void create_clef(); - void read_req (Clef_change_req*); - bool set_type (String); + Clef_item *clef_p_; + Clef_change_req * clef_req_l_; + void create_clef(); + void read_req (Clef_change_req*); + bool set_type (String); protected: - virtual void do_process_requests(); - virtual void fill_staff_info (Staff_info&); - virtual void do_pre_move_processing(); - virtual void do_removal_processing(); - virtual void do_creation_processing(); - virtual void do_post_move_processing(); - virtual bool do_try_request (Request*); - virtual void acknowledge_element (Score_elem_info); + virtual void do_process_requests(); + virtual void fill_staff_info (Staff_info&); + virtual void do_pre_move_processing(); + virtual void do_removal_processing(); + virtual void do_creation_processing(); + virtual void do_post_move_processing(); + virtual bool do_try_request (Request*); + virtual void acknowledge_element (Score_elem_info); public: - int c0_position_i_; - String clef_type_str_; + TRANSLATOR_CLONE(Clef_engraver); + int c0_position_i_; + String clef_type_str_; - /* ************** */ + /* ************** */ - Clef_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + Clef_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; }; -#endif // CLEF_HH - +#endif diff --git a/lily/include/collision-grav.hh b/lily/include/collision-grav.hh index b04d9fe746..996165c3a3 100644 --- a/lily/include/collision-grav.hh +++ b/lily/include/collision-grav.hh @@ -13,13 +13,14 @@ #include "engraver.hh" class Collision_engraver : public Engraver { - Collision* col_p_; + Collision* col_p_; protected: - virtual void acknowledge_element (Score_elem_info); - virtual void do_pre_move_processing(); + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing(); public: - Collision_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Collision_engraver); + Collision_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // COLLISION_GRAV_HH diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 848d4d9e43..d807e2a219 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -19,7 +19,6 @@ class Command_req : public virtual Request { public: REQUESTMETHODS(Command_req, command); - virtual Group_feature_req * groupfeature() { return 0; } virtual Measure_grouping_req * measuregrouping() { return 0; } virtual Clef_change_req * clefchange() { return 0; } virtual Key_change_req * keychange() { return 0; } @@ -125,14 +124,6 @@ public: REQUESTMETHODS(Bar_req,bar); }; -class Group_feature_req : public Command_req { -public: - String type_str_; - String value_str_; - - REQUESTMETHODS(Group_feature_req, groupfeature); -}; - /** Handle key changes. diff --git a/lily/include/dot-column-grav.hh b/lily/include/dot-column-grav.hh new file mode 100644 index 0000000000..38db1b569a --- /dev/null +++ b/lily/include/dot-column-grav.hh @@ -0,0 +1,20 @@ +/* + dot-column-grav.hh -- declare Dot_column_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef DOT_COLUMN_GRAV_HH +#define DOT_COLUMN_GRAV_HH + +#include "engraver.hh" + +class Dot_column_engraver : public Engraver +{ + +}; + +#endif // DOT_COLUMN_GRAV_HH diff --git a/lily/include/dot-column.hh b/lily/include/dot-column.hh new file mode 100644 index 0000000000..01e3e3d3e5 --- /dev/null +++ b/lily/include/dot-column.hh @@ -0,0 +1,31 @@ +/* + dot-column.hh -- declare Dot_column Dot_column + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef DOT_COLUMN_HH +#define DOT_COLUMN_HH + +#include "horizontal-group-item.hh" + +/** + Group dots. This is needed because, the dots have to be aligned per voice + */ +class Dot_column : public Horizontal_group_item +{ + Link_array<Rhythmic_head> head_l_arr_; + Link_array<Dots> dot_l_arr_; + void add (Dots*); + +public: + DECLARE_MY_RUNTIME_TYPEINFO; + void add (Rhythmic_head*); +protected: + virtual void do_pre_processing (); + virtual void do_substitute_dependency (Score_elem *o, Score_elem*n); +}; +#endif // DOT_COLUMN_HH diff --git a/lily/include/dots.hh b/lily/include/dots.hh new file mode 100644 index 0000000000..5463934a21 --- /dev/null +++ b/lily/include/dots.hh @@ -0,0 +1,32 @@ +/* + dots.hh -- declare Dots + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef DOTS_HH +#define DOTS_HH + +#include "item.hh" + +/** + The dots to go with a notehead/rest. A separate class, since they + are a party in collision resolution. + */ +class Dots : public Item +{ +protected: + virtual Molecule * brew_molecule_p () const; + virtual void do_post_processing (); +public: + int no_dots_i_; + int position_i_; + + DECLARE_MY_RUNTIME_TYPEINFO; + Dots (); +}; + +#endif // DOTS_HH diff --git a/lily/include/dynamic-grav.hh b/lily/include/dynamic-grav.hh index bf71902245..a44e3cc801 100644 --- a/lily/include/dynamic-grav.hh +++ b/lily/include/dynamic-grav.hh @@ -13,24 +13,24 @@ #include "engraver.hh" class Dynamic_engraver : public Engraver { - Direction dir_; - Text_item * dynamic_p_; - Crescendo * to_end_cresc_p_; - Crescendo * cresc_p_; - Span_dynamic_req * cresc_req_l_; - Array<Dynamic_req*> dynamic_req_l_arr_; - /* ************** */ + Direction dir_; + Text_item * dynamic_p_; + Crescendo * to_end_cresc_p_; + Crescendo * cresc_p_; + Span_dynamic_req * cresc_req_l_; + Array<Dynamic_req*> dynamic_req_l_arr_; + /* ************** */ public: - Dynamic_engraver(); - ~Dynamic_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Dynamic_engraver); + Dynamic_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual void acknowledge_element (Score_elem_info); - virtual bool do_try_request (Request *req_l); - virtual void do_process_requests(); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); - virtual void set_feature (Feature); + virtual void do_removal_processing (); + virtual void acknowledge_element (Score_elem_info); + virtual bool do_try_request (Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); }; #endif // DYNAMIC_GRAV_HH diff --git a/lily/include/elem-group.hh b/lily/include/elem-group.hh index d65c173123..0edd067ec2 100644 --- a/lily/include/elem-group.hh +++ b/lily/include/elem-group.hh @@ -11,7 +11,7 @@ #define ELEM_GROUP_HH #include "score-elem.hh" -#include "axis-group.hh" +#include "axis-group-element.hh" diff --git a/lily/include/engraver-group.hh b/lily/include/engraver-group.hh index cdfee08c38..9f3dc8b78a 100644 --- a/lily/include/engraver-group.hh +++ b/lily/include/engraver-group.hh @@ -1,5 +1,5 @@ /* - engravergroup.hh -- declare Engraver_group_engraver + engraver-group.hh -- declare Engraver_group_engraver source file of the GNU LilyPond music typesetter @@ -15,74 +15,26 @@ #include "plist.hh" #include "score-elem-info.hh" #include "engraver.hh" -#include "translator.hh" +#include "translator-group.hh" /** Group a number of engravers. Usually delegates everything to its contents. Postfix: group */ -class Engraver_group_engraver : public Engraver, public virtual Translator { +class Engraver_group_engraver : public Engraver, public virtual Translator_group { protected: - Pointer_list<Engraver*> grav_list_; - Link_array<Engraver_group_engraver> group_l_arr_; - Link_array<Engraver> nongroup_l_arr_; - - Array<Score_elem_info> announce_info_arr_; - - virtual void do_print() const; - virtual bool removable_b() const; + Array<Score_elem_info> announce_info_arr_; public: - Engraver*get_simple_engraver (char const*typeinfo) const; - virtual void print() const ; - - Input_translator * itrans_l_; - void check_removal(); - Engraver_group_engraver(); - ~Engraver_group_engraver(); - - bool is_bottom_engraver_b() const; - - - /** - Junk #grav_l#. - Pre: - #grav_l# is in #grav_list_# - */ - virtual void terminate_engraver (Engraver * grav_l); + TRANSLATOR_CLONE(Engraver_group_engraver); + Engraver_group_engraver(); + ~Engraver_group_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; - DECLARE_MY_RUNTIME_TYPEINFO; - - /** - Remove #grav_l# from the list, and return it. - */ - virtual Engraver * remove_engraver_p (Engraver*grav_l); - virtual void set_feature (Feature i); - virtual void sync_features(); - - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); - virtual void do_removal_processing(); - virtual bool do_try_request (Request*); - virtual bool try_request (Request*); - virtual void do_process_requests(); - - virtual Staff_info get_staff_info() const; - - virtual Engraver_group_engraver * find_engraver_l (String name,String id); - virtual void do_announces(); - virtual void announce_element (Score_elem_info); - virtual void add (Engraver* grav_p); - virtual bool contains_b (Engraver*) const; - - virtual Translator* find_get_translator_l (String name, String id); - virtual Translator * get_default_interpreter(); - /** - Go up in the tree. default: choose next parent - */ - Translator * ancestor_l (int l=1); - int depth_i() const; + virtual Staff_info get_staff_info() const; + virtual void do_announces(); + virtual void announce_element (Score_elem_info); }; #endif // ENGRAVERGROUP_HH diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh index 335ab13034..b0f466d3dd 100644 --- a/lily/include/engraver.hh +++ b/lily/include/engraver.hh @@ -15,8 +15,7 @@ #include "request.hh" #include "score-elem-info.hh" #include "staff-info.hh" - - +#include "translator.hh" /** @@ -24,132 +23,51 @@ It may use derived classes. Hungarian postfix: grav */ - -class Engraver { +class Engraver : public virtual Translator { - friend class Engraver_group_engraver; - /** - You cannot copy a Engraver - */ - Engraver (const Engraver&){} - - enum { - VIRGIN, - CREATION_INITED, - MOVE_INITED, - ACCEPTED_REQS, - PROCESSED_REQS, - ACKED_REQS, - MOVE_DONE - } status; + friend class Engraver_group_engraver; protected: - /// utility - virtual Paper_def * paper() const; - + /// utility + Paper_def * paper() const; + /** + Invoke walker method to typeset element. Default: pass on to daddy. + */ + virtual void typeset_element (Score_elem*elem_p); - /// make items/spanners with the requests you got - virtual void do_process_requests(){} - - /** typeset any items/spanners. Default: do nothing - */ - virtual void do_pre_move_processing(){} - /** reset any appropriate data. Default: do nothing - */ - virtual void do_post_move_processing(){} + /** + take note of item/spanner + put item in spanner. Adjust local key; etc. + + Default: ignore the info + */ + virtual void acknowledge_element (Score_elem_info) {} + /** + Announce element. Default: pass on to daddy. Utility + */ + virtual void announce_element (Score_elem_info); + /** + Get information on the staff. Default: ask daddy. + */ + virtual Staff_info get_staff_info() const; + virtual void fill_staff_info (Staff_info&); - virtual void do_creation_processing() {} - virtual void do_removal_processing() {} - - /** - Invoke walker method to typeset element. Default: pass on to daddy. - */ - virtual void typeset_element (Score_elem*elem_p); - - /** - take note of item/spanner - put item in spanner. Adjust local key; etc. - - Default: ignore the info - */ - virtual void acknowledge_element (Score_elem_info) {} - /** - Announce element. Default: pass on to daddy. Utility - */ - virtual void announce_element (Score_elem_info); - /** - Set Feature of the engraver (s). Default: ignore Feature. - */ - virtual void set_feature (Feature){} - /** - ask daddy for a feature - */ - virtual Scalar get_feature (String type_str); - /** - Does this equal or contain a certain engraver? - */ - - virtual void sync_features() {} - - virtual bool contains_b (Engraver*grav_l) const; - /** - Get information on the staff. Default: ask daddy. - */ - virtual Staff_info get_staff_info() const; - virtual void fill_staff_info (Staff_info&); - - - virtual void do_print() const; - /* - @see{try_request} - Default: always return false - */ - virtual bool do_try_request (Request *req_l); public: - void pre_move_processing(); - void process_requests(); - /** - try to fit the request in this engraver - - @return - false: not noted, not taken. - - true: request swallowed. Don't try to put the request elsewhere. - - */ - bool try_request (Request*); - bool is_bottom_engraver() const; - - void post_move_processing(); - void removal_processing(); - - Engraver_group_engraver * daddy_grav_l_; - - Engraver(); - virtual ~Engraver(){} - DECLARE_MY_RUNTIME_TYPEINFO; - void print() const; + TRANSLATOR_CLONE(Engraver); + Engraver_group_engraver * daddy_grav_l() const; + /** + override other ctor + */ + Engraver () {} + + DECLARE_MY_RUNTIME_TYPEINFO; + void print() const; + virtual Engraver * engraver_l () { return this; } }; -/** - A macro to automate administration of engravers. - */ -#define ADD_THIS_ENGRAVER(c) \ -struct c ## init { \ - static Engraver * globalctor(){ \ - return new c; \ - } \ - c ## init() { \ - add_engraver (c::static_name(), globalctor); \ - \ - } \ -} _ ## c ## init; - -typedef Engraver*(*Grav_ctor)(void); -void add_engraver (String s, Grav_ctor f); #endif // ENGRAVER_HH diff --git a/lily/include/global-performers.hh b/lily/include/global-performers.hh deleted file mode 100644 index 0ed76e4c54..0000000000 --- a/lily/include/global-performers.hh +++ /dev/null @@ -1,33 +0,0 @@ - -/* - global-performers.hh -- declare global performer stuff - - source file of the GNU LilyPond music typesetter - - (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl> - Jan Nieuwenhuizen <jan@digicash.com> -*/ - -#ifndef GLOBAL_PERFORMER_HH -#define GLOBAL_PERFORMER_HH - -/** - A macro to automate administration of performers - */ -#define ADD_THIS_PERFORMER( c) \ -struct c ## init { \ - static Performer* globalctor() \ - { \ - return new c;\ - } \ - c ## init() \ - { \ - add_Performer (c::static_name(), globalctor); \ - } \ -} _ ## c ## init; - -// typedef Performer*(*Perf_ctor)(void); c++ ? -typedef Performer*(*Perf_ctor)(); -void add_Performer (String s, Perf_ctor f); - -#endif // GLOBAL_PERFORMER_HH diff --git a/lily/include/global-translator.hh b/lily/include/global-translator.hh index ae97418b7f..1d3d91ed5d 100644 --- a/lily/include/global-translator.hh +++ b/lily/include/global-translator.hh @@ -10,14 +10,17 @@ #ifndef GLOBAL_TRANSLATOR_HH #define GLOBAL_TRANSLATOR_HH -#include "translator.hh" +#include "translator-group.hh" #include "pqueue.hh" -class Global_translator : public virtual Translator { +class Global_translator : public virtual Translator_group{ PQueue<Moment> extra_mom_pq_; public: + TRANSLATOR_CLONE(Global_translator); Moment last_mom_; + Moment now_mom_; Global_translator(); + int moments_left_i() const; void modify_next (Moment&); void add_moment_to_process (Moment); @@ -27,13 +30,11 @@ public: virtual void process() {} virtual void finish() {} virtual void start() {} - + DECLARE_MY_RUNTIME_TYPEINFO; protected: - + virtual Moment now_moment () const; virtual Global_translator *global_l() { return this; } - virtual int depth_i() const; - virtual Translator *ancestor_l (int); }; diff --git a/lily/include/head-column.hh b/lily/include/head-column.hh deleted file mode 100644 index ab38222b1a..0000000000 --- a/lily/include/head-column.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* - head-column.hh -- declare Head_column - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef HEAD_COLUMN_HH -#define HEAD_COLUMN_HH - -#include "script-column.hh" - -/** - Scripts and rests/noteheads - */ -class Head_column : public Script_column -{ -public: - Link_array<Note_head> 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*); -}; -#endif // HEAD_COLUMN_HH diff --git a/lily/include/head-grav.hh b/lily/include/head-grav.hh index fdbbe7064c..66411a4ea8 100644 --- a/lily/include/head-grav.hh +++ b/lily/include/head-grav.hh @@ -13,17 +13,19 @@ make balls and rests */ class Note_head_engraver : public Engraver { - Note_head* note_p_; - Rhythmic_req * note_req_l_; + Note_head* note_p_; + Dots * dot_p_; + Rhythmic_req * note_req_l_; public: - Note_head_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Note_head_engraver); + Note_head_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual bool do_try_request (Request *req_l) ; - virtual void do_process_requests(); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); + 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(); }; diff --git a/lily/include/header.hh b/lily/include/header.hh index 62ee98ddf4..e74aadc236 100644 --- a/lily/include/header.hh +++ b/lily/include/header.hh @@ -11,10 +11,10 @@ #define HEADER_HH #include "string.hh" -#include "assoc.hh" +#include "dictionary.hh" -struct Header : Assoc<String, String> +struct Header : Dictionary<String> { String lily_id_str_; String TeX_string() const; diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index 935f962e39..fc077f60ab 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -31,7 +31,7 @@ struct Identifier : public Input { void print() const; DECLARE_MY_RUNTIME_TYPEINFO; void error (String); - IDACCESSOR(Input_translator, input_translator) + IDACCESSOR(Translator, translator) IDACCESSOR(Music, music) IDACCESSOR(General_script_def, script) IDACCESSOR(Symtables, symtables) @@ -61,7 +61,7 @@ struct Idclass : Identifier {\ }\ -DECLARE_ID_CLASS(Input_translator_id, Input_translator, input_translator); +DECLARE_ID_CLASS(Translator_id, Translator, translator); DECLARE_ID_CLASS(Duration_id, Duration, duration); DECLARE_ID_CLASS(Real_id, Real, real); DECLARE_ID_CLASS(Script_id, General_script_def, script); diff --git a/lily/include/input-translator.hh b/lily/include/input-translator.hh index 14a35e507c..115a48a1fe 100644 --- a/lily/include/input-translator.hh +++ b/lily/include/input-translator.hh @@ -15,38 +15,36 @@ #include "lily-proto.hh" #include "input.hh" #include "string.hh" +#error #include "varray.hh" struct Input_translator_list : public Pointer_list<Input_translator*> { - Input_translator_list (Input_translator_list const &); - Input_translator_list(){} - ~Input_translator_list(){} + Input_translator_list (Input_translator_list const &); + Input_translator_list(){} + ~Input_translator_list(){} }; /** Define a intereter for music. This is an runtime interface to the typesystem */ class Input_translator : public Input { public: - Input_translator_list contains_itrans_p_list_; - Array<String> consists_str_arr_; - Array<String> alias_str_arr_; - String base_str_; - String type_str_; - String default_id_str_; - - void add (Input_translator *); - bool is_name_b (String); - bool accept_req_b(); - bool accepts_b (String); - void print() const; - Engraver_group_engraver * get_group_engraver_p(); - Performer_group_performer * get_group_performer_p(); - Input_translator * get_default_itrans_l(); - Input_translator * recursive_find (String nm); - Input_translator * find_itrans_l (String nm); + Input_translator_list contains_itrans_p_list_; + Array<String> consists_str_arr_; + Array<String> alias_str_arr_; + String base_str_; + String type_str_; + String default_id_str_; + + void add (Input_translator *); + bool is_name_b (String); + bool accept_req_b(); + bool accepts_b (String); + void print() const; + Translator_group * get_group_translator_p(); + Input_translator * get_default_itrans_l(); + Input_translator * recursive_find (String nm); + Input_translator * find_itrans_l (String nm); }; -Engraver* get_engraver_p (String); -Performer* get_performer_p (String); #endif // Input_translator_HH diff --git a/lily/include/key-grav.hh b/lily/include/key-grav.hh index f60243fc8f..b81605e547 100644 --- a/lily/include/key-grav.hh +++ b/lily/include/key-grav.hh @@ -17,26 +17,26 @@ Make the key signature. */ class Key_engraver : public Engraver { - void create_key(); - void read_req (Key_change_req * r); + void create_key(); + void read_req (Key_change_req * r); public: - Key key_; - Key_change_req * keyreq_l_; - Key_item * kit_p_; - Array<int> accidental_idx_arr_; - bool default_key_b_; - bool change_key_b_; + Key_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Key_engraver); + Key key_; + Key_change_req * keyreq_l_; + Key_item * kit_p_; + Array<int> accidental_idx_arr_; + bool default_key_b_; + bool change_key_b_; protected: - virtual bool do_try_request (Request *req_l); - virtual void do_process_requests(); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); - virtual void acknowledge_element (Score_elem_info); -public: - Key_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + virtual bool do_try_request (Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); + virtual void acknowledge_element (Score_elem_info); }; #endif // KEYGRAV_HH diff --git a/lily/include/key-performer.hh b/lily/include/key-performer.hh index f459ea9353..903e7f66b0 100644 --- a/lily/include/key-performer.hh +++ b/lily/include/key-performer.hh @@ -14,17 +14,18 @@ class Key_performer : public Performer { public: - DECLARE_MY_RUNTIME_TYPEINFO; - Key_performer(); - ~Key_performer(); + TRANSLATOR_CLONE(Key_performer); + DECLARE_MY_RUNTIME_TYPEINFO; + Key_performer(); + ~Key_performer(); protected: - void do_print() const; - virtual bool do_try_request (Request* req_l); - virtual void process_requests(); + void do_print() const; + virtual bool do_try_request (Request* req_l); + virtual void do_process_requests(); private: - Key_change_req* key_req_l_; + Key_change_req* key_req_l_; }; #endif // KEY_PERFOMER_HH diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 8e7c46c50a..575b52afbd 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -17,7 +17,9 @@ struct Abbreviation_beam_req; struct Abbreviation_beam_engraver; struct Axis_group_element; struct Axis_group; +struct Translator_group; struct Translator; +struct Abbreviation_beam; struct Audio_element; struct Audio_column; struct Audio_item; @@ -25,7 +27,7 @@ struct Audio_key; struct Audio_meter; struct Audio_note; struct Audio_note_off; -struct Audio_score; +struct Performance; struct Audio_staff; struct Audio_tempo; struct Atom; @@ -61,7 +63,8 @@ struct Complex_music; struct Cresc_req; struct Crescendo ; struct Decresc_req; - +struct Dots; +struct Dot_column; struct Directional_spanner; struct Disallow_break_req; struct Durational_req; @@ -69,13 +72,11 @@ struct Dynamic; struct Dynamic_req; 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; struct Head_column; struct Header; struct Horizontal_align_item; @@ -84,10 +85,7 @@ struct Horizontal_group_item; struct Horizontal_vertical_group; struct Idealspacing; struct Identifier; -struct Interpreter; struct Input_file; -struct Input_score; -struct Input_translator; struct Item; struct Key; struct Key_change_req; @@ -159,6 +157,7 @@ struct Rational; struct Engraver_group_engraver; struct Performer; struct Performer_group_performer; +struct Property_iterator; struct Request; struct Request_column; struct Engraver; @@ -168,6 +167,7 @@ struct Rest_collision_engraver; struct Rest_column; struct Rest_req; struct Rhythmic_grouping; +struct Rhythmic_head; struct Rhythmic_grouping_req; struct Rhythmic_req; struct Score; @@ -203,6 +203,7 @@ struct Symtable; struct Symtables; struct Super_elem; struct Terminate_voice_req; +struct Translation_property; struct Tempo_req; struct Tex_stream; struct Text_def; diff --git a/lily/include/line-group-grav.hh b/lily/include/line-group-grav.hh index 65e35726df..ac57f9ab6a 100644 --- a/lily/include/line-group-grav.hh +++ b/lily/include/line-group-grav.hh @@ -16,16 +16,17 @@ Engravers put elements on the same or lowel level in a line */ class Line_group_engraver : public Engraver{ - Vertical_group_spanner *staffline_p_; + Vertical_group_spanner *staffline_p_; protected: - virtual void do_creation_processing(); - virtual void do_removal_processing(); - virtual void acknowledge_element (Score_elem_info); + virtual void do_creation_processing(); + virtual void do_removal_processing(); + virtual void acknowledge_element (Score_elem_info); public: - DECLARE_MY_RUNTIME_TYPEINFO; - Line_group_engraver(); + TRANSLATOR_CLONE(Line_group_engraver); + DECLARE_MY_RUNTIME_TYPEINFO; + Line_group_engraver(); }; diff --git a/lily/include/local-key-grav.hh b/lily/include/local-key-grav.hh index e060dc6188..49de9f82d2 100644 --- a/lily/include/local-key-grav.hh +++ b/lily/include/local-key-grav.hh @@ -13,18 +13,20 @@ #include "parray.hh" struct Local_key_engraver : Engraver { - Key local_key_; - Key const *key_C_; - Array<Note_req* > mel_l_arr_; - Array<Item* > support_l_arr_; - Link_array<Item > forced_l_arr_; - Link_array<Item > tied_l_arr_; - /* *************** */ - virtual void do_process_requests(); - virtual void acknowledge_element (Score_elem_info); - virtual void do_pre_move_processing(); - Local_key_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; +protected: + TRANSLATOR_CLONE(Local_key_engraver); + virtual void do_process_requests(); + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing(); +public: + Key local_key_; + Key const *key_C_; + Array<Note_req* > mel_l_arr_; + Array<Item* > support_l_arr_; + Link_array<Item > forced_l_arr_; + Link_array<Item > tied_l_arr_; + Local_key_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // LOCALKEYGRAV_HH diff --git a/lily/include/lyric-engraver.hh b/lily/include/lyric-engraver.hh index 632e9c571e..96b6d1dbd0 100644 --- a/lily/include/lyric-engraver.hh +++ b/lily/include/lyric-engraver.hh @@ -23,6 +23,7 @@ protected: virtual void do_process_requests(); virtual void do_post_move_processing(); public: + TRANSLATOR_CLONE(Lyric_engraver); DECLARE_MY_RUNTIME_TYPEINFO; Lyric_engraver(); }; diff --git a/lily/include/lyric-performer.hh b/lily/include/lyric-performer.hh index f03c4faaf0..c8a476037d 100644 --- a/lily/include/lyric-performer.hh +++ b/lily/include/lyric-performer.hh @@ -16,6 +16,7 @@ class Lyric_performer : public Performer { public: + TRANSLATOR_CLONE(Lyric_performer); DECLARE_MY_RUNTIME_TYPEINFO; Lyric_performer(); ~Lyric_performer(); @@ -23,7 +24,7 @@ public: protected: void do_print() const; virtual bool do_try_request (Request* req_l); - virtual void process_requests(); + virtual void do_process_requests(); private: Array<Lyric_req*> lreq_arr_; diff --git a/lily/include/main.hh b/lily/include/main.hh index 75fc6a1e54..98ed2c920e 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -14,7 +14,6 @@ void set_debug (bool); void do_scores(); void add_score (Score* s); void set_default_output (String s); -Input_score* current_iscore_l(); String find_file (String); String get_version_str(); String get_version_number_str(); diff --git a/lily/include/meter-grav.hh b/lily/include/meter-grav.hh index e9e372f8ae..90d19b1fdb 100644 --- a/lily/include/meter-grav.hh +++ b/lily/include/meter-grav.hh @@ -21,6 +21,7 @@ protected: virtual void do_process_requests(); virtual void do_pre_move_processing(); public: + TRANSLATOR_CLONE(Meter_engraver); Meter * meter_p_; Meter_engraver(); diff --git a/lily/include/meter-performer.hh b/lily/include/meter-performer.hh index 51edbad020..fa2f06e9ff 100644 --- a/lily/include/meter-performer.hh +++ b/lily/include/meter-performer.hh @@ -14,17 +14,18 @@ class Meter_performer : public Performer { public: - DECLARE_MY_RUNTIME_TYPEINFO; - Meter_performer(); - ~Meter_performer(); + TRANSLATOR_CLONE(Meter_performer); + DECLARE_MY_RUNTIME_TYPEINFO; + Meter_performer(); + ~Meter_performer(); protected: - void do_print() const; - virtual bool do_try_request (Request* req_l); - virtual void process_requests(); + void do_print() const; + virtual bool do_try_request (Request* req_l); + virtual void do_process_requests(); private: - Meter_change_req* meter_req_l_; + Meter_change_req* meter_req_l_; }; #endif // METER_PERFOMER_HH diff --git a/lily/include/midi-def.hh b/lily/include/midi-def.hh index 115158dfdc..964d87f15d 100644 --- a/lily/include/midi-def.hh +++ b/lily/include/midi-def.hh @@ -9,6 +9,7 @@ #ifndef MIDI_DEF_HH #define MIDI_DEF_HH + #include "lily-proto.hh" #include "real.hh" #include "string.hh" @@ -20,12 +21,8 @@ */ 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_; @@ -37,10 +34,7 @@ public: 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/molecule.hh b/lily/include/molecule.hh index b031688e21..f83eda517b 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -1,37 +1,43 @@ +/* + molecule.hh -- declare Molecule + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ #ifndef MOLECULE_HH #define MOLECULE_HH #include "lily-proto.hh" #include "plist.hh" #include "boxes.hh" - +#include "axes.hh" +#include "direction.hh" /** a group of individually translated symbols. You can add molecules to the top, to the right, etc. */ struct Molecule { - Pointer_list<Atom*> ats; // change to List<Atom>? + Pointer_list<Atom*> ats; // change to List<Atom>? - /* *************** */ + /* *************** */ - Molecule() { } - Molecule (Atom const &a) { add (a) ;} - - void add_right (const Molecule &m); - void add_left (const Molecule &m); - void add_top (const Molecule &m); - void add_bottom (const Molecule &m); - void add (Molecule const &m); - void translate (Offset); - void translate (Real,Axis); - void add (Atom const & a) ; - /// how big is #this#? - Box extent() const; - - String TeX_string() const; - - Molecule (const Molecule&s); - void print() const; + Molecule() { } + Molecule (Atom const &a) { add (a) ;} + + void add_at_edge (Axis a, Direction d, const Molecule &m); + + void add (Molecule const &m); + void translate (Offset); + void translate (Real,Axis); + void add (Atom const & a) ; + /// how big is #this#? + Box extent() const; + + String TeX_string() const; + + Molecule (const Molecule&s); + void print() const; private: - void operator=(const Molecule&); + void operator=(const Molecule&); }; #endif diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 352af5f379..d543a858c9 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -17,29 +17,34 @@ #include "virtual-methods.hh" class Music_iterator { - Array<Translator *>report_to_l_arr_; - void push_translator (Translator*); + Array<Translator_group*>report_to_l_arr_; + void push_translator (Translator_group*); void pop_translator(); protected: bool first_b_; virtual void do_print() const; - virtual Translator * get_req_translator_l(); + virtual Translator_group* get_req_translator_l(); Music_iterator* get_iterator_p (Music*) const; - void set_translator (Translator*); + void set_translator (Translator_group*); Music_iterator *daddy_iter_l_; public: - Translator *report_to_l() const; + Translator_group*report_to_l() const; DECLARE_MY_RUNTIME_TYPEINFO; - static Music_iterator* static_get_iterator_p (Music*,Translator*); + static Music_iterator* static_get_iterator_p (Music*,Translator_group*); Music_iterator(); virtual void process_and_next (Moment until); virtual Moment next_moment() const; virtual bool ok() const; virtual ~Music_iterator(); + + /** + Construct sub-iterators, and set the translator to + report to + */ virtual void construct_children(); void print() const; }; diff --git a/lily/include/music-output-def.hh b/lily/include/music-output-def.hh index b0b8316941..26dacffa31 100644 --- a/lily/include/music-output-def.hh +++ b/lily/include/music-output-def.hh @@ -9,9 +9,12 @@ #ifndef Music_output_DEF_HH #define Music_output_DEF_HH + #include "string.hh" #include "lily-proto.hh" #include "virtual-methods.hh" +#include "plist.hh" +#include "dictionary.hh" /** Definition of how to output mudela. @@ -19,11 +22,21 @@ class Music_output_def { public: + Dictionary<Translator*> translator_p_dict_; + + Music_output_def (Music_output_def const&); + Music_output_def (); + virtual ~Music_output_def (); + 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; } + virtual void print () const; + + Global_translator *get_global_translator_p (); + Translator_group *get_group_translator_p (String type) const; + void assign_translator (String, Translator*); String outfile_str_; + Translator * find_translator_l (String) const; }; + #endif // Music_output_DEF_HH diff --git a/lily/include/music.hh b/lily/include/music.hh index a267fc04eb..767c109a53 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -30,29 +30,28 @@ */ class Music:public Input { public: - Music_list * parent_music_l_; + Music_list * parent_music_l_; - /** The kind of iterator needed to walk this music. This doesn't - make sense for simple (ie non-list) music, but it does no harm - here. Yes, it did harm Music_list: you can forget to copy it. + /** The kind of iterator needed to walk this music. This doesn't + make sense for simple (ie non-list) music, but it does no harm + here. Yes, it did harm Music_list: you can forget to copy it. - */ - String type_str_; - - /// what name (or look for this name) - String id_str_; - - virtual MInterval time_int() const; - virtual ~Music(){} - void print() const; - virtual void transpose (Melodic_req const *); - virtual void translate (Moment dt); - VIRTUAL_COPY_CONS(Music,Music); - DECLARE_MY_RUNTIME_TYPEINFO; - Music(); + */ + String translator_type_str_; + + /// what name (or look for this name) + String translator_id_str_; + + virtual MInterval time_int() const; + virtual ~Music(){} + void print() const; + virtual void transpose (Melodic_req const *); + virtual void translate (Moment dt); + VIRTUAL_COPY_CONS(Music,Music); + DECLARE_MY_RUNTIME_TYPEINFO; + Music(); protected: - virtual void do_print() const; - + virtual void do_print() const; }; #endif // MUSIC_HH diff --git a/lily/include/my-lily-lexer.hh b/lily/include/my-lily-lexer.hh index 6928a0efea..e3272eb9cd 100644 --- a/lily/include/my-lily-lexer.hh +++ b/lily/include/my-lily-lexer.hh @@ -35,7 +35,7 @@ public: void * lexval_l; Notename_table *note_tab_p_; - Assoc<String, Identifier*> *identifier_assoc_p_; + Dictionary<Identifier*> *identifier_p_dict_p_; Keyword_table * keytable_p_; int errorlevel_i_; diff --git a/lily/include/note-column-grav.hh b/lily/include/note-column-grav.hh deleted file mode 100644 index 9c68248eb1..0000000000 --- a/lily/include/note-column-grav.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* - note-column-grav.hh -- declare Note_column_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef NOTE_COLUMN_GRAV_HH -#define NOTE_COLUMN_GRAV_HH - -#include "engraver.hh" - -class Note_column_engraver :public Engraver { - Rest_column * rest_col_l(); - Note_column * note_col_l(); - - Array< Script * > script_l_arr_; - Stem * stem_l_; - Note_column *ncol_p_; - Rest_column *restcol_p_; - bool h_shift_b_; - Direction dir_; - - - bool acceptable_elem_b (Score_elem const*) const; -protected: - virtual void set_feature (Feature); - virtual void acknowledge_element (Score_elem_info); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); -public: - Note_column_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; -}; -#endif // NOTE_COLUMN_GRAV_HH diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index 3c2eb7568e..b2be9b3479 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -11,22 +11,39 @@ #define NOTE_COLUMN_HH #include "item.hh" -#include "head-column.hh" +#include "script-column.hh" /** a struct for treating a group of noteheads (noteheads, stem (chord) and scripts) as a single entity. */ -class Note_column : public Head_column { +class Note_column : public Script_column { protected: virtual void do_pre_processing(); - + virtual void do_print () const; + virtual void do_substitute_dependency (Score_elem*,Score_elem*); public: + /** 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. + */ + Direction dir_; bool h_shift_b_; + Stem* stem_l_; + + + Link_array<Note_head> head_l_arr_; + Link_array<Rest> rest_l_arr_; Interval_t<int> head_positions_interval() const; + void translate_rests(int dy); DECLARE_MY_RUNTIME_TYPEINFO; - Note_column(); - void sort(); + Note_column (); + void set (Stem*); + void set (Dot_column*); + void add (Rhythmic_head*); + bool rest_b () const; + virtual void add (Script*s); + void sort (); }; #endif // NOTE_COLUMN_HH diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index c6826f2cfc..5039521223 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -7,48 +7,35 @@ #ifndef NOTEHEAD_HH #define NOTEHEAD_HH -#include "item.hh" +#include "rhythmic-head.hh" -/** ball at the end of the stem takes care of: +/** ball at the end of the stem. Takes care of: * help lines - * proper placing of dots - It also is the item for a Rest - */ -class Note_head : public Item { +class Note_head : public Rhythmic_head { public: - DECLARE_MY_RUNTIME_TYPEINFO; + DECLARE_MY_RUNTIME_TYPEINFO; - bool rest_b_; - int position_i_; + int position_i_; - /// -1 = lowest, 0 = inside, 1 = top - int extremal_i_; + /// -1 = lowest, 0 = inside, 1 = top + int extremal_i_; - /// needed for the help-lines - int staff_size_i_; - int dots_i_; - int balltype_i_; - int dot_delta_y_i_; - Direction x_dir_; + /// needed for the help-lines + int staff_size_i_; + Direction x_dir_; - /* *************** */ - - void set_rhythmic (Rhythmic_req *); - - /** - position of top line (5 linestaff: 8) - */ - Note_head (int staff_size); - void set_dots(); - static int compare (Note_head * const &a, Note_head *const &b) ; + /** + position of top line (5 linestaff: 8) + */ + Note_head (); + static int compare (Note_head * const &a, Note_head *const &b) ; protected: - virtual void do_print() const; - virtual void do_pre_processing(); - virtual Molecule* brew_molecule_p() const; + virtual void do_pre_processing(); + virtual Molecule* brew_molecule_p() const; }; #endif // NOTEHEAD_HH diff --git a/lily/include/note-performer.hh b/lily/include/note-performer.hh index 436b78bb2a..661e378dc1 100644 --- a/lily/include/note-performer.hh +++ b/lily/include/note-performer.hh @@ -15,18 +15,19 @@ class Note_performer : public Performer { public: - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Note_performer); + DECLARE_MY_RUNTIME_TYPEINFO; - Note_performer(); + Note_performer(); protected: - virtual void process_requests(); + virtual void do_process_requests(); - virtual bool do_try_request (Request *req_l) ; - virtual void do_print() const; + virtual bool do_try_request (Request *req_l) ; + virtual void do_print() const; private: - Melodic_req * note_req_l_; + Melodic_req * note_req_l_; }; #endif // NOTE_PERFORMER_HH diff --git a/lily/include/notename-table.hh b/lily/include/notename-table.hh index 5e083a6d7c..2e9b0bd9fd 100644 --- a/lily/include/notename-table.hh +++ b/lily/include/notename-table.hh @@ -13,9 +13,9 @@ #include "pointer.hh" #include "string.hh" #include "lily-proto.hh" -#include "assoc.hh" +#include "dictionary.hh" -class Notename_table : Assoc<String, P<Melodic_req> >{ +class Notename_table : Dictionary< P<Melodic_req> >{ public: void add (String, Melodic_req*); Melodic_req*get_l (String); diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 2210b2f4c2..a06674be8d 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -34,22 +34,19 @@ */ class Paper_def : public Music_output_def { Lookup *lookup_p_; - Assoc<String, Real> *real_vars_p_; + Dictionary<Real> *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: virtual ~Paper_def(); + DECLARE_MY_RUNTIME_TYPEINFO; 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 diff --git a/lily/include/parseconstruct.hh b/lily/include/parseconstruct.hh index 1bcf0cc4f7..a48ce2c022 100644 --- a/lily/include/parseconstruct.hh +++ b/lily/include/parseconstruct.hh @@ -13,9 +13,7 @@ String * get_scriptdef (char c); Request* get_script_req (char); Request*get_script_req (int d , Script_def*def); Request*get_text_req (int d , Text_def*def); -Request* get_stemdir_req (int); Request*get_grouping_req (Array<int> i_arr); -Request* get_hshift_req (int); #endif // PARSECONSTRUCT_HH diff --git a/lily/include/performer-group-performer.hh b/lily/include/performer-group-performer.hh index e06dd3b017..da592ef9bf 100644 --- a/lily/include/performer-group-performer.hh +++ b/lily/include/performer-group-performer.hh @@ -12,44 +12,16 @@ #include "parray.hh" #include "plist.hh" #include "performer.hh" -#include "translator.hh" +#include "translator-group.hh" /** Group a number of performers. Usually delegates everything to its contents. */ -class Performer_group_performer : public Performer, public virtual Translator { +class Performer_group_performer : public Performer, public virtual Translator_group { public: - DECLARE_MY_RUNTIME_TYPEINFO; - Input_translator* itrans_l_; - - virtual void add (Performer* perf_p); - virtual bool do_try_request (Request* req_l); - virtual void print() const; - virtual bool try_request (Request* r); - - -protected: - virtual ~Performer_group_performer(); - virtual Translator* find_get_translator_l (String name, String id); - virtual Translator* get_default_interpreter(); - - Translator * ancestor_l (int l = 1); - virtual int depth_i() const; - - virtual void process_requests(); - virtual void do_removal_processing(); - virtual void do_creation_processing(); - - bool is_bottom_performer_b() const; - virtual Performer_group_performer* find_performer_l (String name, String id); - virtual void do_print() const; - -private: - Pointer_list<Performer*> perf_p_list_; - - Link_array<Performer_group_performer> group_l_arr_; - Link_array<Performer> nongroup_l_arr_; + TRANSLATOR_CLONE(Performer_group_performer); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // PERFORMER_GROUP_PERFORMER_HH diff --git a/lily/include/performer.hh b/lily/include/performer.hh index 8e9553f08f..8335f87bc3 100644 --- a/lily/include/performer.hh +++ b/lily/include/performer.hh @@ -13,36 +13,22 @@ #include "request.hh" #include "score-elem-info.hh" #include "staff-info.hh" +#include "translator.hh" /** Convert a music definition into a audio representation. A baseclass */ -class Performer { - bool init_b_; +class Performer : public virtual Translator{ public: - DECLARE_MY_RUNTIME_TYPEINFO; - Performer_group_performer* daddy_perf_l_; - - Performer(); - virtual ~Performer(); - - void print() const; - virtual void process_requests(); - - virtual bool try_request (Request* req_l); - - virtual void do_removal_processing(); - void creation_processing(); - + TRANSLATOR_CLONE(Performer); + DECLARE_MY_RUNTIME_TYPEINFO; + Performer_group_performer* daddy_perf_l() const; protected: - virtual void do_creation_processing(); - virtual bool do_try_request (Request*); - virtual int get_tempo_i() const; - virtual void do_print() const; - virtual void play (Audio_element * elem_p ); + virtual int get_tempo_i() const; + virtual void play (Audio_element * elem_p ); + Performer * performer_l () { return this; } }; -#include "global-performers.hh" #endif // PERFORMER_HH diff --git a/lily/include/property-iterator.hh b/lily/include/property-iterator.hh new file mode 100644 index 0000000000..08eb9bf547 --- /dev/null +++ b/lily/include/property-iterator.hh @@ -0,0 +1,26 @@ +/* + property-iterator.hh -- declare Property_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef PROPERTY_ITERATOR_HH +#define PROPERTY_ITERATOR_HH + +#include "music-iterator.hh" + +class Property_iterator : public Music_iterator +{ + Translation_property *property_l_; + +public: + DECLARE_MY_RUNTIME_TYPEINFO; + Property_iterator (Translation_property* prop_l); +protected: + virtual void process_and_next (Moment); +}; + +#endif // PROPERTY_ITERATOR_HH diff --git a/lily/include/rest-collision-grav.hh b/lily/include/rest-collision-grav.hh index e5ea984324..b763e4c63b 100644 --- a/lily/include/rest-collision-grav.hh +++ b/lily/include/rest-collision-grav.hh @@ -14,15 +14,14 @@ #include "engraver.hh" class Rest_collision_engraver : public Engraver { - Rest_collision* rest_collision_p_; + Rest_collision* rest_collision_p_; - void make_collision(); protected: - virtual void acknowledge_element (Score_elem_info); - virtual void do_print() const; - virtual void do_pre_move_processing(); + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing(); public: - Rest_collision_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Rest_collision_engraver); + Rest_collision_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // REST_COLLISION_GRAV_HH diff --git a/lily/include/rest-collision.hh b/lily/include/rest-collision.hh index 84fe927e5b..cbeaf6fbe8 100644 --- a/lily/include/rest-collision.hh +++ b/lily/include/rest-collision.hh @@ -14,11 +14,10 @@ #include "item.hh" class Rest_collision : public Item { - Link_array<Rest_column> rest_l_arr_; + Link_array<Note_column> rest_l_arr_; Link_array<Note_column> ncol_l_arr_; public: void add (Note_column*); - void add (Rest_column*); DECLARE_MY_RUNTIME_TYPEINFO; Rest_collision(); protected: diff --git a/lily/include/rest-column.hh b/lily/include/rest-column.hh deleted file mode 100644 index 61fafc5bda..0000000000 --- a/lily/include/rest-column.hh +++ /dev/null @@ -1,24 +0,0 @@ -/* - rest-column.hh -- declare Rest_column - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef REST_COLUMN_HH -#define REST_COLUMN_HH - -#include "script-column.hh" -#include "head-column.hh" - -/** struct to treat a set of rests as union (one voice should only - produce one rest. */ -class Rest_column : public Head_column { -public: - DECLARE_MY_RUNTIME_TYPEINFO; - void translate_heads (int dy); -}; - -#endif // REST_COLUMN_HH diff --git a/lily/include/rest-grav.hh b/lily/include/rest-grav.hh new file mode 100644 index 0000000000..974955c2c6 --- /dev/null +++ b/lily/include/rest-grav.hh @@ -0,0 +1,30 @@ +/* + rest-grav.hh -- declare Engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef REST_GRAV_HH +#define REST_GRAV_HH + +#include "engraver.hh" + +class Rest_engraver : public Engraver +{ + Rest_req *rest_req_l_; + Dots * dot_p_; + Rest * rest_p_; +protected: + virtual bool do_try_request (Request *); + virtual void do_pre_move_processing (); + virtual void do_post_move_processing (); + virtual void do_process_requests (); +public: + DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Rest_engraver); + Rest_engraver (); +}; +#endif // REST_GRAV_HH diff --git a/lily/include/rest.hh b/lily/include/rest.hh new file mode 100644 index 0000000000..028e7f8c32 --- /dev/null +++ b/lily/include/rest.hh @@ -0,0 +1,27 @@ +/* + rest.hh -- declare Rest + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef REST_HH +#define REST_HH + +#include "rhythmic-head.hh" + +class Rest : public Rhythmic_head +{ +public: + DECLARE_MY_RUNTIME_TYPEINFO; + + int position_i_; + Rest (); + void add (Dots*); +protected: + virtual void do_add_processing (); + virtual Molecule * brew_molecule_p () const; +}; +#endif // REST_HH diff --git a/lily/include/rhythmic-column-grav.hh b/lily/include/rhythmic-column-grav.hh new file mode 100644 index 0000000000..b9a2e6c78f --- /dev/null +++ b/lily/include/rhythmic-column-grav.hh @@ -0,0 +1,33 @@ +/* + rhythmic-column-grav.hh -- declare Rhythmic_column_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef RHYTHMIC_COLUMN_GRAV_HH +#define RHYTHMIC_COLUMN_GRAV_HH + +#include "engraver.hh" +#include "parray.hh" + +class Rhythmic_column_engraver :public Engraver { + Link_array<Script> script_l_arr_; + Stem * stem_l_; + Note_column *ncol_p_; + Dot_column *dotcol_p_; +protected: + TRANSLATOR_CLONE(Rhythmic_column_engraver); + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); +public: + Rhythmic_column_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; +}; +#endif // RHYTHMIC_COLUMN_GRAV_HH + + + diff --git a/lily/include/rhythmic-head.hh b/lily/include/rhythmic-head.hh new file mode 100644 index 0000000000..361591012d --- /dev/null +++ b/lily/include/rhythmic-head.hh @@ -0,0 +1,32 @@ +/* + rhythmic-head.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef RHYTHMIC_HEAD_HH +#define RHYTHMIC_HEAD_HH + +#include "item.hh" + +class Rhythmic_head : public Item +{ +public: + DECLARE_MY_RUNTIME_TYPEINFO; + + int balltype_i_; + int dots_i_; + Dots * dots_l_; + + void add (Dots *); + Rhythmic_head (); +protected: + virtual void do_add_processing (); + virtual void do_print () const; + virtual void do_substitute_dependent (Score_elem*,Score_elem*); +}; + +#endif // RHYTHMIC_HEAD_HH diff --git a/lily/include/score-align-grav.hh b/lily/include/score-align-grav.hh index dc6eae2b65..6a25ac0271 100644 --- a/lily/include/score-align-grav.hh +++ b/lily/include/score-align-grav.hh @@ -1,5 +1,5 @@ /* - score-align-grav.hh -- declare Score_align_reg + score-align-grav.hh -- declare Type_align_engraver source file of the GNU LilyPond music typesetter @@ -15,17 +15,18 @@ /** Group a number of items across staffs */ -class Score_align_engraver: public Engraver +class Type_align_engraver: public Engraver { - Horizontal_group_item * align_p_; + Horizontal_group_item * align_p_; public: + TRANSLATOR_CLONE(Type_align_engraver); - const char* type_ch_C_; - int priority_i_; - Score_align_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + const char* type_ch_C_; + int priority_i_; + Type_align_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual void acknowledge_element (Score_elem_info); - virtual void do_pre_move_processing(); + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing(); }; #endif // SCORE_ALIGN_GRAV_HH diff --git a/lily/include/score-elem-info.hh b/lily/include/score-elem-info.hh index 17b8172ee6..5e327a4b0e 100644 --- a/lily/include/score-elem-info.hh +++ b/lily/include/score-elem-info.hh @@ -28,8 +28,4 @@ struct Score_elem_info { }; -struct Feature { - Scalar type_; - Scalar value_; -}; #endif // STAFFELEMINFO_HH diff --git a/lily/include/score-grav.hh b/lily/include/score-grav.hh index 6328c9bd26..fcdae480fa 100644 --- a/lily/include/score-grav.hh +++ b/lily/include/score-grav.hh @@ -32,6 +32,7 @@ class Score_engraver : void typeset_all(); public: + TRANSLATOR_CLONE(Score_engraver); Paper_score * pscore_p_; DECLARE_MY_RUNTIME_TYPEINFO; @@ -42,7 +43,6 @@ protected: 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 */ @@ -53,8 +53,8 @@ protected: 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(); + virtual void add_processing (); }; #endif // SCORE_GRAV_HH diff --git a/lily/include/score-halign-grav.hh b/lily/include/score-halign-grav.hh index 330cd310e2..353ad8a061 100644 --- a/lily/include/score-halign-grav.hh +++ b/lily/include/score-halign-grav.hh @@ -11,12 +11,13 @@ #define SCORE_HALIGN_GRAV_HH #include "engraver.hh" class Score_horizontal_align_engraver : public Engraver { - Break_align_item * halign_p_; + Break_align_item * halign_p_; public: - DECLARE_MY_RUNTIME_TYPEINFO; - Score_horizontal_align_engraver(); + TRANSLATOR_CLONE(Score_horizontal_align_engraver); + DECLARE_MY_RUNTIME_TYPEINFO; + Score_horizontal_align_engraver(); protected: - virtual void acknowledge_element (Score_elem_info); - virtual void do_pre_move_processing(); + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing(); }; #endif // SCORE_HALIGN_GRAV_HH diff --git a/lily/include/score-performer.hh b/lily/include/score-performer.hh index 2638962d83..ef2385ad46 100644 --- a/lily/include/score-performer.hh +++ b/lily/include/score-performer.hh @@ -18,26 +18,24 @@ class Score_performer: public Performer_group_performer, public Global_translator { public: + TRANSLATOR_CLONE(Score_performer); DECLARE_MY_RUNTIME_TYPEINFO; Score_performer(); ~Score_performer(); - Audio_score *performance_p_; + Performance *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 start(); + virtual void add_processing (); virtual int get_tempo_i() const; virtual void play (Audio_element* p); virtual Music_output *get_output_p (); private: void header (Midi_stream&); - Moment now_mom_; Audio_column* audio_column_l_; }; diff --git a/lily/include/script-grav.hh b/lily/include/script-grav.hh index 522fe5838a..e0463fcf49 100644 --- a/lily/include/script-grav.hh +++ b/lily/include/script-grav.hh @@ -12,17 +12,18 @@ class Script_engraver : public Engraver { - Array<Script *> script_p_arr_; - Array<Script_req *> script_req_l_arr_; + Array<Script *> script_p_arr_; + Array<Script_req *> script_req_l_arr_; public: - DECLARE_MY_RUNTIME_TYPEINFO; - Script_engraver(); + TRANSLATOR_CLONE(Script_engraver); + DECLARE_MY_RUNTIME_TYPEINFO; + Script_engraver(); protected: - virtual bool do_try_request (Request*); - virtual void do_process_requests(); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); + virtual bool do_try_request (Request*); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); }; diff --git a/lily/include/slur-grav.hh b/lily/include/slur-grav.hh index 6662399cc7..ad57d2443d 100644 --- a/lily/include/slur-grav.hh +++ b/lily/include/slur-grav.hh @@ -11,23 +11,23 @@ #include "engraver.hh" class Slur_engraver :public Engraver { - Array<Slur_req*> requests_arr_; - Array<Slur_req*> new_slur_req_l_arr_; - Array<Slur *> slur_l_stack_; - Array<Slur*> end_slur_l_arr_; - Direction dir_; - /* *************** */ + Array<Slur_req*> requests_arr_; + Array<Slur_req*> new_slur_req_l_arr_; + Array<Slur *> slur_l_stack_; + Array<Slur*> end_slur_l_arr_; + Direction dir_; + /* *************** */ protected: - virtual ~Slur_engraver(); - virtual bool do_try_request (Request*); - virtual void set_feature (Feature); - virtual void do_process_requests(); - virtual void acknowledge_element (Score_elem_info); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); + virtual ~Slur_engraver(); + 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(); public: - Slur_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Slur_engraver); + Slur_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // SLURGRAV_HH diff --git a/lily/include/span-bar-grav.hh b/lily/include/span-bar-grav.hh index 8cb16c1302..87b9911d7d 100644 --- a/lily/include/span-bar-grav.hh +++ b/lily/include/span-bar-grav.hh @@ -20,18 +20,19 @@ */ class Span_bar_engraver : public Engraver { - Span_bar * spanbar_p_; - Array<Bar*> bar_l_arr_; - Vertical_align_element * valign_l_; + Span_bar * spanbar_p_; + Array<Bar*> bar_l_arr_; + Vertical_align_element * valign_l_; public: - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Span_bar_engraver); + DECLARE_MY_RUNTIME_TYPEINFO; - Span_bar_engraver(); + Span_bar_engraver(); protected: - virtual void acknowledge_element (Score_elem_info); - virtual void do_pre_move_processing(); - virtual Span_bar* get_span_bar_p() const; + virtual void acknowledge_element (Score_elem_info); + virtual void do_pre_move_processing(); + virtual Span_bar* get_span_bar_p() const; }; #endif // SPAN_BAR_GRAV_HH diff --git a/lily/include/span-score-bar-grav.hh b/lily/include/span-score-bar-grav.hh index 7881c183e7..fbdb2fb131 100644 --- a/lily/include/span-score-bar-grav.hh +++ b/lily/include/span-score-bar-grav.hh @@ -22,8 +22,9 @@ class Span_score_bar_engraver : public Span_bar_engraver { public: - DECLARE_MY_RUNTIME_TYPEINFO; - virtual Span_bar* get_span_bar_p() const; + TRANSLATOR_CLONE(Span_score_bar_engraver); + DECLARE_MY_RUNTIME_TYPEINFO; + virtual Span_bar* get_span_bar_p() const; }; /** @@ -32,8 +33,9 @@ public: class Piano_bar_engraver : public Span_score_bar_engraver { public: - DECLARE_MY_RUNTIME_TYPEINFO; - virtual Span_bar * get_span_bar_p() const; + TRANSLATOR_CLONE(Piano_bar_engraver); + DECLARE_MY_RUNTIME_TYPEINFO; + virtual Span_bar * get_span_bar_p() const; }; #endif // SPAN_SCORE_BAR_GRAV_HH diff --git a/lily/include/staff-info.hh b/lily/include/staff-info.hh index f5413d9346..72cf266383 100644 --- a/lily/include/staff-info.hh +++ b/lily/include/staff-info.hh @@ -17,7 +17,6 @@ struct Staff_info { int *c0_position_i_l_; Staff_symbol*staff_sym_l_; - /// when is now? Time_description const *time_C_; Rhythmic_grouping const *rhythmic_C_; Score_column *musical_l_; @@ -26,7 +25,6 @@ struct Staff_info { /// bool break_allowed_b_; Score * score_l_; - Moment when(); Score *score_l(); Paper_column * command_pcol_l(); Score_column* musical_l(); diff --git a/lily/include/staff-performer.hh b/lily/include/staff-performer.hh index 53aea0812a..0d80586342 100644 --- a/lily/include/staff-performer.hh +++ b/lily/include/staff-performer.hh @@ -17,20 +17,21 @@ class Staff_performer : public Performer_group_performer { public: - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Staff_performer); + DECLARE_MY_RUNTIME_TYPEINFO; - Staff_performer(); - ~Staff_performer(); + Staff_performer(); + ~Staff_performer(); - String instrument_str(); + String instrument_str(); protected: - virtual void play (Audio_element* p); - virtual void do_removal_processing(); - virtual void do_creation_processing(); + virtual void play (Audio_element* p); + virtual void do_removal_processing(); + virtual void do_creation_processing(); private: - Audio_staff* audio_staff_p_; + Audio_staff* audio_staff_p_; }; #endif // STAFF_PERFORMER_HH diff --git a/lily/include/staff-sym-grav.hh b/lily/include/staff-sym-grav.hh index 3d3f1f3f83..9ec528d767 100644 --- a/lily/include/staff-sym-grav.hh +++ b/lily/include/staff-sym-grav.hh @@ -18,13 +18,14 @@ class Staff_sym_engraver : public Engraver { Staff_symbol *span_p_; public: - Staff_sym_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Staff_sym_engraver); + Staff_sym_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual ~Staff_sym_engraver(); - virtual void fill_staff_info (Staff_info&); - virtual void do_removal_processing(); - virtual void do_creation_processing(); + virtual ~Staff_sym_engraver(); + virtual void fill_staff_info (Staff_info&); + virtual void do_removal_processing(); + virtual void do_creation_processing(); }; #endif // STAFF_SYM_GRAV_HH diff --git a/lily/include/stem-grav.hh b/lily/include/stem-grav.hh index 36a3a0971c..136e6e5095 100644 --- a/lily/include/stem-grav.hh +++ b/lily/include/stem-grav.hh @@ -25,9 +25,9 @@ protected: virtual void acknowledge_element (Score_elem_info); virtual void do_pre_move_processing (); virtual bool do_try_request (Request*); - virtual void set_feature (Feature dir_i_); public: + TRANSLATOR_CLONE(Stem_engraver); Stem_engraver(); DECLARE_MY_RUNTIME_TYPEINFO; }; diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 12380ae48b..a492a3d4d8 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -47,12 +47,9 @@ class Stem : public Item { -1 stem points down, +1: stem points up */ Real stem_xoffset_f_; - /** - store the wholes (for vapourware tremolo) - */ - Link_array<Note_head> whole_l_arr_; + Link_array<Note_head> head_l_arr_; - Link_array<Note_head> rest_l_arr_; + Link_array<Rest> rest_l_arr_; public: /// abbrev flag? + count @@ -77,6 +74,7 @@ public: /// ensure that this Stem also encompasses the Notehead #n# void add (Note_head*n); + void add (Rest*); DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/swallow-grav.hh b/lily/include/swallow-grav.hh index 159f10707c..01f294becf 100644 --- a/lily/include/swallow-grav.hh +++ b/lily/include/swallow-grav.hh @@ -18,9 +18,10 @@ */ class Swallow_engraver : public Engraver { protected: - bool acceptable_request_b (Request*) const; - bool do_try_request (Request*) ; + bool acceptable_request_b (Request*) const; + bool do_try_request (Request*) ; public: - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Swallow_engraver); + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // SWALLOW_GRAV_HH diff --git a/lily/include/swallow-perf.hh b/lily/include/swallow-perf.hh index 9e7218aa88..9f8f551462 100644 --- a/lily/include/swallow-perf.hh +++ b/lily/include/swallow-perf.hh @@ -14,9 +14,10 @@ class Swallow_performer : public Performer { public: - DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Swallow_performer); + DECLARE_MY_RUNTIME_TYPEINFO; protected: - virtual bool do_try_request (Request*) { return true; } + virtual bool do_try_request (Request*) { return true; } }; #endif // SWALLOW_PERF_HH diff --git a/lily/include/symtable.hh b/lily/include/symtable.hh index c0768988b9..1c37f7c565 100644 --- a/lily/include/symtable.hh +++ b/lily/include/symtable.hh @@ -3,11 +3,11 @@ */ #ifndef SYMTABLE_HH #define SYMTABLE_HH -#include "assoc.hh" +#include "dictionary.hh" #include "string.hh" #include "symbol.hh" -struct Symtable : public Assoc<String, Symbol> { +struct Symtable : public Dictionary<Symbol> { String id_str; Symbol lookup (String) const; @@ -15,7 +15,7 @@ struct Symtable : public Assoc<String, Symbol> { }; -struct Symtables : private Assoc<String, Symtable*> { +struct Symtables : private Dictionary<Symtable*> { Symtable* operator()(String s); ~Symtables(); diff --git a/lily/include/text-grav.hh b/lily/include/text-grav.hh deleted file mode 100644 index 8bc0bb44a9..0000000000 --- a/lily/include/text-grav.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* - text-grav.hh -- part of GNU LilyPond - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef TEXTGRAV_HH -#define TEXTGRAV_HH -#include "engraver.hh" - -class Text_engraver : public Engraver{ - Text_item * text_p_; - Text_req * text_req_l_; - Direction dir_; - /* *************** */ -protected: - virtual void set_feature (Feature); - virtual bool do_try_request (Request*); - virtual void do_process_requests(); - virtual void do_pre_move_processing(); - virtual void do_post_move_processing(); - virtual void acknowledge_element (Score_elem_info); -public: - Text_engraver(); - DECLARE_MY_RUNTIME_TYPEINFO; -}; - -#endif // TEXTGRAV_HH diff --git a/lily/include/tie-grav.hh b/lily/include/tie-grav.hh index ecdfd4fea7..b967e42c19 100644 --- a/lily/include/tie-grav.hh +++ b/lily/include/tie-grav.hh @@ -27,12 +27,11 @@ protected: virtual void acknowledge_element (Score_elem_info); virtual bool do_try_request (Request*); virtual bool acceptable_request_b (Request*); - virtual void sync_features(); virtual void do_process_requests(); virtual void do_post_move_processing(); virtual void do_pre_move_processing(); - virtual void set_feature (Feature); public: +TRANSLATOR_CLONE(Tie_engraver); Tie_engraver(); DECLARE_MY_RUNTIME_TYPEINFO; }; diff --git a/lily/include/timing-grav.hh b/lily/include/timing-grav.hh index be8b6730a0..c73ccdd83f 100644 --- a/lily/include/timing-grav.hh +++ b/lily/include/timing-grav.hh @@ -10,30 +10,18 @@ #ifndef TIMING_GRAV_HH #define TIMING_GRAV_HH -#include "engraver.hh" -#include "time-description.hh" -#include "grouping.hh" -#include "parray.hh" +#include "timing-translator.hh" /** Do time bookkeeping */ -class Timing_engraver : public Engraver +class Timing_engraver : public Timing_translator, public Engraver { -public: - Time_description time_; - Rhythmic_grouping default_grouping_; - Link_array<Timing_req> timing_req_l_arr_; -protected: - virtual void do_creation_processing (); +protected: 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(); + virtual Engraver * engraver_l () { return Engraver::engraver_l (); } public: - Meter_change_req * meter_req_l () const; - Timing_engraver(); + TRANSLATOR_CLONE(Timing_engraver); DECLARE_MY_RUNTIME_TYPEINFO; }; diff --git a/lily/include/timing-translator.hh b/lily/include/timing-translator.hh new file mode 100644 index 0000000000..f03459bfc4 --- /dev/null +++ b/lily/include/timing-translator.hh @@ -0,0 +1,35 @@ +/* + timing-translator.hh -- declare Timing_translator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef TIMING_TRANSLATOR_HH +#define TIMING_TRANSLATOR_HH + +#include "translator.hh" +#include "time-description.hh" +#include "grouping.hh" +#include "parray.hh" + +class Timing_translator : public virtual Translator +{ +public: + TRANSLATOR_CLONE(Timing_translator); + Meter_change_req * meter_req_l () const; + Timing_translator (); + DECLARE_MY_RUNTIME_TYPEINFO; + Time_description time_; + Rhythmic_grouping default_grouping_; + Link_array<Timing_req> timing_req_l_arr_; +protected: + virtual void do_creation_processing (); + virtual bool do_try_request (Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); +}; +#endif // TIMING_TRANSLATOR_HH diff --git a/lily/include/translation-property.hh b/lily/include/translation-property.hh new file mode 100644 index 0000000000..7fba807720 --- /dev/null +++ b/lily/include/translation-property.hh @@ -0,0 +1,30 @@ +/* + translation-property.hh -- declare Translation_property + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef TRANSLATION_PROPERTY_HH +#define TRANSLATION_PROPERTY_HH + +#include "music.hh" +#include "scalar.hh" + +/** + Set a property of Translator + */ +class Translation_property : public Music +{ +public: + String var_str_; + Scalar value_; + VIRTUAL_COPY_CONS(Translation_property, Music); + DECLARE_MY_RUNTIME_TYPEINFO; +protected: + virtual void do_print () const; +}; + +#endif // PROPERTY_HH diff --git a/lily/include/translator-change.hh b/lily/include/translator-change.hh new file mode 100644 index 0000000000..a357307f5e --- /dev/null +++ b/lily/include/translator-change.hh @@ -0,0 +1,18 @@ +/* + translator-change.hh -- declare Translator_change + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef TRANSLATOR_CHANGE_HH +#define TRANSLATOR_CHANGE_HH + +class Translator_change : public Music +{ + +} + +#endif // TRANSLATOR_CHANGE_HH diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh new file mode 100644 index 0000000000..13b8ca3d1e --- /dev/null +++ b/lily/include/translator-group.hh @@ -0,0 +1,74 @@ +/* + translator-group.hh -- declare Translator_group + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef TRANSLATOR_GROUP_HH +#define TRANSLATOR_GROUP_HH + +#include "string.hh" +#include "lily-proto.hh" +#include "virtual-methods.hh" +#include "translator.hh" +#include "plist.hh" +#include "parray.hh" + +typedef void (Translator::*Method_pointer)(void); + +/** Make some kind of #Element#s from Requests. Elements are made by + hierarchically grouped #Translator#s + */ +class Translator_group : public virtual Translator { +public: + Pointer_list<Translator *> trans_p_list_; + String id_str_; + Array<String> consists_str_arr_; + Array<String> accepts_str_arr_; + int iterator_count_; + + TRANSLATOR_CLONE(Translator_group); + DECLARE_MY_RUNTIME_TYPEINFO; + + Translator_group(Translator_group const &); + Translator_group(); + void add (Translator *); + + Link_array<Translator> nongroup_l_arr () const; + Link_array<Translator_group> group_l_arr () const; + + virtual Global_translator *global_l() { return 0; } + + /// Score_register = 0, Staff_registers = 1, etc) + Translator_group* ancestor_l (int l=1); + int depth_i() const; + bool is_bottom_translator_b () const; + bool removable_b() const; + void terminate_translator (Translator*r_l); + Translator *remove_translator_p (Translator*trans_l); + void check_removal (); + + Translator *get_simple_translator (char const *type) const; + Translator_group *find_existing_translator_l (String n, String id); + Translator_group *find_create_translator_l (String n, String id); + Link_array<Translator_group> path_to_acceptable_translator (String alias) const; + + Translator_group*get_default_interpreter(); +protected: + virtual ~Translator_group (); + virtual Translator_group * group_l () { return this; } + virtual void do_print () const; + virtual void do_process_requests (); + virtual void add_processing (); + virtual bool do_try_request (Request* req_l); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); + virtual void do_creation_processing(); + virtual void do_removal_processing(); + void each (Method_pointer) const; +}; + +#endif // TRANSLATOR_GROUP_HH diff --git a/lily/include/translator.hh b/lily/include/translator.hh index bfcf734e30..e9fc506a46 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -13,30 +13,103 @@ #include "string.hh" #include "lily-proto.hh" #include "virtual-methods.hh" +#include "scalar.hh" +#include "dictionary.hh" +#include "parray.hh" +#include "input.hh" + +#define TRANSLATOR_CLONE(c) VIRTUAL_COPY_CONS(c, Translator) /** Make some kind of #Element#s from Requests. Elements are made by hierarchically grouped #Translator#s */ -class Translator { +class Translator : public Input { + Dictionary<Scalar> properties_dict_; public: - String id_str_; - - int iterator_count_; - - 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; + Music_output_def * output_def_l_; + String type_str_; + + bool is_alias_b (String) const; + + + DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Translator); + Translator (Translator const &); + Translator (); + virtual ~Translator (); + + Translator_group * daddy_trans_l_ ; + + virtual void add_processing (); + void print () const; + + /** + try to fit the request in this engraver + + @return + false: not noted, not taken. + + true: request swallowed. Don't try to put the request elsewhere. + + */ + bool try_request (Request*); + void pre_move_processing(); + void creation_processing (); + void process_requests(); + void post_move_processing(); + void removal_processing(); + /** + ask daddy for a feature + */ + Scalar get_property (String type_str); + void set_property (String var_name, Scalar value); + Music_output_def *output_def_l () const; + + virtual Moment now_moment () const; + virtual Engraver *engraver_l () { return 0; } + virtual Performer *performer_l() { return 0; } + virtual Translator_group * group_l () { return 0; } + +protected: + enum { + ORPHAN, + VIRGIN, + CREATION_INITED, + MOVE_INITED, + ACCEPTED_REQS, + PROCESSED_REQS, + ACKED_REQS, + MOVE_DONE + } status; + + /* + @see{try_request} + Default: always return false + */ + virtual bool do_try_request (Request *req_l); + virtual void do_print () const; + virtual void do_pre_move_processing(){} + virtual void do_post_move_processing(){} + virtual void do_process_requests () {} + virtual void do_creation_processing() {} + virtual void do_removal_processing() {} }; +/** + A macro to automate administration of translators. + */ +#define ADD_THIS_TRANSLATOR(c) \ +struct c ## init { \ + c ## init() { \ + Translator *t = new c;\ + t-> type_str_ = c::static_name ();\ + add_translator (t);\ + } \ +} _ ## c ## init; + +extern Dictionary<Translator*> *global_translator_dict_p; +void add_translator (Translator*trans_p); + +Translator*get_translator_l (String s); + #endif // TRANSLATOR_HH diff --git a/lily/include/type-swallow-trans.hh b/lily/include/type-swallow-trans.hh new file mode 100644 index 0000000000..0bebd32512 --- /dev/null +++ b/lily/include/type-swallow-trans.hh @@ -0,0 +1,38 @@ +/* + type-swallow-grav.hh -- declare Type_swallow_translator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef TYPESWALLOW_GRAV_HH +#define TYPESWALLOW_GRAV_HH + +#include "translator.hh" +/// eat a certain type of request +class Type_swallow_translator : public virtual Translator +{ +protected: + const char * type_; + bool do_try_request (Request*); +public: + DECLARE_MY_RUNTIME_TYPEINFO; + TRANSLATOR_CLONE(Type_swallow_translator); + Type_swallow_translator (); +}; + +#define DECLARE_REQUEST_SWALLOWER(TYPE) \ +struct TYPE ## _swallow_translator : public Type_swallow_translator {\ + TYPE ## _swallow_translator() { \ + type_ = TYPE::static_name ();\ + }\ + DECLARE_MY_RUNTIME_TYPEINFO;\ + TRANSLATOR_CLONE(TYPE ## _swallow_translator);\ +};\ +IMPLEMENT_IS_TYPE_B1(TYPE ## _swallow_translator, Type_swallow_translator);\ +ADD_THIS_TRANSLATOR(TYPE ## _swallow_translator);\ + +#endif // TYPESWALLOW_GRAV_HH + diff --git a/lily/include/vertical-align-grav.hh b/lily/include/vertical-align-grav.hh index 685073e242..4f26048eee 100644 --- a/lily/include/vertical-align-grav.hh +++ b/lily/include/vertical-align-grav.hh @@ -13,15 +13,16 @@ #include "engraver.hh" class Vertical_align_engraver : public Engraver { - Vertical_align_spanner * valign_p_; + Vertical_align_spanner * valign_p_; public: - DECLARE_MY_RUNTIME_TYPEINFO; - Vertical_align_engraver(); + TRANSLATOR_CLONE(Vertical_align_engraver); + DECLARE_MY_RUNTIME_TYPEINFO; + Vertical_align_engraver(); protected: - virtual void acknowledge_element (Score_elem_info); - virtual void do_creation_processing(); - virtual void do_removal_processing(); + virtual void acknowledge_element (Score_elem_info); + virtual void do_creation_processing(); + virtual void do_removal_processing(); }; #endif // VERTICAL_ALIGN_GRAV_HH diff --git a/lily/include/voice-group-gravs.hh b/lily/include/voice-group-gravs.hh deleted file mode 100644 index e6b9a3de84..0000000000 --- a/lily/include/voice-group-gravs.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* - voice-group-gravs.hh -- declare Voice_group_engravers - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef VOICEGROUPGRAVS_HH -#define VOICEGROUPGRAVS_HH - -#include "engraver-group.hh" - -/** - A group of voices which share certain characteristics (such as beams.). - */ -class Voice_group_engravers : public Engraver_group_engraver { - Moment termination_mom_; - Direction dir_; - -protected: - virtual void do_print() const; - virtual Scalar get_feature (String); - virtual bool do_try_request (Request*); -public: - - - DECLARE_MY_RUNTIME_TYPEINFO; - static bool static_acceptable_request_b (Request*); - Voice_group_engravers(); -}; -#endif // VOICEGROUPGRAVS_HH diff --git a/lily/ineq-constrained-qp.cc b/lily/ineq-constrained-qp.cc index a8cbd0a9db..4455a195b4 100644 --- a/lily/ineq-constrained-qp.cc +++ b/lily/ineq-constrained-qp.cc @@ -35,11 +35,11 @@ Ineq_constrained_qp::eliminate_var (int idx, Real value) row.del (idx); lin +=row ; - for (int i=0; i < cons.size(); i++) - { - consrhs[i] -= cons[i](idx) *value; - cons[i].del (idx); - } + for (int i=0; i < cons.size(); i++) + { + consrhs[i] -= cons[i](idx) *value; + cons[i].del (idx); + } } void @@ -81,12 +81,12 @@ min_elt_index (Vector v) int idx=-1; for (int i = 0; i < v.dim(); i++) { - if (v (i) < m) - { - idx = i; - m = v (i); - } - assert (v (i) <= infinity_f); + if (v (i) < m) + { + idx = i; + m = v (i); + } + assert (v (i) <= infinity_f); } return idx; } @@ -109,11 +109,11 @@ Vector Ineq_constrained_qp::constraint_solve (Vector start) const { if (!dim()) - return Vector (0); + return Vector (0); // experimental if (quad.dim() > 10) - quad.try_set_band(); + quad.try_set_band(); Active_constraints act (this); act.OK(); @@ -121,87 +121,87 @@ Ineq_constrained_qp::constraint_solve (Vector start) const Vector x (start); Vector gradient=quad*x+lin; - // Real fvalue = x*quad*x/2 + lin*x + const_term; - // it's no use. + // Real fvalue = x*quad*x/2 + lin*x + const_term; + // it's no use. Vector last_gradient (gradient); int iterations=0; while (iterations++ < MAXITER) { - Vector direction= - act.find_active_optimum (gradient); + Vector direction= - act.find_active_optimum (gradient); - DOUT << "gradient "<< gradient<< "\ndirection " << direction<<"\n"; + DOUT << "gradient "<< gradient<< "\ndirection " << direction<<"\n"; - if (direction.norm() > EPS) - { - DOUT << act.status() << '\n'; + if (direction.norm() > EPS) + { + DOUT << act.status() << '\n'; - Real minalf = infinity_f; + Real minalf = infinity_f; - Inactive_iter minidx (act); + Inactive_iter minidx (act); - /* + /* we know the optimum on this "hyperplane". Check if we bump into the edges of the simplex */ - for (Inactive_iter ia (act); ia.ok(); ia++) - { + for (Inactive_iter ia (act); ia.ok(); ia++) + { - if (ia.vec() * direction >= 0) - continue; - Real alfa= - (ia.vec()*x - ia.rhs ())/ - (ia.vec()*direction); + if (ia.vec() * direction >= 0) + continue; + Real alfa= - (ia.vec()*x - ia.rhs ())/ + (ia.vec()*direction); - if (minalf > alfa) - { - minidx = ia; - minalf = alfa; - } - } - Real unbounded_alfa = 1.0; - Real optimal_step = min (minalf, unbounded_alfa); - - Vector deltax=direction * optimal_step; - x += deltax; - gradient += optimal_step * (quad * deltax); + if (minalf > alfa) + { + minidx = ia; + minalf = alfa; + } + } + Real unbounded_alfa = 1.0; + Real optimal_step = min (minalf, unbounded_alfa); + + Vector deltax=direction * optimal_step; + x += deltax; + gradient += optimal_step * (quad * deltax); - DOUT << "step = " << optimal_step<< " (|dx| = " << - deltax.norm() << ")\n"; + DOUT << "step = " << optimal_step<< " (|dx| = " << + deltax.norm() << ")\n"; - if (minalf < unbounded_alfa) - { - /* bumped into an edge. try again, in smaller space. */ - act.add (minidx.idx()); - DOUT << "adding cons "<< minidx.idx()<<'\n'; - continue; - } - /*ASSERT: we are at optimal solution for this "plane"*/ + if (minalf < unbounded_alfa) + { + /* bumped into an edge. try again, in smaller space. */ + act.add (minidx.idx()); + DOUT << "adding cons "<< minidx.idx()<<'\n'; + continue; + } + /*ASSERT: we are at optimal solution for this "plane"*/ - } + } - Vector lagrange_mult=act.get_lagrange (gradient); - int m= min_elt_index (lagrange_mult); + Vector lagrange_mult=act.get_lagrange (gradient); + int m= min_elt_index (lagrange_mult); - if (m>=0 && lagrange_mult (m) > 0) - { - break; // optimal sol. - } - else if (m<0) - { - assert (gradient.norm() < EPS) ; + if (m>=0 && lagrange_mult (m) > 0) + { + break; // optimal sol. + } + else if (m<0) + { + assert (gradient.norm() < EPS) ; - break; - } + break; + } - DOUT << "dropping cons " << m<<'\n'; - act.drop (m); + DOUT << "dropping cons " << m<<'\n'; + act.drop (m); } if (iterations >= MAXITER) - WARN<<"didn't converge!\n"; + WARN<<"didn't converge!\n"; DOUT << ": found " << x<<" in " << iterations <<" iterations\n"; assert_solution (x); @@ -215,11 +215,11 @@ Ineq_constrained_qp::solve (Vector start) const /* no hassle if no constraints*/ if (! cons.size()) { - Choleski_decomposition chol (quad); - return - chol.solve (lin); + Choleski_decomposition chol (quad); + return - chol.solve (lin); } else { - return constraint_solve (start); + return constraint_solve (start); } } diff --git a/lily/input-translator.cc b/lily/input-translator.cc deleted file mode 100644 index ff277cc672..0000000000 --- a/lily/input-translator.cc +++ /dev/null @@ -1,137 +0,0 @@ -/* - input-translator.cc -- implement Input_translator - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "debug.hh" -#include "engraver.hh" -#include "input-translator.hh" -#include "parray.hh" -#include "input-translator.hh" -#include "engraver-group.hh" -#include "performer-group-performer.hh" - -bool -Input_translator::is_name_b (String n) -{ - for (int i=0; i < alias_str_arr_.size(); i++) - if (alias_str_arr_[i] == n) - return true; - return false; -} - -void -Input_translator::print() const -{ -#ifndef NPRINT - if (! check_debug) - return ; - DOUT << base_str_ <<" " << type_str_<<" {\n"; - DOUT << "Consists of "; - for (int i=0; i< consists_str_arr_.size(); i++) - DOUT << consists_str_arr_[i] << ','; - if (contains_itrans_p_list_.size()) - DOUT << "\nContains " ; - for (PCursor<Input_translator*> i (contains_itrans_p_list_.top()); i.ok (); i++) - i->print(); - DOUT << "}\n"; -#endif -} - - - -Input_translator * -Input_translator::recursive_find (String nm) -{ - if (is_name_b (nm)) - return this; - - Input_translator * r =0; - // what bout for() ? - PCursor<Input_translator*> i (contains_itrans_p_list_.top()); - for (; !r &&i.ok(); i++) - { - if (i->recursive_find (nm)) - r = i.ptr(); - } - - return r; -} - -Input_translator * -Input_translator::find_itrans_l (String nm) -{ - for (PCursor<Input_translator*> i (contains_itrans_p_list_.top()); i.ok (); i++) - if (i->is_name_b (nm)) - return i; - - return 0; -} - - -Engraver_group_engraver * -Input_translator::get_group_engraver_p() -{ - assert (base_str_ == "Engraver"); - Engraver_group_engraver * grav_p = (Engraver_group_engraver*) - get_engraver_p (type_str_); - - for (int i=0; i < consists_str_arr_.size(); i++) - { - grav_p->add (get_engraver_p (consists_str_arr_[i])); - } - grav_p->itrans_l_ = this; - grav_p->id_str_ = default_id_str_; - return grav_p; -} - -Performer_group_performer* -Input_translator::get_group_performer_p() -{ - assert (base_str_ == "Performer"); - Performer_group_performer * perf_p = (Performer_group_performer*) - get_performer_p (type_str_); - - for (int i=0; i < consists_str_arr_.size(); i++) - { - perf_p->add (get_performer_p (consists_str_arr_[i])); - } - perf_p->itrans_l_ = this; - perf_p->id_str_ = default_id_str_; - return perf_p; -} - -bool -Input_translator::accept_req_b() -{ - return ! contains_itrans_p_list_.size(); -} - -void -Input_translator::add (Input_translator *ip) -{ - contains_itrans_p_list_.bottom().add (ip); -} - -Input_translator* -Input_translator::get_default_itrans_l() -{ - if (contains_itrans_p_list_.size()) - return contains_itrans_p_list_.top(); - else - return 0; -} - - -Input_translator_list::Input_translator_list (Input_translator_list const &s) -{ - for (PCursor<Input_translator*> pc (s); pc.ok(); pc++) - { - Input_translator *q = pc; - Input_translator *p=new Input_translator (*q) ; - bottom().add (p); - } -} diff --git a/lily/key-grav.cc b/lily/key-grav.cc index f2d81ae907..f8d47a0830 100644 --- a/lily/key-grav.cc +++ b/lily/key-grav.cc @@ -126,4 +126,4 @@ Key_engraver::do_post_move_processing() IMPLEMENT_IS_TYPE_B1(Key_engraver,Engraver); -ADD_THIS_ENGRAVER(Key_engraver); +ADD_THIS_TRANSLATOR(Key_engraver); diff --git a/lily/key-item.cc b/lily/key-item.cc index 5fbfd29f39..d328f44ac9 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -74,7 +74,7 @@ Key_item::brew_molecule_p() const Atom a (s); a.translate ((c_position + pitch[i]) * inter, Y_AXIS); Molecule m (a); - output->add_right (m); + output->add_at_edge (X_AXIS, RIGHT, m); } if (pitch.size()) { @@ -82,7 +82,7 @@ Key_item::brew_molecule_p() const Interval (0, paper()->note_width ()), Interval (0,0)))); - output->add_right (m); + output->add_at_edge (X_AXIS, RIGHT, m); } return output; } diff --git a/lily/key-performer.cc b/lily/key-performer.cc index 160dee4a64..bca4c5c106 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -13,7 +13,7 @@ IMPLEMENT_IS_TYPE_B1(Key_performer,Performer); -ADD_THIS_PERFORMER(Key_performer); +ADD_THIS_TRANSLATOR(Key_performer); Key_performer::Key_performer() { @@ -34,7 +34,7 @@ Key_performer::do_print() const } void -Key_performer::process_requests() +Key_performer::do_process_requests() { if (key_req_l_) play (new Audio_key (key_req_l_)); diff --git a/lily/line-group-grav.cc b/lily/line-group-grav.cc index 5915e78544..a975b75cc6 100644 --- a/lily/line-group-grav.cc +++ b/lily/line-group-grav.cc @@ -48,5 +48,5 @@ Line_group_engraver::do_creation_processing() IMPLEMENT_IS_TYPE_B1(Line_group_engraver,Engraver); -ADD_THIS_ENGRAVER(Line_group_engraver); +ADD_THIS_TRANSLATOR(Line_group_engraver); diff --git a/lily/local-key-grav.cc b/lily/local-key-grav.cc index 7da053d418..ab566e1216 100644 --- a/lily/local-key-grav.cc +++ b/lily/local-key-grav.cc @@ -122,4 +122,4 @@ Local_key_engraver::do_process_requests() IMPLEMENT_IS_TYPE_B1(Local_key_engraver,Engraver); -ADD_THIS_ENGRAVER(Local_key_engraver); +ADD_THIS_TRANSLATOR(Local_key_engraver); diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 33037e26ea..eab94bf659 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -43,8 +43,8 @@ Local_key_item::add (int o, int p , int a) l.name_i_ = p; l.accidental_i_ = a; for (int i=0; i< accs.size(); i++) - if (!Local_acc::compare (l, accs[i])) - return; + if (!Local_acc::compare (l, accs[i])) + return; accs.push (l); } @@ -63,33 +63,33 @@ Local_key_item::brew_molecule_p() const int lastoct = -100; for (int i = 0; i < accs.size(); i++) { - // do one octave - if (accs[i].octave_i_ != lastoct) - { - if (octmol) - { - Real dy =lastoct*7*paper()->internote_f (); - octmol->translate (dy, Y_AXIS); - output->add (*octmol); - delete octmol; - } - octmol= new Molecule; - } - lastoct = accs[i].octave_i_; - Symbol s =paper()->lookup_l ()->accidental (accs[i].accidental_i_); - Atom a (s); - Real dy = (accs[i].name_i_ + c0_position) * paper()->internote_f (); - a.translate (dy, Y_AXIS); - - octmol->add_right (a); + // do one octave + if (accs[i].octave_i_ != lastoct) + { + if (octmol) + { + Real dy =lastoct*7*paper()->internote_f (); + octmol->translate (dy, Y_AXIS); + output->add (*octmol); + delete octmol; + } + octmol= new Molecule; + } + lastoct = accs[i].octave_i_; + Symbol s =paper()->lookup_l ()->accidental (accs[i].accidental_i_); + Atom a (s); + Real dy = (accs[i].name_i_ + c0_position) * paper()->internote_f (); + a.translate (dy, Y_AXIS); + + octmol->add_at_edge (X_AXIS, RIGHT, a); } if (octmol) { - Real dy =lastoct*7*paper()->internote_f (); - octmol->translate (dy, Y_AXIS); - output->add (*octmol); - delete octmol; + Real dy =lastoct*7*paper()->internote_f (); + octmol->translate (dy, Y_AXIS); + output->add (*octmol); + delete octmol; } Interval head_width=itemlist_width (support_items_); @@ -102,9 +102,9 @@ int Local_acc::compare (Local_acc&a, Local_acc&b) { if (a.octave_i_ - b.octave_i_) - return a.octave_i_ - b.octave_i_; + return a.octave_i_ - b.octave_i_; if (a.name_i_ - b.name_i_) - return a.name_i_ - b.name_i_; + return a.name_i_ - b.name_i_; return a.accidental_i_ - b.accidental_i_; }; diff --git a/lily/lyric-grav.cc b/lily/lyric-grav.cc index a10cf614b2..346ade0301 100644 --- a/lily/lyric-grav.cc +++ b/lily/lyric-grav.cc @@ -24,7 +24,7 @@ Lyric_engraver::do_try_request (Request*r) { Musical_req * m =r->musical(); if (!m || ! m->lreq_l()) - return false; + return false; lreq_l_ = m->lreq_l(); return true; @@ -35,12 +35,12 @@ Lyric_engraver::do_process_requests() { if (lreq_l_) { - lyric_item_p_ = new Text_item (lreq_l_->tdef_p_); + lyric_item_p_ = new Text_item (lreq_l_->tdef_p_); - lyric_item_p_->translate (paper()->note_width ()/2 , X_AXIS); - lyric_item_p_->dir_ = DOWN; - lyric_item_p_->fat_b_ = true; - announce_element (Score_elem_info (lyric_item_p_, lreq_l_)); + lyric_item_p_->translate (paper()->note_width ()/2 , X_AXIS); + lyric_item_p_->dir_ = DOWN; + lyric_item_p_->fat_b_ = true; + announce_element (Score_elem_info (lyric_item_p_, lreq_l_)); } } @@ -55,11 +55,11 @@ Lyric_engraver::do_pre_move_processing() { if (lyric_item_p_) { - typeset_element (lyric_item_p_); - lyric_item_p_ =0; + typeset_element (lyric_item_p_); + lyric_item_p_ =0; } } IMPLEMENT_IS_TYPE_B1(Lyric_engraver,Engraver); -ADD_THIS_ENGRAVER(Lyric_engraver); +ADD_THIS_TRANSLATOR(Lyric_engraver); diff --git a/lily/lyric-performer.cc b/lily/lyric-performer.cc index 9a7fef130c..f55844044c 100644 --- a/lily/lyric-performer.cc +++ b/lily/lyric-performer.cc @@ -14,7 +14,7 @@ IMPLEMENT_IS_TYPE_B1(Lyric_performer,Performer); -ADD_THIS_PERFORMER(Lyric_performer); +ADD_THIS_TRANSLATOR(Lyric_performer); Lyric_performer::Lyric_performer() { @@ -34,7 +34,7 @@ Lyric_performer::do_print() const } void -Lyric_performer::process_requests() +Lyric_performer::do_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_)); diff --git a/lily/main.cc b/lily/main.cc index 259f95f651..efba1f0c29 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -106,12 +106,12 @@ 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 +"\'"); return ; } - if (file_str!= "" && path.find (file_str) == "") + if (file_str && !path.find (file_str)) { error ("Can not find `" + file_str + "'"); return ; @@ -216,7 +216,7 @@ destill_inname (String &name_str_r) split_path (name_str_r,a,b,c,d); // add extension if not present. - if (d == "") + if (!d) d = ".ly"; name_str_r = a+b+c+d; } diff --git a/lily/meter-grav.cc b/lily/meter-grav.cc index 378acbc741..70ca2af2bc 100644 --- a/lily/meter-grav.cc +++ b/lily/meter-grav.cc @@ -11,6 +11,7 @@ #include "command-request.hh" #include "timing-grav.hh" #include "engraver-group.hh" + Meter_engraver::Meter_engraver() { meter_p_ =0; @@ -20,7 +21,8 @@ void Meter_engraver::do_process_requests() { Timing_engraver * timing_grav_l= (Timing_engraver*) - daddy_grav_l_->get_simple_engraver (Timing_engraver::static_name()); + daddy_grav_l()->get_simple_translator (Timing_engraver::static_name()) + ->engraver_l (); Meter_change_req *req = timing_grav_l->meter_req_l(); if (req) @@ -47,5 +49,5 @@ Meter_engraver::do_pre_move_processing() } -ADD_THIS_ENGRAVER(Meter_engraver); +ADD_THIS_TRANSLATOR(Meter_engraver); IMPLEMENT_IS_TYPE_B1(Meter_engraver,Engraver); diff --git a/lily/meter-performer.cc b/lily/meter-performer.cc index 63eb06946b..b7206c2b78 100644 --- a/lily/meter-performer.cc +++ b/lily/meter-performer.cc @@ -11,7 +11,7 @@ #include "audio-item.hh" IMPLEMENT_IS_TYPE_B1(Meter_performer,Performer); -ADD_THIS_PERFORMER(Meter_performer); +ADD_THIS_TRANSLATOR(Meter_performer); Meter_performer::Meter_performer() { @@ -32,7 +32,7 @@ Meter_performer::do_print() const } void -Meter_performer::process_requests() +Meter_performer::do_process_requests() { if (meter_req_l_) play (new Audio_meter (meter_req_l_)); diff --git a/lily/midi-def.cc b/lily/midi-def.cc index c3ffe65d47..7fc60a1d64 100644 --- a/lily/midi-def.cc +++ b/lily/midi-def.cc @@ -9,8 +9,8 @@ #include <math.h> #include "misc.hh" #include "midi-def.hh" -#include "input-translator.hh" -#include "audio-score.hh" +#include "translator.hh" +#include "performance.hh" #include "assoc-iter.hh" #include "score-performer.hh" #include "debug.hh" @@ -21,30 +21,22 @@ // destructor // routines, alphasorted -// statics Midi_def -// ugh - -int Midi_def::den_i_s = 4; -int Midi_def::num_i_s = 4; - Midi_def::Midi_def() { outfile_str_ = ""; - itrans_p_ = 0; // ugh set_tempo (Moment (1, 4), 60); } Midi_def::Midi_def (Midi_def const& s) + : Music_output_def (s) { whole_seconds_f_ = s.whole_seconds_f_; - itrans_p_ = s.itrans_p_ ? new Input_translator (*s.itrans_p_) : 0; outfile_str_ = s.outfile_str_; } Midi_def::~Midi_def() { - delete itrans_p_; } Real @@ -56,17 +48,7 @@ Midi_def::duration_to_seconds_f (Moment mom) return Moment (whole_seconds_f_) * mom; } -Global_translator* -Midi_def::get_global_translator_p() -{ - 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) @@ -85,12 +67,6 @@ Midi_def::print() const #endif } -void -Midi_def::set (Input_translator* itrans_p) -{ - delete itrans_p_; - itrans_p_ = itrans_p; -} void Midi_def::set_tempo (Moment moment, int count_per_minute_i) diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index 0521e87c75..874f367a42 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -30,13 +30,13 @@ Midi_stream::~Midi_stream() Midi_stream& Midi_stream::operator <<(String str) { - if (check_debug) - str = String_convert::bin2hex_str (str); + if (check_debug && !monitor->silence("Midistrings")) + str = String_convert::bin2hex_str (str); *os_p_ << str; - if (check_debug) - *os_p_ << "\n"; + if (check_debug && !monitor->silence("Midistrings")) + *os_p_ << "\n"; return *this; } @@ -44,10 +44,10 @@ Midi_stream::operator <<(String str) Midi_stream& Midi_stream::operator <<(Midi_item const& mitem_c_r) { -// *this << mitem_c_r.str(); + // *this << mitem_c_r.str(); mitem_c_r.output (this); - if (check_debug) - *os_p_ << "\n"; + if (check_debug && !monitor->silence("Midistrings")) + *os_p_ << "\n"; return *this; } @@ -64,5 +64,5 @@ Midi_stream::open() { os_p_ = new ofstream (filename_str_); if (!*os_p_) - error ("can't open `" + filename_str_ + "\'"); + error ("can't open `" + filename_str_ + "\'"); } diff --git a/lily/molecule.cc b/lily/molecule.cc index ad176da26f..e37f9e7c33 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -19,7 +19,7 @@ Molecule::TeX_string() const { String s; for (iter_top (ats,c); c.ok(); c++) - s+=c->TeX_string(); + s+=c->TeX_string(); return s; } @@ -28,7 +28,7 @@ Molecule::extent() const { Box b; for (iter_top (ats,c); c.ok(); c++) - b.unite (c->extent()); + b.unite (c->extent()); return b; } @@ -36,14 +36,14 @@ void Molecule::translate (Offset o) { for (iter_top (ats,c); c.ok(); c++) - c->translate (o); + c->translate (o); } void Molecule::translate (Real x,Axis a) { for (iter_top (ats,c); c.ok(); c++) - c->translate (x,a); + c->translate (x,a); } void @@ -51,71 +51,27 @@ Molecule::add (Molecule const &m) { for (iter_top (m.ats,c); c.ok(); c++) { - add (**c); + add (**c); } } -void -Molecule::add_right (Molecule const &m) -{ - if (!ats.size()) - { - add (m); - return; - } - Real xof=extent().x ().right - m.extent ().x ().left; - - - Molecule toadd (m); - toadd.translate (Offset (xof, 0.0)); - add (toadd); -} - -void -Molecule::add_left (Molecule const &m) -{ - if (!ats.size()) - { - add (m); - return; - } - Real xof=extent().x ().left - m.extent ().x ().right; - - Molecule toadd (m); - toadd.translate (Offset (xof, 0.0)); - add (toadd); -} - - -void -Molecule::add_top (Molecule const &m) -{ - if (!ats.size()) - { - add (m); - return; - } - Real yof=extent().y ().right - m.extent ().y ().left; - - Molecule toadd (m); - toadd.translate (yof, Y_AXIS); - add (toadd); -} void -Molecule::add_bottom (Molecule const &m) +Molecule::add_at_edge (Axis a, Direction d, Molecule const &m) { if (!ats.size()) { - add (m); - return; + add (m); + return; } - Real yof=extent().y ().left- m.extent ().y ().right; + Real offset = extent ()[a][d] - m.extent ()[a][-d]; Molecule toadd (m); - toadd.translate (yof, Y_AXIS); + toadd.translate (offset, a); add (toadd); } + + void Molecule::operator = (Molecule const &) { @@ -132,9 +88,9 @@ Molecule::print() const { #ifndef NPRINT if (! check_debug) - return; + return; for (iter_top (ats,c); c.ok(); c++) - c->print(); + c->print(); #endif } diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index ef36b59d14..d05b752df0 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -9,10 +9,11 @@ #include "music-list.hh" #include "music-iterator.hh" #include "voice-iterator.hh" +#include "property-iterator.hh" #include "chord-iterator.hh" #include "request-iterator.hh" -#include "translator.hh" - +#include "translator-group.hh" +#include "translation-property.hh" IMPLEMENT_IS_TYPE_B(Music_iterator); @@ -41,11 +42,11 @@ Music_iterator::print() const #endif } -Translator * +Translator_group* Music_iterator::get_req_translator_l() { assert (report_to_l()); - if (report_to_l()->is_bottom_engraver_b ()) + if (report_to_l()->is_bottom_translator_b ()) return report_to_l(); set_translator (report_to_l()->get_default_interpreter ()); @@ -53,7 +54,7 @@ Music_iterator::get_req_translator_l() } void -Music_iterator::push_translator (Translator*t) +Music_iterator::push_translator (Translator_group*t) { report_to_l_arr_.push (t); t->iterator_count_ ++; @@ -67,7 +68,7 @@ Music_iterator::pop_translator() report_to_l_arr_.pop(); } -Translator* +Translator_group* Music_iterator::report_to_l() const { if (! report_to_l_arr_.size()) @@ -77,7 +78,7 @@ Music_iterator::report_to_l() const void -Music_iterator::set_translator (Translator*trans) +Music_iterator::set_translator (Translator_group*trans) { if (report_to_l()==trans) return; @@ -118,7 +119,7 @@ Music_iterator::ok() const Music_iterator* Music_iterator::static_get_iterator_p (Music *m, - Translator *report_l) + Translator_group*report_l) { Music_iterator * p =0; if (m->is_type_b (Request_chord::static_name())) @@ -127,11 +128,13 @@ Music_iterator::static_get_iterator_p (Music *m, p = new Chord_iterator ((Chord*) m); else if (m->is_type_b (Voice::static_name())) p = new Voice_iterator ((Voice*) m); - - if (m -> type_str_ != "") + else if (m->is_type_b (Translation_property::static_name ())) + p = new Property_iterator((Translation_property *) m); + + if (m -> translator_type_str_) { - Translator * a =report_l-> - find_get_translator_l (m-> type_str_, m->id_str_); + Translator_group* a =report_l-> + find_create_translator_l (m-> translator_type_str_, m->translator_id_str_); p->set_translator (a); } diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index 5de256a365..0c93fb55ab 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -6,7 +6,71 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ +#include "debug.hh" #include "music-output-def.hh" +#include "global-translator.hh" +#include "dictionary-iter.hh" IMPLEMENT_IS_TYPE_B(Music_output_def); +Music_output_def::Music_output_def () +{ +} + +Music_output_def::~Music_output_def () +{ + for (Dictionary_iter<Translator*> i (translator_p_dict_); i.ok (); i++) + delete i.val (); +} + +Music_output_def::Music_output_def (Music_output_def const &s) +{ + for (Dictionary_iter<Translator*> i (s.translator_p_dict_); i.ok (); i++) + assign_translator (i.key (), i.val ()->clone ()); +} + +Translator* +Music_output_def::find_translator_l (String name) const +{ + if (translator_p_dict_.elt_b (name)) + return translator_p_dict_[name]; + + if (global_translator_dict_p->elt_b (name)) + return (*global_translator_dict_p)[name]; + + return 0; +} + + +Global_translator * +Music_output_def::get_global_translator_p () +{ + Translator * t = find_translator_l ("Score")->clone (); + Global_translator *g = t->group_l ()->global_l (); + t->add_processing (); + + return g; +} + + +void +Music_output_def::assign_translator (String s, Translator*t) +{ + t->type_str_ = s; + t->output_def_l_ = this; + if (translator_p_dict_.elt_b (s)) + delete translator_p_dict_[s]; + translator_p_dict_[s] = t; +} + +void +Music_output_def::print () const +{ +#ifndef NPRINT + for (Dictionary_iter<Translator*> i (translator_p_dict_); i.ok (); i++) + { + DOUT << i.key () << " = "; + i.val ()->print (); + } +#endif +} diff --git a/lily/music.cc b/lily/music.cc index 7de77d1fc9..053275cc1f 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -24,8 +24,8 @@ Music::print() const if (! check_debug) return ; DOUT << name() << "{"; - if (type_str_!="" || id_str_!="") - DOUT << "`" <<type_str_ << " = " << id_str_<<"\'"; + if (translator_type_str_) + DOUT << translator_type_str_ << " = " << translator_id_str_; do_print(); DOUT << "}\n"; #endif diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index f09f0dd6c8..13a479956c 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -22,7 +22,6 @@ static Keyword_ent the_key_tab[]={ {"accepts", ACCEPTS}, - {"alias", ALIAS}, {"bar", BAR}, {"cadenza", CADENZA}, {"clear", CLEAR}, @@ -32,11 +31,9 @@ static Keyword_ent the_key_tab[]={ {"contains", CONTAINS}, {"duration", DURATION}, {"absdynamic", ABSDYNAMIC}, - {"group", GROUP}, - {"hshift", HSHIFT}, - {"id", ID}, {"in", IN_T}, - {"requesttranslator", REQUESTTRANSLATOR}, + {"translator", TRANSLATOR}, + {"type", TYPE}, {"lyric", LYRIC}, {"key", KEY}, {"melodic" , MELODIC}, @@ -52,12 +49,12 @@ static Keyword_ent the_key_tab[]={ {"partial", PARTIAL}, {"paper", PAPER}, {"plet", PLET}, + {"property", PROPERTY}, {"pt", PT_T}, {"score", SCORE}, {"script", SCRIPT}, {"skip", SKIP}, {"staff", STAFF}, - {"stem", STEM}, {"table", TABLE}, {"spandynamic", SPANDYNAMIC}, {"symboltables", SYMBOLTABLES}, @@ -73,7 +70,7 @@ static Keyword_ent the_key_tab[]={ My_lily_lexer::My_lily_lexer() { keytable_p_ = new Keyword_table (the_key_tab); - identifier_assoc_p_ = new Assoc<String, Identifier*>; + identifier_p_dict_p_ = new Dictionary<Identifier*>; errorlevel_i_ = 0; post_quotes_b_ = false; note_tab_p_ = new Notename_table; @@ -88,10 +85,10 @@ My_lily_lexer::lookup_keyword (String s) Identifier* My_lily_lexer::lookup_identifier (String s) { - if (!identifier_assoc_p_->elt_b (s)) - return 0; + if (!identifier_p_dict_p_->elt_b (s)) + return 0; - return (*identifier_assoc_p_)[s]; + return (*identifier_p_dict_p_)[s]; } @@ -101,10 +98,10 @@ My_lily_lexer::set_identifier (String name_str, Identifier*i) Identifier *old = lookup_identifier (name_str); if (old) { - old->warning("redeclaration of \\" + name_str); - delete old; + old->warning("redeclaration of \\" + name_str); + delete old; } - (*identifier_assoc_p_)[name_str] = i; + (*identifier_p_dict_p_)[name_str] = i; } My_lily_lexer::~My_lily_lexer() @@ -112,25 +109,25 @@ My_lily_lexer::~My_lily_lexer() delete keytable_p_; for (Assoc_iter<String,Identifier*> - ai (*identifier_assoc_p_); ai.ok(); ai++) - { - DOUT << "deleting: " << ai.key()<<'\n'; - delete ai.val(); + ai (*identifier_p_dict_p_); ai.ok(); ai++) + { + DOUT << "deleting: " << ai.key()<<'\n'; + delete ai.val(); } delete note_tab_p_; - delete identifier_assoc_p_; + delete identifier_p_dict_p_; } void My_lily_lexer::print_declarations (bool init_b) const { - for (Assoc_iter<String,Identifier*> ai (*identifier_assoc_p_); ai.ok(); - ai++) - { - if (ai.val()->init_b_ == init_b) - { - DOUT << ai.key() << '='; - ai.val()->print (); - } + for (Assoc_iter<String,Identifier*> ai (*identifier_p_dict_p_); + ai.ok(); ai++) + { + if (ai.val()->init_b_ == init_b) + { + DOUT << ai.key() << '='; + ai.val()->print (); + } } } @@ -139,15 +136,13 @@ My_lily_lexer::LexerError (char const *s) { if (include_stack_.empty()) { - *mlog << "error at EOF" << s << '\n'; + *mlog << "error at EOF" << s << '\n'; } else { - errorlevel_i_ |= 1; - - Input spot (source_file_l(),here_ch_C()); - - spot.error (s); + errorlevel_i_ |= 1; + Input spot (source_file_l(),here_ch_C()); + spot.error (s); } } diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index 9878369e16..d03e29ffec 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -90,6 +90,11 @@ My_lily_parser::parse_file (String init, String s) set_debug(); lexer_p_->new_input (init, source_l_); do_yyparse(); + + if (error_level_i_) + { + error ("Found errors in init files"); + } print_declarations(); init_parse_b_ = false; diff --git a/lily/note-column-grav.cc b/lily/note-column-grav.cc deleted file mode 100644 index a77557793e..0000000000 --- a/lily/note-column-grav.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* - note-column-reg.cc -- implement Note_column_engraver - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "note-column-grav.hh" -#include "note-head.hh" -#include "stem.hh" -#include "note-column.hh" -#include "script.hh" -#include "rest-column.hh" - -bool -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()); -} -Note_column* -Note_column_engraver::note_col_l() -{ - if (!ncol_p_) - { - ncol_p_ = new Note_column; - announce_element (Score_elem_info (ncol_p_, 0)); - } - return ncol_p_; -} - -Rest_column * -Note_column_engraver::rest_col_l() -{ - if (!restcol_p_) - { - restcol_p_ = new Rest_column; - announce_element (Score_elem_info (restcol_p_,0)); - } - return restcol_p_; -} - -void -Note_column_engraver::acknowledge_element (Score_elem_info i) -{ - if (!acceptable_elem_b (i.elem_l_)) - 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()); - } - 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); - - } - else if (nC == Stem::static_name()) - { - stem_l_ = (Stem*)i.elem_l_->item(); - } - - 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_); - } - - - 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(); - } - -} - -void -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_) - ncol_p_->dir_ = dir_; - - typeset_element (ncol_p_); - ncol_p_ =0; - } - if (restcol_p_) - { - if (! restcol_p_->dir_) - restcol_p_->dir_ = dir_; - - typeset_element (restcol_p_); - restcol_p_ =0; - } -} - -void -Note_column_engraver::do_post_move_processing() -{ - script_l_arr_.clear(); - stem_l_ =0; -} - -void -Note_column_engraver::set_feature (Feature i) -{ - 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_ =CENTER; - h_shift_b_ = false; - - ncol_p_=0; - restcol_p_ =0; - do_post_move_processing(); -} - - -IMPLEMENT_IS_TYPE_B1(Note_column_engraver,Engraver); -ADD_THIS_ENGRAVER(Note_column_engraver); diff --git a/lily/note-column.cc b/lily/note-column.cc index f310d0828c..fb70c3e7a6 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -5,18 +5,27 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ - +#include "dot-column.hh" #include "note-column.hh" #include "script.hh" #include "note-head.hh" #include "stem.hh" +#include "rest.hh" +#include "debug.hh" +IMPLEMENT_IS_TYPE_B1(Note_column,Script_column); -IMPLEMENT_IS_TYPE_B1(Note_column,Head_column); +bool +Note_column::rest_b () const +{ + return rest_l_arr_.size (); +} Note_column::Note_column() { - h_shift_b_ =false; + stem_l_ = 0; + h_shift_b_ = false; + dir_ =CENTER; } void @@ -30,19 +39,107 @@ Note_column::head_positions_interval() const { ((Note_column*)this)->sort(); return Interval_t<int> (head_l_arr_[0]->position_i_, - head_l_arr_.top()->position_i_); + head_l_arr_.top()->position_i_); } - void Note_column::do_pre_processing() { - if (!dir_&& !stem_l_) + + if (!dir_) { - dir_ = (head_positions_interval().center () >= 5) ? DOWN:UP; + if (stem_l_) + dir_ = stem_l_->dir_; + else if (head_l_arr_.size ()) + { + dir_ = (head_positions_interval().center () >= 5) ? DOWN:UP; + } } - Head_column::do_pre_processing(); + Script_column::do_pre_processing(); } + +void +Note_column::set (Stem * stem_l) +{ + add_support (stem_l); + stem_l_ = stem_l; + /* + don't add stem to support; mostly invisible for rest-columns (and possibly taken . .) + + */ + Score_elem::add_dependency (stem_l); + for (int i=0; i < script_l_arr_.size(); i++) + script_l_arr_[i]->set_stem (stem_l); + +} + +void +Note_column::add (Script *script_l) +{ + Script_column::add (script_l) ; + if (stem_l_) + script_l->set_stem (stem_l_); +} + +void +Note_column::do_substitute_dependency (Score_elem*o, Score_elem*n) +{ + if (stem_l_ == o) + { + stem_l_ = n ? (Stem*)n->item():0; + } + if (o->is_type_b (Note_head::static_name ())) + { + head_l_arr_.substitute ((Note_head*)o->item(), + (n)? (Note_head*)n->item() : 0); + } + Script_column::do_substitute_dependency (o,n); + if (o->is_type_b (Rest::static_name ())) + { + rest_l_arr_.substitute ((Rest*)o->item(), + (n)? (Rest*)n->item() : 0); + } +} + +void +Note_column::add (Rhythmic_head *h) +{ + if (h->is_type_b (Rest::static_name ())) + { + rest_l_arr_.push ((Rest*)h); + add_support (h); + } + if (h->is_type_b (Note_head::static_name ())) + { + head_l_arr_.push ((Note_head*) h); + add_support (h); + } +} + +/** + translate the rest symbols + */ +void +Note_column::translate_rests (int dy_i) +{ + for (int i=0; i < rest_l_arr_.size(); i++) + rest_l_arr_[i]->position_i_ += dy_i; +} + +void +Note_column::do_print() const +{ +#ifndef NPRINT + DOUT << "rests: " << rest_l_arr_.size() << ", "; + DOUT << "heads: " << head_l_arr_.size(); +#endif +} + +void +Note_column::set (Dot_column *d) +{ + add_element (d); +} diff --git a/lily/note-performer.cc b/lily/note-performer.cc index 9ae829f7ff..4b60d69229 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -7,15 +7,12 @@ */ #include "note-performer.hh" -#include "translator.hh" -#include "input-translator.hh" #include "musical-request.hh" #include "audio-item.hh" #include "debug.hh" IMPLEMENT_IS_TYPE_B1(Note_performer,Performer); - -ADD_THIS_PERFORMER(Note_performer); +ADD_THIS_TRANSLATOR(Note_performer); Note_performer::Note_performer() { @@ -28,17 +25,17 @@ Note_performer::do_print() const #ifndef NPRINT if (note_req_l_) { - note_req_l_->print(); + note_req_l_->print(); } #endif } void -Note_performer::process_requests() +Note_performer::do_process_requests() { // this is _really_ braindead, but it generates some output if (!note_req_l_ || !note_req_l_->melodic() || !note_req_l_->rhythmic ()) - return; + return; play (new Audio_note (note_req_l_)); note_req_l_ = 0; @@ -48,10 +45,10 @@ bool Note_performer::do_try_request (Request* req_l) { if (note_req_l_) - return false; + return false; if (!req_l->musical() || !req_l->musical ()->note ()) - return false; + return false; note_req_l_ = req_l->musical()->melodic (); return true; diff --git a/lily/note.cc b/lily/note.cc index 6bb466a5af..caa6abf3da 100644 --- a/lily/note.cc +++ b/lily/note.cc @@ -23,24 +23,24 @@ get_scriptdef (char c) String s; switch (c) { - case '^' : s = "marcato"; - break; - case '+' : s = "stopped"; - break; - case '-' : s = "tenuto"; - break; - case '|': s = "staccatissimo"; - break; - case 'o' : s = ""; - break; - case '>' : s = "accent"; - break; - case 'v' : s = ""; - break; - case '.' : s = "staccato"; - break; - default: - assert (false); + case '^' : s = "marcato"; + break; + case '+' : s = "stopped"; + break; + case '-' : s = "tenuto"; + break; + case '|': s = "staccatissimo"; + break; + case 'o' : s = ""; + break; + case '>' : s = "accent"; + break; + case 'v' : s = ""; + break; + case '.' : s = "staccato"; + break; + default: + assert (false); } return new String (s); } @@ -56,23 +56,7 @@ get_script_req (int d , General_script_def*def) -Request* -get_stemdir_req (int d) -{ - d = sign (long (d)); - Group_feature_req * gfreq_p = new Group_feature_req; - gfreq_p->type_str_ = "vdir"; - gfreq_p->value_str_ = String (d); - return gfreq_p; -} -Request* -get_hshift_req (int i) -{ - Group_feature_req * gfreq_p = new Group_feature_req; - gfreq_p->type_str_ = "hshift"; - gfreq_p->value_str_ = String (i); - return gfreq_p; -} + Request* get_grouping_req (Array<int> i_arr) @@ -80,8 +64,8 @@ get_grouping_req (Array<int> i_arr) Measure_grouping_req * mr_p = new Measure_grouping_req; for (int i=0; i <i_arr.size();) { - mr_p->elt_length_arr_.push (Moment (1, i_arr[i++])); - mr_p->beat_i_arr_.push (i_arr[i++]); + mr_p->elt_length_arr_.push (Moment (1, i_arr[i++])); + mr_p->beat_i_arr_.push (i_arr[i++]); } return mr_p; } diff --git a/lily/notehead.cc b/lily/notehead.cc index 0afaabd49f..389ff0cf60 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -7,6 +7,7 @@ */ #include "misc.hh" +#include "dots.hh" #include "note-head.hh" #include "dimen.hh" #include "debug.hh" @@ -15,68 +16,26 @@ #include "molecule.hh" #include "musical-request.hh" -/* - TODO - - Separate notehead into - - - Rhythmic_head - Note_head - Rest - and Stem takes Rhythmic_heads - */ - - -Note_head::Note_head (int ss) +Note_head::Note_head () { x_dir_ = CENTER; - staff_size_i_=ss; + staff_size_i_= 8; // UGH position_i_ = 0; - balltype_i_ = 0; - dots_i_ = 0; - dot_delta_y_i_ = 0; extremal_i_ = 0; - rest_b_ = false; } void -Note_head::do_pre_processing() +Note_head::do_pre_processing () { // 8 ball looks the same as 4 ball: - if (balltype_i_ > 2 && !rest_b_) + if (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 (dots_l_) // move into Rhythmic_head? + dots_l_->position_i_ = position_i_; } -void -Note_head::set_rhythmic (Rhythmic_req*r_req_l) -{ - balltype_i_ = r_req_l->duration_.durlog_i_; - dots_i_ = r_req_l->duration_.dots_i_; -} - - -IMPLEMENT_IS_TYPE_B1(Note_head,Item); - -void -Note_head::do_print() const -{ -#ifndef NPRINT - if (rest_b_) - DOUT << "REST! "; - DOUT << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_ - << "dots_i_ " << dots_i_; -#endif -} +IMPLEMENT_IS_TYPE_B1(Note_head,Rhythmic_head); int @@ -85,57 +44,26 @@ Note_head::compare (Note_head *const &a, Note_head * const &b) return a->position_i_ - b->position_i_; } -void -Note_head::set_dots() -{ - if (!(position_i_ %2) && rest_b_ && balltype_i_ == 0) - dot_delta_y_i_ = -1; - else if (!(position_i_ %2)) - dot_delta_y_i_ = 1; -} - -/* - Ugh, hairy. - */ Molecule* Note_head::brew_molecule_p() const { - ((Note_head*)this)->set_dots(); // UGH GUH Molecule*out = 0; Paper_def *p = paper(); - Real inter_f = p->internote_f(); - Symbol s; + Real inter_f = p->internote_f (); // ugh bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1); - if (!rest_b_) - s = p->lookup_l()->ball (balltype_i_); - else - { - s = p->lookup_l()->rest (balltype_i_, streepjes_b); - } + Symbol s = p->lookup_l()->ball (balltype_i_); out = new Molecule (Atom (s)); - 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); - } + out->translate (x_dir_ * s.dim.x().length (), X_AXIS); - - if (rest_b_) - { - 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 s =(position_i_<-1) + ? -((-position_i_)/2) + : (position_i_-staff_size_i_)/2; Symbol str = p->lookup_l()->streepjes (s); Molecule sm; @@ -148,4 +76,3 @@ Note_head::brew_molecule_p() const out->translate (inter_f*position_i_, Y_AXIS); return out; } - diff --git a/lily/p-score.cc b/lily/p-score.cc index ffa0dcfc2b..986d3665ba 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -205,7 +205,7 @@ Paper_score::process () // output String outname = paper_l_->outfile_str_ ; - if (outname == "") + if (!outname) outname = default_out_str_+ ".tex"; *mlog << "TeX output to " << outname << " ...\n"; diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 8bf32b1490..d55e3b740d 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -14,12 +14,33 @@ #include "debug.hh" #include "lookup.hh" #include "dimen.hh" -#include "input-translator.hh" #include "assoc-iter.hh" #include "score-grav.hh" #include "p-score.hh" #include "main.hh" + +Paper_def::Paper_def() +{ + lookup_p_ = 0; + real_vars_p_ = new Dictionary<Real>; +} + +Paper_def::~Paper_def() +{ + delete real_vars_p_; + delete lookup_p_; +} + +Paper_def::Paper_def (Paper_def const&s) + : Music_output_def (s) +{ + lookup_p_ = s.lookup_p_? new Lookup (*s.lookup_p_) : 0; + lookup_p_->paper_l_ = this; + real_vars_p_ = new Dictionary<Real> (*s.real_vars_p_); + outfile_str_ = s.outfile_str_; +} + void Paper_def::set_var (String s, Real r) { @@ -77,36 +98,6 @@ Paper_def::geometric_spacing(Moment d) const return get_var ("basicspace") + get_var ("unitspace") * dur_f; } -Paper_def::Paper_def() -{ - itrans_p_ = 0; - lookup_p_ = 0; - real_vars_p_ = new Assoc<String,Real>; -} - -Paper_def::~Paper_def() -{ - delete itrans_p_; - delete real_vars_p_; - delete lookup_p_; -} - -Paper_def::Paper_def (Paper_def const&s) -{ - itrans_p_ = s.itrans_p_ ? new Input_translator (*s.itrans_p_):0; - lookup_p_ = s.lookup_p_? new Lookup (*s.lookup_p_) : 0; - lookup_p_->paper_l_ = this; - real_vars_p_ = new Assoc<String,Real> (*s.real_vars_p_); - outfile_str_ = s.outfile_str_; -} - -void -Paper_def::set (Input_translator * itrans_p) -{ - delete itrans_p_; - itrans_p_ = itrans_p; -} - void Paper_def::set (Lookup*l) { @@ -150,10 +141,10 @@ void Paper_def::print() const { #ifndef NPRINT + Music_output_def::print (); DOUT << "Paper {"; DOUT << "out: " <<outfile_str_; lookup_p_->print(); - itrans_p_->print(); for (Assoc_iter<String,Real> i (*real_vars_p_); i.ok(); i++) { DOUT << i.key() << "= " << i.val () << "\n"; @@ -169,20 +160,4 @@ Paper_def::lookup_l() return lookup_p_; } -Global_translator* -Paper_def::get_global_translator_p() -{ - 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 48aee8d856..ed9a28aceb 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -12,8 +12,10 @@ #include <iostream.h> // mmm -#define MUDELA_VERSION "0.1.2" +#define MUDELA_VERSION "0.1.5" +#include "scalar.hh" +#include "translation-property.hh" #include "script-def.hh" #include "symtable.hh" #include "lookup.hh" @@ -31,7 +33,7 @@ #include "musical-request.hh" #include "my-lily-parser.hh" #include "text-def.hh" -#include "input-translator.hh" +#include "translator-group.hh" #include "score.hh" #include "music-list.hh" #include "header.hh" @@ -60,7 +62,7 @@ Chord * chord; Duration *duration; Identifier *id; - Input_translator* itrans; + Translator* trans; Music *music; Music_list *musiclist; Score *score; @@ -77,6 +79,7 @@ Real real; Request * request; General_script_def * script; + Scalar *scalar; String *string; Symbol * symbol; Symtable * symtable; @@ -91,13 +94,13 @@ %{ int -yylex(YYSTYPE *s, void * v_l) +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(); + return lex_l->yylex (); } @@ -120,12 +123,9 @@ yylex(YYSTYPE *s, void * v_l) %token ABSDYNAMIC %token END %token GROUPING -%token GROUP -%token REQUESTTRANSLATOR -%token HSHIFT +%token TRANSLATOR %token HEADER %token IN_T -%token ID %token LYRIC %token KEY %token MELODIC @@ -147,14 +147,15 @@ yylex(YYSTYPE *s, void * v_l) %token SPANDYNAMIC %token STAFF %token START_T -%token STEM %token SYMBOLTABLES %token TABLE %token TRANSPOSE %token TEMPO +%token TYPE %token TEXID %token TEXTSTYLE %token TITLE +%token PROPERTY %token VERSION /* escaped */ @@ -172,7 +173,7 @@ yylex(YYSTYPE *s, void * v_l) %token <id> SCRIPT_IDENTIFIER %token <id> COMMAND_IDENTIFIER %token <id> REAL_IDENTIFIER -%token <id> INPUT_TRANS_IDENTIFIER +%token <id> TRANS_IDENTIFIER %token <id> INT_IDENTIFIER %token <id> SCORE_IDENTIFIER %token <id> MIDI_IDENTIFIER @@ -207,7 +208,9 @@ yylex(YYSTYPE *s, void * v_l) %type <midi> midi_block midi_body %type <moment> duration_length +%type <scalar> scalar %type <music> Music transposed_music +%type <music> propertydef %type <musiclist> Voice Voice_body %type <chord> Chord Chord_body %type <paper> paper_block paper_body @@ -222,11 +225,12 @@ yylex(YYSTYPE *s, void * v_l) %type <string> script_abbreviation %type <symbol> symboldef %type <symtable> symtable symtable_body -%type <itrans> input_translator_spec input_translator_spec_body +%type <trans> translator_spec translator_spec_body %type <tempo> tempo_request %type <string> header_record -%left PRIORITY +%expect 2 + %% @@ -236,7 +240,7 @@ mudela: /* empty */ THIS->default_header_p_ = $2; } | mudela score_block { - add_score($2); + add_score ($2); } | mudela add_declaration { } | mudela error @@ -246,12 +250,12 @@ mudela: /* empty */ check_version: VERSION STRING ';' { - if ( String( *$2 ) != MUDELA_VERSION) { + if (String (*$2) != MUDELA_VERSION) { if (THIS->ignore_version_b_) { - THIS->here_input().error("Incorrect mudela version"); + THIS->here_input ().error ("Incorrect mudela version"); } else { THIS->fatal_error_i_ = 1; - THIS->parser_error("Incorrect mudela version"); + THIS->parser_error ("Incorrect mudela version"); } } } @@ -264,10 +268,10 @@ notenames_body: /**/ { } | notenames_body CLEAR { - THIS->clear_notenames(); + THIS->clear_notenames (); } | notenames_body STRING '=' melodic_request { - THIS->add_notename(*$2, $4); + THIS->add_notename (*$2, $4); delete $2; } ; @@ -285,12 +289,12 @@ mudela_header_body: mudela_header: HEADER { - THIS->lexer_p_->push_header_state(); + THIS->lexer_p_->push_header_state (); } '{' mudela_header_body '}' { $$ = $4; - THIS->lexer_p_->pop_state(); + THIS->lexer_p_->pop_state (); } ; @@ -311,118 +315,113 @@ header_record: add_declaration: STRING { - THIS->remember_spot(); + THIS->remember_spot (); } /* cont */ '=' identifier_init { - THIS->lexer_p_->set_identifier(*$1, $4); + THIS->lexer_p_->set_identifier (*$1, $4); $4->init_b_ = THIS->init_parse_b_; - $4->set_spot(THIS->pop_spot()); + $4->set_spot (THIS->pop_spot ()); } ; identifier_init: score_block { - $$ = new Score_id($1, SCORE_IDENTIFIER); + $$ = new Score_id ($1, SCORE_IDENTIFIER); } | paper_block { - $$ = new Paper_def_id($1, PAPER_IDENTIFIER); + $$ = new Paper_def_id ($1, PAPER_IDENTIFIER); } | midi_block { - $$ = new Midi_def_id($1, MIDI_IDENTIFIER); + $$ = new Midi_def_id ($1, MIDI_IDENTIFIER); } | script_definition { - $$ = new Script_id($1, SCRIPT_IDENTIFIER); + $$ = new Script_id ($1, SCRIPT_IDENTIFIER); } | Music { - $$ = new Music_id($1, MUSIC_IDENTIFIER); + $$ = new Music_id ($1, MUSIC_IDENTIFIER); } | symtables { - $$ = new Lookup_id($1, IDENTIFIER); + $$ = new Lookup_id ($1, IDENTIFIER); } | real { - $$ = new Real_id(new Real($1), REAL_IDENTIFIER); + $$ = new Real_id (new Real ($1), REAL_IDENTIFIER); } | int { - $$ = new Int_id(new int($1), INT_IDENTIFIER); + $$ = new Int_id (new int ($1), INT_IDENTIFIER); } | post_request { - $$ = new Request_id($1, POST_REQUEST_IDENTIFIER); + $$ = new Request_id ($1, POST_REQUEST_IDENTIFIER); } | melodic_request { - $$ = new Request_id($1, MELODIC_REQUEST_IDENTIFIER); + $$ = new Request_id ($1, MELODIC_REQUEST_IDENTIFIER); } - | input_translator_spec { - $$ = new Input_translator_id ( $1, INPUT_TRANS_IDENTIFIER); + | translator_spec { + $$ = new Translator_id ($1, TRANS_IDENTIFIER); } | explicit_duration { - $$ = new Duration_id( $1, DURATION_IDENTIFIER); + $$ = new Duration_id ($1, DURATION_IDENTIFIER); } ; -input_translator_spec: - REQUESTTRANSLATOR '{' input_translator_spec_body '}' +translator_spec: + TRANSLATOR '{' translator_spec_body '}' { $$ = $3; } ; -input_translator_spec_body: - INPUT_TRANS_IDENTIFIER { - $$ = $1->input_translator(); - $$-> set_spot( THIS->here_input() ); +translator_spec_body: + TRANS_IDENTIFIER { + $$ = $1->translator (); + $$-> set_spot (THIS->here_input ()); } - | STRING STRING { - $$ = new Input_translator; - $$->base_str_ = *$1; - $$->type_str_ =*$2; - $$->set_spot ( THIS->here_input() ); - delete $1; + | TYPE STRING ';' { + $$ = get_translator_l (*$2)->clone (); + $$->set_spot (THIS->here_input ()); delete $2; } - | input_translator_spec_body ID STRING ';' { - $$-> default_id_str_ = *$3; - delete $3; + | translator_spec_body STRING '=' scalar ';' { + $$-> set_property (*$2, *$4); + delete $2; + delete $4; } - | input_translator_spec_body ALIAS STRING ';' { - $$-> alias_str_arr_.push(*$3); + | translator_spec_body CONSISTS STRING ';' { + $$->group_l ()->consists_str_arr_.push (*$3); delete $3; } - | input_translator_spec_body CONSISTS STRING ';' { - $$-> consists_str_arr_.push(*$3); + | translator_spec_body ACCEPTS STRING ';' { + $$->group_l ()->accepts_str_arr_.push (*$3); delete $3; } - | input_translator_spec_body CONTAINS input_translator_spec { - $$->add($3); - } ; /* SCORE */ score_block: - SCORE { THIS->remember_spot(); + SCORE { THIS->remember_spot (); THIS->error_level_i_ =0; } /*cont*/ '{' score_body '}' { $$ = $4; - $$->set_spot(THIS->pop_spot()); + $$->set_spot (THIS->pop_spot ()); if (!$$->def_p_arr_.size ()) - $$->add ( THIS->default_paper()); + $$->add (THIS->default_paper ()); /* handle error levels. */ $$->errorlevel_i_ = THIS->error_level_i_; THIS->error_level_i_ = 0; if (!$$->header_p_ && THIS->default_header_p_) - $$->header_p_ = new Header(*THIS->default_header_p_); + $$->header_p_ = new Header (*THIS->default_header_p_); } ; @@ -430,7 +429,7 @@ score_body: { $$ = new Score; } | SCORE_IDENTIFIER { - $$ = $1->score(); + $$ = $1->score (); } | score_body mudela_header { $$->header_p_ = $2; @@ -439,7 +438,7 @@ score_body: { $$->music_p_ = $2; } | score_body output_def { - $$->add( $2); + $$->add ($2); } | score_body error { @@ -458,7 +457,7 @@ output_def: intastint_list: /* */ { $$ =new Array<int>; } | intastint_list int '*' int { - $$->push($2); $$->push($4); + $$->push ($2); $$->push ($4); } ; @@ -473,24 +472,25 @@ paper_block: paper_body: /* empty */ { - $$ = THIS->default_paper(); // paper / video / engrave + $$ = THIS->default_paper (); // paper / video / engrave } | PAPER_IDENTIFIER { - $$ = $1->paperdef(); + $$ = $1->paperdef (); } | paper_body OUTPUT STRING ';' { $$->outfile_str_ = *$3; delete $3; } - | paper_body symtables { $$->set($2); } + | paper_body symtables { $$->set ($2); } | paper_body STRING '=' dim ';' { - $$->set_var(*$2, $4); + $$->set_var (*$2, $4); } | paper_body STRING '=' real ';' { - $$->set_var(*$2, $4); + $$->set_var (*$2, $4); } - | paper_body input_translator_spec { - $$->set( $2 ); + | paper_body STRING '=' translator_spec { + $$-> assign_translator (*$2, $4); + delete $2; } | paper_body error { @@ -507,19 +507,20 @@ midi_block: ; midi_body: /* empty */ { - $$ = THIS->default_midi(); + $$ = THIS->default_midi (); + } + | midi_body STRING '=' translator_spec { + $$-> assign_translator (*$2, $4); + delete $2; } | midi_body OUTPUT STRING ';' { $$->outfile_str_ = *$3; delete $3; } | midi_body tempo_request ';' { - $$->set_tempo( $2->dur_.length(), $2->metronome_i_ ); + $$->set_tempo ($2->dur_.length (), $2->metronome_i_); delete $2; } - | midi_body input_translator_spec { - $$->set( $2 ); - } | midi_body error { } @@ -548,35 +549,69 @@ Voice_body: /**/ { $$ = new Voice; } - | Voice_body ID STRING STRING ';' { - $$ = new Voice; - $$->type_str_ = *$3; - $$->id_str_ = *$4; - delete $3; - delete $4; - } | Voice_body Music { - $$->add($2); + $$->add ($2); } ; Music: full_element { $$ = $1; } + | TYPE STRING Music { + $$ = $3; + $$->translator_type_str_ = *$2; + delete $2; + } + | TYPE STRING '=' STRING Music { + $$ = $5; + $$->translator_type_str_ = *$2; + $$->translator_id_str_ = *$4; + delete $2; + delete $4; + } | Voice { $$ = $1; } | Chord { $$ = $1; } | transposed_music { $$ = $1; } - | MUSIC_IDENTIFIER { $$ = $1->music(); } + | MUSIC_IDENTIFIER { $$ = $1->music (); } | MELODIC - { THIS->lexer_p_->push_note_state(); } + { THIS->lexer_p_->push_note_state (); } Music - { $$=$3; THIS->lexer_p_->pop_state(); } + { $$=$3; THIS->lexer_p_->pop_state (); } | LYRIC - { THIS->lexer_p_->push_lyric_state(); } + { THIS->lexer_p_->push_lyric_state (); } Music - { $$ = $3; THIS->lexer_p_->pop_state(); } + { $$ = $3; THIS->lexer_p_->pop_state (); } + | propertydef ; +propertydef: + TRANSLATOR STRING '=' STRING { + /* kluge. Could use Music just as well */ + Translation_property * t = new Translation_property; + t-> translator_type_str_ = *$2; + t-> translator_id_str_ = *$4; + $$ = t; + delete $2; + delete $4; + } + | PROPERTY STRING '.' STRING '=' scalar { + Translation_property *t = new Translation_property; + t-> translator_type_str_ = *$2; + t-> var_str_ = *$4; + t-> value_ = *$6; + $$ = t; + delete $2; + delete $4; + delete $6; + } + ; + +scalar: + STRING { $$ = new Scalar (*$1); delete $1; } + | int { $$ = new Scalar ($1); } + ; + + Chord: '<' Chord_body '>' { $$ = $2; } ; @@ -589,21 +624,15 @@ Chord_body: | Chord_body MULTI INT ';' { $$->multi_level_i_=$3; } - | Chord_body ID STRING STRING ';' { - $$->type_str_ = *$3; - $$->id_str_ = *$4; - delete $4; - delete $3; - } | Chord_body Music { - $$->add($2); + $$->add ($2); } ; transposed_music: TRANSPOSE steno_melodic_req Music { $$ = $3; - $$ -> transpose($2); + $$ -> transpose ($2); delete $2; } ; @@ -614,7 +643,7 @@ transposed_music: */ full_element: pre_requests simple_element post_requests { - THIS->add_requests((Chord*)$2);//ugh + THIS->add_requests ((Chord*)$2);//ugh $$ = $2; } | command_elt @@ -629,9 +658,9 @@ simple_element: command_elt: command_req { $$ = new Request_chord; - $$-> set_spot( THIS->here_input()); - $1-> set_spot( THIS->here_input()); - ((Chord*)$$) ->add($1);//ugh + $$-> set_spot (THIS->here_input ()); + $1-> set_spot (THIS->here_input ()); + ((Chord*)$$) ->add ($1);//ugh } ; @@ -646,30 +675,24 @@ abbrev_command_req: $$ = new Barcheck_req; } | COMMAND_IDENTIFIER { - $$ = $1->request(); + $$ = $1->request (); } ; verbose_command_req: BAR STRING { - $$ = new Bar_req(*$2); + $$ = new Bar_req (*$2); delete $2; } | METER int '/' int { Meter_change_req *m = new Meter_change_req; - m->set($2,$4); - // sorry hw, i need meter at output of track, - // but don-t know where to get it... statics should go. - // HW : default: 4/4, meterchange reqs may change it. - - Midi_def::num_i_s = $2; - Midi_def::den_i_s = $4; + m->set ($2,$4); $$ = m; } | SKIP duration_length { Skip_req * skip_p = new Skip_req; - skip_p->duration_.set_plet($2->numerator().as_long(), - $2->denominator().as_long()); + skip_p->duration_.set_plet ($2->numerator ().as_long (), + $2->denominator ().as_long ()); delete $2; $$ = skip_p; @@ -678,20 +701,14 @@ verbose_command_req: $$ = $1; } | CADENZA int { - $$ = new Cadenza_req($2); + $$ = new Cadenza_req ($2); } | PARTIAL duration_length { - $$ = new Partial_measure_req(*$2); + $$ = new Partial_measure_req (*$2); delete $2; } - | STEM int { - $$ = get_stemdir_req($2); - } - | HSHIFT int { - $$ = get_hshift_req($2); - } | CLEF STRING { - $$ = new Clef_change_req(*$2); + $$ = new Clef_change_req (*$2); delete $2; } | KEY pitch_list { @@ -701,30 +718,35 @@ verbose_command_req: delete $2; } | GROUPING intastint_list { - $$ = get_grouping_req(*$2); delete $2; + $$ = get_grouping_req (*$2); delete $2; } ; post_requests: { - assert(THIS->post_reqs.empty()); + assert (THIS->post_reqs.empty ()); } | post_requests post_request { - $2->set_spot( THIS->here_input()); - THIS->post_reqs.push($2); + $2->set_spot (THIS->here_input ()); + THIS->post_reqs.push ($2); } ; post_request: POST_REQUEST_IDENTIFIER { - $$ = (Request*)$1->request(); + $$ = (Request*)$1->request (); } |close_request_parens { - $$ = THIS->get_parens_request($1); + $$ = THIS->get_parens_request ($1); } | script_req | dynamic_req + | abbrev_type { + Abbreviation_req* a = new Abbreviation_req; + a->type_i_ = $1; + $$ = a; + } ; @@ -734,7 +756,7 @@ post_request: */ steno_melodic_req: NOTENAME_ID { - $$ = $1->clone()->musical()->melodic(); + $$ = $1->clone ()->musical ()->melodic (); $$->octave_i_ += THIS->default_octave_i_; } | steno_melodic_req POST_QUOTES { @@ -863,7 +885,7 @@ script_definition: script_body: STRING int int int int int { Script_def *s = new Script_def; - s->set_from_input(*$1,$2, $3,$4,$5, $6); + s->set_from_input (*$1,$2, $3,$4,$5, $6); $$ = s; delete $1; } @@ -874,7 +896,7 @@ script_req: Musical_script_req *m = new Musical_script_req; $$ = m; m-> scriptdef_p_ = $2; - m-> set_spot ( THIS->here_input() ); + m-> set_spot (THIS->here_input ()); m-> dir_ = $1; } ; @@ -882,7 +904,7 @@ script_req: gen_script_def: text_def { $$ = $1; } | mudela_script { $$ = $1; - $$-> set_spot( THIS->here_input() ); + $$-> set_spot (THIS->here_input ()); } ; @@ -893,27 +915,27 @@ text_def: t->text_str_ = *$1; delete $1; t->style_str_ = THIS->textstyle_str_; - $$->set_spot( THIS->here_input() ); + $$->set_spot (THIS->here_input ()); } ; script_abbreviation: - '^' { $$ = get_scriptdef('^'); } - | '+' { $$ = get_scriptdef('+'); } - | '-' { $$ = get_scriptdef('-'); } - | '|' { $$ = get_scriptdef('|'); } - | 'o' { $$ = get_scriptdef('o'); } - | '>' { $$ = get_scriptdef('>'); } + '^' { $$ = get_scriptdef ('^'); } + | '+' { $$ = get_scriptdef ('+'); } + | '-' { $$ = get_scriptdef ('-'); } + | '|' { $$ = get_scriptdef ('|'); } + | 'o' { $$ = get_scriptdef ('o'); } + | '>' { $$ = get_scriptdef ('>'); } | '.' { - $$ = get_scriptdef('.'); + $$ = get_scriptdef ('.'); } ; mudela_script: - SCRIPT_IDENTIFIER { $$ = $1->script(); } + SCRIPT_IDENTIFIER { $$ = $1->script (); } | script_definition { $$ = $1; } | script_abbreviation { - $$ = THIS->lexer_p_->lookup_identifier(*$1)->script(); + $$ = THIS->lexer_p_->lookup_identifier (*$1)->script (); delete $1; } ; @@ -926,27 +948,27 @@ script_dir: pre_requests: | pre_requests pre_request { - THIS->pre_reqs.push($2); - $2->set_spot( THIS->here_input()); + THIS->pre_reqs.push ($2); + $2->set_spot (THIS->here_input ()); } ; pre_request: open_request_parens { - $$ = THIS->get_parens_request($1); + $$ = THIS->get_parens_request ($1); } ; voice_command: PLET INT '/' INT { - THIS->default_duration_.set_plet($2,$4); + THIS->default_duration_.set_plet ($2,$4); } | DURATION STRING { - THIS->set_duration_mode(*$2); + THIS->set_duration_mode (*$2); delete $2; } | DURATION entered_notemode_duration { - THIS->set_default_duration($2); + THIS->set_default_duration ($2); delete $2; } | OCTAVE { @@ -971,10 +993,10 @@ voice_command: duration_length: { - $$ = new Moment(0,1); + $$ = new Moment (0,1); } | duration_length explicit_steno_duration { - *$$ += $2->length(); + *$$ += $2->length (); } ; @@ -985,14 +1007,14 @@ dots: entered_notemode_duration: /* */ { - $$ = new Duration(THIS->default_duration_); + $$ = new Duration (THIS->default_duration_); } | dots { - $$ = new Duration(THIS->default_duration_); + $$ = new Duration (THIS->default_duration_); $$->dots_i_ = $1; } | explicit_steno_duration { - THIS->set_last_duration($1); + THIS->set_last_duration ($1); $$ = $1; } ; @@ -1008,14 +1030,14 @@ notemode_duration: explicit_steno_duration: int { $$ = new Duration; - if ( !Duration::duration_type_b($1) ) - THIS->parser_error("Not a duration"); + if (!Duration::duration_type_b ($1)) + THIS->parser_error ("Not a duration"); else { - $$->durlog_i_ = Duration_convert::i2_type($1); + $$->durlog_i_ = Duration_convert::i2_type ($1); } } | DURATION_IDENTIFIER { - $$ = $1->duration(); + $$ = $1->duration (); } | explicit_steno_duration '.' { $$->dots_i_ ++; @@ -1030,11 +1052,7 @@ explicit_steno_duration: abbrev_type: - /* */ - { - $$ = THIS->default_abbrev_type_i_; - } - | ':' int { + ':' int { if (!Duration::duration_type_b ($2)) THIS->parser_error ("Not a duration"); else if ($2 < 8) @@ -1046,21 +1064,15 @@ abbrev_type: ; music_elt: - steno_note_req notemode_duration abbrev_type { + steno_note_req notemode_duration { if (!THIS->lexer_p_->note_state_b ()) THIS->parser_error ("have to be in Note mode for notes"); $1->set_duration (*$2); int durlog_i = $2->durlog_i_; - Chord* c = THIS->get_note_element ($1, $2); - $$ = c; - if ($3) { - Abbreviation_req* a = new Abbreviation_req; - a->type_i_ = $3; - c->add (a); - } + $$ = THIS->get_note_element ($1, $2); } | RESTNAME notemode_duration { - $$ = THIS->get_rest_element(*$1, $2); + $$ = THIS->get_rest_element (*$1, $2); delete $1; } ; @@ -1068,9 +1080,9 @@ music_elt: lyrics_elt: text_def notemode_duration { /* this sux! text-def should be feature of lyric-engraver. */ - if (!THIS->lexer_p_->lyric_state_b()) - THIS->parser_error("Have to be in Lyric mode for lyrics"); - $$ = THIS->get_word_element($1, $2); + if (!THIS->lexer_p_->lyric_state_b ()) + THIS->parser_error ("Have to be in Lyric mode for lyrics"); + $$ = THIS->get_word_element ($1, $2); }; @@ -1081,7 +1093,7 @@ pitch_list: { $$ = new Array<Melodic_req*>; } | pitch_list NOTENAME_ID { - $$->push($2->clone()->musical()->melodic()); + $$->push ($2->clone ()->musical ()->melodic ()); } ; @@ -1090,7 +1102,7 @@ int: $$ = $1; } | INT_IDENTIFIER { - int *i_p = $1->intid(); + int *i_p = $1->intid (); $$ = *i_p; delete i_p; } @@ -1102,7 +1114,7 @@ real: $$ = $1; } | REAL_IDENTIFIER { - Real *r_p = $1->real(); + Real *r_p = $1->real (); $$ = * r_p; delete r_p; } @@ -1133,14 +1145,14 @@ symtables_body: $$ = new Lookup; } | IDENTIFIER { - $$ = $1->lookup(); + $$ = $1->lookup (); } | symtables_body TEXID STRING { $$->texsetting = *$3; delete $3; } | symtables_body STRING '=' symtable { - $$->add(*$2, $4); + $$->add (*$2, $4); delete $2; } ; @@ -1152,7 +1164,7 @@ symtable: symtable_body: { $$ = new Symtable; } | symtable_body STRING symboldef { - $$->add(*$2, *$3); + $$->add (*$2, *$3); delete $2; delete $3; } @@ -1160,56 +1172,56 @@ symtable_body: symboldef: STRING box { - $$ = new Symbol(*$1, *$2); + $$ = new Symbol (*$1, *$2); delete $1; delete $2; } | STRING { - Box b(Interval(0,0), Interval(0,0)); - $$ = new Symbol(*$1, b); + Box b (Interval (0,0), Interval (0,0)); + $$ = new Symbol (*$1, b); delete $1; } ; box: dinterval dinterval { - $$ = new Box(*$1, *$2); + $$ = new Box (*$1, *$2); delete $1; delete $2; } ; dinterval: dim dim { - $$ = new Interval($1, $2); + $$ = new Interval ($1, $2); } ; %% void -My_lily_parser::set_yydebug(bool b ) +My_lily_parser::set_yydebug (bool b) { #ifdef YYDEBUG yydebug = b; #endif } void -My_lily_parser::do_yyparse() +My_lily_parser::do_yyparse () { - yyparse((void*)this); + yyparse ((void*)this); } Paper_def* -My_lily_parser::default_paper() +My_lily_parser::default_paper () { - Identifier *id = lexer_p_->lookup_identifier( "default_paper" ); - return id ? id->paperdef() : new Paper_def ; + Identifier *id = lexer_p_->lookup_identifier ("default_paper"); + return id ? id->paperdef () : new Paper_def ; } Midi_def* -My_lily_parser::default_midi() +My_lily_parser::default_midi () { - Identifier *id = lexer_p_->lookup_identifier( "default_midi" ); - return id ? id->mididef() : new Midi_def ; + Identifier *id = lexer_p_->lookup_identifier ("default_midi"); + return id ? id->mididef () : new Midi_def ; } diff --git a/lily/performer-group-performer.cc b/lily/performer-group-performer.cc index ae1e93dd6f..525b6202fc 100644 --- a/lily/performer-group-performer.cc +++ b/lily/performer-group-performer.cc @@ -8,168 +8,9 @@ */ #include "performer-group-performer.hh" -#include "input-translator.hh" -#include "debug.hh" - -IMPLEMENT_IS_TYPE_B2(Performer_group_performer,Performer, Translator); -ADD_THIS_PERFORMER(Performer_group_performer); - -Performer_group_performer::~Performer_group_performer() -{ - -} - -void -Performer_group_performer::add (Performer *perf_p) -{ - perf_p_list_.bottom().add (perf_p); - perf_p->daddy_perf_l_ = this; - - if (perf_p->is_type_b (Performer_group_performer::static_name())) - { - group_l_arr_.push ((Performer_group_performer*)perf_p); - } - else - { - nongroup_l_arr_ .push (perf_p); - } -} - -Translator* -Performer_group_performer::ancestor_l (int l) -{ - if (!l || !daddy_perf_l_) - return this; - - return daddy_perf_l_->ancestor_l (l - 1); -} - -int -Performer_group_performer::depth_i() const -{ - return daddy_perf_l_->depth_i() + 1; -} - -void -Performer_group_performer::do_creation_processing() -{ - for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++) - i->creation_processing(); -} - -void -Performer_group_performer::do_print() const -{ -#ifndef NPRINT - if (!check_debug) - return ; - for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++) - i->print(); -#endif -} -void -Performer_group_performer::do_removal_processing() -{ - for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++) - i->do_removal_processing(); -} - -bool -Performer_group_performer::do_try_request (Request* req_l) -{ - bool hebbes_b =false; - for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++) - hebbes_b =nongroup_l_arr_[i]->try_request (req_l); - if (!hebbes_b && daddy_perf_l_) - hebbes_b = daddy_perf_l_->try_request (req_l); - return hebbes_b ; -} - -Translator* -Performer_group_performer::find_get_translator_l (String n,String id) -{ - Translator * ret=0; - Input_translator* itrans_l= itrans_l_-> recursive_find (n); - if (itrans_l) - { - ret = find_performer_l (n,id); - if (!ret) - { - Performer_group_performer * group = - itrans_l-> get_group_performer_p(); - - 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); - - } - } - else if (daddy_perf_l_) - ret =daddy_perf_l_->find_get_translator_l (n,id); - else - { - warning ("Can't find or create `" + n + "' called `" + id + "'\n"); - ret =0; - } - return ret; -} - -Performer_group_performer* -Performer_group_performer::find_performer_l (String n, String id) -{ - if (name() == n && id_str_ == id) - return this; - Performer_group_performer * r = 0; - for (int i =0; !r && i< group_l_arr_.size(); i++) - { - r = group_l_arr_[i]->find_performer_l (n,id); - } - - return r; -} - -Translator* -Performer_group_performer::get_default_interpreter() -{ - // ? - if (is_bottom_performer_b()) - return daddy_perf_l_->get_default_interpreter(); - - Performer_group_performer *perf_p= itrans_l_-> - get_default_itrans_l()->get_group_performer_p (); - add (perf_p); - if (perf_p->is_bottom_performer_b()) - return perf_p; - else - return perf_p->get_default_interpreter(); -} - -bool -Performer_group_performer::is_bottom_performer_b() const -{ - return !itrans_l_->get_default_itrans_l(); -} - -void -Performer_group_performer::print() const -{ - Performer::print(); -} +#include "debug.hh" -void -Performer_group_performer::process_requests() -{ - for (PCursor<Performer*> i (perf_p_list_.top()); i.ok (); i++) - i->process_requests(); -} +IMPLEMENT_IS_TYPE_B2(Performer_group_performer,Performer, Translator_group); +ADD_THIS_TRANSLATOR(Performer_group_performer); -bool -Performer_group_performer::try_request (Request* r) -{ - return Performer::try_request (r); -} diff --git a/lily/performer.cc b/lily/performer.cc index ed72f2a2ce..5775f157eb 100644 --- a/lily/performer.cc +++ b/lily/performer.cc @@ -12,82 +12,28 @@ #include "debug.hh" -IMPLEMENT_IS_TYPE_B(Performer); +IMPLEMENT_IS_TYPE_B1(Performer, Translator); Performer::Performer() -{ - daddy_perf_l_ = 0; - init_b_ =false; -} - -Performer::~Performer() -{ -} - -void -Performer::do_print() const { } void Performer::play (Audio_element* p) { - daddy_perf_l_->play (p); + daddy_perf_l ()->play (p); } int Performer::get_tempo_i() const { - return daddy_perf_l_->get_tempo_i(); -} - -void -Performer::print() const -{ -#ifndef NPRINT - DOUT << "\n" << name() << " {"; - do_print(); - DOUT << "}"; -#endif -} - -void -Performer::process_requests() -{ -} - -bool -Performer::do_try_request (Request* req_l) -{ - return false; -} - -bool -Performer::try_request (Request*r) -{ - if (!init_b_) - { - creation_processing(); - } - return do_try_request (r); -} - -void -Performer::creation_processing() -{ - if (!init_b_) - { - do_creation_processing(); - init_b_ = true; - } -} - -void -Performer::do_creation_processing() -{ + return daddy_perf_l ()->get_tempo_i(); } -void -Performer::do_removal_processing() +Performer_group_performer* +Performer::daddy_perf_l () const { + return (daddy_trans_l_) + ?(Performer_group_performer*) daddy_trans_l_->performer_l () + : 0; } diff --git a/lily/property-iterator.cc b/lily/property-iterator.cc new file mode 100644 index 0000000000..7fbab5fe9d --- /dev/null +++ b/lily/property-iterator.cc @@ -0,0 +1,26 @@ +/* + property-iterator.cc -- implement Property_iterator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "property-iterator.hh" +#include "translation-property.hh" +#include "translator-group.hh" + +Property_iterator::Property_iterator (Translation_property *prop_l) +{ + property_l_ = prop_l; +} + +void +Property_iterator::process_and_next (Moment m) +{ + if (property_l_->var_str_) + report_to_l ()->set_property (property_l_->var_str_, property_l_->value_); + Music_iterator::process_and_next (m); +} + +IMPLEMENT_IS_TYPE_B1(Property_iterator, Music_iterator); diff --git a/lily/qlp.cc b/lily/qlp.cc index b7f9eee739..7a99cc639f 100644 --- a/lily/qlp.cc +++ b/lily/qlp.cc @@ -34,20 +34,20 @@ Vector Mixed_qp::solve (Vector start) const { if (!dim()) - return Vector (0); + return Vector (0); print(); Ineq_constrained_qp pure (*this); for (int i= eq_cons.size()-1; i>=0; i--) { - pure.eliminate_var (eq_cons[i], eq_consrhs[i]); - start.del (eq_cons[i]); + pure.eliminate_var (eq_cons[i], eq_consrhs[i]); + start.del (eq_cons[i]); } Vector sol = pure.solve (start); for (int i= 0; i < eq_cons.size(); i++) { - sol.insert (eq_consrhs[i],eq_cons[i]); + sol.insert (eq_consrhs[i],eq_cons[i]); } return sol; } @@ -59,10 +59,10 @@ Ineq_constrained_qp::assert_solution (Vector sol) const Array<int> binding; for (int i=0; i < cons.size(); i++) { - Real R=cons[i] * sol- consrhs[i]; - assert (R> -EPS); - if (R < EPS) - binding.push (i); + Real R=cons[i] * sol- consrhs[i]; + assert (R> -EPS); + if (R < EPS) + binding.push (i); } // KKT check... // todo @@ -74,11 +74,11 @@ Ineq_constrained_qp::print() const #ifndef NPRINT DOUT << "Quad " << quad; DOUT << "lin " << lin <<"\n" - << "const " << const_term<<"\n"; + << "const " << const_term<<"\n"; for (int i=0; i < cons.size(); i++) { - DOUT << "constraint["<<i<<"]: " << cons[i] << " >= " << consrhs[i]; - DOUT << "\n"; + DOUT << "constraint["<<i<<"]: " << cons[i] << " >= " << consrhs[i]; + DOUT << "\n"; } #endif } @@ -104,7 +104,7 @@ Mixed_qp::print() const Ineq_constrained_qp::print(); for (int i=0; i < eq_cons.size(); i++) { - DOUT << "eq cons "<<i<<": x["<<eq_cons[i]<<"] == " << eq_consrhs[i]<<"\n"; + DOUT << "eq cons "<<i<<": x["<<eq_cons[i]<<"] == " << eq_consrhs[i]<<"\n"; } #endif } diff --git a/lily/qlpsolve.cc b/lily/qlpsolve.cc index d2ffad85d4..b863a63f67 100644 --- a/lily/qlpsolve.cc +++ b/lily/qlpsolve.cc @@ -22,13 +22,13 @@ Active_constraints::status() const String s ("Active|Inactive ["); for (int i=0; i< active.size(); i++) { - s += String (active[i]) + " "; + s += String (active[i]) + " "; } s+="| "; for (int i=0; i< inactive.size(); i++) { - s += String (inactive[i]) + " "; + s += String (inactive[i]) + " "; } s+="]"; @@ -47,19 +47,19 @@ Active_constraints::OK() Array<int> allcons; for (int i=0; i < opt->cons.size(); i++) - allcons.push (0); + allcons.push (0); for (int i=0; i < active.size(); i++) { - int j = active[i]; - allcons[j]++; + int j = active[i]; + allcons[j]++; } for (int i=0; i < inactive.size(); i++) { - int j = inactive[i]; - allcons[j]++; + int j = inactive[i]; + allcons[j]++; } for (int i=0; i < allcons.size(); i++) - assert (allcons[i] == 1); + assert (allcons[i] == 1); #endif } @@ -86,24 +86,24 @@ Active_constraints::add (int k) Vector addrow (Ha.dim()); if (abs (aHa) > EPS) { - /* - a != 0, so if Ha = O(EPS), then - Ha * aH / aHa = O(EPS^2/EPS) + /* + a != 0, so if Ha = O(EPS), then + Ha * aH / aHa = O(EPS^2/EPS) - if H*a == 0, the constraints are dependent. + if H*a == 0, the constraints are dependent. */ - H -= Matrix (Ha/aHa , Ha); + H -= Matrix (Ha/aHa , Ha); - /* + /* sorry, don't know how to justify this. .. */ - addrow=Ha; + addrow=Ha; addrow/= aHa; - A -= Matrix (A*a, addrow); - A.insert_row (addrow,A.rows()); - }else - WARN << "degenerate constraints"; + A -= Matrix (A*a, addrow); + A.insert_row (addrow,A.rows()); + }else + WARN << "degenerate constraints"; } void @@ -111,7 +111,7 @@ Active_constraints::drop (int k) { int q=active.size()-1; - // drop indices + // drop indices inactive.push (active[k]); active.swap (k,q); A.swap_rows (k,q); @@ -120,15 +120,15 @@ Active_constraints::drop (int k) Vector a (A.row (q)); if (a.norm() > EPS) { - /* + /* - */ + */ Real q = a*opt->quad*a; - Matrix aaq (a,a/q); - H += aaq; - A -= A*opt->quad*aaq; - }else - WARN << "degenerate constraints"; + Matrix aaq (a,a/q); + H += aaq; + A -= A*opt->quad*aaq; + }else + WARN << "degenerate constraints"; #ifndef NDEBUG Vector rem_row (A.row (q)); assert (rem_row.norm() < EPS); @@ -140,16 +140,16 @@ Active_constraints::drop (int k) Active_constraints::Active_constraints (Ineq_constrained_qp const *op) : A(0,op->dim()), - H(op->dim()), - opt (op) + H(op->dim()), + opt (op) { for (int i=0; i < op->cons.size(); i++) - inactive.push (i); + inactive.push (i); Choleski_decomposition chol (op->quad); /* ugh. - */ + */ H=chol.inverse(); OK(); } diff --git a/lily/request-iterator.cc b/lily/request-iterator.cc index 82093173e8..f9cf8f0046 100644 --- a/lily/request-iterator.cc +++ b/lily/request-iterator.cc @@ -6,7 +6,7 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "translator.hh" +#include "translator-group.hh" #include "debug.hh" #include "request-iterator.hh" #include "music-list.hh" diff --git a/lily/rest-collision-grav.cc b/lily/rest-collision-grav.cc index fbd6d0ba5e..7a41c7ab45 100644 --- a/lily/rest-collision-grav.cc +++ b/lily/rest-collision-grav.cc @@ -15,36 +15,25 @@ IMPLEMENT_IS_TYPE_B1(Rest_collision_engraver, Engraver); -ADD_THIS_ENGRAVER(Rest_collision_engraver); +ADD_THIS_TRANSLATOR(Rest_collision_engraver); Rest_collision_engraver::Rest_collision_engraver() { rest_collision_p_ =0; } -void -Rest_collision_engraver::make_collision() -{ - if (!rest_collision_p_) - { - rest_collision_p_ = new Rest_collision; - announce_element (Score_elem_info (rest_collision_p_, 0)); - } -} void Rest_collision_engraver::acknowledge_element (Score_elem_info i) { - char const * nC = i.elem_l_->name(); - if (nC == Note_column::static_name()) + if (i.elem_l_->name()== Note_column::static_name()) { - // what should i do, what should _engraver do? - make_collision(); - rest_collision_p_->add ((Note_column*)i.elem_l_->item()); - } - else if (nC == Rest_column::static_name()) - { - make_collision(); - rest_collision_p_->add ((Rest_column*)i.elem_l_->item()); + // what should i do, what should _engraver do? + if (!rest_collision_p_) + { + rest_collision_p_ = new Rest_collision; + announce_element (Score_elem_info (rest_collision_p_, 0)); + } + rest_collision_p_->add ((Note_column*)i.elem_l_->item()); } } @@ -53,16 +42,7 @@ Rest_collision_engraver::do_pre_move_processing() { if (rest_collision_p_) { - typeset_element (rest_collision_p_); - rest_collision_p_ = 0; + typeset_element (rest_collision_p_); + rest_collision_p_ = 0; } } - -void -Rest_collision_engraver::do_print() const -{ -#ifndef NPRINT - if (rest_collision_p_) - rest_collision_p_->print(); -#endif -} diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 3e66ec7513..54392d5585 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -22,14 +22,10 @@ void Rest_collision::add (Note_column *nc_l) { add_dependency (nc_l); - ncol_l_arr_.push (nc_l); -} - -void -Rest_collision::add (Rest_column *rc_l) -{ - add_dependency (rc_l); - rest_l_arr_.push (rc_l); + if (nc_l->rest_b ()) + rest_l_arr_.push (nc_l); + else + ncol_l_arr_.push (nc_l); } void @@ -51,10 +47,10 @@ Rest_collision::do_post_processing() // can this happen? Stem* stem_l = rest_l_arr_[0]->stem_l_; if (!stem_l) - return; + return; // no beam if (!(stem_l->beams_left_i_ || stem_l->beams_right_i_)) - return; + return; int dir_i = rest_l_arr_[0]->dir_; int midpos = 4; @@ -66,66 +62,66 @@ Rest_collision::do_post_processing() #else // nogo: stem_start not set for rests? int pos = (stem_l->stem_start_f() - midpos) + dir_i * 2; #endif - rest_l_arr_[0]->translate_heads (pos); + rest_l_arr_[0]->translate_rests (pos); } void Rest_collision::do_pre_processing() { /* - handle rest-rest and rest-note collisions + handle rest-rest and rest-note collisions - [todo] - decide not to print rest if too crowded? + [todo] + decide not to print rest if too crowded? */ // no rests to collide if (!rest_l_arr_.size()) - return; + return; // no partners to collide with if (rest_l_arr_.size() + ncol_l_arr_.size () < 2) - return; + return; // meisjes met meisjes if (!ncol_l_arr_.size()) { - int dy = rest_l_arr_.size() > 2 ? 6 : 4; + int dy = rest_l_arr_.size() > 2 ? 6 : 4; - rest_l_arr_[0]->translate_heads (rest_l_arr_[0]->dir_ *dy); - // top is last element... - rest_l_arr_.top()->translate_heads (rest_l_arr_.top ()->dir_* dy); + rest_l_arr_[0]->translate_rests (rest_l_arr_[0]->dir_ *dy); + // top is last element... + rest_l_arr_.top()->translate_rests (rest_l_arr_.top ()->dir_* dy); } // meisjes met jongetjes else { #if 0 // breendet: rests go always under - // geen gemug, trug op je rug - int dir_i = -1; - rest_l_arr_[0]->translate_heads (dir_i * 3); + // geen gemug, trug op je rug + int dir_i = -1; + rest_l_arr_[0]->translate_rests (dir_i * 3); #else - // int dir_i = - ncol_l_arr_[0]->dir_; - int dir_i = rest_l_arr_[0]->dir_; - // hope it's 4: if it works->doco - int midpos = 4; + // int dir_i = - ncol_l_arr_[0]->dir_; + int dir_i = rest_l_arr_[0]->dir_; + // hope it's 4: if it works->doco + int midpos = 4; // minimum move - int minpos = 4; + int minpos = 4; - // quart rest height - // UGH Should get dims from table! - int size_i = 6; + // quart rest height + // UGH Should get dims from table! + int size_i = 6; - int sep_i = 3 + size_i / 2; - for (int i = 0; i < ncol_l_arr_.size(); i++) - { - // how to know whether to sort? - ncol_l_arr_[i]->sort(); - for (int j = 0; j < ncol_l_arr_[i]->head_l_arr_.size(); j++) - minpos = minpos >? dir_i * - (ncol_l_arr_[i]->head_l_arr_[j]->position_i_ -midpos) + sep_i; - } - rest_l_arr_[0]->translate_heads (dir_i * minpos); + int sep_i = 3 + size_i / 2; + for (int i = 0; i < ncol_l_arr_.size(); i++) + { + // how to know whether to sort? + ncol_l_arr_[i]->sort(); + for (int j = 0; j < ncol_l_arr_[i]->head_l_arr_.size(); j++) + minpos = minpos >? dir_i * + (ncol_l_arr_[i]->head_l_arr_[j]->position_i_ -midpos) + sep_i; + } + rest_l_arr_[0]->translate_rests (dir_i * minpos); #endif } } @@ -143,10 +139,14 @@ void Rest_collision::do_substitute_dependency (Score_elem*o,Score_elem*n) { Item*o_l = o->item(); - Item*n_l = n?n->item():0; - rest_l_arr_.substitute ((Rest_column*)o_l,(Rest_column*)n_l); - ncol_l_arr_.substitute ((Note_column*)o_l,(Note_column*)n_l); + + if (o_l&&o_l->is_type_b (Note_column::static_name ())) + { + Note_column *n_l = n?(Note_column*)n->item():0; + rest_l_arr_.substitute ((Note_column*)o_l, n_l); + ncol_l_arr_.substitute ((Note_column*)o_l, n_l); + } } Rest_collision::Rest_collision() diff --git a/lily/rest-column.cc b/lily/rest-column.cc deleted file mode 100644 index 0c7260ee62..0000000000 --- a/lily/rest-column.cc +++ /dev/null @@ -1,28 +0,0 @@ -/* - rest-column.cc -- implement Rest_column - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "debug.hh" -#include "rest-column.hh" -#include "note-head.hh" -#include "rest-column.hh" -#include "stem.hh" - - -IMPLEMENT_IS_TYPE_B1(Rest_column,Head_column); - - -/** - translate the rest symbols - */ -void -Rest_column::translate_heads (int dy_i) -{ - for (int i=0; i < head_l_arr_.size(); i++) - head_l_arr_[i]->position_i_ += dy_i; -} - diff --git a/lily/rest-grav.cc b/lily/rest-grav.cc new file mode 100644 index 0000000000..762cbd6e36 --- /dev/null +++ b/lily/rest-grav.cc @@ -0,0 +1,74 @@ +/* + rest-grav.cc -- implement Rest_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "rest-grav.hh" +#include "musical-request.hh" +#include "dots.hh" +#include "rest.hh" +/* + Should merge with Note_head_engraver + */ +Rest_engraver::Rest_engraver () +{ + rest_req_l_ =0; + rest_p_ =0; + dot_p_ =0; +} + +void +Rest_engraver::do_post_move_processing () +{ + rest_req_l_ =0; +} + +void +Rest_engraver::do_pre_move_processing () +{ + if (rest_p_) + { + typeset_element (rest_p_); + rest_p_ =0; + } + if (dot_p_) + { + typeset_element (dot_p_); + dot_p_ =0; + } +} + +void +Rest_engraver::do_process_requests () +{ + if (rest_req_l_ && !rest_p_) + { + rest_p_ = new Rest; + rest_p_->balltype_i_ = rest_req_l_->duration_.durlog_i_; + rest_p_->dots_i_ = rest_req_l_->duration_.dots_i_; + if (rest_p_->dots_i_) + { + dot_p_ = new Dots; + rest_p_->dots_l_ =dot_p_; + announce_element (Score_elem_info (dot_p_,0)); + } + announce_element (Score_elem_info (rest_p_, rest_req_l_)); + } +} + +bool +Rest_engraver::do_try_request (Request *r) +{ + Musical_req *m = r->musical (); + if (!m || !m->rest ()) + return false; + + rest_req_l_ = m->rest (); // ugh + return true; +} + +IMPLEMENT_IS_TYPE_B1(Rest_engraver, Engraver); +ADD_THIS_TRANSLATOR(Rest_engraver); diff --git a/lily/rest.cc b/lily/rest.cc new file mode 100644 index 0000000000..d2ccd2a01b --- /dev/null +++ b/lily/rest.cc @@ -0,0 +1,46 @@ +/* + rest.cc -- implement + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "molecule.hh" +#include "paper-def.hh" +#include "lookup.hh" +#include "rest.hh" +#include "dots.hh" +#include "axis-group-element.hh" +#include "p-score.hh" + +void +Rest::do_add_processing () +{ + if (balltype_i_ == 0) + position_i_ += 6; + else if (balltype_i_ == 1) + position_i_ += 4; + Rhythmic_head::do_add_processing (); + if (dots_l_) + dots_l_->position_i_ = position_i_; +} + +Rest::Rest () +{ + position_i_ =0; +} + +Molecule * +Rest::brew_molecule_p () const +{ + int staff_size_i_ =8; + bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1); + + Symbol s(paper ()->lookup_l()->rest (balltype_i_, streepjes_b)); + Molecule * m = new Molecule ( Atom (s)); + m->translate (position_i_ * paper ()->internote_f (), Y_AXIS); + return m; +} + +IMPLEMENT_IS_TYPE_B1(Rest, Rhythmic_head); diff --git a/lily/rhythmic-column-grav.cc b/lily/rhythmic-column-grav.cc new file mode 100644 index 0000000000..af3238c0f9 --- /dev/null +++ b/lily/rhythmic-column-grav.cc @@ -0,0 +1,104 @@ +/* + rhythmic-column-grav.cc -- implement Rhythmic_column_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "rhythmic-column-grav.hh" +#include "note-head.hh" +#include "stem.hh" +#include "note-column.hh" +#include "script.hh" +#include "dot-column.hh" + +Rhythmic_column_engraver::Rhythmic_column_engraver() +{ + stem_l_ =0; + ncol_p_=0; + dotcol_p_ =0; +} + + +void +Rhythmic_column_engraver::acknowledge_element (Score_elem_info i) +{ + if (i.elem_l_->is_type_b (Script::static_name ()) + && i.req_l_ && i.req_l_->musical ()) + { + script_l_arr_.push ((Script*)i.elem_l_->item()); + } + else if (i.elem_l_->is_type_b (Stem::static_name())) + { + stem_l_ = (Stem*) i.elem_l_->item(); + } + else if (i.elem_l_->is_type_b (Rhythmic_head::static_name ())) + { + Rhythmic_head * r = (Rhythmic_head*)i.elem_l_->item (); + if (!ncol_p_) + { + ncol_p_ = new Note_column; + announce_element (Score_elem_info (ncol_p_, 0)); + } + ncol_p_->add (r); + + if (r->dots_l_) + { + if (!dotcol_p_) + { + dotcol_p_ = new Dot_column; + ncol_p_->set (dotcol_p_); + announce_element (Score_elem_info (dotcol_p_, 0)); + } + dotcol_p_->add (r); + } + } + + if (ncol_p_) + { + if (stem_l_&& !ncol_p_->stem_l_) + ncol_p_->set (stem_l_); + + for (int i=0; i < script_l_arr_.size(); i++) + { + if (ncol_p_) + ncol_p_->add (script_l_arr_[i]); + } + + script_l_arr_.clear(); + } +} + +void +Rhythmic_column_engraver::do_pre_move_processing() +{ + if (ncol_p_) + { + if (! ncol_p_->h_shift_b_) + ncol_p_->h_shift_b_ = (bool) get_property ("hshift"); + if (! ncol_p_->dir_) + ncol_p_->dir_ =(Direction) int(get_property ("ydirection")); + + typeset_element (ncol_p_); + ncol_p_ =0; + } + if (dotcol_p_) + { + typeset_element (dotcol_p_); + dotcol_p_ =0; + } +} + +void +Rhythmic_column_engraver::do_post_move_processing() +{ + script_l_arr_.clear(); + stem_l_ =0; +} + + + + +IMPLEMENT_IS_TYPE_B1(Rhythmic_column_engraver,Engraver); +ADD_THIS_TRANSLATOR(Rhythmic_column_engraver); diff --git a/lily/rhythmic-head.cc b/lily/rhythmic-head.cc new file mode 100644 index 0000000000..616b8bf8cd --- /dev/null +++ b/lily/rhythmic-head.cc @@ -0,0 +1,66 @@ +/* + rhythmic-head.cc -- implement + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "rhythmic-head.hh" +#include "debug.hh" +#include "molecule.hh" +#include "paper-def.hh" +#include "lookup.hh" +#include "rest.hh" +#include "dots.hh" +#include "axis-group-element.hh" +#include "p-score.hh" + +void +Rhythmic_head::do_add_processing () +{ + if (dots_i_ && !dots_l_) + { + Dots *d = new Dots; + add (d); + pscore_l_->typeset_element (d); + axis_group_l_a_[Y_AXIS]->add_element (d); + axis_group_l_a_[X_AXIS]->add_element (d); + } + if (dots_l_) + { + dots_l_->no_dots_i_ = dots_i_; + } +} + +void +Rhythmic_head::add (Dots *dot_l) +{ + dots_l_ = dot_l; + dot_l->add_dependency (this); +} + + +Rhythmic_head::Rhythmic_head () +{ + dots_l_ =0; + balltype_i_ =0; + dots_i_ = 0; +} + +void +Rhythmic_head::do_substitute_dependent (Score_elem*o,Score_elem*n) +{ + if (o == dots_l_) + dots_l_ = n ? (Dots*)n->item () :0; +} + +IMPLEMENT_IS_TYPE_B1(Rhythmic_head, Item); +void +Rhythmic_head::do_print () const +{ +#ifndef NPRINT + DOUT << "balltype = "<< balltype_i_ << "dots = " << dots_i_; +#endif +} + diff --git a/lily/score-align-grav.cc b/lily/score-align-grav.cc index 7f8ee615e1..3af608484c 100644 --- a/lily/score-align-grav.cc +++ b/lily/score-align-grav.cc @@ -1,5 +1,5 @@ /* - score-align-reg.cc -- implement Score_align_engraver + score-align-reg.cc -- implement Type_align_engraver source file of the GNU LilyPond music typesetter @@ -11,7 +11,7 @@ #include "score-align-grav.hh" #include "item.hh" -Score_align_engraver::Score_align_engraver() +Type_align_engraver::Type_align_engraver() { type_ch_C_ = 0; priority_i_ =0; @@ -19,33 +19,33 @@ Score_align_engraver::Score_align_engraver() } void -Score_align_engraver::do_pre_move_processing() +Type_align_engraver::do_pre_move_processing() { if (align_p_) { - typeset_element (align_p_); - align_p_ =0; + typeset_element (align_p_); + align_p_ =0; } } void -Score_align_engraver::acknowledge_element (Score_elem_info inf) +Type_align_engraver::acknowledge_element (Score_elem_info inf) { if (inf.elem_l_->is_type_b (type_ch_C_)) { - if (!align_p_) - { - align_p_ = new Horizontal_group_item; - align_p_->breakable_b_ = true; - announce_element (Score_elem_info (align_p_,0)); - } - Score_elem * unbound_elem = inf.elem_l_; - while (unbound_elem->axis_group_l_a_[X_AXIS]) - unbound_elem = unbound_elem->axis_group_l_a_[X_AXIS]; - align_p_->add_element (unbound_elem); + if (!align_p_) + { + align_p_ = new Horizontal_group_item; + align_p_->breakable_b_ = true; + announce_element (Score_elem_info (align_p_,0)); + } + Score_elem * unbound_elem = inf.elem_l_; + while (unbound_elem->axis_group_l_a_[X_AXIS]) + unbound_elem = unbound_elem->axis_group_l_a_[X_AXIS]; + align_p_->add_element (unbound_elem); } } -IMPLEMENT_IS_TYPE_B1(Score_align_engraver,Engraver); +IMPLEMENT_IS_TYPE_B1(Type_align_engraver,Engraver); diff --git a/lily/score-align-gravs.cc b/lily/score-align-gravs.cc index 32127d1886..c3531e596b 100644 --- a/lily/score-align-gravs.cc +++ b/lily/score-align-gravs.cc @@ -12,21 +12,22 @@ #include "bar.hh" #include "score-align-grav.hh" -#define IMPLEMENT_ALIGN_REG(C,T,p)\ -class C ## _align_engraver : public Score_align_engraver \ +#define IMPLEMENT_ALIGN_GRAV(C,T,p)\ +class C ## _align_engraver : public Type_align_engraver \ { \ public: \ DECLARE_MY_RUNTIME_TYPEINFO; \ - C ## _align_engraver() : Score_align_engraver () \ + TRANSLATOR_CLONE(C ## _align_engraver);\ + C ## _align_engraver() : Type_align_engraver () \ { type_ch_C_ = T::static_name();\ priority_i_ = p;} \ }; \ -ADD_THIS_ENGRAVER(C ## _align_engraver); \ -IMPLEMENT_IS_TYPE_B1(C ## _align_engraver, Score_align_engraver) ; +ADD_THIS_TRANSLATOR(C ## _align_engraver); \ +IMPLEMENT_IS_TYPE_B1(C ## _align_engraver, Type_align_engraver) ; -IMPLEMENT_ALIGN_REG(Key,Key_item,3); -IMPLEMENT_ALIGN_REG(Clef,Clef_item,2); -IMPLEMENT_ALIGN_REG(Meter,Meter,4); -IMPLEMENT_ALIGN_REG(Bar, Bar,0); +IMPLEMENT_ALIGN_GRAV(Key,Key_item,3); +IMPLEMENT_ALIGN_GRAV(Clef,Clef_item,2); +IMPLEMENT_ALIGN_GRAV(Meter,Meter,4); +IMPLEMENT_ALIGN_GRAV(Bar, Bar,0); diff --git a/lily/score-elem.cc b/lily/score-elem.cc index 9d7b090daf..9995896a02 100644 --- a/lily/score-elem.cc +++ b/lily/score-elem.cc @@ -21,6 +21,42 @@ #include "item.hh" #include "p-col.hh" +Score_elem::Score_elem() +{ + transparent_b_ = empty_b_ = false; + axis_group_l_a_[0] = axis_group_l_a_[1] =0; + pscore_l_=0; + offset_ = Offset (0,0); + output = 0; + status_ = ORPHAN; +} + +Score_elem::Score_elem (Score_elem const&s) +{ + /* called from derived ctor, so most info points to the same deps + as (Directed_graph_node&)s. Nobody points to us, so don't copy + dependents. + */ + copy_edges_out (s); + transparent_b_ = s.transparent_b_; + empty_b_ = s.empty_b_; + axis_group_l_a_[0] = axis_group_l_a_[1] =0; + status_ = s.status_; + assert (!s.output); + output = 0; + pscore_l_ = s.pscore_l_; + offset_ = Offset (0,0); +} + +Score_elem::~Score_elem() +{ + // some paranoia to prevent weird segv's + assert (status_ < DELETED); + delete output; + status_ = DELETED; + output = 0; +} + Score_elem* Score_elem::dependency (int i) const { @@ -53,7 +89,7 @@ Score_elem::make_TeX_string (Offset o)const a.push (print_dimen (o.y())); a.push (print_dimen (o.x())); String t = output->TeX_string(); - if (t == "") + if (!t) return t; a.push (t); @@ -69,32 +105,6 @@ Score_elem::do_TeX_output_str () const return make_TeX_string(absolute_offset()); } -Score_elem::Score_elem (Score_elem const&s) -{ - /* called from derived ctor, so most info points to the same deps - as (Directed_graph_node&)s. Nobody points to us, so don't copy - dependents. - */ - copy_edges_out (s); - transparent_b_ = s.transparent_b_; - empty_b_ = s.empty_b_; - axis_group_l_a_[0] = axis_group_l_a_[1] =0; - status_ = s.status_; - assert (!s.output); - output = 0; - pscore_l_ = s.pscore_l_; - offset_ = Offset (0,0); -} - -Score_elem::~Score_elem() -{ - // some paranoia to prevent weird segv's - assert (status_ < DELETED); - delete output; - status_ = DELETED; - output = 0; -} - /* GEOMETRY */ @@ -241,16 +251,6 @@ Score_elem::print() const #endif } -Score_elem::Score_elem() -{ - transparent_b_ = empty_b_ = false; - axis_group_l_a_[0] = axis_group_l_a_[1] =0; - pscore_l_=0; - offset_ = Offset (0,0); - output = 0; - status_ = ORPHAN; -} - Paper_def* Score_elem::paper() const diff --git a/lily/score-grav.cc b/lily/score-grav.cc index 183d8e54fe..bad0498dcc 100644 --- a/lily/score-grav.cc +++ b/lily/score-grav.cc @@ -9,15 +9,13 @@ #include "super-elem.hh" #include "scoreline.hh" #include "debug.hh" -#include "score-elem.hh" -#include "bar.hh" // needed for Bar::static_name +#include "item.hh" #include "score-grav.hh" -#include "p-col.hh" #include "p-score.hh" -#include "score.hh" #include "musical-request.hh" #include "score-column.hh" #include "command-request.hh" +#include "paper-def.hh" Score_engraver::Score_engraver() @@ -33,6 +31,7 @@ Score_engraver::Score_engraver() void Score_engraver::prepare (Moment w) { + Global_translator::prepare (w); set_columns (new Score_column (w), new Score_column (w)); disallow_break_b_ = false; @@ -210,11 +209,6 @@ Score_engraver::get_staff_info() const return inf; } -Paper_def* -Score_engraver::paper() const -{ - return pscore_p_->paper_l_; -} Music_output* @@ -235,6 +229,14 @@ Score_engraver::do_try_request (Request*r) } IMPLEMENT_IS_TYPE_B1(Score_engraver,Engraver_group_engraver); -ADD_THIS_ENGRAVER(Score_engraver); +ADD_THIS_TRANSLATOR(Score_engraver); - +void +Score_engraver::add_processing () +{ + Translator_group::add_processing (); + assert (output_def_l_->is_type_b (Paper_def::static_name ())); + assert (!daddy_trans_l_); + pscore_p_ = new Paper_score; + pscore_p_->paper_l_ = (Paper_def*)output_def_l_; +} diff --git a/lily/score-halign-grav.cc b/lily/score-halign-grav.cc index c694c50ee2..8af2412f66 100644 --- a/lily/score-halign-grav.cc +++ b/lily/score-halign-grav.cc @@ -21,8 +21,8 @@ Score_horizontal_align_engraver::do_pre_move_processing() { if (halign_p_) { - typeset_element (halign_p_); - halign_p_ =0; + typeset_element (halign_p_); + halign_p_ =0; } } @@ -32,22 +32,22 @@ Score_horizontal_align_engraver::acknowledge_element (Score_elem_info i) { Engraver* reg = i.origin_grav_l_arr_[0]; if (reg->is_type_b ( - Score_align_engraver::static_name())) - { - Score_align_engraver * align_grav_l = (Score_align_engraver*) reg; - if (!halign_p_) - { - halign_p_ = new Break_align_item; - halign_p_->breakable_b_ = true; - announce_element (Score_elem_info (halign_p_,0)); - } - Item * it = i.elem_l_->item(); - if (align_grav_l->type_ch_C_ == Bar::static_name()) - halign_p_->center_l_ = it; + Type_align_engraver::static_name())) + { + Type_align_engraver * align_grav_l = (Type_align_engraver*) reg; + if (!halign_p_) + { + halign_p_ = new Break_align_item; + halign_p_->breakable_b_ = true; + announce_element (Score_elem_info (halign_p_,0)); + } + Item * it = i.elem_l_->item(); + if (align_grav_l->type_ch_C_ == Bar::static_name()) + halign_p_->center_l_ = it; - halign_p_->add (it, align_grav_l->priority_i_); + halign_p_->add (it, align_grav_l->priority_i_); } } IMPLEMENT_IS_TYPE_B1(Score_horizontal_align_engraver,Engraver); -ADD_THIS_ENGRAVER(Score_horizontal_align_engraver); +ADD_THIS_TRANSLATOR(Score_horizontal_align_engraver); diff --git a/lily/score-performer.cc b/lily/score-performer.cc index 6473489284..75e9fc2200 100644 --- a/lily/score-performer.cc +++ b/lily/score-performer.cc @@ -7,11 +7,10 @@ */ #include "score-performer.hh" -#include "input-translator.hh" #include "midi-def.hh" #include "audio-column.hh" #include "audio-item.hh" -#include "audio-score.hh" +#include "performance.hh" #include "midi-stream.hh" #include "string-convert.hh" #include "debug.hh" @@ -21,8 +20,7 @@ #include "audio-staff.hh" IMPLEMENT_IS_TYPE_B1(Score_performer,Performer_group_performer); - -ADD_THIS_PERFORMER(Score_performer); +ADD_THIS_TRANSLATOR(Score_performer); Score_performer::Score_performer() @@ -34,28 +32,12 @@ Score_performer::~Score_performer() { } - -Translator* -Score_performer::ancestor_l (int l) -{ - return Global_translator::ancestor_l (l); -} - - -int -Score_performer::depth_i() const -{ - return Global_translator::depth_i(); -} - - - void Score_performer::play (Audio_element * p) { if (p->is_type_b (Audio_item::static_name())) { - audio_column_l_->add ((Audio_item*)p); + audio_column_l_->add ((Audio_item*)p); } else if (p->is_type_b (Audio_staff::static_name())) { @@ -64,13 +46,13 @@ Score_performer::play (Audio_element * p) performance_p_->add (p); } - void Score_performer::prepare (Moment m) { - now_mom_ = m; + Global_translator::prepare (m); audio_column_l_ = new Audio_column (m); performance_p_->add (audio_column_l_); + post_move_processing (); } @@ -78,10 +60,10 @@ void Score_performer::process() { process_requests(); + pre_move_processing(); + check_removal(); } - - void Score_performer::start() { @@ -97,7 +79,8 @@ Score_performer::get_tempo_i() const void Score_performer::finish() { - Performer_group_performer::do_removal_processing(); + check_removal (); + removal_processing(); } Music_output * @@ -107,3 +90,12 @@ Score_performer::get_output_p () performance_p_ =0; return o; } + +void +Score_performer::add_processing () +{ + Translator_group::add_processing (); + assert (output_def_l_->is_type_b (Midi_def::static_name ())); + performance_p_ = new Performance; + performance_p_->midi_l_ = (Midi_def*) output_def_l_; +} diff --git a/lily/score.cc b/lily/score.cc index 3da46e2c23..f1adcc0def 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -123,6 +123,7 @@ Score::print() const { #ifndef NPRINT DOUT << "score {\n"; + music_p_ -> print (); for (int i=0; i < def_p_arr_.size (); i++) def_p_arr_[i]->print(); DOUT << "}\n"; diff --git a/lily/scores.cc b/lily/scores.cc index 3886a7715d..90fbcf17a7 100644 --- a/lily/scores.cc +++ b/lily/scores.cc @@ -22,22 +22,21 @@ do_scores() { for (int i=0; i < global_score_array.size(); i++) { - Score *&is_p = global_score_array[i]; - if (is_p->header_p_) - is_p->header_p_->lily_id_str_ = "Lily was here, " + - get_version_number_str(); - if (is_p->errorlevel_i_) - { - is_p->warning ("Score contains errors. Will not process it. "); - exit_status_i_ |= 1; - } - else - { - is_p->print(); - is_p->process(); - } - delete is_p; - is_p =0; + Score *&is_p = global_score_array[i]; + if (is_p->header_p_) + is_p->header_p_->lily_id_str_ = "Lily was here, " + + get_version_number_str(); + if (is_p->errorlevel_i_) + { + is_p->warning ("Score contains errors. Will not process it. "); + exit_status_i_ |= 1; + } + else + { + is_p->process(); + } + delete is_p; + is_p =0; } global_score_array.clear(); diff --git a/lily/script-grav.cc b/lily/script-grav.cc index c9c1585612..d49c447fb5 100644 --- a/lily/script-grav.cc +++ b/lily/script-grav.cc @@ -67,4 +67,4 @@ Script_engraver::do_post_move_processing() IMPLEMENT_IS_TYPE_B1(Script_engraver,Engraver); -ADD_THIS_ENGRAVER(Script_engraver); +ADD_THIS_TRANSLATOR(Script_engraver); diff --git a/lily/slur-grav.cc b/lily/slur-grav.cc index a96eae70cb..14fea917f6 100644 --- a/lily/slur-grav.cc +++ b/lily/slur-grav.cc @@ -36,13 +36,6 @@ Slur_engraver::acknowledge_element (Score_elem_info info) } } -void -Slur_engraver::set_feature (Feature f) -{ - if (f.type_ == "vdir") - dir_ = (Direction)int(f.value_); -} - /* abracadabra */ @@ -86,6 +79,7 @@ Slur_engraver::do_process_requests() void Slur_engraver::do_pre_move_processing() { + dir_ = (Direction) int(get_property ("ydirection")); for (int i = 0; i < end_slur_l_arr_.size(); i++) { if (dir_) @@ -109,4 +103,4 @@ Slur_engraver::~Slur_engraver() } IMPLEMENT_IS_TYPE_B1(Slur_engraver,Engraver); -ADD_THIS_ENGRAVER(Slur_engraver); +ADD_THIS_TRANSLATOR(Slur_engraver); diff --git a/lily/span-bar-grav.cc b/lily/span-bar-grav.cc index 7d51fbe78c..1850c66ab9 100644 --- a/lily/span-bar-grav.cc +++ b/lily/span-bar-grav.cc @@ -61,4 +61,4 @@ Span_bar_engraver::do_pre_move_processing() IMPLEMENT_IS_TYPE_B1(Span_bar_engraver,Engraver); -ADD_THIS_ENGRAVER(Span_bar_engraver); +ADD_THIS_TRANSLATOR(Span_bar_engraver); diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 5f19f84177..ba2c3739f2 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -29,16 +29,16 @@ Span_bar::do_substitute_dependency (Score_elem*o, Score_elem*n) { Bar * bold = 0; if (o->is_type_b (Bar::static_name())) - bold = (Bar*)o->item(); + bold = (Bar*)o->item(); else - return; + return; bold->spanned_i_ --; Bar * b =0; if (n && n->is_type_b (Bar::static_name())) { - b = (Bar*)n->item(); - b->spanned_i_ ++; + b = (Bar*)n->item(); + b->spanned_i_ ++; } spanning_l_arr_.substitute (bold , b); @@ -62,26 +62,26 @@ Span_bar::do_pre_processing() { if (spanning_l_arr_.size() < 1) { - transparent_b_ = true; - empty_b_ =true; + transparent_b_ = true; + empty_b_ =true; } else { - if (type_str_ == "") - type_str_ = spanning_l_arr_[0]->type_str_; - if (type_str_ =="") - { - transparent_b_=true; - empty_b_ = true; - } - else if (type_str_ == "|:") - { - type_str_ = ".|"; - } - else if (type_str_ == ":|") - { - type_str_ = "|."; - } + if (!type_str_) + type_str_ = spanning_l_arr_[0]->type_str_; + if (!type_str_) + { + transparent_b_=true; + empty_b_ = true; + } + else if (type_str_ == "|:") + { + type_str_ = ".|"; + } + else if (type_str_ == ":|") + { + type_str_ = "|."; + } } } @@ -98,13 +98,13 @@ Span_bar::brew_molecule_p() const Interval y_int; for (int i=0; i < spanning_l_arr_.size(); i++) { - Axis_group_element *common = - common_group (spanning_l_arr_[i], Y_AXIS); + Axis_group_element *common = + common_group (spanning_l_arr_[i], Y_AXIS); - Real y = spanning_l_arr_[i]->relative_coordinate (common, Y_AXIS) - -relative_coordinate (common,Y_AXIS); + Real y = spanning_l_arr_[i]->relative_coordinate (common, Y_AXIS) + -relative_coordinate (common,Y_AXIS); - y_int.unite (y + spanning_l_arr_[i]->height()); + y_int.unite (y + spanning_l_arr_[i]->height()); } Symbol s = get_bar_sym (y_int.length()); diff --git a/lily/span-score-bar-grav.cc b/lily/span-score-bar-grav.cc index b09322c329..6f4d282330 100644 --- a/lily/span-score-bar-grav.cc +++ b/lily/span-score-bar-grav.cc @@ -25,5 +25,5 @@ Piano_bar_engraver::get_span_bar_p() const return new Piano_brace; } -ADD_THIS_ENGRAVER(Piano_bar_engraver); -ADD_THIS_ENGRAVER(Span_score_bar_engraver); +ADD_THIS_TRANSLATOR(Piano_bar_engraver); +ADD_THIS_TRANSLATOR(Span_score_bar_engraver); diff --git a/lily/spanner.cc b/lily/spanner.cc index 397cfdb6c5..07eb278b84 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -78,12 +78,17 @@ Spanner::set_my_columns() void Spanner::set_bounds(Direction d, Item*i) { + if (spanned_drul_[d]) spanned_drul_[d]->attached_span_l_arr_.substitute(this,0); spanned_drul_[d] =i; if (i) i->attached_span_l_arr_.push(this); + + assert (!spanned_drul_[d] || + spanned_drul_[Direction(-d)] != spanned_drul_[d]); + } void diff --git a/lily/staff-info.cc b/lily/staff-info.cc index 75854b82a9..383df71ce1 100644 --- a/lily/staff-info.cc +++ b/lily/staff-info.cc @@ -50,9 +50,3 @@ Staff_info::musical_pcol_l() return musical_l(); } -Moment -Staff_info::when() -{ - return command_l()->when (); -} - diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 72b1ef6840..99eed10c50 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -7,15 +7,14 @@ */ #include "staff-performer.hh" -#include "translator.hh" -#include "input-translator.hh" +#include "translator-group.hh" #include "debug.hh" #include "audio-column.hh" #include "audio-item.hh" #include "audio-staff.hh" IMPLEMENT_IS_TYPE_B1(Staff_performer,Performer_group_performer); -ADD_THIS_PERFORMER(Staff_performer); +ADD_THIS_TRANSLATOR(Staff_performer); Staff_performer::Staff_performer() { @@ -34,23 +33,25 @@ Staff_performer::do_creation_processing() if (instrument_str().length_i()) { - // staff name - play (new Audio_text (Audio_text::TRACK_NAME, instrument_str ())); - // instrument description - play (new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_str ())); + // staff name + play (new Audio_text (Audio_text::TRACK_NAME, id_str_)); + // instrument description + play (new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_str ())); } // tempo - play(new Audio_tempo(get_tempo_i())); + play (new Audio_tempo (get_tempo_i ())); if (instrument_str ().length_i ()) - // instrument - play (new Audio_instrument (instrument_str ())); + // instrument + play (new Audio_instrument (instrument_str ())); + Performer_group_performer::do_creation_processing (); } void Staff_performer::do_removal_processing() { + Performer_group_performer::do_removal_processing (); Performer::play (audio_staff_p_); audio_staff_p_ = 0; } @@ -58,7 +59,7 @@ Staff_performer::do_removal_processing() String Staff_performer::instrument_str() { - return Translator::id_str_; + return get_property ("instrument"); } void @@ -66,7 +67,7 @@ Staff_performer::play (Audio_element* p) { if (p->is_type_b (Audio_item::static_name())) { - audio_staff_p_->add ((Audio_item*)p); + audio_staff_p_->add ((Audio_item*)p); } Performer::play (p); } diff --git a/lily/staff-sym-grav.cc b/lily/staff-sym-grav.cc index f2dfad4d32..d704518f8c 100644 --- a/lily/staff-sym-grav.cc +++ b/lily/staff-sym-grav.cc @@ -48,4 +48,4 @@ Staff_sym_engraver::do_removal_processing() IMPLEMENT_IS_TYPE_B1(Staff_sym_engraver,Engraver); -ADD_THIS_ENGRAVER(Staff_sym_engraver); +ADD_THIS_TRANSLATOR(Staff_sym_engraver); diff --git a/lily/stem-grav.cc b/lily/stem-grav.cc index 08f07ff59f..2d81cc58f2 100644 --- a/lily/stem-grav.cc +++ b/lily/stem-grav.cc @@ -46,6 +46,7 @@ Stem_engraver::do_pre_move_processing() { if (stem_p_) { + dir_ = (Direction) int(get_property ("ydirection")); if (dir_) stem_p_->dir_ = dir_; @@ -71,12 +72,5 @@ Stem_engraver::do_try_request (Request* r) return true; } -void -Stem_engraver::set_feature (Feature i) -{ - if (i.type_ == "vdir") - dir_ = (Direction) int(i.value_); -} - IMPLEMENT_IS_TYPE_B1(Stem_engraver, Engraver); -ADD_THIS_ENGRAVER(Stem_engraver); +ADD_THIS_TRANSLATOR(Stem_engraver); diff --git a/lily/stem.cc b/lily/stem.cc index e876f7a020..0cd5486d0f 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -16,6 +16,7 @@ #include "p-col.hh" #include "misc.hh" #include "beam.hh" +#include "rest.hh" const int STEMLEN=7; @@ -101,23 +102,23 @@ void Stem::add (Note_head *n) { n->add_dependency (this); - if (n->rest_b_) - rest_l_arr_.push (n); - else - head_l_arr_.push (n); - -#if 0 - else if (1) //why different? (n->balltype_i_) head_l_arr_.push (n); - else - whole_l_arr_.push (n); -#endif +} + +void +Stem::add (Rest *r) +{ + rest_l_arr_.push (r); + r->add_dependency (this); // ? } bool Stem::invisible_b () const { - return !head_l_arr_.size(); + + return !head_l_arr_.size () || + head_l_arr_[0]->balltype_i_ <= 0; + } // if dir_ is set we return fake values. @@ -244,11 +245,12 @@ Stem::do_pre_processing () if (stem_bottom_f_== stem_top_f_) set_default_extents (); set_noteheads (); - flag_i_ = dir_*abs (flag_i_); + flag_i_ = dir_ * abs (flag_i_); transparent_b_ = invisible_b (); empty_b_ = invisible_b (); } + Interval Stem::do_width () const { @@ -260,46 +262,50 @@ Stem::do_width () const return r; } -Molecule -Stem::abbrev_mol () const -{ - Real dy = paper ()->interbeam_f (); - Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim.x ().length (); - Real beamdy = paper ()->interline_f () / 2; - - int beams_i = 0; - Real slope = paper ()->internote_f () / 4; - - if (beam_l_) { - // huh? - slope = 2 * beam_l_->slope; - // ugh, rather calc from Abbreviation_req - beams_i = beams_right_i_ >? beams_left_i_; - } - paper()->lookup_l ()->beam (slope, 20 PT); - - Molecule beams; - Atom a (paper ()->lookup_l ()->beam (slope, w)); - a.translate (Offset(- w / 2, stem_end_f () - (w / 2 * slope))); - // ugh - if (!beams_i) - a.translate (dy + beamdy - dir_ * dy, Y_AXIS); - else - a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS); - - for (int i = 0; i < abbrev_flag_i_; i++) - { - Atom b (a); - b.translate (-dir_ * dy * (beams_i + i), Y_AXIS); - beams.add (b); - } - return beams; -} + + Molecule + Stem::abbrev_mol () const + { + Real dy = paper ()->interbeam_f (); + Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim.x ().length (); + Real beamdy = paper ()->interline_f () / 2; + + int beams_i = 0; + Real slope = paper ()->internote_f () / 4; + + if (beam_l_) { + // huh? + slope = 2 * beam_l_->slope; + // ugh, rather calc from Abbreviation_req + beams_i = beams_right_i_ >? beams_left_i_; + } + paper ()->lookup_l ()->beam (slope, 20 PT); + + Molecule beams; + Atom a (paper ()->lookup_l ()->beam (slope, w)); + a.translate (Offset(- w / 2, stem_end_f () - (w / 2 * slope))); + // ugh + if (!beams_i) + a.translate (dy + beamdy - dir_ * dy, Y_AXIS); + else + a.translate (2 * beamdy - dir_ * (beamdy - dy), Y_AXIS); + + for (int i = 0; i < abbrev_flag_i_; i++) + { + Atom b (a); + b.translate (-dir_ * dy * (beams_i + i), Y_AXIS); + beams.add (b); + } + + return beams; + } Molecule* Stem::brew_molecule_p () const { + Molecule *mol_p =new Molecule; + Real bot = stem_bottom_f_; Real top = stem_top_f_; @@ -308,31 +314,32 @@ Stem::brew_molecule_p () const Paper_def *p =paper (); Real dy = p->internote_f (); - Symbol ss =p->lookup_l ()->stem (bot*dy,top*dy); - - Molecule* mol_p = new Molecule; - if (head_l_arr_.size() && head_l_arr_[0]->balltype_i_) - mol_p->add (Atom (ss)); - - if (!beam_l_ && abs (flag_i_) > 4) + if (!invisible_b ()) + { + Symbol ss =p->lookup_l ()->stem (bot*dy,top*dy); + mol_p->add (Atom (ss)); + } + + if (!beam_l_ &&abs (flag_i_) > 4) { Symbol fl = p->lookup_l ()->flag (flag_i_); Molecule m (fl); - if (flag_i_ < -4){ - mol_p->add_bottom (m); - } + if (flag_i_ < -4) + { + mol_p->add_at_edge (Y_AXIS, DOWN, m); + } else if (flag_i_ > 4) { - mol_p->add_top (m); + mol_p->add_at_edge (Y_AXIS, UP, m); } else assert (false); - assert (!abbrev_flag_i_); - } + assert (!abbrev_flag_i_); + } if (abbrev_flag_i_) mol_p->add (abbrev_mol ()); - + mol_p->translate (stem_xoffset_f_, X_AXIS); return mol_p; } @@ -348,8 +355,7 @@ void Stem::do_substitute_dependency (Score_elem*o,Score_elem*n) { Item * o_l = o->item (); - Item * n_l = n? n->item ():0; -// whole_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l); + Item * n_l = n? n->item () : 0; head_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l); - rest_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l); + rest_l_arr_.substitute ((Rest*)o_l, (Rest*)n_l); } diff --git a/lily/swallow-grav.cc b/lily/swallow-grav.cc index 84de4871b5..a8fbfcd0f3 100644 --- a/lily/swallow-grav.cc +++ b/lily/swallow-grav.cc @@ -9,7 +9,7 @@ IMPLEMENT_IS_TYPE_B1(Swallow_engraver,Engraver); -ADD_THIS_ENGRAVER(Swallow_engraver); +ADD_THIS_TRANSLATOR(Swallow_engraver); bool diff --git a/lily/swallow-perf.cc b/lily/swallow-perf.cc index 332964af40..6d8c55936e 100644 --- a/lily/swallow-perf.cc +++ b/lily/swallow-perf.cc @@ -10,4 +10,4 @@ IMPLEMENT_IS_TYPE_B1(Swallow_performer, Performer); -ADD_THIS_PERFORMER(Swallow_performer); +ADD_THIS_TRANSLATOR(Swallow_performer); diff --git a/lily/symtable.cc b/lily/symtable.cc index 25e4ff8ce7..2bb6f53fa9 100644 --- a/lily/symtable.cc +++ b/lily/symtable.cc @@ -51,7 +51,7 @@ Symtable::lookup (String s) const Symtable* Symtables::operator()(String s) { - return Assoc<String, Symtable*>::operator[](s); + return Dictionary<Symtable*>::operator[](s); } void Symtables::print() const @@ -76,5 +76,5 @@ void Symtables::add (String s, Symtable*p) { p-> id_str = s; - Assoc<String, Symtable*>::add (s,p); + Dictionary<Symtable*>::add (s,p); } diff --git a/lily/template3.cc b/lily/template3.cc index 9e6e7e6dce..d9ea0deba2 100644 --- a/lily/template3.cc +++ b/lily/template3.cc @@ -7,11 +7,8 @@ */ #include "symbol.hh" -#include "request.hh" -#include "input-translator.hh" #include "molecule.hh" #include "plist.tcc" #include "pcursor.tcc" template POINTERLIST_INSTANTIATE(Atom); -template POINTERLIST_INSTANTIATE(Input_translator); diff --git a/lily/template4.cc b/lily/template4.cc index a1ef773cd2..63b5cad9ad 100644 --- a/lily/template4.cc +++ b/lily/template4.cc @@ -6,9 +6,4 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#if 0 -#include "proto.hh" -#include "list.tcc" -#include "cursor.tcc" - -#endif +// empty. Yes I know. diff --git a/lily/template6.cc b/lily/template6.cc index dd7bf02997..eff2467ad5 100644 --- a/lily/template6.cc +++ b/lily/template6.cc @@ -1,7 +1,7 @@ #include "proto.hh" #include "plist.tcc" -#include "engraver.hh" -#include "performer.hh" +#include "translator.hh" + + +template POINTERLIST_INSTANTIATE(Translator); -template POINTERLIST_INSTANTIATE(Engraver); -template POINTERLIST_INSTANTIATE(Performer); diff --git a/lily/tex-slur.cc b/lily/tex-slur.cc index 30d06d3d32..27dede2e41 100644 --- a/lily/tex-slur.cc +++ b/lily/tex-slur.cc @@ -235,8 +235,8 @@ Lookup::big_slur (int dy , Real &dx, Direction dir) const mol.add (l); Atom a (m); a.translate (slur_extra * internote_f, Y_AXIS); - mol.add_right (m); - mol.add_right (r); + mol.add_at_edge (X_AXIS, RIGHT, m); + mol.add_at_edge (X_AXIS, RIGHT, r); mol.translate (l_dy * internote_f, Y_AXIS); Symbol s; s.tex = mol.TeX_string(); diff --git a/lily/tie-grav.cc b/lily/tie-grav.cc index f1b3463c31..c7201bde2e 100644 --- a/lily/tie-grav.cc +++ b/lily/tie-grav.cc @@ -24,24 +24,17 @@ Tie_engraver::Tie_engraver() dir_ = CENTER; } -void -Tie_engraver::sync_features() -{ - dir_ = Direction (int (get_feature ("vdir"))); -} - - void Tie_engraver::do_post_move_processing() { - if (tie_p_ && get_staff_info().when () == end_mom_) + if (tie_p_ && now_moment () == end_mom_) { - end_tie_p_ = tie_p_; - end_req_l_ = req_l_; - end_melodic_req_l_ = melodic_req_l_; - tie_p_ =0; - req_l_ =0; - end_mom_ = -1; + end_tie_p_ = tie_p_; + end_req_l_ = req_l_; + end_melodic_req_l_ = melodic_req_l_; + tie_p_ =0; + req_l_ =0; + end_mom_ = -1; } } @@ -55,23 +48,24 @@ bool Tie_engraver::do_try_request (Request*r) { if (!acceptable_request_b (r)) - return false; + return false; if (req_l_) { - return false; + return false; } req_l_ = r->musical()->tie (); end_mom_ = r->parent_music_l_->time_int().length () - + get_staff_info().when (); + + now_moment (); return true; } void Tie_engraver::do_process_requests() { + dir_ = (Direction) int (get_property ("ydirection")); if (req_l_ && ! tie_p_) { - tie_p_ = new Tie; + tie_p_ = new Tie; } } @@ -80,19 +74,19 @@ Tie_engraver::acknowledge_element (Score_elem_info i) { if (i.elem_l_->name() == Note_head::static_name ()) { - if (tie_p_) - { - tie_p_->set_head (LEFT, (Note_head*)i.elem_l_->item()); - melodic_req_l_ = i.req_l_->musical()->melodic (); - } - - if (end_tie_p_) - { - end_tie_p_->set_head (RIGHT, (Note_head*)i.elem_l_->item()); - if (!Melodic_req::compare (*end_melodic_req_l_, *melodic_req_l_)) - end_tie_p_->same_pitch_b_ = true; - announce_element (Score_elem_info (end_tie_p_,end_req_l_)); - } + if (tie_p_) + { + tie_p_->set_head (LEFT, (Note_head*)i.elem_l_->item()); + melodic_req_l_ = i.req_l_->musical()->melodic (); + } + + if (end_tie_p_) + { + end_tie_p_->set_head (RIGHT, (Note_head*)i.elem_l_->item()); + if (!Melodic_req::compare (*end_melodic_req_l_, *melodic_req_l_)) + end_tie_p_->same_pitch_b_ = true; + announce_element (Score_elem_info (end_tie_p_,end_req_l_)); + } } } @@ -101,32 +95,25 @@ Tie_engraver::do_pre_move_processing() { if (end_tie_p_) { - if (dir_) - end_tie_p_->dir_ = dir_; + if (dir_) + end_tie_p_->dir_ = dir_; - typeset_element (end_tie_p_); - end_tie_p_ =0; - end_req_l_ =0; + typeset_element (end_tie_p_); + end_tie_p_ =0; + end_req_l_ =0; } - } Tie_engraver::~Tie_engraver() { if (tie_p_) { - req_l_->warning ("unended Tie"); - delete tie_p_; + req_l_->warning ("unended Tie"); + delete tie_p_; } } -void -Tie_engraver::set_feature (Feature f) -{ - if (f.type_ == "vdir") - dir_ = Direction (int (f.value_)); -} IMPLEMENT_IS_TYPE_B1(Tie_engraver,Engraver); -ADD_THIS_ENGRAVER(Tie_engraver); +ADD_THIS_TRANSLATOR(Tie_engraver); diff --git a/lily/tie.cc b/lily/tie.cc index b5863193cf..c0564a0b97 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -10,6 +10,7 @@ #include "tie.hh" #include "note-head.hh" #include "p-col.hh" +#include "debug.hh" void @@ -38,7 +39,9 @@ Tie::set_default_dir() void Tie::do_add_processing() { - assert (head_l_drul_[LEFT] && head_l_drul_[RIGHT]); + if (!(head_l_drul_[LEFT] && head_l_drul_[RIGHT])) + warning ("Lonely tie.. "); + set_bounds(LEFT,head_l_drul_[LEFT]); set_bounds(RIGHT,head_l_drul_[RIGHT]); } diff --git a/lily/timing-grav.cc b/lily/timing-grav.cc index f27e9f92be..9b5ea11d9c 100644 --- a/lily/timing-grav.cc +++ b/lily/timing-grav.cc @@ -10,10 +10,6 @@ #include "command-request.hh" -Timing_engraver::Timing_engraver() -{ - default_grouping_ = Rhythmic_grouping (MInterval (0,4),4); // ugh -} void Timing_engraver::fill_staff_info (Staff_info &inf) @@ -22,123 +18,5 @@ Timing_engraver::fill_staff_info (Staff_info &inf) inf.rhythmic_C_ = &default_grouping_; } -bool -Timing_engraver::do_try_request(Request*r) -{ - Command_req * c = r->command(); - if (!(c && c->timing())) - return false; - for (int i=0; i < timing_req_l_arr_.size (); i++) - { - if (timing_req_l_arr_[i]->equal_b(r)) - return true; - if (timing_req_l_arr_[i]->name() == r->name()) - { - r->warning ("conflicting timing request"); - return false; - } - } - - timing_req_l_arr_.push(c->timing()); - return true; -} - -Meter_change_req* -Timing_engraver::meter_req_l() const -{ - Meter_change_req *m_l=0; - for (int i=0; !m_l && i < timing_req_l_arr_.size (); i++) - { - m_l=timing_req_l_arr_[i]->meterchange(); - } - return m_l; -} - -void -Timing_engraver::do_process_requests() -{ - for (int i=0; i < timing_req_l_arr_.size (); i++) - { - Timing_req * tr_l = timing_req_l_arr_[i]; - Meter_change_req *m_l = tr_l->meterchange(); - if (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_); - - } - } -} - - -void -Timing_engraver::do_pre_move_processing() -{ - timing_req_l_arr_.set_size (0); - Engraver_group_engraver * grav_l = daddy_grav_l_; - while (grav_l->daddy_grav_l_) - { - grav_l = grav_l->daddy_grav_l_; - } - - assert (grav_l->name() == Score_engraver::static_name ()); - if (!time_.cadenza_b_) - ((Score_engraver*)grav_l)->add_moment_to_process (time_.next_bar_moment()); -} - -IMPLEMENT_IS_TYPE_B1(Timing_engraver, Engraver); -ADD_THIS_ENGRAVER(Timing_engraver); - -void -Timing_engraver::do_creation_processing() -{ - time_.when_ = get_staff_info().when (); -} - -void -Timing_engraver::do_post_move_processing() -{ - time_.add (get_staff_info().when () - time_.when_); -} - +IMPLEMENT_IS_TYPE_B1(Timing_engraver, Timing_translator); +ADD_THIS_TRANSLATOR(Timing_engraver); diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc new file mode 100644 index 0000000000..c282d0c608 --- /dev/null +++ b/lily/timing-translator.cc @@ -0,0 +1,135 @@ + +/* + timing-translator.cc -- implement Timing_translator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "timing-translator.hh" +#include "command-request.hh" +#include "translator-group.hh" +#include "global-translator.hh" + +Timing_translator::Timing_translator() +{ + default_grouping_ = Rhythmic_grouping (MInterval (0,4),4); // ugh +} + +bool +Timing_translator::do_try_request(Request*r) +{ + Command_req * c = r->command(); + if (!(c && c->timing())) + return false; + for (int i=0; i < timing_req_l_arr_.size (); i++) + { + if (timing_req_l_arr_[i]->equal_b(r)) + return true; + if (timing_req_l_arr_[i]->name() == r->name()) + { + r->warning ("conflicting timing request"); + return false; + } + } + + timing_req_l_arr_.push(c->timing()); + return true; +} + +Meter_change_req* +Timing_translator::meter_req_l() const +{ + Meter_change_req *m_l=0; + for (int i=0; !m_l && i < timing_req_l_arr_.size (); i++) + { + m_l=timing_req_l_arr_[i]->meterchange(); + } + return m_l; +} + +void +Timing_translator::do_process_requests() +{ + for (int i=0; i < timing_req_l_arr_.size (); i++) + { + Timing_req * tr_l = timing_req_l_arr_[i]; + Meter_change_req *m_l = tr_l->meterchange(); + if (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_); + + } + } +} + + +void +Timing_translator::do_pre_move_processing() +{ + timing_req_l_arr_.set_size (0); + Global_translator *global_l = + daddy_trans_l_->ancestor_l (100)->global_l (); // ugh 100. + + if (!time_.cadenza_b_) + global_l->add_moment_to_process (time_.next_bar_moment ()); +} + +IMPLEMENT_IS_TYPE_B1(Timing_translator, Translator); +ADD_THIS_TRANSLATOR(Timing_translator); + +void +Timing_translator::do_creation_processing() +{ + time_.when_ = now_moment (); +} + +void +Timing_translator::do_post_move_processing() +{ + time_.add (now_moment () - time_.when_); +} + diff --git a/lily/translation-property.cc b/lily/translation-property.cc new file mode 100644 index 0000000000..483036be50 --- /dev/null +++ b/lily/translation-property.cc @@ -0,0 +1,20 @@ +/* + translation-property.cc -- implement Translation_property + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "translation-property.hh" +#include "debug.hh" + +IMPLEMENT_IS_TYPE_B1(Translation_property, Music); + +void +Translation_property::do_print () const +{ +#ifndef NPRINT + DOUT << "." << var_str_ << " = " << String(value_); +#endif +} diff --git a/lily/translator-ctors.cc b/lily/translator-ctors.cc new file mode 100644 index 0000000000..b313340e5a --- /dev/null +++ b/lily/translator-ctors.cc @@ -0,0 +1,36 @@ +/* + translator-ctors.cc -- implement Translator construction + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "proto.hh" +#include "plist.hh" +#include "translator.hh" +#include "dictionary.hh" +#include "debug.hh" + +Dictionary<Translator*> *global_translator_dict_p=0; + +void +add_translator (Translator *t) +{ + if (!global_translator_dict_p) + global_translator_dict_p = new Dictionary<Translator*>; + + global_translator_dict_p->elem (t->name ()) = t; +} + +Translator* +get_translator_l (String s) +{ + if (global_translator_dict_p->elt_b (s)) + { + return (*global_translator_dict_p)[s]; + } + + error ("Unknown translator `" + s +"\'"); + return 0; +} diff --git a/lily/translator-group.cc b/lily/translator-group.cc new file mode 100644 index 0000000000..cd7b6e62e9 --- /dev/null +++ b/lily/translator-group.cc @@ -0,0 +1,328 @@ +/* + Translator_group.cc -- implement Translator_group + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "music-output-def.hh" +#include "translator-group.hh" +#include "translator.hh" +#include "debug.hh" +#include "pcursor.hh" + +Translator_group::Translator_group (Translator_group const&s) + : Translator(s) +{ + consists_str_arr_ = s.consists_str_arr_; + accepts_str_arr_ = s.accepts_str_arr_; + iterator_count_ =0; +} + +Translator_group::~Translator_group () +{ + assert (removable_b()); +} + + +Translator_group::Translator_group() +{ + iterator_count_ = 0; +} + +void +Translator_group::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_translator (group_l_arr ()[i]); + else + i++; + } +} + + + +IMPLEMENT_IS_TYPE_B1(Translator_group, Translator); + +void +Translator_group::add (Translator *trans_p) +{ + trans_p_list_.bottom().add (trans_p); + trans_p->daddy_trans_l_ = this; + trans_p->output_def_l_ = output_def_l_; + trans_p->add_processing (); +} + +bool +Translator_group::removable_b() const +{ + return !(iterator_count_ || group_l_arr ().size()); +} + +Translator_group * +Translator_group::find_existing_translator_l (String n, String id) +{ + if (is_alias_b (n) && (id_str_ == id || !id)) + return this; + Translator_group* r = 0; + for (int i =0; !r && i < group_l_arr ().size(); i++) + { + r = group_l_arr ()[i]->find_existing_translator_l (n,id); + } + + return r; +} + +Link_array<Translator_group> +Translator_group::path_to_acceptable_translator (String type) const +{ + Link_array<Translator_group> retval; + + if (type_str_ == type) + { + retval.push (output_def_l ()->find_translator_l (type)->group_l ()); + } + else for (int i=0; i < accepts_str_arr_.size (); i++) + { + Translator *t = output_def_l ()->find_translator_l (accepts_str_arr_[i]); + if (!t || !t->group_l ()) + continue; + + Translator_group * g = t->group_l (); + + Link_array<Translator_group> result + = g->path_to_acceptable_translator (type); + if (result.size ()) + { + retval.push (output_def_l ()->find_translator_l (type_str_)->group_l ()); + retval.concat (result); + break; + } + } + + return retval; +} + +Translator_group* +Translator_group::find_create_translator_l (String n, String id) +{ + Translator_group * existing = find_existing_translator_l (n,id); + if (existing) + return existing; + + Link_array<Translator_group> path = path_to_acceptable_translator (n); + + if (path.size ()) + { + Translator_group * current = this; + + // start at 1. The first one will be us. + for (int i=1; i < path.size (); i++) + { + Translator_group * new_group = path[i]->clone ()->group_l (); + current->add (new_group); + current = new_group; + } + current->id_str_ = id; + return current; + } + + + Translator_group * ret =0; + if (daddy_trans_l_) + ret = daddy_trans_l_->find_create_translator_l (n,id); + else + { + warning ("Can't find or create `" + n + "' called `" + id + "'\n"); + ret =0; + } + return ret; +} + + +bool +Translator_group::do_try_request (Request* req_l) +{ + bool hebbes_b =false; + for (int i =0; !hebbes_b && i < nongroup_l_arr ().size() ; i++) + hebbes_b =nongroup_l_arr ()[i]->try_request (req_l); + if (!hebbes_b && daddy_trans_l_) + hebbes_b = daddy_trans_l_->try_request (req_l); + return hebbes_b ; +} + +int +Translator_group::depth_i() const +{ + return (daddy_trans_l_) ? daddy_trans_l_->depth_i() + 1 : 0; +} + +Translator_group* +Translator_group::ancestor_l (int level) +{ + if (!level || !daddy_trans_l_) + return this; + + return daddy_trans_l_->ancestor_l (level-1); +} + +Link_array<Translator_group> +Translator_group::group_l_arr () const +{ + Link_array<Translator_group> groups; + for (PCursor<Translator*> i (trans_p_list_.top ()); i.ok (); i++) + { + if (i->group_l ()) + groups.push (i->group_l ()); + } + return groups; +} + +Link_array<Translator> +Translator_group::nongroup_l_arr () const +{ + Link_array<Translator> groups; + for (PCursor<Translator*> i (trans_p_list_.top ()); i.ok (); i++) + { + if (!i->group_l ()) + groups.push (i.ptr ()); + } + return groups; +} + +void +Translator_group::terminate_translator (Translator*r_l) +{ + DOUT << "Removing " << r_l->name() << " at " << now_moment () << "\n"; + r_l->removal_processing(); + Translator * trans_p =remove_translator_p (r_l); + + delete trans_p; +} + +Translator * +Translator_group::remove_translator_p (Translator*trans_l) +{ + PCursor<Translator*> trans_cur (trans_p_list_.find (trans_l)); + return trans_cur.remove_p(); +} + + +Translator* +Translator_group::get_simple_translator (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 (daddy_trans_l_) + return daddy_trans_l_->get_simple_translator (type); + return 0; +} + + +bool +Translator_group::is_bottom_translator_b () const +{ + return !accepts_str_arr_.size (); +} + + + +Translator_group* +Translator_group::get_default_interpreter() +{ + if (accepts_str_arr_.size()) + { + Translator*t = output_def_l ()->find_translator_l (accepts_str_arr_[0]); + Translator_group * g= t->clone ()->group_l (); + add (g); + + if (!g->is_bottom_translator_b ()) + return g->get_default_interpreter (); + else + return g; + } + return this; +} + +void +Translator_group::each (Method_pointer method) const +{ + for (PCursor<Translator*> i (trans_p_list_.top ()); i.ok (); i++) + (i.ptr()->*method) (); +} + +void +Translator_group::do_print() const +{ +#ifndef NPRINT + if (!check_debug) + return ; + if (status == ORPHAN) + { + DOUT << "consists of: "; + for (int i=0; i < consists_str_arr_.size (); i++) + DOUT << consists_str_arr_[i] << ", "; + DOUT << "\naccepts: "; + for (int i=0; i < accepts_str_arr_.size (); i++) + DOUT << accepts_str_arr_[i] << ", "; + } + else + { + if (id_str_) + DOUT << "ID: " << id_str_ ; + DOUT << " iterators: " << iterator_count_<< "\n"; + } + each (&Translator::print); +#endif +} + +void +Translator_group::do_pre_move_processing () +{ + each (&Translator::pre_move_processing); +} + +void +Translator_group::do_post_move_processing () +{ + each (&Translator::post_move_processing); +} + +void +Translator_group::do_process_requests () +{ + each (&Translator::process_requests); +} + +void +Translator_group::do_creation_processing () +{ + each (&Translator::creation_processing); +} + +void +Translator_group::do_removal_processing () +{ + each (&Translator::removal_processing); +} + +void +Translator_group::add_processing () +{ + Translator::add_processing (); + for (int i=0; i < consists_str_arr_.size(); i++) + { + Translator * t = output_def_l ()->find_translator_l (consists_str_arr_[i]); + if (!t) + warning ("Could not find `" +consists_str_arr_[i]+ "'"); + else + add (t->clone ()); + } +} diff --git a/lily/translator.cc b/lily/translator.cc index 642c9b9401..636123a950 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -1,30 +1,168 @@ /* - Translator.cc -- implement Translator + translator.cc -- implement Translator source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ + #include "translator.hh" +#include "debug.hh" +#include "translator-group.hh" +#include "dictionary-iter.hh" -Translator::Translator() +Translator::~Translator () { - iterator_count_ = 0; } +Translator::Translator () +{ + status = ORPHAN; + daddy_trans_l_ = 0; + output_def_l_ = 0; +} -IMPLEMENT_IS_TYPE_B(Translator); +Translator::Translator (Translator const &s) +{ + status = ORPHAN; + daddy_trans_l_ =0; + output_def_l_ = s.output_def_l_; + properties_dict_ = s.properties_dict_; + type_str_ = s.type_str_; +} + +bool +Translator::is_alias_b (String s) const +{ + return s == type_str_; +} bool -Translator::try_request (Request*) +Translator::do_try_request (Request *) { return false; } + + +Moment +Translator::now_moment () const +{ + return daddy_trans_l_->now_moment (); +} + + +void +Translator::add_processing () +{ + if (status == ORPHAN) + status = VIRGIN; +} + +void +Translator::print () const +{ +#ifndef NPRINT + DOUT << name () << " {"; + if (name () != type_str_) + DOUT << "type= " << type_str_; + for (Dictionary_iter<Scalar> i (properties_dict_); i.ok (); i++) + { + DOUT << i.key () << "=" << i.val () <<"\n"; + } + do_print (); + DOUT << "}\n"; +#endif +} + +void +Translator::do_print () const +{ +} + +IMPLEMENT_IS_TYPE_B(Translator); + + +void +Translator::creation_processing () +{ + if (status >= CREATION_INITED) + return ; + + do_creation_processing (); + status = CREATION_INITED; +} + +void +Translator::post_move_processing() +{ + if (status >= MOVE_INITED) + return; + creation_processing(); + do_post_move_processing(); + status = MOVE_INITED; +} void -Translator::print() const +Translator::removal_processing() +{ + creation_processing(); + do_removal_processing(); +} + + +bool +Translator::try_request (Request * r) { + if (status < MOVE_INITED) + post_move_processing(); + + return do_try_request (r); +} +void +Translator::process_requests() +{ + if (status < PROCESSED_REQS) + post_move_processing(); + else if (status >= PROCESSED_REQS) + return; + + status = PROCESSED_REQS; + do_process_requests(); +} + +void +Translator::pre_move_processing() +{ + do_pre_move_processing(); + status = CREATION_INITED; +} + +Scalar +Translator::get_property (String id) +{ + if (properties_dict_.elt_b (id)) + { + return properties_dict_[id]; + } + + if (daddy_trans_l_) + return daddy_trans_l_->get_property (id); + + return ""; +} + +void +Translator::set_property (String id, Scalar val) +{ + properties_dict_[id] = val; +} + + +Music_output_def * +Translator::output_def_l () const +{ + return output_def_l_; } diff --git a/lily/type-swallow-trans.cc b/lily/type-swallow-trans.cc new file mode 100644 index 0000000000..b90ced5d1b --- /dev/null +++ b/lily/type-swallow-trans.cc @@ -0,0 +1,28 @@ +/* + type-swallow-trans.cc -- implement Type_swallow_translator + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "type-swallow-trans.hh" +#include "musical-request.hh" + +Type_swallow_translator::Type_swallow_translator () +{ + type_ =0; +} + +bool +Type_swallow_translator::do_try_request (Request*r) +{ + if (type_&&r->is_type_b (type_)) + return true; + return false; +} + +IMPLEMENT_IS_TYPE_B1(Type_swallow_translator, Translator); + +DECLARE_REQUEST_SWALLOWER(Skip_req); + diff --git a/lily/vertical-align-grav.cc b/lily/vertical-align-grav.cc index 65fcceec2d..94f5d05204 100644 --- a/lily/vertical-align-grav.cc +++ b/lily/vertical-align-grav.cc @@ -46,4 +46,4 @@ Vertical_align_engraver::acknowledge_element (Score_elem_info i) IMPLEMENT_IS_TYPE_B1(Vertical_align_engraver, Engraver); -ADD_THIS_ENGRAVER(Vertical_align_engraver); +ADD_THIS_TRANSLATOR(Vertical_align_engraver); diff --git a/lily/voice-group-gravs.cc b/lily/voice-group-gravs.cc deleted file mode 100644 index 927d9983e7..0000000000 --- a/lily/voice-group-gravs.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* - voicegroup.cc -- implement Voice_group_engravers - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ -#include "proto.hh" -#include "plist.hh" -#include "musical-request.hh" -#include "voice-group-gravs.hh" -#include "engraver.hh" -#include "command-request.hh" -#include "debug.hh" - - -Voice_group_engravers::Voice_group_engravers() -{ - dir_ =CENTER; -} - -bool -Voice_group_engravers::do_try_request (Request*r_l) -{ - Command_req* c_l = r_l->command(); - if (c_l&& c_l->groupfeature()) - { - Feature f; - f.type_ = c_l->groupfeature()->type_str_; - f.value_ = c_l->groupfeature()->value_str_; - set_feature (f); - return true; - } - return Engraver_group_engraver::do_try_request (r_l); -} - - - -IMPLEMENT_IS_TYPE_B1(Voice_group_engravers,Engraver_group_engraver); - -void -Voice_group_engravers::do_print() const -{ -#ifndef NPRINT - Engraver_group_engraver::do_print(); -#endif -} - - - -Scalar -Voice_group_engravers::get_feature (String f) -{ - if (f == "vdir") - return dir_; - Engraver_group_engraver::get_feature (f); -} - -ADD_THIS_ENGRAVER(Voice_group_engravers); diff --git a/lily/voice-iterator.cc b/lily/voice-iterator.cc index b8318e2c74..a5b3d60711 100644 --- a/lily/voice-iterator.cc +++ b/lily/voice-iterator.cc @@ -6,7 +6,7 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ -#include "translator.hh" +#include "translator-group.hh" #include "debug.hh" #include "voice-iterator.hh" #include "music-list.hh" diff --git a/make/lilypond.lsm b/make/lilypond.lsm index 3d5f8bf885..55823d2e0a 100644 --- a/make/lilypond.lsm +++ b/make/lilypond.lsm @@ -1,7 +1,7 @@ Begin3 Title: LilyPond -Version: 0.1.12 -Entered-date: 03SEP97 +Version: 0.1.13 +Entered-date: 11SEP97 Description: LilyPond is the GNU Project music typesetter. This program converts music definition files into visual or auditive output: it can typeset formatted @@ -14,8 +14,8 @@ Author: hanwen@stack.nl (Han-Wen Nienhuys) jan@digicash.com (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps - 395k lilypond-0.1.12.tar.gz + 395k lilypond-0.1.13.tar.gz Original-site: pcnov095.win.tue.nl /pub/lilypond/ - 395k lilypond-0.1.12.tar.gz + 395k lilypond-0.1.13.tar.gz Copying-policy: GPL End diff --git a/make/lilypond.spec b/make/lilypond.spec index 2d43580ecf..dbee70b290 100644 --- a/make/lilypond.spec +++ b/make/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 0.1.12 +Version: 0.1.13 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.12.tar.gz +Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.13.tar.gz Summary: A preprocessor to make TeX typeset music. URL: http://www.stack.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys <hanwen@stack.nl> @@ -29,7 +29,7 @@ make -C Documentation gifs make prefix="$RPM_BUILD_ROOT/usr" install %files %doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/faq.text Documentation/out/gnu-music.text Documentation/out/index.text Documentation/out/internals.text Documentation/out/language.text Documentation/out/lilypond.text Documentation/out/links.text Documentation/out/literature.text Documentation/out/mi2mu.text Documentation/out/mudela-book.text Documentation/out/mutopia.text Documentation/out/other-packages.text BUGS TODO NEWS DEDICATION ANNOUNCE README -%doc input/beams.ly input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/fugue1.ly input/gallina.ly input/gallina.tex input/header.ly input/keys.ly input/kortjakje.ly input/multi.ly input/pedal.ly input/prelude1.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen-16.tex input/standchen-20.tex input/standchen.ly input/toccata-fuga-E.ly input/twinkle-pop.ly input/twinkle.ly input/wohltemperirt.ly Documentation/mudela-course.doc Documentation/mudela-man.doc +%doc input/abbrev.ly input/beams.ly input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/gallina.ly input/gallina.tex input/header.ly input/keys.ly input/kortjakje.ly input/multi.ly input/pedal.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen-16.tex input/standchen-20.tex input/standchen.ly input/toccata-fuga-E.ly input/twinkle-pop.ly input/twinkle.ly input/wtk1-fugue1.ly input/wtk1-fugue2.ly input/wtk1-prelude1.ly Documentation/mudela-course.doc Documentation/mudela-man.doc %doc Documentation/out/lelie_logo.gif /usr/bin/convert-mudela /usr/bin/mudela-book diff --git a/mf/Makefile b/mf/Makefile index c6fbecd8c1..f3523f04c1 100644 --- a/mf/Makefile +++ b/mf/Makefile @@ -12,7 +12,7 @@ include ./$(depth)/make/Include.make # TEXFILES = $(wildcard *.tex) MFFILES = $(wildcard *.mf) -DISTFILES = Makefile $(MFFILES) $(TEXFILES) +EXTRA_DISTFILES = $(MFFILES) $(TEXFILES) TODO # localinstall: diff --git a/mf/TODO b/mf/TODO new file mode 100644 index 0000000000..06eef8d16b --- /dev/null +++ b/mf/TODO @@ -0,0 +1,11 @@ + - move to OpusTeX fonts + - make own lilyfont{10,11,13,16,20} files + - opustex/lilypond fonts from the same generic driver files + - LilyPond fonts should generate TFM spacing info + - include important spaacing dims in TFM + - lilyrules.mf for different rules (lines) ? + - check out Adobe Sonata/Petrucci font layout. They are the +standard for Music fonts + - rewrite : make a metafont iso font +l + diff --git a/tex/dimen.tex b/mf/dimen.tex similarity index 100% rename from tex/dimen.tex rename to mf/dimen.tex diff --git a/mf/dyn.tex b/mf/dyn.tex index 10b1d534f0..914f005e68 100644 --- a/mf/dyn.tex +++ b/mf/dyn.tex @@ -2,7 +2,7 @@ % A tex file to help view dynamic letters % -\font\dynfont=dyn10 scaled \magstep2 +\font\dynfont=dyn10 \def\thefont{\dynfont} \def\mb#1{{\thefont\char#1}} @@ -12,16 +12,36 @@ % \vbox to12pt{\vfill\hbox to0pt{\qquad\kern-1pt\twvrul\hss}}% % \hbox to50pt{\qquad\twhrul\mb{#1}\hss}% \hbox to 30pt{\qquad\mb{#1}\hss} - \setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0} + \setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0} \newcount\n \def\charn{\n=-1 - \loop\ifnum\n<5\advance\n by1 + \loop\ifnum\n<4\advance\n by1 \doitem{\number\n}\endgraf\repeat} \charn -\input dyndefs +%from lilyponddefs +% dynamics take extra kerning +\def\dyn{\dynfont} +\def\kdynf{{\dynfont \char0\kern-.2ex}} +\def\kdynm{{\dynfont \char1\kern-.18ex}} +\def\kdynp{{\dynfont \char2\kern-.08ex}} +\def\kdyns{{\dynfont \char3\kern-.22ex}} +\def\kdynz{{\dynfont \char4\kern-.2ex}} + +\def\dynp{\kdynp} +\def\dynpp{\dynp\kdynp} +\def\dynppp{\dynpp\kdynp} +\def\dynmp{\kdynm\kdynp} +\def\dynmf{\kdynm\kdynf} +\def\dynf{\kdynf} +\def\dynff{\dynf\kdynf} +\def\dynfff{\dynff\kdynf} + +\def\dynfp{\kdynf\kern.35ex\kdynp} +\def\dynsf{\kdyns\kdynf} +\def\dynsfz{\dynsf\kern.3ex\kdynz} \hbox{\dynp} \hbox{\dynpp} diff --git a/mf/dyn10.mf b/mf/dyn10.mf index 7e2d853f74..3b49ec253d 100644 --- a/mf/dyn10.mf +++ b/mf/dyn10.mf @@ -94,32 +94,19 @@ math_fitting:=false; % should math-mode spacing be used? % "s", "m", and "z". sometimes the "m" and "z" are a bit fatter than % "s". -slant:=.68; % tilt ratio $(\Delta x/\Delta y)$ +slant:=.62; % tilt ratio $(\Delta x/\Delta y)$ crisp#:=19/36pt#; % diameter of serif corners tiny#:=19/36pt#; % diameter of rounded corners fine#:=20/36pt#; % diameter of sharply rounded corners thin_join#:=20/36pt#; % width of extrafine details -stem#:=72/36pt#; % lowercase stem breadth -%curve#:=64/36pt#; % lowercase curve breadth -flare#:=52/36pt#; % diameter of bulbs or breadth of terminals +stem#:=57/36pt#; % lowercase stem breadth +curve#:=64/36pt#; % lowercase curve breadth +flare#:=64/36pt#; % diameter of bulbs or breadth of terminals -% mode_setup; font_setup; -mode_setup; -font_setup; - -num=-1; +mode_setup; font_setup; input ital-f; - slant:=.38; % tilt ratio $(\Delta x/\Delta y)$ -stem#:=58/36pt#; % lowercase stem breadth -font_setup; - -input ital-f; -stem#:=54/36pt#; % lowercase stem breadth - -% mode_setup; font_setup; -font_setup; - +mode_setup; font_setup; input ital-p; slant:=.28; % tilt ratio $(\Delta x/\Delta y)$ @@ -132,12 +119,11 @@ fine#:=10/36pt#; % diameter of sharply rounded corners thin_join#:=10/36pt#; % width of extrafine details hair#:=20/36pt#; % lowercase hairline breadth % stem#:=38/36pt#; % lowercase stem breadth -curve#:=43/36pt#; % lowercase curve breadth +% curve#:=43/36pt#; % lowercase curve breadth flare#:=42/36pt#; % diameter of bulbs or breadth of terminals % ess#:=35/36pt#; % breadth in middle of lowercase s -% mode_setup; font_setup; -font_setup; +mode_setup; font_setup; input ital-m; input ital-s; diff --git a/mf/ital-f.mf b/mf/ital-f.mf index 027eadaead..be97ed0263 100644 --- a/mf/ital-f.mf +++ b/mf/ital-f.mf @@ -12,7 +12,7 @@ % cmchar "Italic letter f"; % beginchar("f",max(1.5u#,stem#)+max(3.5u#,2flare#),asc_height#,desc_depth#); \"Dynamic letter f"; -beginchar(incr num,max(1.5u#,stem#)+max(3.5u#,2flare#),asc_height#,desc_depth#); +beginchar(0,max(1.5u#,stem#)+max(3.5u#,2flare#),asc_height#,desc_depth#); italcorr asc_height#*slant+.75u#; adjust_fit(if monospace:u#,u# else: 0,0 fi); pickup fine.nib; numeric theta; z88=(.5w-.5u,h); z89=(.5w+.5u,-d); theta=angle(z88-z89); @@ -22,8 +22,7 @@ pos5(stem,theta-90); pos6(.5[hair,stem],0); pos7(vair,-90); pos8(hair,-180); pos9(flare,-180); rt x1r=hround(w+.25u); lft x8r=hround-.35u; x2=.6[x1,x4]; x7=.6[x8,x5]; y9-.5flare=vround -.85d; y2-y0=y9-y7; top y2r=h+oo; bot y7r=-d-oo; -% y4=.25[x_height,h]; y5=.5[-d,y4]; -y4=x_height-.5bar; y5=y4; +y4=.25[x_height,h]; y5=.5[-d,y4]; z4=whatever[z88,z89]; z5=whatever[z88,z89]; x3=.8[x2+x4-x88,x88]; x6=.8[x7+x5-x89,x89]; y3=.8[y4,y2]; y6=.8[y5,y7]; bulb(2,1,0); bulb(7,8,9); % bulbs diff --git a/mf/ital-m.mf b/mf/ital-m.mf index c3d8563683..6f6828d2d2 100644 --- a/mf/ital-m.mf +++ b/mf/ital-m.mf @@ -12,7 +12,7 @@ % cmchar "Italic letter m"; % beginchar("m",15u#,x_height#,0); \"Dynamic letter m"; -beginchar(incr num,15u#,x_height#,0); +beginchar(1,15u#,x_height#,0); italcorr 1/3x_height#*slant+.5hair#+.5u#; adjust_fit(if monospace:-1.5u#,-2u# else: 0,0 fi); pickup fine.nib; numeric shaved_stem; shaved_stem=mfudged.stem; diff --git a/mf/ital-p.mf b/mf/ital-p.mf index c9e0cdc888..3c853cc8f2 100644 --- a/mf/ital-p.mf +++ b/mf/ital-p.mf @@ -12,7 +12,7 @@ % cmchar "Italic letter p"; % beginchar("p",9u#,x_height#,desc_depth#); \"Dynamic letter p"; -beginchar(incr num,9u#,x_height#,desc_depth#); +beginchar(2,9u#,x_height#,desc_depth#); italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi; adjust_fit(0,0); pickup fine.nib; x0=0; x2-.5stem=hround(2.5u-.5stem); hook_in(0,1,2); % opening hook diff --git a/mf/ital-s.mf b/mf/ital-s.mf index 60af94b6e5..0599a312d8 100644 --- a/mf/ital-s.mf +++ b/mf/ital-s.mf @@ -12,7 +12,7 @@ % cmchar "Italic letter s"; % beginchar("s",5.25u#+max(1.75u#,flare#),x_height#,0); \"Dynamic letter s"; -beginchar(incr num,5.25u#+max(1.75u#,flare#),x_height#,0); +beginchar(3,5.25u#+max(1.75u#,flare#),x_height#,0); italcorr x_height#*slant-.5u#; adjust_fit(0,0); pickup fine.nib; numeric theta; theta=90-angle(40u,h); slope:=-h/40u; % angle at middle diff --git a/mf/ital-z.mf b/mf/ital-z.mf index 6c0f517aed..9e8992878e 100644 --- a/mf/ital-z.mf +++ b/mf/ital-z.mf @@ -12,7 +12,7 @@ % cmchar "Italic letter z"; % beginchar("z",5.5u#+max(1.5u#,stem#),x_height#,0); \"Dynamic letter z"; -beginchar(incr num,5.5u#+max(1.5u#,stem#),x_height#,0); +beginchar(4,5.5u#+max(1.5u#,stem#),x_height#,0); italcorr x_height#*slant+.5hair#; adjust_fit(if monospace:.5u#,.5u# else: 0,0 fi); pickup fine.nib; pos1(hair,0); pos2(stem,-90); pos3(vair,-90); pos4(hair,0); diff --git a/tex/dyndefs.tex b/tex/dyndefs.tex deleted file mode 100644 index 630cf8e824..0000000000 --- a/tex/dyndefs.tex +++ /dev/null @@ -1,27 +0,0 @@ -% dyndefs.tex -% - -\def\dyn{\dynfont} -\def\dynaf{\dynfont\char0} -\def\dynnf{\dynfont\char1} -\def\dynnf{\dynfont\char1} -\def\dynp{\dynfont\char2} -\def\dynm{\dynfont\char3} -\def\dyns{\dynfont\char4} -\def\dynz{\dynfont\char5} - -\def\kdynf{\dynnf} -\def\kdynp{\dynp\kern-.1ex} - -\def\dynf{\dynaf} -\def\dynpp{\kdynp\dynp} -\def\dynppp{\kdynp\kdynp\dynp} -\def\dynmp{\dynm\kern -.2ex\dynp} -\def\dynmf{\dynfont\raise.08ex\hbox{\dynm}\kern-.3ex\dynnf} -\def\dynff{\kdynf\dynnf} -\def\dynfff{\kdynf\kdynf\dynnf} - -\def\dynfp{\kdynf\dynp} -\def\dynsf{\dyns\kern-.3ex\dynnf} -\def\dynsfz{\dynsf\dynz} - diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index 49e60c567e..9a5256e9aa 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -66,6 +66,7 @@ \noteheight=5pt \staffrulethickness=0.4pt \musixtwentyfonts + \font\textmusic=cmmi12 \musixcalc } @@ -75,9 +76,16 @@ \notewidth=5pt \noteheight=4pt \musixsixteenfonts + \font\textmusic=cmmi10 \musixcalc } +\def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}} +\def\textflat{\raise.4ex\hbox{\textmusic\char"5B}} +\def\flt{\raise.2ex\hbox{\mus\char"5B}} + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % do derivative calcs @@ -89,7 +97,24 @@ } -\input dyndefs +\def\kdynf{{\dynfont \char0\kern-.2ex}} +\def\kdynm{{\dynfont \char1\kern-.18ex}} +\def\kdynp{{\dynfont \char2\kern-.08ex}} +\def\kdyns{{\dynfont \char3\kern-.22ex}} +\def\kdynz{{\dynfont \char4\kern-.2ex}} + +\def\dynp{\kdynp} +\def\dynpp{\dynp\kdynp} +\def\dynppp{\dynpp\kdynp} +\def\dynmp{\kdynm\kdynp} +\def\dynmf{\kdynm\kdynf} +\def\dynf{\kdynf} +\def\dynff{\dynf\kdynf} +\def\dynfff{\dynff\kdynf} + +\def\dynfp{\kdynf\kern.35ex\kdynp} +\def\dynsf{\kdyns\kdynf} +\def\dynsfz{\dynsf\kern.3ex\kdynz} \input taupindefs @@ -214,6 +239,7 @@ % big fat marks, if errors are detected. \def\columnerrormark{\placebox{-5pt}{0pt}{\bf C!}} \def\scorelineerrormark{\placebox{0pt}{-10pt}{\bf L!}} +\def\errormark{{\bf E!}} \def\unknown{{\bf u}} \def\postheader{} @@ -230,11 +256,6 @@ \renewcommand{\@oddfoot}{\ifnum\thepage=1 {\hfil \LilyIdString }\else{foo\hfil\the\pageno\hfil}\fi}} - \def\ps@empty{ - \renewcommand{\@oddhead}{}% - \renewcommand{\@evenfoot}{}% - \renewcommand{\@evenhead}{}% - \renewcommand{\@oddfoot}{\ifnum\thepage=1 - {\hfil \LilyIdString - }\else{foo\hfil\the\pageno\hfil}\fi}} \fi + + diff --git a/tex/taupindefs.tex b/tex/taupindefs.tex index 9e2c6c1c52..2aef5e5e87 100644 --- a/tex/taupindefs.tex +++ b/tex/taupindefs.tex @@ -12,7 +12,7 @@ \font\musicfnt=musix20 \font\musicdraw=musixsps \font\italicfont=cmti10 - \font\dynfont=dyn10 scaled \magstep2 + \font\dynfont=dyn10% scaled \magstep2 \font\musicmathfont=cmsy10 } @@ -29,7 +29,7 @@ \font\hslurdfont=xslhd16 \font\hslurhfont=xslhz20 \font\musicfnt=musix16 - \font\dynfont=dyn10 scaled \magstep1 + \font\dynfont=dyn10% scaled \magstep1 \font\musicdraw=musixsps \font\musicmathfont=cmsy8 } @@ -40,9 +40,13 @@ \musicdef\halfball{'010} \musicdef\wholeball{'011} \musicdef\breveball{'040} +\musicdef\longaball{'047} \musicdef\halfrest{'074} \musicdef\wholerest{'075} + \musicdef\breverest{'072} +\musicdef\breverest{'073} %% <- Mats, is this cool? + %% hmm \musicdef\outsidehalfrest{10} \musicdef\outsidewholerest{11} -- 2.39.5