From cd8d30ddd7b21b6cf6b25be70c2d5753de8eddbc Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:24:50 +0000 Subject: [PATCH] lilypond-1.3.73 --- Documentation/faq.texi | 91 +++- Documentation/regression-test.tely | 4 +- flower/include/input.hh | 7 + flower/include/source-file.hh | 2 +- flower/input.cc | 38 +- input/minimal.ly | 9 + lily/align-note-column-engraver.cc | 2 +- lily/auto-beam-engraver.cc | 2 +- lily/axis-group-engraver.cc | 62 ++- lily/axis-group-interface.cc | 1 - lily/bar-engraver.cc | 2 +- lily/bar-number-engraver.cc | 7 +- lily/beam-engraver.cc | 16 +- lily/break-align-engraver.cc | 6 +- lily/breathing-sign-engraver.cc | 4 +- lily/change-iterator.cc | 2 +- lily/chord-name-engraver.cc | 2 +- lily/chord-tremolo-engraver.cc | 6 +- lily/chord-tremolo-iterator.cc | 9 +- lily/clef-engraver.cc | 6 +- lily/collision-engraver.cc | 2 +- lily/command-request.cc | 12 +- lily/debug.cc | 2 +- lily/dot-column-engraver.cc | 2 +- lily/dynamic-engraver.cc | 15 +- lily/engraver-group-engraver.cc | 6 +- lily/engraver.cc | 16 +- lily/extender-engraver.cc | 6 +- lily/folded-repeat-iterator.cc | 24 +- lily/gourlay-breaking.cc | 2 +- lily/hyphen-engraver.cc | 6 +- lily/identifier.cc | 9 - lily/include/chord-tremolo-iterator.hh | 2 +- lily/include/command-request.hh | 9 +- lily/include/engraver.hh | 10 +- lily/include/folded-repeat-iterator.hh | 3 +- lily/include/hara-kiri-engraver.hh | 9 - lily/include/identifier.hh | 6 - lily/include/input-smob.hh | 22 + lily/include/item.hh | 1 + lily/include/lily-guile.hh | 4 +- lily/include/local-key-item.hh | 40 +- lily/include/ly-smobs.icc | 1 + lily/include/lyric-combine-music-iterator.hh | 2 +- lily/include/lyric-combine-music.hh | 6 - lily/include/molecule.hh | 2 + lily/include/music-iterator.hh | 12 +- lily/include/music-list.hh | 54 +-- lily/include/music-sequence.hh | 40 ++ lily/include/music-wrapper-iterator.hh | 2 +- lily/include/music-wrapper.hh | 5 +- lily/include/music.hh | 27 +- lily/include/output-property.hh | 13 +- lily/include/paper-outputter.hh | 5 - lily/include/paper-score.hh | 2 - lily/include/repeated-music.hh | 10 +- lily/include/request-chord-iterator.hh | 1 - lily/include/score-element.hh | 2 +- lily/include/score.hh | 3 +- lily/include/sequential-music-iterator.hh | 4 +- lily/include/simultaneous-music-iterator.hh | 2 +- lily/include/spanner.hh | 5 +- lily/include/translation-property.hh | 15 +- lily/include/translator-group.hh | 1 + lily/include/unfolded-repeat-iterator.hh | 4 +- lily/input-smob.cc | 76 ++++ lily/instrument-name-engraver.cc | 2 +- lily/item.cc | 15 + lily/key-engraver.cc | 10 +- lily/key-performer.cc | 2 +- lily/lexer.ll | 7 +- lily/line-group-group-engraver.cc | 2 +- lily/line-number-engraver.cc | 9 +- lily/local-key-engraver.cc | 39 +- lily/local-key-item.cc | 117 ++--- lily/lyric-combine-music-iterator.cc | 36 +- lily/lyric-combine-music.cc | 36 +- lily/lyric-engraver.cc | 2 +- lily/mark-engraver.cc | 10 +- lily/multi-measure-rest-engraver.cc | 2 +- lily/music-iterator.cc | 34 +- lily/music-list.cc | 75 +--- lily/music-sequence.cc | 93 +++- lily/music-wrapper-iterator.cc | 4 +- lily/music-wrapper.cc | 32 +- lily/music.cc | 159 ++++++- lily/my-lily-parser.cc | 13 +- lily/note-heads-engraver.cc | 5 +- lily/note-name-engraver.cc | 2 +- lily/output-property-engraver.cc | 7 +- lily/output-property.cc | 4 +- lily/paper-def.cc | 2 +- lily/paper-outputter.cc | 6 + lily/paper-score.cc | 5 + lily/parser.yy | 138 +++--- lily/performer-group-performer.cc | 6 +- lily/piano-pedal-engraver.cc | 8 +- lily/piano-pedal-performer.cc | 2 +- lily/property-iterator.cc | 7 +- lily/relative-octave-music.cc | 2 +- lily/repeat-engraver.cc | 25 +- lily/repeated-music.cc | 86 ++-- lily/request-chord-iterator.cc | 14 +- lily/request-iterator.cc | 4 +- lily/rest-collision-engraver.cc | 2 +- lily/rest-engraver.cc | 4 +- lily/rhythmic-column-engraver.cc | 2 +- lily/score-element.cc | 39 +- lily/score-engraver.cc | 4 +- lily/score.cc | 20 +- lily/script-column-engraver.cc | 2 +- lily/script-engraver.cc | 4 +- lily/separating-line-group-engraver.cc | 4 +- lily/sequential-music-iterator.cc | 19 +- lily/simultaneous-music-iterator.cc | 11 +- lily/slur-engraver.cc | 6 +- lily/spacing-engraver.cc | 2 +- lily/span-bar-engraver.cc | 2 +- lily/span-dynamic-performer.cc | 2 +- lily/spanner.cc | 9 +- lily/staff-symbol-engraver.cc | 2 +- lily/stem-engraver.cc | 6 +- lily/system-start-delimiter-engraver.cc | 2 +- lily/text-engraver.cc | 2 +- lily/tie-engraver.cc | 8 +- lily/tie-performer.cc | 2 +- lily/time-scaled-music-iterator.cc | 2 +- lily/time-signature-engraver.cc | 2 +- lily/timing-translator.cc | 6 +- lily/translation-property.cc | 11 +- lily/translator-group.cc | 9 +- lily/tuplet-engraver.cc | 4 +- lily/unfolded-repeat-iterator.cc | 45 +- ly/init.ly | 3 - mf/feta-nummer-code.mf | 421 ++++++++++++++++++ mf/feta-nummer.mf | 435 ++----------------- mf/feta-nummer10.mf | 5 +- mf/feta-nummer12.mf | 4 +- mf/feta-nummer14.mf | 2 + mf/feta-nummer3.mf | 4 +- mf/feta-nummer4.mf | 4 +- mf/feta-nummer5.mf | 4 +- mf/feta-nummer6.mf | 4 +- mf/feta-nummer7.mf | 4 +- mf/feta-nummer8.mf | 6 +- scm/lily.scm | 18 + 146 files changed, 1699 insertions(+), 1250 deletions(-) create mode 100644 input/minimal.ly create mode 100644 lily/include/input-smob.hh create mode 100644 lily/include/music-sequence.hh create mode 100644 lily/input-smob.cc create mode 100644 mf/feta-nummer-code.mf create mode 100644 mf/feta-nummer14.mf diff --git a/Documentation/faq.texi b/Documentation/faq.texi index aa35683a34..ae735e482b 100644 --- a/Documentation/faq.texi +++ b/Documentation/faq.texi @@ -2,16 +2,9 @@ @setfilename faq.info @settitle FAQ - GNU LilyPond FAQs -@node Top, , Windows32, (dir) +@node Top, , , (dir) @top @menu -* FAQ - GNU LilyPond FAQs:: FAQ - GNU LilyPond FAQs -@end menu - - - -@node FAQ - GNU LilyPond FAQs, Miscellaneous, , Top -@menu * Miscellaneous:: Miscellaneous * Installing:: Installing * Documentation:: Documentation @@ -26,7 +19,7 @@ @chapter FAQ - GNU LilyPond FAQs -@node Miscellaneous, Installing, FAQ - GNU LilyPond FAQs, FAQ - GNU LilyPond FAQs +@node Miscellaneous, ,,top @section Miscellaneous @subsubsection HELP! I'm stuck! @@ -37,7 +30,7 @@ directly. Note: relative paths are meant to be relative to the source directory -@node Installing, Documentation, Miscellaneous, FAQ - GNU LilyPond FAQs +@node Installing,, ,top @section Installing @@ -88,21 +81,23 @@ Metafont when you run TeX. Check your TeX installation, or ask your local TeX guru. The supplied @file{.afm} files are intended to be used by LilyPond, not by any other programs. -@node Documentation, Language- mudela, Installing, FAQ - GNU LilyPond FAQs +@node Documentation,, ,top @section Documentation @subsubsection What a sober website/manual you have there! -LilyPond development is moving quite fast, documentation will often lag -a bit behind. But don't hesitate to point out inaccuracies. Whip up -your mail reader and write to the mailing list. +LilyPond development is moving fast, so the documentation will often be out +of date. But don't hesitate to point out inaccuracies. Whip up your +mail reader and write to the mailing list. @subsubsection Please take me off your mailing list, I get so much mail! Don't ask Han-wen, don't ask David. Instead, read about @uref{../../index.html#mailing-lists, the mailing lists} here. -@node Language- mudela, Do you support -, Documentation, FAQ - GNU LilyPond FAQs + + +@node Language- mudela,, ,top @section Language: mudela @subsubsection Why do I have to type the accidentals to the note if I @@ -150,7 +145,7 @@ of (x,y) positions and symbols. You can only sensibly do TeX stuff in the symbol string. You can access the symbol string easily for some symbols (notably lyrics and @code{^"text"} commands). -@node Do you support -, How do I -, Language- mudela, FAQ - GNU LilyPond FAQs +@node Do you support -,, ,top @section Do you support ... @subsubsection Do you support pop songs (chords, single staff, lyrics)? @@ -183,7 +178,7 @@ No. Yes. See @file{input/test/grace.ly}. -@node How do I -, Development, Do you support -, FAQ - GNU LilyPond FAQs +@node How do I -,, ,top @section How do I .... @subsubsection How do I change the TeX layout? @@ -324,7 +319,7 @@ will do the trick for you: @end example -@node Development, Running, How do I -, FAQ - GNU LilyPond FAQs +@node Development,, ,top @section Development @subsubsection Could you implement feature XXXX? It is really easy, just extend the syntax to allow YYYY! @@ -398,9 +393,63 @@ end Upgrade/downgrade to 4.17. -@node Running, Copyright, Development, FAQ - GNU LilyPond FAQs +@node Running,, ,top @section Running +@subsubsection Correcting errors is so tedious. Is there a better way? + +As of 1.3.73, lilypond provides support for the xdvi @code{src:} +special. This can be used with Xdvik (22.16 or better) and xdvi (22.28 +or better) to go to the place in the input that corresponds to a symbol +in the output. + +lilypond: + +Decide if you want column positioning, and edit @file{lily.scm} +according to the comments at the function @code{define-origin}. + +emacs: + +Put this in @file{~/.emacs}: +@example +(server-start) +@end example + +For column positioning, apply @uref{this +patch,http://www.cs.uu.nl/~hanwen/software/emacsclient-column} to +@code{emacsclient.c} and @code{server.el}. Stick the compiled +emacsclient into a bin directory, and put @code{server.el} into a elisp +directory (eg. @file{~/usr/share/emacs/}). Add the following to your +@file{.emacs} init file, before invoking server-start. +@example +(setq load-path (cons (concat (getenv "HOME") "/usr/share/emacs") + load-path)) +@end example + +Xdvik: + +Warning: @uref{Xdvik,ftp://ftp.cs.uu.nl/pub/tex-archive/dviware/xdvik/}, +which is shipped with most TeX distributions, doesn't work very well for +src specials. You're better off using plain xdvi. +@example + xdvi -srcmode -srcvisibility output.dvi +@end example + +Click control-mouse button 2 for making emacs jump to the appropriate place. + +For column positioning you must install this @uref{patch, +http://www.cs.uu.nl/~hanwen/software/xdvik-src} to make Xdvik emit +column numbers. Add the command line option @code{-srceditorcommand +"emacsclient --no-wait +%l:%c %f"} + +Xdvi + +@uref{Xdvi,ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz} has +better support for src specials. Apply @uref{this patch, +http://www.cs.uu.nl/~hanwen/software/xdvi-src}. When viewing, +control-mousebutton 1 will take you to the correct line/column. + + @subsubsection I use dvilj4, and there are lots of warning messages for the printing You should use dvips and ghostscript to print the @code{dvi} output: the @@ -492,7 +541,7 @@ The MIDI output was originally put in as a proof that MIDI could be done, and as a method of proof"reading" the input. The MIDI support is by no means finished. Patches appreciated. -@node Copyright, Windows32, Running, FAQ - GNU LilyPond FAQs +@node Copyright,, ,top @section Copyright @subsubsection What is Urtext? Critical Edition? @@ -646,7 +695,7 @@ for a summary of copyright relative to old music, also for the expert forum for such subsubsections. -@node Windows32, Top, Copyright, FAQ - GNU LilyPond FAQs +@node Windows32,, ,top @section Windows32 @subsubsection I downloaded the windows32 port, and it doesn't match the website! diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index 9cdf843841..0e745b244f 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -287,7 +287,6 @@ between note and accidentals is less than between the notes with the same value. Clef changes also get extra space, but not as much as barlines. - Even if a line is very tightly spaced, there will still be room between prefatory matter and the following notes. The space after the prefatory is very rigid. In contrast, the space before the barline @@ -380,6 +379,9 @@ also created on a clef change. @mudelafile{keys.ly} + + + @ignore @c the input file is too long and does not test for specific bugs diff --git a/flower/include/input.hh b/flower/include/input.hh index 44f2bb90da..a9baf330b3 100644 --- a/flower/include/input.hh +++ b/flower/include/input.hh @@ -28,6 +28,13 @@ public: Input spot () const; String location_str () const; String line_number_str () const; + + + String file_str ()const; + int line_number ()const; + int column_number ()const; + + Input (Source_file*, char const*); Input (); }; diff --git a/flower/include/source-file.hh b/flower/include/source-file.hh index 26c0b021f4..f8a3e4a036 100644 --- a/flower/include/source-file.hh +++ b/flower/include/source-file.hh @@ -54,7 +54,7 @@ public: // only used in binary-source-file, currently -protected: +public: Slice line_slice (char const* pos_ch_C) const; String line_str (char const* pos_ch_C) const; int column_i (char const* pos_ch_C) const; diff --git a/flower/input.cc b/flower/input.cc index 7483606ba0..1ec7fb9428 100644 --- a/flower/input.cc +++ b/flower/input.cc @@ -37,11 +37,9 @@ Input::set_spot (Input const &i) } /* - Produce almost GNU-compliant error message. Lily used to be rather - GNU-compliant in this too, but correcting mudela is such a breeze if - you('re edidor) know(s) the error column too (there's no GNU standard - on columns, is there?). - + Produce GNU-compliant error message. Correcting mudela is such a + breeze if you('re edidor) know(s) the error column too + Format: [file:line:column:][warning:]message @@ -114,3 +112,33 @@ Input::line_number_str () const else return "?"; } + +String +Input::file_str () const +{ + if (source_file_l_) + return source_file_l_->name_str (); + else + return ""; +} + + +int +Input::line_number () const +{ + if (source_file_l_) + return source_file_l_->line_i (defined_ch_C_); + else + return 0; + +} + +int +Input::column_number () const +{ + if (source_file_l_) + return source_file_l_->column_i (defined_ch_C_); + else + return 0; + +} diff --git a/input/minimal.ly b/input/minimal.ly new file mode 100644 index 0000000000..b654a3a666 --- /dev/null +++ b/input/minimal.ly @@ -0,0 +1,9 @@ + + +\score{ \sequential {\clef bass ; } +\paper { \translator { \type Score_engraver ; \name "Score"; } + linewidth =1.5\cm; + +} + +} diff --git a/lily/align-note-column-engraver.cc b/lily/align-note-column-engraver.cc index 05a51c710b..75fb5b94e3 100644 --- a/lily/align-note-column-engraver.cc +++ b/lily/align-note-column-engraver.cc @@ -51,7 +51,7 @@ Align_note_column_engraver::do_creation_processing () Side_position::set_direction (align_item_p_, LEFT); // needed for setting font size. - announce_element (Score_element_info (align_item_p_, 0)); + announce_element (align_item_p_, 0); } void diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 316cc56f62..2b75352435 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -254,7 +254,7 @@ Auto_beam_engraver::create_beam_p () Beam::add_stem (beam_p,(*stem_l_arr_p_)[i]); } - announce_element (Score_element_info (beam_p, 0)); + announce_element (beam_p, 0); return beam_p; } diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index 25ed6142d9..ca6f5fb359 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -6,13 +6,33 @@ (c) 1999--2000 Han-Wen Nienhuys */ -#include "axis-group-engraver.hh" #include "spanner.hh" #include "paper-column.hh" #include "axis-group-interface.hh" - +#include "engraver.hh" #include "engraver-group-engraver.hh" +/** + Put stuff in a Spanner with an Axis_group_interface. + Use as last element of a context. + */ +class Axis_group_engraver : public Engraver +{ +protected: + Spanner *staffline_p_; + Link_array elts_; + virtual void do_creation_processing(); + virtual void do_removal_processing(); + virtual void acknowledge_element (Score_element_info); + virtual void process_acknowledged (); + virtual Spanner* get_spanner_p () const; +public: + VIRTUAL_COPY_CONS(Translator); + Axis_group_engraver (); +}; + +ADD_THIS_TRANSLATOR(Axis_group_engraver); + Axis_group_engraver::Axis_group_engraver () { staffline_p_ = 0; @@ -29,7 +49,7 @@ Axis_group_engraver::do_creation_processing () Pointer_group_interface (it, "bounded-by-me").add_element (staffline_p_); staffline_p_->set_bound(LEFT,it); - announce_element (Score_element_info (staffline_p_, 0)); + announce_element (staffline_p_, 0); } Spanner* @@ -91,4 +111,38 @@ Axis_group_engraver::process_acknowledged () elts_.clear (); } -ADD_THIS_TRANSLATOR(Axis_group_engraver); + +//////////////////////////////////////////////////////// + +// maybenot sucsh a good idea after all. + +#include "hara-kiri-group-spanner.hh" +#include "rhythmic-head.hh" + +class Hara_kiri_engraver : public Axis_group_engraver +{ +protected: + virtual Spanner*get_spanner_p ()const; + virtual void acknowledge_element (Score_element_info); +public: + VIRTUAL_COPY_CONS(Translator); +}; + +Spanner* +Hara_kiri_engraver::get_spanner_p () const +{ + Spanner * sp = new Spanner (get_property ("basicHaraKiriVerticalGroupspannerProperties")); + Hara_kiri_group_spanner::set_interface (sp); + return sp; +} + +void +Hara_kiri_engraver::acknowledge_element (Score_element_info i) +{ + Axis_group_engraver::acknowledge_element (i); + if (Rhythmic_head::has_interface (i.elem_l_)) + { + Hara_kiri_group_spanner::add_interesting_item (staffline_p_, i.elem_l_); + } +} +ADD_THIS_TRANSLATOR(Hara_kiri_engraver); diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 83f391c976..943c74a7ba 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -126,5 +126,4 @@ Axis_group_interface::set_interface (Score_element*me) { me->set_interface (ly_symbol2scm ("axis-group-interface")); } - me->set_elt_property ("elements", SCM_EOL); } diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index 3451841d66..dfa4d906fa 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -37,7 +37,7 @@ Bar_engraver::create_bar () bar_p_->set_elt_property ("glyph", default_type); // ugh } - announce_element (Score_element_info (bar_p_, 0)); + announce_element (bar_p_, 0); } } diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 5b29f4a19f..facf059ace 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -25,7 +25,6 @@ protected: Protected_scm staffs_; protected: - virtual void do_creation_processing (); virtual void do_pre_move_processing (); virtual void acknowledge_element (Score_element_info); void create_items(); @@ -62,10 +61,6 @@ Bar_number_engraver::Bar_number_engraver () staffs_ = SCM_EOL; } -void -Bar_number_engraver::do_creation_processing () -{ -} @@ -130,6 +125,6 @@ Bar_number_engraver::create_items () } - announce_element (Score_element_info (text_p_, 0)); + announce_element (text_p_, 0); } diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 1678dff784..5574830c37 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -72,7 +72,7 @@ Beam_engraver::do_try_music (Music *m) if (d == STOP && !beam_p_) { - m->warning (_ ("can't find start of beam")); + m->origin ()->warning (_ ("can't find start of beam")); return false; } reqs_drul_[d ] = c; @@ -88,7 +88,7 @@ Beam_engraver::do_process_music () if (reqs_drul_[STOP]) { if (!beam_p_) - reqs_drul_[STOP]->warning (_("can't find start of beam")); + reqs_drul_[STOP]->origin ()->warning (_("can't find start of beam")); prev_start_req_ =0; finished_beam_p_ = beam_p_; finished_beam_info_p_ = beam_info_p_; @@ -117,7 +117,7 @@ Beam_engraver::do_process_music () { if (beam_p_) { - reqs_drul_[START]->warning (_ ("already have a beam")); + reqs_drul_[START]->origin ()->warning (_ ("already have a beam")); return; } @@ -135,7 +135,7 @@ Beam_engraver::do_process_music () /* urg, must copy to Auto_beam_engraver too */ - announce_element (Score_element_info (beam_p_, reqs_drul_[START])); + announce_element (beam_p_, reqs_drul_[START]); } } @@ -174,7 +174,7 @@ Beam_engraver::do_removal_processing () typeset_beam (); if (beam_p_) { - prev_start_req_->warning (_ ("unterminated beam")); + prev_start_req_->origin ()->warning (_ ("unterminated beam")); finished_beam_p_ = beam_p_; finished_beam_info_p_ = beam_info_p_; typeset_beam (); @@ -209,7 +209,7 @@ Beam_engraver::acknowledge_element (Score_element_info info) { String s = _ ("stem must have Rhythmic structure"); if (info.req_l_) - info.req_l_->warning (s); + info.req_l_->origin ()->warning (s); else ::warning (s); @@ -218,8 +218,8 @@ Beam_engraver::acknowledge_element (Score_element_info info) if (rhythmic_req->duration_.durlog_i_<= 2) { - rhythmic_req->warning (_ ("stem doesn't fit in beam")); - prev_start_req_->warning (_ ("beam was started here")); + rhythmic_req->origin ()->warning (_ ("stem doesn't fit in beam")); + prev_start_req_->origin ()->warning (_ ("beam was started here")); /* don't return, since diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index cd8c9a1b81..3ca38f7db7 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -98,7 +98,7 @@ Break_align_engraver::acknowledge_element (Score_element_info inf) { align_l_ = new Item (get_property ("basicBreakAlignProperties")); Break_align_item::set_interface (align_l_); - announce_element (Score_element_info (align_l_,0)); + announce_element (align_l_,0); SCM edge_sym = ly_symbol2scm ("Left_edge_item"); Item * edge = new Item (get_property ("leftEdgeBasicProperties")); @@ -113,7 +113,7 @@ Break_align_engraver::acknowledge_element (Score_element_info inf) align_l_->set_elt_property ("group-center-element", edge->self_scm_); - announce_element (Score_element_info(edge, 0)); + announce_element (edge, 0); column_alist_ = scm_assoc_set_x (column_alist_, edge_sym, edge->self_scm_); } @@ -135,7 +135,7 @@ Break_align_engraver::acknowledge_element (Score_element_info inf) group->set_elt_property ("break-align-symbol", align_name); group->set_parent (align_l_, Y_AXIS); - announce_element (Score_element_info (group, 0)); + announce_element (group, 0); column_alist_ = scm_assoc_set_x (column_alist_, align_name, group->self_scm_); } Axis_group_interface::add_element (group, item_l); diff --git a/lily/breathing-sign-engraver.cc b/lily/breathing-sign-engraver.cc index 1088b39d33..2a19cdb4ab 100644 --- a/lily/breathing-sign-engraver.cc +++ b/lily/breathing-sign-engraver.cc @@ -18,7 +18,7 @@ TODO: #include "musical-request.hh" #include "command-request.hh" #include "engraver-group-engraver.hh" -#include "local-key-item.hh" +#include "item.hh" #include "engraver.hh" #include "command-request.hh" @@ -67,7 +67,7 @@ Breathing_sign_engraver::do_process_music() Breathing_sign::set_interface (breathing_sign_p_); - announce_element (Score_element_info (breathing_sign_p_, breathing_sign_req_l_)); + announce_element (breathing_sign_p_, breathing_sign_req_l_); } } diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc index f860c69773..08fdc53271 100644 --- a/lily/change-iterator.cc +++ b/lily/change-iterator.cc @@ -28,7 +28,7 @@ Change_iterator::error (String reason) + report_to_l ()->type_str_ + " = `" + report_to_l ()->id_str_ + "': "; warning (warn2); - t->warning (warn1); + t->origin ()->warning (warn1); } /* diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 3e82a77350..41a452f76e 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -113,7 +113,7 @@ Chord_name_engraver::do_process_music () if (chord.bass_b_) chord_name_p_->set_elt_property ("bass", chord.bass_pitch_.to_scm ()); - announce_element (Score_element_info (chord_name_p_, 0)); + announce_element (chord_name_p_, 0); } void diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 87fdecbce8..63626bd022 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -101,7 +101,7 @@ Chord_tremolo_engraver::do_process_music () SCM smp = get_property ("measurePosition"); Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0); beam_start_location_ = mp; - announce_element (Score_element_info (beam_p_, repeat_)); + announce_element (beam_p_, repeat_); } } @@ -112,7 +112,7 @@ Chord_tremolo_engraver::do_removal_processing () typeset_beam (); if (beam_p_) { - repeat_->warning (_ ("unterminated chord tremolo")); + repeat_->origin ()->warning (_ ("unterminated chord tremolo")); finished_beam_p_ = beam_p_; typeset_beam (); } @@ -171,7 +171,7 @@ Chord_tremolo_engraver::acknowledge_element (Score_element_info info) { String s = _ ("stem must have Rhythmic structure"); if (info.req_l_) - info.req_l_->warning (s); + info.req_l_->origin ()->warning (s); else ::warning (s); } diff --git a/lily/chord-tremolo-iterator.cc b/lily/chord-tremolo-iterator.cc index c74c8be464..1fe1425527 100644 --- a/lily/chord-tremolo-iterator.cc +++ b/lily/chord-tremolo-iterator.cc @@ -12,15 +12,16 @@ this is culled from various other iterators, but sharing code by subclassing proved to be too difficult. */ +#include "input.hh" #include "chord-tremolo-iterator.hh" #include "repeated-music.hh" void Chord_tremolo_iterator::construct_children () { - Repeated_music const* rep = dynamic_cast (music_l_); + Repeated_music * rep = dynamic_cast (music_l_); factor_ = Moment (1, rep->repeats_i_); - child_iter_p_ = get_iterator_p (rep->repeat_body_p_); + child_iter_p_ = get_iterator_p (rep->body ()); } Chord_tremolo_iterator::Chord_tremolo_iterator() @@ -38,7 +39,7 @@ Chord_tremolo_iterator::do_process_and_next (Moment m) if (yeah) set_translator (yeah->report_to_l ()); else - music_l_->warning ( _("no one to print a tremolos")); + music_l_->origin ()->warning ( _("no one to print a tremolos")); } child_iter_p_->process_and_next (factor_ * m); @@ -63,7 +64,7 @@ Chord_tremolo_iterator::~Chord_tremolo_iterator () } Music_iterator* -Chord_tremolo_iterator::try_music_in_children (Music const *m) const +Chord_tremolo_iterator::try_music_in_children (Music *m) const { return child_iter_p_->try_music (m); } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index b9813a1aa9..5d287e38a8 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -164,7 +164,7 @@ Clef_engraver::do_try_music (Music * r_l) { clef_req_l_ = cl; if (!set_type (cl->clef_str_)) - cl->error (_ ("unknown clef type")); + cl->origin ()->warning (_ ("unknown clef type")); return true; } @@ -179,7 +179,7 @@ Clef_engraver::create_clef() if (!clef_p_) { Item *c= new Item ( current_settings_); - announce_element (Score_element_info (c, clef_req_l_)); + announce_element (c, clef_req_l_); Staff_symbol_referencer::set_interface (c); @@ -198,7 +198,7 @@ Clef_engraver::create_clef() g->add_offset_callback (Side_position::centered_on_parent, X_AXIS); g->set_elt_property ("direction", gh_int2scm (octave_dir_)); octavate_p_ = g; - announce_element (Score_element_info (octavate_p_, clef_req_l_)); + announce_element (octavate_p_, clef_req_l_); } } diff --git a/lily/collision-engraver.cc b/lily/collision-engraver.cc index 9b3218de78..fc0d97cc98 100644 --- a/lily/collision-engraver.cc +++ b/lily/collision-engraver.cc @@ -40,7 +40,7 @@ Collision_engraver::process_acknowledged () Axis_group_interface::set_interface (col_p_); Axis_group_interface::set_axes (col_p_, X_AXIS, Y_AXIS); - announce_element (Score_element_info (col_p_,0)); + announce_element (col_p_,0); } for (int i=0; i< note_column_l_arr_.size (); i++) diff --git a/lily/command-request.cc b/lily/command-request.cc index 92143f8a55..bc919f63e7 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -105,16 +105,16 @@ bool Key_change_req::do_equal_b (Request const * req) const { Key_change_req const * k = dynamic_cast (req); - return k && scm_equal_p (pitch_alist_, k->pitch_alist_); + return k && scm_equal_p (get_mus_property ("pitch-alist"), k->get_mus_property ("pitch-alist")); } - void Key_change_req::transpose (Musical_pitch p) { SCM newlist = SCM_EOL; - for (SCM s = pitch_alist_; gh_pair_p (s); s = gh_cdr (s)) + SCM pa = get_mus_property ("pitch-alist"); + for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s)) { SCM k = gh_caar (s); @@ -141,7 +141,7 @@ Key_change_req::transpose (Musical_pitch p) } } - pitch_alist_ = newlist; + set_mus_property ("pitch-alist", newlist); } Break_req::Break_req () @@ -149,10 +149,10 @@ Break_req::Break_req () } - bool Mark_req::do_equal_b (Request const * r) const { Mark_req const * other = dynamic_cast (r); - return other && scm_equal_p (other->mark_label_, mark_label_); + return other && scm_equal_p (other->get_mus_property ("mark-label"), + get_mus_property ("mark-label")); } diff --git a/lily/debug.cc b/lily/debug.cc index e3aad9a4aa..44f120101d 100644 --- a/lily/debug.cc +++ b/lily/debug.cc @@ -1,6 +1,6 @@ /* debug.cc -- implement debugging routines - + source file of the GNU LilyPond music typesetter (c) 1996--2000 Han-Wen Nienhuys diff --git a/lily/dot-column-engraver.cc b/lily/dot-column-engraver.cc index 35ca2c3cc4..935d3f3e65 100644 --- a/lily/dot-column-engraver.cc +++ b/lily/dot-column-engraver.cc @@ -56,7 +56,7 @@ Dot_column_engraver::acknowledge_element (Score_element_info info) Dot_column::set_interface (dotcol_p_); Side_position::set_axis (dotcol_p_, X_AXIS); Side_position::set_direction (dotcol_p_, RIGHT); - announce_element (Score_element_info (dotcol_p_, 0)); + announce_element (dotcol_p_, 0); } Dot_column::add_head (dotcol_p_, info.elem_l_); diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index f0390d4798..c57c533265 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -123,9 +123,8 @@ Dynamic_engraver::do_process_music () Side_position::set_axis (line_spanner_, Y_AXIS); Axis_group_interface::set_interface (line_spanner_); Axis_group_interface::set_axes (line_spanner_, Y_AXIS, Y_AXIS); - announce_element (Score_element_info - (line_spanner_, - text_req_l_ ? text_req_l_ : accepted_spanreqs_drul_[START])); + announce_element (line_spanner_, + text_req_l_ ? text_req_l_ : accepted_spanreqs_drul_[START]); } } @@ -174,14 +173,14 @@ Dynamic_engraver::do_process_music () text_p_->add_offset_callback (Side_position::aligned_on_self, Y_AXIS); - announce_element (Score_element_info (text_p_, text_req_l_)); + announce_element (text_p_, text_req_l_); } if (accepted_spanreqs_drul_[STOP]) { if (!cresc_p_) { - accepted_spanreqs_drul_[STOP]->warning + accepted_spanreqs_drul_[STOP]->origin ()->warning (_ ("can't find start of (de)crescendo")); } else @@ -198,7 +197,7 @@ Dynamic_engraver::do_process_music () { if (current_cresc_req_) { - accepted_spanreqs_drul_[START]->warning + accepted_spanreqs_drul_[START]->origin ()->warning (current_cresc_req_->span_dir_ == 1 ? _ ("already have a crescendo") @@ -267,7 +266,7 @@ Dynamic_engraver::do_process_music () cresc_p_->set_elt_property ("self-alignment-Y", gh_int2scm (0)); cresc_p_->add_offset_callback (Side_position::aligned_on_self, Y_AXIS); - announce_element (Score_element_info (cresc_p_, accepted_spanreqs_drul_[START])); + announce_element (cresc_p_, accepted_spanreqs_drul_[START]); } } } @@ -287,7 +286,7 @@ Dynamic_engraver::do_removal_processing () { typeset_element (cresc_p_ ); finished_cresc_p_ = cresc_p_; - current_cresc_req_->warning (_ ("unterminated (de)crescendo")); + current_cresc_req_->origin ()->warning (_ ("unterminated (de)crescendo")); } if (line_spanner_) { diff --git a/lily/engraver-group-engraver.cc b/lily/engraver-group-engraver.cc index db7a7d79dd..c12283e8e4 100644 --- a/lily/engraver-group-engraver.cc +++ b/lily/engraver-group-engraver.cc @@ -23,6 +23,7 @@ Engraver_group_engraver::announce_element (Score_element_info info) Engraver::announce_element (info); } + void Engraver_group_engraver::do_announces() { @@ -32,17 +33,12 @@ Engraver_group_engraver::do_announces() trg->do_announces (); } - Request dummy_req; - while (announce_info_arr_.size ()) { for (int j =0; j < announce_info_arr_.size(); j++) { Score_element_info info = announce_info_arr_[j]; - if (!info.req_l_) - info.req_l_ = &dummy_req; - for (Cons *p = trans_p_list_.head_; p; p = p->next_) { if (!dynamic_cast (p->car_)) diff --git a/lily/engraver.cc b/lily/engraver.cc index 7ef5dda44f..896c206f12 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -17,17 +17,29 @@ void -Engraver::announce_element (Score_element_info i) +Engraver::announce_element (Score_element_info inf) { - Score_element * e = i.elem_l_; + daddy_grav_l()->announce_element (inf); +} +void +Engraver::announce_element (Score_element* e, Music *m) +{ if (e->get_elt_property ("interfaces") == SCM_EOL) Group_interface (e, "interfaces").add_thing (ly_symbol2scm (e->name())); + + if (m && m->origin ()->location_str ().length_i ()) + { + e->set_elt_property ("origin", m->get_mus_property ("origin")); + } + Score_element_info i (e, m); if (!i.origin_trans_l_) i.origin_trans_l_ = this; daddy_grav_l()->announce_element (i); } + + void Engraver::typeset_element (Score_element*p) diff --git a/lily/extender-engraver.cc b/lily/extender-engraver.cc index 21a246d713..db813f141a 100644 --- a/lily/extender-engraver.cc +++ b/lily/extender-engraver.cc @@ -95,7 +95,7 @@ Extender_engraver::do_removal_processing () { if (extender_p_) { - req_l_->warning (_ ("unterminated extender")); + req_l_->origin ()->warning (_ ("unterminated extender")); extender_p_->set_bound(RIGHT, unsmob_element (get_property ("currentCommandColumn"))); } } @@ -107,7 +107,7 @@ Extender_engraver::do_process_music () { if (!last_lyric_l_) { - req_l_->warning (_ ("Nothing to connect extender to on the left. Ignoring extender request.")); + req_l_->origin ()->warning (_ ("Nothing to connect extender to on the left. Ignoring extender request.")); return; } @@ -115,7 +115,7 @@ Extender_engraver::do_process_music () extender_p_->set_extent_callback (Score_element::point_dimension_callback, Y_AXIS); Lyric_extender (extender_p_).set_textitem (LEFT, last_lyric_l_); - announce_element (Score_element_info (extender_p_, req_l_)); + announce_element (extender_p_, req_l_); } } diff --git a/lily/folded-repeat-iterator.cc b/lily/folded-repeat-iterator.cc index 1083b8fa69..38241b8cf4 100644 --- a/lily/folded-repeat-iterator.cc +++ b/lily/folded-repeat-iterator.cc @@ -45,8 +45,8 @@ Folded_repeat_iterator::next_moment () const void Folded_repeat_iterator::construct_children () { - Repeated_music const * mus = dynamic_cast (music_l_); - main_iter_p_ = get_iterator_p (mus->repeat_body_p_); + Repeated_music * mus = dynamic_cast (music_l_); + main_iter_p_ = get_iterator_p (mus->body ()); if (!main_iter_p_->ok()) { leave_body (); @@ -61,7 +61,7 @@ Folded_repeat_iterator::do_process_and_next (Moment m) { bool success = try_music (music_l_); if (!success) - music_l_->warning ( _("no one to print a repeat brace")); + music_l_->origin ()->warning ( _("no one to print a repeat brace")); } if (main_iter_p_) @@ -90,36 +90,30 @@ Folded_repeat_iterator::do_process_and_next (Moment m) void Folded_repeat_iterator::leave_body () { - Repeated_music const * mus = dynamic_cast (music_l_); + Repeated_music * mus = dynamic_cast (music_l_); delete main_iter_p_; main_iter_p_ = 0; - main_length_mom_ += mus->repeat_body_p_->length_mom (); + main_length_mom_ += mus->body ()->length_mom (); } void Folded_repeat_iterator::enter_alternative () { - Repeated_music const * mus = dynamic_cast (music_l_); - if (mus->alternatives_p_) + Repeated_music * mus = dynamic_cast (music_l_); + if (mus->alternatives ()) { Simultaneous_music_iterator * s = new Simultaneous_music_iterator; s->separate_contexts_b_ = true; - s->init_translator (mus->alternatives_p_, report_to_l ()); + s->init_translator (mus->alternatives (), report_to_l ()); alternative_iter_p_ = s; alternative_iter_p_->construct_children (); } } -void -Folded_repeat_iterator::do_print () const -{ -#ifndef NPRINT -#endif -} Music_iterator* -Folded_repeat_iterator::try_music_in_children (Music const* m) const +Folded_repeat_iterator::try_music_in_children (Music * m) const { if (main_iter_p_) { diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 192ece0a69..b442cca427 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -136,7 +136,7 @@ Gourlay_breaking::do_solve () const /* do the last one */ if (break_idx % HAPPY_DOTS_I) - progress_indication (String ("[") + to_str (break_idx) + "]"); + progress_indication (String ("[") + to_str (break_idx) + "]"); progress_indication ("\n"); diff --git a/lily/hyphen-engraver.cc b/lily/hyphen-engraver.cc index 9625b16f02..79fbe31f7f 100644 --- a/lily/hyphen-engraver.cc +++ b/lily/hyphen-engraver.cc @@ -87,7 +87,7 @@ Hyphen_engraver::do_removal_processing () { if (hyphen_p_) { - req_l_->warning (_ ("unterminated hyphen")); + req_l_->origin ()->warning (_ ("unterminated hyphen")); hyphen_p_->set_bound(RIGHT, unsmob_element (get_property ("currentCommandColumn"))); } } @@ -99,14 +99,14 @@ Hyphen_engraver::do_process_music () { if (!last_lyric_l_) { - req_l_->warning (_ ("Nothing to connect hyphen to on the left. Ignoring hyphen request.")); + req_l_->origin ()->warning (_ ("Nothing to connect hyphen to on the left. Ignoring hyphen request.")); return; } hyphen_p_ = new Spanner (get_property ("basicHyphenSpannerProperties")); hyphen_p_->set_extent_callback (Score_element::point_dimension_callback,Y_AXIS); Hyphen_spanner (hyphen_p_).set_textitem (LEFT, last_lyric_l_); - announce_element (Score_element_info (hyphen_p_, req_l_)); + announce_element (hyphen_p_, req_l_); } } diff --git a/lily/identifier.cc b/lily/identifier.cc index c82598ed5e..41b5e049f9 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -16,7 +16,6 @@ #include "identifier.hh" #include "my-lily-lexer.hh" #include "debug.hh" -#include "request.hh" #include "translator-group.hh" #include "ly-smobs.icc" @@ -83,8 +82,6 @@ Class ## _identifier::do_print () const { \ DEFAULT_PRINT(Translator_group); -DEFAULT_PRINT(Music); -DEFAULT_PRINT(Request); DEFAULT_PRINT(Score); DEFAULT_PRINT(Music_output_def); @@ -97,8 +94,6 @@ Class ## _identifier::do_str () const { \ DUMMY_STR(Translator_group); -DUMMY_STR(Music); -DUMMY_STR(Request); DUMMY_STR(Score); DUMMY_STR(Music_output_def); DUMMY_STR(Duration); @@ -156,12 +151,8 @@ Class ## _identifier::Class ## _identifier (Class ## _identifier const &s) \ IMPLEMENT_ID_CLASS(Duration); IMPLEMENT_ID_CLASS(Translator_group); -IMPLEMENT_ID_CLASS(Music); IMPLEMENT_ID_CLASS(Score); -IMPLEMENT_ID_CLASS(Request); IMPLEMENT_ID_CLASS(Music_output_def); -VIRTUAL_ACCESSOR(Music); -VIRTUAL_ACCESSOR(Request); VIRTUAL_ACCESSOR(Translator_group); VIRTUAL_ACCESSOR(Music_output_def); DEFAULT_ACCESSOR(Duration); diff --git a/lily/include/chord-tremolo-iterator.hh b/lily/include/chord-tremolo-iterator.hh index 9100bce319..9cd632985d 100644 --- a/lily/include/chord-tremolo-iterator.hh +++ b/lily/include/chord-tremolo-iterator.hh @@ -27,7 +27,7 @@ protected: virtual bool ok () const; virtual void do_print () const; virtual void do_process_and_next (Moment) ; - virtual Music_iterator *try_music_in_children (Music const *) const; + virtual Music_iterator *try_music_in_children (Music *) const; }; diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 845598a3ad..7593325081 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -26,8 +26,9 @@ protected: class Mark_req : public Request { public: - Protected_scm mark_label_; -protected: + SCM mark_label (); + + virtual bool do_equal_b (Request const*) const; VIRTUAL_COPY_CONS(Music); }; @@ -102,8 +103,8 @@ class Breathing_sign_req : public Request { class Key_change_req : public Request { public: - Protected_scm pitch_alist_; - + SCM pitch_alist (); + protected: VIRTUAL_COPY_CONS(Music); void transpose (Musical_pitch d); diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh index 2c3ef7afd6..3c20037f7e 100644 --- a/lily/include/engraver.hh +++ b/lily/include/engraver.hh @@ -24,18 +24,13 @@ class Engraver : public virtual Translator { friend class Engraver_group_engraver; - protected: - - /// utility Paper_def * paper_l() const; /** Invoke walker method to typeset element. Default: pass on to daddy. */ virtual void typeset_element (Score_element*elem_p); - - /** take note of item/spanner put item in spanner. Adjust local key; etc. @@ -52,7 +47,8 @@ protected: /** Announce element. Default: pass on to daddy. Utility */ - virtual void announce_element (Score_element_info); + virtual void announce_element (Score_element*, Music*); + virtual void announce_element (Score_element_info); public: VIRTUAL_COPY_CONS(Translator); Engraver_group_engraver * daddy_grav_l() const; @@ -60,8 +56,6 @@ public: override other ctor */ Engraver () {} - - }; diff --git a/lily/include/folded-repeat-iterator.hh b/lily/include/folded-repeat-iterator.hh index 499b7b4be8..e26bac173e 100644 --- a/lily/include/folded-repeat-iterator.hh +++ b/lily/include/folded-repeat-iterator.hh @@ -34,9 +34,8 @@ protected: void enter_alternative (); void leave_body (); - virtual void do_print () const; virtual void do_process_and_next (Moment); - virtual Music_iterator *try_music_in_children (Music const *) const; + virtual Music_iterator *try_music_in_children (Music *) const; }; #endif /* FOLDED_REPEAT_ITERATOR_HH */ diff --git a/lily/include/hara-kiri-engraver.hh b/lily/include/hara-kiri-engraver.hh index 93eeb8feb7..0c1d70778e 100644 --- a/lily/include/hara-kiri-engraver.hh +++ b/lily/include/hara-kiri-engraver.hh @@ -12,13 +12,4 @@ #include "axis-group-engraver.hh" -class Hara_kiri_engraver : public Axis_group_engraver -{ -protected: - virtual Spanner*get_spanner_p ()const; - virtual void acknowledge_element (Score_element_info); -public: - VIRTUAL_COPY_CONS(Translator); -}; - #endif /* HARA_KIRI_ENGRAVER_HH */ diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index cb9b8b6fdf..750c49089a 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -16,9 +16,7 @@ class Translator_group_identifier; -class Music_identifier; class Output_def_identifier; -class Request_identifier; class Score_identifier; class Duration_identifier; @@ -49,9 +47,7 @@ struct Identifier : public Input { void error (String) const; String str () const; IDACCESSOR(Translator_group) - IDACCESSOR(Music) IDACCESSOR(Music_output_def) - IDACCESSOR(Request) IDACCESSOR(Score) IDACCESSOR(Duration) VIRTUAL_COPY_CONS(Identifier); @@ -77,9 +73,7 @@ struct Class ## _identifier : Identifier {\ DECLARE_ID_CLASS(Translator_group); DECLARE_ID_CLASS(Duration); -DECLARE_ID_CLASS(Music); DECLARE_ID_CLASS(Score); -DECLARE_ID_CLASS(Request); DECLARE_ID_CLASS(Music_output_def); Identifier * unsmob_identifier (SCM); diff --git a/lily/include/input-smob.hh b/lily/include/input-smob.hh new file mode 100644 index 0000000000..87d63c5ba6 --- /dev/null +++ b/lily/include/input-smob.hh @@ -0,0 +1,22 @@ +/* + input-smob.hh -- declare input smob + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#ifndef INPUT_SMOB_HH +#define INPUT_SMOB_HH + +#include "input.hh" +#include "lily-guile.hh" + +SCM make_input (Input spot); +Input *unsmob_input (SCM); + +extern Input dummy_input_global; + +#endif /* INPUT_SMOB_HH */ + diff --git a/lily/include/item.hh b/lily/include/item.hh index 3a84af0def..85c58aa4a9 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -56,6 +56,7 @@ public: protected: virtual void discretionary_processing (); void copy_breakable_items(); + virtual SCM do_derived_mark (); }; diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 3dc1f64f16..be8a39ff6f 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -79,11 +79,11 @@ void add_scm_init_func (void (*)()); #define MAKE_SCHEME_CALLBACK(TYPE, FUNC) \ -static SCM TYPE ## _ ## FUNC ## _scm;\ +static SCM TYPE ## _ ## FUNC ## _proc;\ void \ TYPE ## _ ## FUNC ## _init_functions () \ { \ - TYPE ## _ ## FUNC ## _scm = gh_new_procedure1_0 (#TYPE "::" #FUNC, \ + TYPE ## _ ## FUNC ## _proc = gh_new_procedure1_0 (#TYPE "::" #FUNC, \ (SCM(*)(...))TYPE :: FUNC); \ } \ \ diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index fb2c190ece..e1f45bd305 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -8,47 +8,17 @@ #define LOCALKEYITEM_HH -#include "item.hh" #include "array.hh" #include "musical-pitch.hh" - - -struct Local_key_cautionary_tuple -{ - Musical_pitch pitch_; - bool cautionary_b_; - bool natural_b_; - - Local_key_cautionary_tuple () - { - cautionary_b_ = false; - natural_b_ = false; - } - static int compare (Local_key_cautionary_tuple const&s1, Local_key_cautionary_tuple const&s2) - { - return Musical_pitch::compare (s1.pitch_, s2.pitch_); - } -}; - -/** - Accidentals which can be different for each octave. - - TODO: schemify me! - */ -class Local_key_item : public Item +class Local_key_item { - Array accidental_arr_; - - static Molecule accidental (Score_element*me, int,bool,bool) ; + static Molecule parenthesize (Score_element*me, Molecule) ; public: - Local_key_item (SCM ); - static SCM brew_molecule (SCM); - - void add_pitch (Musical_pitch, bool cautionary, bool natural); - - static SCM before_line_breaking (SCM); + static SCM brew_molecule (SCM); + static void add_pitch (Score_element*me, Musical_pitch, bool cautionary, bool natural); static bool has_interface (Score_element*); + static void set_interface (Score_element*); }; diff --git a/lily/include/ly-smobs.icc b/lily/include/ly-smobs.icc index d496d25bc9..8a8648e6a5 100644 --- a/lily/include/ly-smobs.icc +++ b/lily/include/ly-smobs.icc @@ -10,6 +10,7 @@ #ifndef LY_SMOBS_ICC #define LY_SMOBS_ICC +#include "smobs.hh" #define IMPLEMENT_UNSMOB(CL, name) \ diff --git a/lily/include/lyric-combine-music-iterator.hh b/lily/include/lyric-combine-music-iterator.hh index 73b7c925a8..2264996110 100644 --- a/lily/include/lyric-combine-music-iterator.hh +++ b/lily/include/lyric-combine-music-iterator.hh @@ -22,7 +22,7 @@ protected: virtual void construct_children (); virtual Moment next_moment () const; virtual void do_process_and_next (Moment); - virtual Music_iterator *try_music_in_children (Music const*) const; + virtual Music_iterator *try_music_in_children (Music *) const; virtual bool ok () const; virtual void do_print () const; diff --git a/lily/include/lyric-combine-music.hh b/lily/include/lyric-combine-music.hh index 16a60a60c0..a4a47c2a43 100644 --- a/lily/include/lyric-combine-music.hh +++ b/lily/include/lyric-combine-music.hh @@ -14,21 +14,15 @@ class Lyric_combine_music : public Music { - Music * music_p_; - Music * lyrics_p_; public: Music * music_l () const; Music * lyrics_l () const; Lyric_combine_music (Music*, Music*); - virtual void transpose (Musical_pitch); virtual void do_print () const; - VIRTUAL_COPY_CONS(Music); - Lyric_combine_music (Lyric_combine_music const&); virtual Moment length_mom () const; - virtual ~Lyric_combine_music (); virtual Musical_pitch to_relative_octave (Musical_pitch); virtual void compress (Moment); }; diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index 548085bcff..898cb63732 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -37,6 +37,8 @@ Empty molecules have empty dimensions. If add_at_edge is used to init the molecule, we assume that DIMENSIONS = (Interval(0,0),Interval(0,0) + + TODO: go full smob with Molecule. */ class Molecule { diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 754525578a..561e9c11eb 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -28,7 +28,7 @@ class Music_iterator { Interpretation_context_handle handle_; protected: - Music const * music_l_; + Music * music_l_; /// ugh. JUNKME bool first_b_; @@ -47,7 +47,7 @@ protected: /** Get an iterator for MUS, inheriting the translation unit from THIS. */ - Music_iterator* get_iterator_p (Music const*mus) const; + Music_iterator* get_iterator_p (Music *mus) const; /** Do the actual move. This should be overriden in derived classes. It is called by #process_and_next#, the public interface @@ -55,7 +55,7 @@ protected: virtual void do_process_and_next (Moment until); - virtual Music_iterator* try_music_in_children (Music const *) const; + virtual Music_iterator* try_music_in_children (Music *) const; public: @@ -63,7 +63,7 @@ public: Do the reporting. Will try MUSIC_L_ in its own translator first, then its children. Returns the iterator that succeeded */ - Music_iterator * try_music (Music const *) const; + Music_iterator * try_music (Music *) const; /** The translation unit that we this iterator is reporting to now. @@ -75,8 +75,8 @@ public: /** Get an iterator matching the type of MUS, and use TRANS to find an accompanying translation unit */ - static Music_iterator* static_get_iterator_p (Music const* mus); - void init_translator (Music const *, Translator_group *); + static Music_iterator* static_get_iterator_p (Music * mus); + void init_translator (Music *, Translator_group *); Music_iterator(); diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh index 386cf49fae..6abf926c4d 100644 --- a/lily/include/music-list.hh +++ b/lily/include/music-list.hh @@ -11,46 +11,7 @@ #ifndef Music_sequence_HH #define Music_sequence_HH -#include "music.hh" -#include "cons.hh" - - -class Music_list : public Cons_list , public Input -{ -public: - Musical_pitch do_relative_octave (Musical_pitch, bool); - void add_music (Music*); - Music_list (Music_list const&); - Music_list (); -}; - - -/** - Music can be a list of other "Music" elements - */ -class Music_sequence : public Music -{ -public: - Music_list * music_p_list_p_; - - Music_sequence (Music_sequence const&); - Music_sequence (Music_list *l_p); - - VIRTUAL_COPY_CONS(Music); - - Musical_pitch do_relative_octave (Musical_pitch p, bool b); - virtual void transpose (Musical_pitch ); - virtual void compress (Moment); - void add_music (Music *music_p); - int length_i () const; - Moment cumulative_length () const; - Moment maximum_length () const; - virtual ~Music_sequence (); - -protected: - virtual Musical_pitch to_relative_octave (Musical_pitch); - virtual void do_print() const; -}; +#include "music-sequence.hh" /** Simultaneous_music is a list of music-elements which happen simultaneously @@ -58,15 +19,12 @@ protected: class Simultaneous_music : public Music_sequence { public: - VIRTUAL_COPY_CONS(Music); - - Simultaneous_music(Music_list *); + Simultaneous_music(SCM); virtual Musical_pitch to_relative_octave (Musical_pitch); virtual Moment length_mom () const; }; - /** The request is a collection of Requests. A note that you enter in mudela is one Request_chord, one syllable of lyrics is one Request_chord @@ -75,12 +33,10 @@ class Request_chord : public Simultaneous_music { public: VIRTUAL_COPY_CONS(Music); - virtual Musical_pitch to_relative_octave (Musical_pitch); - Request_chord(); + Request_chord(SCM list); }; - /** Sequential_music is a list of music-elements which are placed behind each other. */ @@ -88,8 +44,8 @@ class Sequential_music : public Music_sequence { public: VIRTUAL_COPY_CONS(Music); - - Sequential_music(Music_list*); + Sequential_music(SCM); virtual Moment length_mom () const; }; + #endif // Music_sequence_HH diff --git a/lily/include/music-sequence.hh b/lily/include/music-sequence.hh new file mode 100644 index 0000000000..736d4abf98 --- /dev/null +++ b/lily/include/music-sequence.hh @@ -0,0 +1,40 @@ + + +/* + music-sequence.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#ifndef MUSIC_SEQUENCE_HH +#define MUSIC_SEQUENCE_HH +#include "music.hh" +/** + Music can be a list of other "Music" elements + */ +class Music_sequence : public Music +{ +public: + Music_sequence (SCM h); + + SCM music_list () const; + void append_music (Music *); + VIRTUAL_COPY_CONS(Music); + + Musical_pitch do_relative_octave (Musical_pitch p, bool b); + virtual void transpose (Musical_pitch ); + void truncate (int k); + virtual void compress (Moment); + int length_i () const; + Moment cumulative_length () const; + Moment maximum_length () const; + +protected: + virtual Musical_pitch to_relative_octave (Musical_pitch); + virtual void do_print() const; + +}; +#endif diff --git a/lily/include/music-wrapper-iterator.hh b/lily/include/music-wrapper-iterator.hh index 97bbe2abc1..8200709e52 100644 --- a/lily/include/music-wrapper-iterator.hh +++ b/lily/include/music-wrapper-iterator.hh @@ -31,7 +31,7 @@ public: protected: virtual void do_print () const; virtual void do_process_and_next (Moment) ; - virtual Music_iterator *try_music_in_children (Music const *) const; + virtual Music_iterator *try_music_in_children (Music *) const; Music_iterator *child_iter_p_; }; diff --git a/lily/include/music-wrapper.hh b/lily/include/music-wrapper.hh index 95d7f0bd84..76987deac5 100644 --- a/lily/include/music-wrapper.hh +++ b/lily/include/music-wrapper.hh @@ -21,17 +21,14 @@ */ class Music_wrapper : public Music { - Music * element_p_; public: Music_wrapper (Music*); - Music * element_l () const; + Music * element () const; virtual void transpose (Musical_pitch); virtual void do_print () const; VIRTUAL_COPY_CONS(Music); - Music_wrapper (Music_wrapper const&); virtual Moment length_mom () const; - virtual ~Music_wrapper (); virtual Musical_pitch to_relative_octave (Musical_pitch); virtual void compress (Moment); }; diff --git a/lily/include/music.hh b/lily/include/music.hh index ce355795d9..2eee399d18 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -12,10 +12,10 @@ #define MUSIC_HH #include "virtual-methods.hh" -#include "input.hh" #include "minterval.hh" #include "lily-proto.hh" #include "string.hh" +#include "smobs.hh" /** Music is anything that has duration and supports both time compression and transposition. @@ -28,14 +28,31 @@ @see Music_sequence */ -class Music:public Input { +class Music { public: + DECLARE_SMOBS; + SCM immutable_property_alist_; + SCM mutable_property_alist_; + + Input *origin () const; + void set_spot (Input); + + SCM get_mus_property (const char*) const; + SCM get_mus_property (SCM) const; + void set_mus_property (const char * , SCM val); + void set_immutable_mus_property (const char * , SCM val); + void set_immutable_mus_property (SCM key, SCM val); + void set_mus_property (SCM , SCM val); + void set_mus_pointer (const char*, SCM val); + SCM remove_mus_property (const char* nm); + + virtual SCM do_derived_mark (); virtual Musical_pitch to_relative_octave (Musical_pitch); /// The duration of this piece of music virtual Moment length_mom () const; - virtual ~Music(){} + virtual ~Music(); void print() const; /// Transpose, with the interval central C to #p# virtual void transpose (Musical_pitch p); @@ -43,12 +60,14 @@ public: /// Scale the music in time by #factor#. virtual void compress (Moment factor); VIRTUAL_COPY_CONS(Music); - + Music (Music const &m); Music(); protected: virtual void do_print() const; }; + +Music * unsmob_music (SCM); #endif // MUSIC_HH diff --git a/lily/include/output-property.hh b/lily/include/output-property.hh index f266642eb2..8590868d81 100644 --- a/lily/include/output-property.hh +++ b/lily/include/output-property.hh @@ -13,15 +13,18 @@ #include "music.hh" #include "protected-scm.hh" + +/* + +props: + + relevant stuff: the predicate, the symbol, the value + + */ class Output_property : public Music { public: Output_property(SCM, SCM, SCM); - - /** - relevant stuff: the predicate, the symbol, the value - */ - Protected_scm pred_sym_val_list_; }; #endif /* OUTPUT_PROPERTY_HH */ diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index ff9846cfbf..a0660f8032 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -21,11 +21,6 @@ */ class Paper_outputter { -#if 0 - Protected_scm molecules_; - SCM last_cons_; -#endif - bool verbatim_scheme_b_; Paper_stream * stream_p_; public: diff --git a/lily/include/paper-score.hh b/lily/include/paper-score.hh index 41823001cb..31914b2c20 100644 --- a/lily/include/paper-score.hh +++ b/lily/include/paper-score.hh @@ -38,8 +38,6 @@ public: int find_col_idx (Paper_column const *) const; Link_array broken_col_range (Item const*,Item const*) const; - - void typeset_line (Line_of_score*); protected: diff --git a/lily/include/repeated-music.hh b/lily/include/repeated-music.hh index 4f373f5958..cb9b9b5760 100644 --- a/lily/include/repeated-music.hh +++ b/lily/include/repeated-music.hh @@ -49,7 +49,12 @@ */ class Repeated_music : public Music { + Music * repeat_body_p_; + Music_sequence * alternatives_p_; public: + + Music * body () const; + Music_sequence * alternatives () const; String type_; bool fold_b_; @@ -58,10 +63,6 @@ public: /// how often do we repeat? int repeats_i_; - - Music * repeat_body_p_; - Music_sequence * alternatives_p_; - virtual Musical_pitch to_relative_octave (Musical_pitch); /// The duration of this piece of music @@ -79,7 +80,6 @@ public: Repeated_music (Music*, int , Music_sequence*); Repeated_music (Repeated_music const&); - ~Repeated_music (); protected: virtual void do_print() const; }; diff --git a/lily/include/request-chord-iterator.hh b/lily/include/request-chord-iterator.hh index fb9b38e042..bc09247992 100644 --- a/lily/include/request-chord-iterator.hh +++ b/lily/include/request-chord-iterator.hh @@ -22,7 +22,6 @@ class Request_chord_iterator : public Music_iterator { */ Moment elt_length_mom_; bool last_b_; - Cons* cursor_; public: Request_chord_iterator (); diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index eaf4e3cebd..7ce14c8cc1 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -131,7 +131,7 @@ public: virtual void do_break_processing (); virtual Score_element *find_broken_piece (Line_of_score*) const; virtual void discretionary_processing (); - virtual void do_derived_mark (); + virtual SCM do_derived_mark (); Molecule get_molecule () const; void suicide (); diff --git a/lily/include/score.hh b/lily/include/score.hh index 7be4e5c20b..b7515dc32a 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -12,6 +12,7 @@ #include "input.hh" #include "lily-proto.hh" +#include "protected-scm.hh" #include "parray.hh" /// the total music def of one movement @@ -19,7 +20,7 @@ class Score: public Input { public: /// paper_, staffs_ and commands_ form the problem definition. Link_array def_p_arr_; - Music * music_p_; + Protected_scm music_; Scope * header_p_; int errorlevel_i_; diff --git a/lily/include/sequential-music-iterator.hh b/lily/include/sequential-music-iterator.hh index 0d2565abf5..79f493fa87 100644 --- a/lily/include/sequential-music-iterator.hh +++ b/lily/include/sequential-music-iterator.hh @@ -28,13 +28,13 @@ public: protected: virtual void do_print() const; virtual void do_process_and_next (Moment); - virtual Music_iterator *try_music_in_children (Music const*) const; + virtual Music_iterator *try_music_in_children (Music *) const; private: Moment here_mom_; - Cons *cursor_; + SCM cursor_; Music_iterator * iter_p_; /* diff --git a/lily/include/simultaneous-music-iterator.hh b/lily/include/simultaneous-music-iterator.hh index 96ec914760..6c4008a95b 100644 --- a/lily/include/simultaneous-music-iterator.hh +++ b/lily/include/simultaneous-music-iterator.hh @@ -29,7 +29,7 @@ public: protected: virtual void do_print () const; virtual void do_process_and_next (Moment); - virtual Music_iterator *try_music_in_children (Music const*) const; + virtual Music_iterator *try_music_in_children (Music *) const; private: diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index dd5a61b21b..165ed99efe 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -34,7 +34,10 @@ class Spanner : public Score_element { public: Link_array broken_into_l_arr_; + + // todo: move to somewhere else. Real get_broken_left_end_align () const; + // TODO: make virtual and do this for Items as well. Interval_t spanned_rank_iv (); void set_bound (Direction d, Score_element*); @@ -48,7 +51,7 @@ public: static int compare (Spanner * const &,Spanner * const &); virtual Score_element* find_broken_piece (Line_of_score*) const; - virtual void do_derived_mark (); + virtual SCM do_derived_mark (); protected: void set_my_columns (); VIRTUAL_COPY_CONS(Score_element); diff --git a/lily/include/translation-property.hh b/lily/include/translation-property.hh index aecce178f2..ffb2968a29 100644 --- a/lily/include/translation-property.hh +++ b/lily/include/translation-property.hh @@ -11,22 +11,19 @@ #define TRANSLATION_PROPERTY_HH #include "music.hh" -#include "protected-scm.hh" /** - Set a property of Translator - */ + Set a property of Translator + + value -- the value to set + symbol -- the symbol to set. + +*/ class Translation_property : public Music { public: - String var_str_; - Protected_scm value_; - VIRTUAL_COPY_CONS(Music); - -protected: - virtual void do_print () const; }; #endif // PROPERTY_HH diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 8ceac15def..5bb0d08e28 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -40,6 +40,7 @@ protected: public: SCM get_property (SCM name_sym) const; void set_property (String var_name, SCM value); + void set_property (SCM var_sym, SCM value); Translator_group *where_defined (SCM name_sym) const; String id_str_; diff --git a/lily/include/unfolded-repeat-iterator.hh b/lily/include/unfolded-repeat-iterator.hh index 9008f30420..97a649a10a 100644 --- a/lily/include/unfolded-repeat-iterator.hh +++ b/lily/include/unfolded-repeat-iterator.hh @@ -39,7 +39,7 @@ public: Music_iterator * current_iter_p_; /// pointer to the alternative that will be processed next. - Cons *alternative_cons_l_; + SCM alternative_cons_; ~Unfolded_repeat_iterator(); Unfolded_repeat_iterator (); @@ -48,7 +48,7 @@ protected: virtual void construct_children (); virtual Moment next_moment () const; virtual void do_process_and_next (Moment); - virtual Music_iterator *try_music_in_children (Music const*) const; + virtual Music_iterator *try_music_in_children (Music *) const; virtual bool ok () const; virtual void next_element (); diff --git a/lily/input-smob.cc b/lily/input-smob.cc new file mode 100644 index 0000000000..ead1b749e2 --- /dev/null +++ b/lily/input-smob.cc @@ -0,0 +1,76 @@ +/* + input-smob.cc -- implement Input smob + + source file of the GNU LilyPond music typesetter + + (c) 2000 Han-Wen Nienhuys + + */ + +#include "input.hh" +#include "input-smob.hh" +#include "string.hh" +#include "ly-smobs.icc" + +static long input_tag; + + +static +SCM mark_smob (SCM) +{ + return SCM_EOL; +} + +static int +print_smob (SCM s, SCM port, scm_print_state *) +{ + String str = "#location_str () + ">"; + scm_puts (str.ch_C(), port); + return 1; +} + +static +scm_sizet free_smob (SCM s) +{ + delete unsmob_input (s); + return 0; +} + +static +void start_input_smobs() +{ + input_tag + = scm_make_smob_type_mfpe ("input", 0, + mark_smob, free_smob, + print_smob, 0); +} + +SCM +make_input (Input ip) +{ + Input * nip = new Input (ip); + SCM z; + + SCM_NEWCELL(z); + SCM_SETCAR (z, (SCM)input_tag); + SCM_SETCDR (z, (SCM)nip); + // fixme: done_malloc + return z; +} + +Input * +unsmob_input (SCM s) +{ + if (SCM_IMP (s)) + return 0; + if ((long)SCM_CAR(s) == input_tag) // ugh. + return (Input*) SCM_CDR(s); + else + return 0; +} + + +ADD_SCM_INIT_FUNC(input, start_input_smobs); + + +Input dummy_input_global; diff --git a/lily/instrument-name-engraver.cc b/lily/instrument-name-engraver.cc index 8b65565b94..26520d46e3 100644 --- a/lily/instrument-name-engraver.cc +++ b/lily/instrument-name-engraver.cc @@ -64,7 +64,7 @@ Instrument_name_engraver::create_text (SCM txt) if (delim_) text_->set_parent (delim_, Y_AXIS); - announce_element (Score_element_info (text_,0)); + announce_element (text_,0); } } diff --git a/lily/item.cc b/lily/item.cc index 4e995bfd77..d9531c6dfb 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -149,6 +149,12 @@ Item::handle_prebroken_dependencies () /* Can't do this earlier, because try_visibility_lambda () might set the elt property transparent, which would then be copied. + + TODO: + + handle visibility-lambda the item itself iso. breakstatusdir, so + the function can do more complicated things. + */ SCM vis = get_elt_property ("visibility-lambda"); if (gh_procedure_p (vis)) @@ -170,3 +176,12 @@ Item::handle_prebroken_dependencies () } } +SCM +Item::do_derived_mark () +{ + if (broken_to_drul_[LEFT]) + scm_gc_mark (broken_to_drul_[LEFT]->self_scm_); + if (broken_to_drul_[RIGHT]) + scm_gc_mark (broken_to_drul_[RIGHT]->self_scm_); + return SCM_EOL; +} diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 9208f26ab3..9f1b66d1a6 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -9,7 +9,7 @@ #include "key-item.hh" #include "command-request.hh" #include "musical-request.hh" -#include "local-key-item.hh" +#include "item.hh" #include "bar.hh" #include "timing-translator.hh" #include "staff-symbol-referencer.hh" @@ -65,6 +65,7 @@ Key_engraver::create_key (bool def) item_p_->set_elt_property ("new-accidentals", get_property ("keySignature")); Staff_symbol_referencer::set_interface (item_p_); + Key_item::set_interface (item_p_); SCM prop = get_property ("keyOctaviation"); bool multi = to_boolean (prop); @@ -72,7 +73,7 @@ Key_engraver::create_key (bool def) if (multi) item_p_->set_elt_property ("multi-octave", gh_bool2scm (multi)); - announce_element (Score_element_info (item_p_,keyreq_l_)); + announce_element (item_p_,keyreq_l_); } if (!def) @@ -137,10 +138,11 @@ Key_engraver::do_pre_move_processing () void Key_engraver::read_req (Key_change_req const * r) { - if (r->pitch_alist_ == SCM_UNDEFINED) + SCM p = r->get_mus_property ("pitch-alist"); + if (p == SCM_UNDEFINED) return; - SCM n = scm_list_copy (r->pitch_alist_); + SCM n = scm_list_copy (p); SCM accs = SCM_EOL; for (SCM s = get_property ("keyAccidentalOrder"); gh_pair_p (s); s = gh_cdr (s)) diff --git a/lily/key-performer.cc b/lily/key-performer.cc index b55210a448..79fdac637e 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -26,7 +26,7 @@ Key_performer::~Key_performer () void Key_performer::do_process_music () { - if (key_req_l_ && key_req_l_->pitch_alist_ != SCM_UNDEFINED) + if (key_req_l_ && key_req_l_->get_mus_property ("pitch-alist") != SCM_UNDEFINED) { audio_p_ = new Audio_key (); // *key_req_l_->key_); Audio_element_info info (audio_p_, key_req_l_); diff --git a/lily/lexer.ll b/lily/lexer.ll index 7178826d35..9be2c94085 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -137,9 +137,9 @@ HYPHEN -- String s (YYText ()+1); s = s.left_str (s.index_last_i ('"')); DEBUG_OUT << "#version `" << s << "'\n"; + yy_pop_state (); if (!valid_version_b (s)) return INVALID; - yy_pop_state (); } . { LexerError ("No quoted string found after \\version"); @@ -477,9 +477,14 @@ My_lily_lexer::scan_escaped_word (String str) } else if (gh_number_p (sid)) { yylval.scm = sid; return NUMBER_IDENTIFIER; + } else if (Music * mus =unsmob_music (sid)) { + yylval.scm = sid; + + return dynamic_cast (mus) ? REQUEST_IDENTIFIER : MUSIC_IDENTIFIER; } + Identifier * id = unsmob_identifier (sid); if (id) { yylval.id = id; diff --git a/lily/line-group-group-engraver.cc b/lily/line-group-group-engraver.cc index 908396dbe8..53c61f40c3 100644 --- a/lily/line-group-group-engraver.cc +++ b/lily/line-group-group-engraver.cc @@ -52,7 +52,7 @@ Line_group_engraver_group::do_creation_processing() staffline_p_->set_bound(LEFT,it); Pointer_group_interface (it, "bounded-by-me").add_element (staffline_p_); - Engraver::announce_element (Score_element_info (staffline_p_,0)); + Engraver::announce_element (staffline_p_,0); } void diff --git a/lily/line-number-engraver.cc b/lily/line-number-engraver.cc index 2811792adb..476ade7070 100644 --- a/lily/line-number-engraver.cc +++ b/lily/line-number-engraver.cc @@ -43,14 +43,17 @@ Line_number_engraver::process_acknowledged () text_item_p_->set_parent (interesting_[0].elem_l_, Y_AXIS); - announce_element (Score_element_info (text_item_p_, 0)); + announce_element (text_item_p_, 0); } } void Line_number_engraver::acknowledge_element (Score_element_info inf) { - if (Note_head::has_interface (inf.elem_l_)) + if (!inf.req_l_) + return ; + + if ( Note_head::has_interface (inf.elem_l_)) { interesting_.push (inf); support_.push (inf.elem_l_); @@ -73,7 +76,7 @@ Line_number_engraver::do_pre_move_processing () if (i) s += ","; - s += interesting_[i].req_l_->line_number_str (); + s += interesting_[i].req_l_->origin ()->line_number_str (); } diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index 2067092594..07fd651e14 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -7,7 +7,7 @@ #include "musical-request.hh" #include "command-request.hh" #include "local-key-item.hh" -#include "key-item.hh" +#include "item.hh" #include "tie.hh" #include "rhythmic-head.hh" #include "timing-translator.hh" @@ -25,7 +25,7 @@ (FIXME). */ struct Local_key_engraver : Engraver { - Local_key_item *key_item_p_; + Item *key_item_p_; protected: VIRTUAL_COPY_CONS(Translator); virtual void do_process_music(); @@ -97,12 +97,13 @@ Local_key_engraver::process_acknowledged () { if (!key_item_p_) { - key_item_p_ = new Local_key_item (get_property ("basicLocalKeyProperties")); + key_item_p_ = new Item(get_property ("basicLocalKeyProperties")); + Local_key_item::set_interface (key_item_p_); Side_position::set_axis (key_item_p_, X_AXIS); Side_position::set_direction (key_item_p_, LEFT); Staff_symbol_referencer::set_interface (key_item_p_); - announce_element (Score_element_info (key_item_p_, 0)); + announce_element (key_item_p_, 0); } @@ -110,14 +111,18 @@ Local_key_engraver::process_acknowledged () sign (prev_acc) * (prev_acc - a) == 1 && abs(prev_acc) == 2; - key_item_p_->add_pitch (note_l->pitch_, - note_l->cautionary_b_, - extra_natural); + Local_key_item::add_pitch (key_item_p_, note_l->pitch_, + note_l->cautionary_b_, + extra_natural); Side_position::add_support (key_item_p_,support_l); } if (!forget) { + /* + not really really correct if there are more than one + noteheads with the same notename. + */ localsig = scm_assoc_set_x (localsig, gh_cons (gh_int2scm (o), gh_int2scm (n)), gh_int2scm (a)); @@ -141,10 +146,8 @@ Local_key_engraver::process_acknowledged () - daddy_trans_l_->set_property ("localKeySignature", localsig); + daddy_trans_l_->set_property ("localKeySignature", localsig); } - /* - */ if (key_item_p_ && grace_align_l_) { @@ -218,16 +221,20 @@ Local_key_engraver::do_process_music() Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0); SCM sig = get_property ("keySignature"); - if (!mp) - { - if (!to_boolean (get_property ("noResetKey"))) - daddy_trans_l_->set_property ("localKeySignature", ly_deep_copy (sig)); - } - else if (last_keysig_ != sig) + + /* + Detect key sig changes. If we haven't found any, check if at start + of measure, and set localKeySignature anyhow. */ + if (last_keysig_ != sig) { daddy_trans_l_->set_property ("localKeySignature", ly_deep_copy (sig)); last_keysig_ = sig; } + else if (!mp) + { + if (!to_boolean (get_property ("noResetKey"))) + daddy_trans_l_->set_property ("localKeySignature", ly_deep_copy (sig)); + } } diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 9cc338a48a..6ef1dfba8a 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -14,61 +14,69 @@ #include "rhythmic-head.hh" #include "misc.hh" +SCM +pitch_less (SCM p1, SCM p2) +{ + for (int i = 3; i--; p1 = gh_cdr (p1), p2 = gh_cdr (p2)) + { + if (scm_less_p (gh_car (p1), gh_car (p2))) + return SCM_BOOL_T; + if (gh_car (p1) != gh_car (p2)) + return SCM_BOOL_F; + } + return SCM_BOOL_T; +} + +SCM pitch_less_proc; + + void -Local_key_item::add_pitch (Musical_pitch p, bool cautionary, bool natural) +init_pitch_funcs () { - for (int i=0; i< accidental_arr_.size(); i++) - if (!Musical_pitch::compare (p, accidental_arr_[i].pitch_)) - return; - /* maybe natural (and cautionary) should be modif. nonetheless? */ - - Local_key_cautionary_tuple t; - t.pitch_ = p; - t.cautionary_b_ = cautionary; - t.natural_b_ = natural; - accidental_arr_.push (t); + pitch_less_proc = gh_new_procedure2_0 ("pitch-less", &pitch_less); } -MAKE_SCHEME_CALLBACK(Local_key_item,before_line_breaking); +ADD_SCM_INIT_FUNC(pitch,init_pitch_funcs); -SCM -Local_key_item::before_line_breaking (SCM smob) + +void +Local_key_item::add_pitch (Score_element*me, Musical_pitch p, bool cautionary, bool natural) { - Local_key_item* me = dynamic_cast(unsmob_element (smob)); - me->accidental_arr_.sort (Local_key_cautionary_tuple::compare); - return SCM_UNSPECIFIED; + SCM acs = me->get_elt_property ("accidentals"); + SCM pitch = p.to_scm (); + SCM opts = SCM_EOL; + if (cautionary) + opts = gh_cons (ly_symbol2scm ("cautionary"), opts); + if (natural) + opts = gh_cons (ly_symbol2scm ("natural"), opts); + + pitch = gh_append2 (pitch, opts); + acs = scm_merge_x (acs, gh_cons (pitch, SCM_EOL), pitch_less_proc); + + me->set_elt_property ("accidentals", acs); } Molecule -Local_key_item::accidental (Score_element*me, int j, bool cautionary, bool natural) +Local_key_item::parenthesize (Score_element*me, Molecule m) { - Molecule m (me->lookup_l ()->afm_find (String ("accidentals-") + to_str (j))); - if (natural) - { - Molecule prefix = me->lookup_l ()->afm_find (String ("accidentals-0")); - m.add_at_edge(X_AXIS, LEFT, Molecule(prefix), 0); - } - if (cautionary) - { - Molecule open = me->lookup_l ()->afm_find (String ("accidentals-(")); - Molecule close = me->lookup_l ()->afm_find (String ("accidentals-)")); - m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0); - m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0); - } - + Molecule open = me->lookup_l ()->afm_find (String ("accidentals-(")); + Molecule close = me->lookup_l ()->afm_find (String ("accidentals-)")); + m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0); + m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0); + return m; } /* - UGH. clean me up + UGH. clean me, revise placement routine (See Ross & Wanske; + accidental placement is more complicated than this. */ MAKE_SCHEME_CALLBACK(Local_key_item,brew_molecule); SCM Local_key_item::brew_molecule (SCM smob) { - Local_key_item* lki = dynamic_cast(unsmob_element (smob)); - Score_element* me = lki; + Score_element* me = unsmob_element (smob); Molecule mol; @@ -76,10 +84,13 @@ Local_key_item::brew_molecule (SCM smob) Molecule octave_mol; bool oct_b = false; int lastoct = -100; - - for (int i = 0; i < lki->accidental_arr_.size(); i++) + + SCM accs = me->get_elt_property ("accidentals"); + for (SCM s = accs; + gh_pair_p (s); s = gh_cdr (s)) { - Musical_pitch p (lki->accidental_arr_[i].pitch_); + Musical_pitch p (gh_car (s)); + // do one octave if (p.octave_i_ != lastoct) { @@ -99,12 +110,20 @@ Local_key_item::brew_molecule (SCM smob) Real dy = (gh_number_p (c0) ? gh_scm2int (c0) : 0 + p.notename_i_) * note_distance; - Molecule m (accidental (me,p.accidental_i_, - lki->accidental_arr_[i].cautionary_b_, - lki->accidental_arr_[i].natural_b_)); + Molecule acc (me->lookup_l ()->afm_find (String ("accidentals-") + + to_str (p.accidental_i_))); + + if (scm_memq (ly_symbol2scm ("natural"), gh_car (s)) != SCM_BOOL_F) + { + Molecule prefix = me->lookup_l ()->afm_find (String ("accidentals-0")); + acc.add_at_edge(X_AXIS, LEFT, Molecule(prefix), 0); + } + + if (scm_memq (ly_symbol2scm ("cautionary"), gh_car (s)) != SCM_BOOL_F) + acc = parenthesize (me, acc); - m.translate_axis (dy, Y_AXIS); - octave_mol.add_at_edge (X_AXIS, RIGHT, m, 0); + acc.translate_axis (dy, Y_AXIS); + octave_mol.add_at_edge (X_AXIS, RIGHT, acc, 0); } if (oct_b) @@ -115,7 +134,7 @@ Local_key_item::brew_molecule (SCM smob) octave_mol = Molecule (); } - if (lki->accidental_arr_.size()) + if (gh_pair_p (accs)) { Drul_array pads; @@ -142,13 +161,13 @@ Local_key_item::brew_molecule (SCM smob) return mol.create_scheme(); } -Local_key_item::Local_key_item (SCM s) - : Item (s) -{ - -} bool Local_key_item::has_interface (Score_element*m) { return m && m->has_interface (ly_symbol2scm ("accidentals-interface")); } +void +Local_key_item::set_interface (Score_element*m) +{ + m->set_interface (ly_symbol2scm ("accidentals-interface")); +} diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc index fe73d4f62e..c422d79e63 100644 --- a/lily/lyric-combine-music-iterator.cc +++ b/lily/lyric-combine-music-iterator.cc @@ -12,16 +12,25 @@ #include "lyric-combine-music.hh" #include "musical-request.hh" -Busy_playing_req busy_req; -Melisma_req melisma_start_req; -Melisma_req melisma_stop_req; -Melisma_playing_req melisma_playing_req; - +/* + Ugh, why static? + */ +Busy_playing_req *busy_req; +Melisma_req *melisma_start_req; +Melisma_req *melisma_stop_req; +Melisma_playing_req * melisma_playing_req; Lyric_combine_music_iterator::Lyric_combine_music_iterator () { - melisma_start_req.span_dir_ = START; - melisma_stop_req.span_dir_ = STOP; + if (!busy_req) + { + busy_req = new Busy_playing_req; + melisma_playing_req = new Melisma_playing_req; + melisma_stop_req = new Melisma_req; + melisma_start_req = new Melisma_req; + } + melisma_start_req->span_dir_ = START; + melisma_stop_req->span_dir_ = STOP; music_iter_p_ =0; lyric_iter_p_ =0; @@ -65,19 +74,20 @@ Lyric_combine_music_iterator::do_process_and_next (Moment m) music_iter_p_->process_and_next (m); - bool busy = try_music (&busy_req); + bool busy = try_music (busy_req); if (busy) { - bool melisma_b = try_music (&melisma_playing_req); + bool melisma_b = try_music (melisma_playing_req); if (!melisma_b) { if (lyric_iter_p_->ok ()) { + // FIXME #if 0 // devise a new way for this if (melisma_b && !melisma_started_b_) - lyric_iter_p_->try_music (&melisma_start_req); + lyric_iter_p_->try_music (melisma_start_req); else if (melisma_started_b_) - lyric_iter_p_->try_music (&melisma_stop_req); + lyric_iter_p_->try_music (melisma_stop_req); #endif Moment m= lyric_iter_p_->next_moment (); @@ -86,8 +96,6 @@ Lyric_combine_music_iterator::do_process_and_next (Moment m) } } - - Music_iterator::do_process_and_next (m); } @@ -98,7 +106,7 @@ Lyric_combine_music_iterator::~Lyric_combine_music_iterator () } Music_iterator* -Lyric_combine_music_iterator::try_music_in_children (Music const *m) const +Lyric_combine_music_iterator::try_music_in_children (Music *m) const { Music_iterator * i = music_iter_p_->try_music (m); if (i) diff --git a/lily/lyric-combine-music.cc b/lily/lyric-combine-music.cc index 5676d4cff0..d6e42d2cbc 100644 --- a/lily/lyric-combine-music.cc +++ b/lily/lyric-combine-music.cc @@ -12,64 +12,52 @@ Lyric_combine_music::Lyric_combine_music (Music * m, Music * l) { - music_p_ = m; - lyrics_p_ = l; + set_mus_property ("music", m->self_scm_); + set_mus_property ("lyrics", l->self_scm_); } -Lyric_combine_music::~Lyric_combine_music () -{ - delete music_p_; - delete lyrics_p_; -} - -Lyric_combine_music::Lyric_combine_music (Lyric_combine_music const&s) - : Music (s) -{ - music_p_ = s.music_p_ ? s.music_p_->clone ():0; - lyrics_p_ = s.lyrics_p_ ? s.lyrics_p_->clone ():0; -} void Lyric_combine_music::transpose (Musical_pitch p) { - music_p_->transpose (p); - lyrics_p_->transpose (p); + music_l ()->transpose (p); + lyrics_l () ->transpose (p); } void Lyric_combine_music::do_print () const { - music_p_->print(); - lyrics_p_->print (); + music_l ()->print(); + lyrics_l () ->print (); } Moment Lyric_combine_music::length_mom () const { - return music_p_->length_mom (); + return music_l ()->length_mom (); } Musical_pitch Lyric_combine_music::to_relative_octave ( Musical_pitch p ) { - p = music_p_->to_relative_octave (p); - return lyrics_p_->to_relative_octave (p); + p = music_l ()->to_relative_octave (p); + return lyrics_l () ->to_relative_octave (p); } void Lyric_combine_music::compress (Moment m) { - music_p_->compress (m); + music_l ()->compress (m); } Music* Lyric_combine_music::music_l () const { - return music_p_; + return unsmob_music (get_mus_property ("music")); } Music* Lyric_combine_music::lyrics_l () const { - return lyrics_p_; + return unsmob_music (get_mus_property ("lyrics")); } diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index 9f142dc891..3108ca01a4 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -53,7 +53,7 @@ Lyric_engraver::do_process_music() */ text_p_->translate_axis (paper_l()->get_var ("quartwidth")/2, X_AXIS); - announce_element (Score_element_info (text_p_, req_l_)); + announce_element (text_p_, req_l_); } } diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 9a9b96e245..6b37780158 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -123,7 +123,7 @@ Mark_engraver::create_items (Request *rq) } - announce_element (Score_element_info (text_p_, rq)); + announce_element (text_p_, rq); } @@ -161,9 +161,11 @@ Mark_engraver::do_process_music () /* automatic marks. */ - SCM m = (mark_req_l_->mark_label_ == SCM_UNDEFINED) - ? get_property ("rehearsalMark") - : SCM(mark_req_l_->mark_label_); + + SCM m = mark_req_l_->get_mus_property ("label"); + if (gh_string_p (m)) + m = get_property ("rehearsalMark"); +; if (gh_number_p (m)) { diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 214ea14fc2..d6a34e3268 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -115,7 +115,7 @@ Multi_measure_rest_engraver::do_process_music () Multi_measure_rest::set_interface (mmrest_p_); Staff_symbol_referencer::set_interface (mmrest_p_); - announce_element (Score_element_info (mmrest_p_, busy_span_req_l_)); + announce_element (mmrest_p_, busy_span_req_l_); start_measure_i_ = gh_scm2int (get_property ("currentBarNumber")); } diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index 1ad45da523..d3a92834e7 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -122,33 +122,33 @@ Music_iterator::ok() const } Music_iterator* -Music_iterator::static_get_iterator_p (Music const *m) +Music_iterator::static_get_iterator_p (Music *m) { Music_iterator * p =0; /* It would be nice to do this decentrally, but the order of this is significant. */ - if (dynamic_cast (m)) + if (dynamic_cast (m)) p = new Request_chord_iterator; - else if (dynamic_cast (m)) + else if (dynamic_cast (m)) p = new Lyric_combine_music_iterator; - else if (dynamic_cast (m)) + else if (dynamic_cast (m)) p = new Simultaneous_music_iterator; - else if (dynamic_cast (m)) + else if (dynamic_cast (m)) p = new Sequential_music_iterator; - else if (dynamic_cast (m)) + else if (dynamic_cast (m)) p = new Property_iterator; - else if (dynamic_cast (m)) + else if (dynamic_cast (m)) p = new Change_iterator; - else if (dynamic_cast (m)) + else if (dynamic_cast (m)) p = new Time_scaled_music_iterator; - else if (dynamic_cast (m)) + else if (dynamic_cast (m)) p = new Grace_iterator; - else if (dynamic_cast (m)) + else if (dynamic_cast (m)) p = new Auto_change_iterator; - else if (dynamic_cast (m)) + else if (dynamic_cast (m)) p = new Music_wrapper_iterator; - else if (Repeated_music const * n = dynamic_cast (m)) + else if (Repeated_music * n = dynamic_cast (m)) { if (n->type_ == "tremolo") p = new Chord_tremolo_iterator; @@ -167,10 +167,10 @@ Music_iterator::static_get_iterator_p (Music const *m) } void -Music_iterator::init_translator (Music const *m, Translator_group *report_l) +Music_iterator::init_translator (Music *m, Translator_group *report_l) { music_l_ = m; - if (Context_specced_music const * csm =dynamic_cast(m)) + if (Context_specced_music * csm =dynamic_cast(m)) { Translator_group* a =report_l-> find_create_translator_l (csm->translator_type_str_, csm->translator_id_str_); @@ -185,7 +185,7 @@ Music_iterator::init_translator (Music const *m, Translator_group *report_l) Music_iterator* -Music_iterator::get_iterator_p (Music const*m) const +Music_iterator::get_iterator_p (Music *m) const { Music_iterator*p = static_get_iterator_p (m); p->init_translator (m, report_to_l()); @@ -200,7 +200,7 @@ Music_iterator::Music_iterator() } Music_iterator* -Music_iterator::try_music (Music const *m) const +Music_iterator::try_music (Music *m) const { bool b = report_to_l ()->try_music ((Music*)m); // ugh Music_iterator * it = b ? (Music_iterator*) this : 0; // ugh @@ -210,7 +210,7 @@ Music_iterator::try_music (Music const *m) const } Music_iterator* -Music_iterator::try_music_in_children (Music const * ) const +Music_iterator::try_music_in_children (Music * ) const { return 0; } diff --git a/lily/music-list.cc b/lily/music-list.cc index 5824cc7ada..4df9c53da4 100644 --- a/lily/music-list.cc +++ b/lily/music-list.cc @@ -21,25 +21,18 @@ Simultaneous_music::length_mom () const return maximum_length (); } - -void -Music_sequence::compress (Moment m) -{ - for (Cons *i = music_p_list_p_->head_; i; i = i->next_) - i->car_->compress (m); -} - -Simultaneous_music::Simultaneous_music(Music_list *p) - : Music_sequence (p) +Simultaneous_music::Simultaneous_music(SCM head) + : Music_sequence (head) { } -Sequential_music::Sequential_music(Music_list *p) - : Music_sequence (p) +Sequential_music::Sequential_music(SCM head) + : Music_sequence (head) { } + Moment Sequential_music::length_mom () const { @@ -52,57 +45,18 @@ Simultaneous_music::to_relative_octave (Musical_pitch p) return do_relative_octave (p, true); } - - - -Musical_pitch -Music_list::do_relative_octave (Musical_pitch last, bool ret_first) -{ - Musical_pitch retval; - int count=0; - for (Cons *i = head_; i ; i = i->next_) - { - last = i->car_->to_relative_octave (last); - if (!count ++ ) - retval = last; - } - - if (!ret_first) - retval = last; - - return retval; -} - - -Music_list::Music_list (Music_list const &s) - : Cons_list (s), Input (s) +Request_chord::Request_chord(SCM s) + : Simultaneous_music (s) { - Cons_list::init (); - clone_killing_cons_list (*this, s.head_); } - -void -Music_list::add_music (Music*m_p) -{ - if (!m_p) - return; - - append (new Killing_cons (m_p, 0)); -} - -Request_chord::Request_chord() - : Simultaneous_music (new Music_list) -{ -} - - Musical_pitch Request_chord::to_relative_octave (Musical_pitch last) { - for (Cons *i = music_p_list_p_->head_; i ; i = i->next_) - { - if (Melodic_req *m= dynamic_cast (i->car_)) + for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + { + Music * mus = unsmob_music (gh_car (s)); + if (Melodic_req *m= dynamic_cast (mus)) { Musical_pitch &pit = m->pitch_; pit.to_relative_octave (last); @@ -113,11 +67,4 @@ Request_chord::to_relative_octave (Musical_pitch last) } -Music_list::Music_list () -{ -} -Music_sequence::~Music_sequence () -{ - delete music_p_list_p_; -} diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index 9d5801d2f2..aa3bc2eb35 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -10,50 +10,74 @@ #include "debug.hh" #include "musical-pitch.hh" -Music_sequence::Music_sequence (Music_sequence const&s) - : Music (s) + +void +Music_sequence::truncate (int k) { - music_p_list_p_ = new Music_list (*s.music_p_list_p_); -} + SCM l = get_mus_property ("list"); + if (k == 0) + { + l = SCM_EOL; + } + else + { + SCM s = l; + k--; + for (; gh_pair_p (s) && k--; s = gh_cdr (s)) + ; + if (gh_pair_p (s)) + { + gh_set_cdr_x (s, SCM_EOL); + } + } + set_mus_property ("list", l); +} +SCM +Music_sequence::music_list ()const +{ + return get_mus_property ("list"); +} -Music_sequence::Music_sequence(Music_list *mlist_p) +/* + Ugh this sucks. Linear. do not use. + */ +void +Music_sequence::append_music (Music *m) +{ + set_mus_property ("list", + gh_append2( music_list(), gh_cons (m->self_scm_, SCM_EOL))); +} +Music_sequence::Music_sequence(SCM h) { - music_p_list_p_ = mlist_p; + set_mus_property ("list", h); } void Music_sequence::transpose (Musical_pitch rq) { - for (Cons *i = music_p_list_p_->head_; i; i = i->next_) - i->car_->transpose (rq); + for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + unsmob_music (gh_car (s))->transpose (rq); } void Music_sequence::do_print() const { #ifndef NPRINT - for (Cons *i = music_p_list_p_->head_; i; i = i->next_) - i->car_->print(); + for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + unsmob_music (gh_car (s))->print(); #endif } -void -Music_sequence::add_music (Music *m_p) -{ - music_p_list_p_->add_music (m_p); -} Moment Music_sequence::cumulative_length () const { Moment last=0; - for (Cons *i = music_p_list_p_->head_; i; i = i->next_) - { - last += i->car_->length_mom (); - } + for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + last += unsmob_music (gh_car (s))->length_mom (); return last; } @@ -68,19 +92,40 @@ Moment Music_sequence::maximum_length () const { Moment dur = 0; - for (Cons *i = music_p_list_p_->head_; i; i = i->next_) - dur = dur >? i->car_->length_mom (); + for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + dur = dur >? unsmob_music (gh_car (s))->length_mom (); return dur; } int Music_sequence::length_i () const { - return cons_list_size_i (music_p_list_p_->head_); + return scm_ilength (music_list ()); } Musical_pitch -Music_sequence::do_relative_octave (Musical_pitch p, bool b) +Music_sequence::do_relative_octave (Musical_pitch p, bool ret_first) +{ + Musical_pitch retval; + int count=0; + + Musical_pitch last = p; + for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + { + last = unsmob_music (gh_car (s))->to_relative_octave (last); + if (!count ++ ) + retval = last; + } + + if (!ret_first) + retval = last; + + return retval; +} + +void +Music_sequence::compress (Moment m) { - return music_p_list_p_->do_relative_octave (p, b); + for (SCM s = music_list (); gh_pair_p (s); s = gh_cdr (s)) + unsmob_music (gh_car (s))->compress (m); } diff --git a/lily/music-wrapper-iterator.cc b/lily/music-wrapper-iterator.cc index 69429384dc..af658cf72a 100644 --- a/lily/music-wrapper-iterator.cc +++ b/lily/music-wrapper-iterator.cc @@ -28,7 +28,7 @@ void Music_wrapper_iterator::construct_children () { child_iter_p_ = - get_iterator_p (dynamic_cast (music_l_)->element_l ()); + get_iterator_p (dynamic_cast (music_l_)->element ()); } Music_wrapper_iterator::~Music_wrapper_iterator () @@ -59,7 +59,7 @@ Music_wrapper_iterator::next_moment () const Music_iterator* -Music_wrapper_iterator::try_music_in_children (Music const *m) const +Music_wrapper_iterator::try_music_in_children (Music *m) const { return child_iter_p_->try_music (m); } diff --git a/lily/music-wrapper.cc b/lily/music-wrapper.cc index 26807805e7..59d3c43441 100644 --- a/lily/music-wrapper.cc +++ b/lily/music-wrapper.cc @@ -10,61 +10,47 @@ #include "music-wrapper.hh" -Music_wrapper::~Music_wrapper () -{ - delete element_p_; -} - -Music_wrapper::Music_wrapper (Music_wrapper const&s) - : Music (s) -{ - element_p_ = (s.element_p_)?s.element_p_->clone ():0; -} - void Music_wrapper::do_print () const { - element_p_->print (); + element ()->print (); } - void Music_wrapper::transpose (Musical_pitch p) { - if (element_p_) - element_p_-> transpose (p); + if (element ()) + element ()-> transpose (p); } Music_wrapper::Music_wrapper(Music*p) { - element_p_ = p; + set_mus_property ("element", p->self_scm_); } - - Moment Music_wrapper::length_mom () const { - return element_p_->length_mom (); + return element ()->length_mom (); } Musical_pitch Music_wrapper::to_relative_octave (Musical_pitch p) { - return element_p_->to_relative_octave (p); + return element ()->to_relative_octave (p); } Music* -Music_wrapper::element_l () const +Music_wrapper::element () const { - return element_p_; + return unsmob_music (get_mus_property ("element")); } void Music_wrapper::compress (Moment m) { - element_l ()->compress (m); + element ()->compress (m); } diff --git a/lily/music.cc b/lily/music.cc index 4b1f842458..536082211e 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -6,13 +6,57 @@ (c) 1997--2000 Han-Wen Nienhuys */ +#include "input-smob.hh" #include "music.hh" #include "music-list.hh" #include "debug.hh" #include "musical-pitch.hh" +#include "ly-smobs.icc" + +SCM +ly_deep_mus_copy (SCM m) +{ + if (unsmob_music (m)) + { + return unsmob_music (m)->clone ()->self_scm_; + } + else if (gh_pair_p (m)) + { + return gh_cons (ly_deep_copy (gh_car (m)), ly_deep_copy (gh_cdr (m))); + } + else + return m; +} + + +Music::Music (Music const &m) +{ + self_scm_ = SCM_EOL; + immutable_property_alist_ = m.immutable_property_alist_; + SCM c =ly_deep_mus_copy (m.mutable_property_alist_); + mutable_property_alist_ = c; + + smobify_self (); + + set_spot (*m.origin ()); +} + Music::Music() { + self_scm_ = SCM_EOL; + immutable_property_alist_ = SCM_EOL; + mutable_property_alist_ = SCM_EOL; + smobify_self (); +} + +SCM +Music::mark_smob (SCM m) +{ + Music * mus = SMOB_TO_TYPE (Music, m); + scm_gc_mark (mus->immutable_property_alist_); + scm_gc_mark (mus->mutable_property_alist_); + return mus->do_derived_mark (); } void @@ -31,17 +75,13 @@ Music::length_mom () const return 0; } -void -Music::print() const +int +Music::print_smob(SCM s, SCM p, scm_print_state*) { -#ifndef NPRINT - if (! flower_dstream) - return ; - DEBUG_OUT << classname(this) << "{"; - - do_print(); - DEBUG_OUT << "}\n"; -#endif + scm_puts ("#",p); + return 1; } Musical_pitch @@ -56,3 +96,102 @@ Music::transpose (Musical_pitch ) { } + +IMPLEMENT_UNSMOB(Music,music); +IMPLEMENT_SMOBS(Music); + +/****************************/ + +SCM +Music::get_mus_property (const char *nm) const +{ + SCM sym = ly_symbol2scm (nm); + return get_mus_property (sym); +} + +SCM +Music::get_mus_property (SCM sym) const +{ + SCM s = scm_sloppy_assq(sym, mutable_property_alist_); + if (s != SCM_BOOL_F) + return gh_cdr (s); + + s = scm_sloppy_assq (sym, immutable_property_alist_); + return (s == SCM_BOOL_F) ? SCM_EOL : gh_cdr (s); +} + +/* + Remove the value associated with KEY, and return it. The result is + that a next call will yield SCM_EOL (and not the underlying + `basic' property. +*/ +SCM +Music::remove_mus_property (const char* key) +{ + SCM val = get_mus_property (key); + if (val != SCM_EOL) + set_mus_property (key, SCM_EOL); + return val; +} + +void +Music::set_mus_property (const char* k, SCM v) +{ + SCM s = ly_symbol2scm (k); + set_mus_property (s, v); +} + +void +Music::set_immutable_mus_property (const char*k, SCM v) +{ + SCM s = ly_symbol2scm (k); + set_immutable_mus_property (s, v); +} + +void +Music::set_immutable_mus_property (SCM s, SCM v) +{ + immutable_property_alist_ = gh_cons (gh_cons (s,v), mutable_property_alist_); + mutable_property_alist_ = scm_assq_remove_x (mutable_property_alist_, s); +} +void +Music::set_mus_property (SCM s, SCM v) +{ + mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v); +} + +void +Music::set_spot (Input ip) +{ + set_mus_property ("origin", make_input (ip)); +} + + + +Input* +Music::origin () const +{ + Input *ip = unsmob_input (get_mus_property ("origin")); + return ip ? ip : & dummy_input_global; +} + +SCM +Music::do_derived_mark () +{ + return SCM_EOL; +} + +void +Music::print ()const +{ +} + +void +Music::do_smobify_self () +{ +} + +Music::~Music () +{ + +} diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index dbdbeabd18..3e4bbb602b 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -106,8 +106,6 @@ My_lily_parser::get_chord (Musical_pitch tonic, Musical_pitch* bass_p, Duration d) { - Simultaneous_music*v = new Request_chord; - v->set_spot (here_input ()); /* UARGAUGRAGRUAUGRUINAGRAUGIRNA @@ -120,22 +118,22 @@ My_lily_parser::get_chord (Musical_pitch tonic, Tonic_req* t = new Tonic_req; t->pitch_ = tonic; - v->add_music (t); + SCM l = SCM_EOL; //urg if (chord.inversion_b_ && Chord::find_notename_i (&chord.pitch_arr_, chord.inversion_pitch_) > 0) { Inversion_req* i = new Inversion_req; i->pitch_ = chord.inversion_pitch_; - v->add_music (i); + l = gh_cons (i->self_scm_, l); } if (chord.bass_b_) { Bass_req* b = new Bass_req; b->pitch_ = chord.bass_pitch_; - v->add_music (b); + l = gh_cons (b->self_scm_, l); } Array pitch_arr = chord.to_pitch_arr (); @@ -145,9 +143,12 @@ My_lily_parser::get_chord (Musical_pitch tonic, Note_req* n = new Note_req; n->pitch_ = p; n->duration_ = d; - v->add_music (n); + l = gh_cons (n->self_scm_, l); } + Simultaneous_music*v = new Request_chord (l); + v->set_spot (here_input ()); + return v; } diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index 39b1cf6b13..5378672633 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -111,14 +111,13 @@ Note_heads_engraver::do_process_music() d->set_parent (note_p, Y_AXIS); d->add_offset_callback (Dots::quantised_position_callback, Y_AXIS); - announce_element (Score_element_info (d,0)); + announce_element (d,0); dot_p_arr_.push (d); } note_p->set_elt_property("staff-position", gh_int2scm (note_req_l->pitch_.steps ())); - Score_element_info itinf (note_p,note_req_l); - announce_element (itinf); + announce_element (note_p,note_req_l); note_p_arr_.push (note_p); } } diff --git a/lily/note-name-engraver.cc b/lily/note-name-engraver.cc index c46007a16f..095f18cd60 100644 --- a/lily/note-name-engraver.cc +++ b/lily/note-name-engraver.cc @@ -48,7 +48,7 @@ Note_name_engraver::do_process_music () { Item * t = new Item (get_property ("basicNoteNameProperties")); t->set_elt_property ("text", ly_str02scm ( s.ch_C())); - announce_element (Score_element_info (t, req_l_arr_[0])); + announce_element (t, req_l_arr_[0]); texts_.push (t); } } diff --git a/lily/output-property-engraver.cc b/lily/output-property-engraver.cc index ebbb40b6b6..40036ec0af 100644 --- a/lily/output-property-engraver.cc +++ b/lily/output-property-engraver.cc @@ -42,7 +42,7 @@ Output_property_engraver::acknowledge_element (Score_element_info inf) for (int i=props_.size (); i--; ) { Output_property * o = props_[i]; - SCM pred = gh_car (o->pred_sym_val_list_); + SCM pred = o->get_mus_property ("predicate"); /* should typecheck pred. @@ -51,8 +51,9 @@ Output_property_engraver::acknowledge_element (Score_element_info inf) gh_list (inf.elem_l_->self_scm_, SCM_UNDEFINED)); if (to_boolean (result)) { - inf.elem_l_->set_elt_property (gh_cadr (o->pred_sym_val_list_), - gh_caddr (o->pred_sym_val_list_)); + SCM sym = o->get_mus_property ("symbol"); + SCM val = o->get_mus_property ("value"); + inf.elem_l_->set_elt_property (sym, val); } } } diff --git a/lily/output-property.cc b/lily/output-property.cc index e8a2d6a463..8cd70e8262 100644 --- a/lily/output-property.cc +++ b/lily/output-property.cc @@ -11,6 +11,8 @@ Output_property::Output_property(SCM pred, SCM sym, SCM val) { - pred_sym_val_list_ = gh_list (pred, sym, val, SCM_UNDEFINED); + set_mus_property ("predicate", pred); + set_mus_property ("symbol", sym); + set_mus_property ("value", val); } diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 9eec211a70..d90d5b305b 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -68,7 +68,7 @@ Paper_def::get_realvar (SCM s) const } else { - non_fatal_error (_("not a real variable")); + programming_error ("not a real variable"); return 0.0; } } diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 0277f753a7..39d1b49c0e 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -126,6 +126,12 @@ Paper_outputter::output_scheme (SCM scm) } +/* + UGH. + + Should probably change interface to do less eval ( symbol ), and more + apply (procedure, args) + */ void Paper_outputter::dump_scheme (SCM s) { diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 86797de758..ec2c83f65f 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -40,6 +40,11 @@ Paper_score::typeset_line (Line_of_score *l) } main_smob_ = gh_cons (l->self_scm_, main_smob_); l->pscore_l_ = this; + + /* + We don't unprotect l->self_scm_, we haven't got any place else to + protect it from collection. */ + } Paper_score::Paper_score (Paper_score const &s) diff --git a/lily/parser.yy b/lily/parser.yy index d2449736ed..8ce72cb885 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -31,6 +31,7 @@ #include "music-list.hh" #include "change-translator.hh" #include "file-results.hh" +#include "input.hh" #include "scope.hh" #include "relative-music.hh" #include "lyric-combine-music.hh" @@ -86,7 +87,6 @@ print_mudela_versions (ostream &os) Identifier *id; String * string; Music *music; - Music_list *music_list; Score *score; Scope *scope; Interval *interval; @@ -194,14 +194,14 @@ yylex (YYSTYPE *s, void * v_l) %token CHORDMODIFIER_PITCH %token DURATION_IDENTIFIER %token IDENTIFIER -%token MUSIC_IDENTIFIER -%token REQUEST_IDENTIFIER %token TRANS_IDENTIFIER -%token NUMBER_IDENTIFIER %token SCORE_IDENTIFIER %token MUSIC_OUTPUT_DEF_IDENTIFIER +%token NUMBER_IDENTIFIER +%token REQUEST_IDENTIFIER +%token MUSIC_IDENTIFIER %token STRING_IDENTIFIER SCM_IDENTIFIER %token DURATION RESTNAME %token STRING @@ -239,7 +239,7 @@ yylex (YYSTYPE *s, void * v_l) %type Music Sequential_music Simultaneous_music Music_sequence %type relative_music re_rhythmed_music %type property_def translator_change -%type Music_list +%type Music_list %type music_output_def_body %type shorthand_command_req %type post_request @@ -378,11 +378,12 @@ identifier_init: $$ = smobify (new Translator_group_identifier ($1, TRANS_IDENTIFIER)); } | Music { - $$ = smobify (new Music_identifier ($1, MUSIC_IDENTIFIER)); + $$ = $1->self_scm_; + scm_unprotect_object ($$); } - | post_request { - $$ = smobify (new Request_identifier ($1, REQUEST_IDENTIFIER)); + $$ = $1->self_scm_; + scm_unprotect_object ($$); } | explicit_duration { $$ = smobify (new Duration_identifier ($1, DURATION_IDENTIFIER)); @@ -474,8 +475,11 @@ score_block: score_body: Music { $$ = new Score; + $$->set_spot (THIS->here_input ()); - $$->music_p_ = $1; + SCM m = $1->self_scm_; + scm_unprotect_object (m); + $$->music_ = m; } | SCORE_IDENTIFIER { $$ = $1->access_content_Score (true); @@ -548,7 +552,6 @@ music_output_def_body: music. */ dynamic_cast ($$)->set_tempo ($2->dur_.length_mom (), $2->metronome_i_); - delete $2; } | music_output_def_body bare_int '=' FONT STRING { // ugh, what a syntax Lookup * l =unsmob_lookup (Lookup::make_lookup()); @@ -570,11 +573,19 @@ tempo_request: ; Music_list: /* empty */ { - $$ = new Music_list; - $$->set_spot (THIS->here_input ()); + $$ = gh_cons (SCM_EOL, SCM_EOL); } | Music_list Music { - $$->add_music ($2); + SCM s = $$; + SCM c = gh_cons ($2->self_scm_, SCM_EOL); + scm_unprotect_object ($2->self_scm_); /* UGH */ + + + if (gh_pair_p (gh_cdr (s))) + gh_set_cdr_x (gh_cdr (s), c); /* append */ + else + gh_set_car_x (s, c); /* set first cons */ + gh_set_cdr_x (s, c) ; /* remember last cell */ } | Music_list error { } @@ -604,42 +615,37 @@ Repeated_music: { Music_sequence* m = dynamic_cast ($5); if (m && $3 < m->length_i ()) - $5->warning (_ ("More alternatives than repeats. Junking excess alternatives.")); + $5->origin ()->warning (_ ("More alternatives than repeats. Junking excess alternatives.")); Repeated_music * r = new Repeated_music ($4, $3 >? 1, m); $$ = r; r->type_ = ly_scm2string ($2); r->fold_b_ = (r->type_ == "fold"); r->volta_fold_b_ = (r->type_ == "volta"); - r->set_spot ($4->spot ()); + r->set_spot (*$4->origin ()); } ; Music_sequence: '{' Music_list '}' { - $$ = new Music_sequence ($2); - $$->set_spot ($2->spot ()); + $$ = new Music_sequence (gh_car ($2)); } ; Sequential_music: SEQUENTIAL '{' Music_list '}' { - $$ = new Sequential_music ($3); - $$->set_spot ($3->spot ()); + $$ = new Sequential_music (gh_car ($3)); } | '{' Music_list '}' { - $$ = new Sequential_music ($2); - $$->set_spot ($2->spot ()); + $$ = new Sequential_music (gh_car ($2)); } ; Simultaneous_music: SIMULTANEOUS '{' Music_list '}'{ - $$ = new Simultaneous_music ($3); - $$->set_spot ($3->spot ()); + $$ = new Simultaneous_music (gh_car ($3)); } | '<' Music_list '>' { - $$ = new Simultaneous_music ($2); - $$->set_spot ($2->spot ()); + $$ = new Simultaneous_music (gh_car ($2)); } ; @@ -659,7 +665,7 @@ Simple_music: $$ = new Output_property (pred,$3, $5); } - | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); } + | MUSIC_IDENTIFIER { $$ = unsmob_music ($1)->clone (); } | property_def | translator_change | Simple_music '*' bare_unsigned '/' bare_unsigned { @@ -687,7 +693,7 @@ Composite_music: Auto_change_music * chm = new Auto_change_music (ly_scm2string ($2), $3); $$ = chm; - chm->set_spot ($3->spot ()); + chm->set_spot (*$3->origin ()); } | GRACE Music { $$ = new Grace_music ($2); @@ -715,11 +721,11 @@ Composite_music: | Sequential_music { $$ = $1; } | TRANSPOSE musical_pitch Music { $$ = new Transposed_music ($3, *$2); - delete $2; + delete $2; // ugh } | TRANSPOSE steno_tonic_pitch Music { $$ = new Transposed_music ($3, *$2); - delete $2; + delete $2; // ugh } | NOTES { THIS->lexer_p_->push_note_state (); } @@ -748,7 +754,7 @@ Composite_music: relative_music: RELATIVE absolute_musical_pitch Music { $$ = new Relative_octave_music ($3, *$2); - delete $2; + delete $2; // ugh } ; @@ -774,8 +780,8 @@ property_def: PROPERTY STRING '.' STRING '=' scalar { Translation_property *t = new Translation_property; - t->var_str_ = ly_scm2string ($4); - t->value_ = $6; + t->set_mus_property ("symbol", scm_string_to_symbol ($4)); + t->set_mus_property ("value", $6); Context_specced_music *csm = new Context_specced_music (t); $$ = csm; @@ -797,9 +803,9 @@ request_chord: Music_sequence *l = dynamic_cast($2); if (l) { for (int i=0; i < $1->size(); i++) - l->add_music ($1->elem(i)); + l->append_music ($1->elem(i)); for (int i=0; i < $3->size(); i++) - l->add_music ($3->elem(i)); + l->append_music ($3->elem(i)); } else programming_error ("Need Sequence to add music to"); @@ -811,16 +817,15 @@ request_chord: command_element: command_req { - $$ = new Request_chord; + $$ = new Request_chord (gh_cons ($1->self_scm_, SCM_EOL)); $$-> set_spot (THIS->here_input ()); $1-> set_spot (THIS->here_input ()); - ((Simultaneous_music*)$$) ->add_music ($1);//ugh } | PARTIAL duration_length ';' { Translation_property * p = new Translation_property; - p->var_str_ = "measurePosition"; - p->value_ = (new Moment (-$2->length_mom ()))->smobify_self (); - delete $2; + p->set_mus_property ("symbol", ly_symbol2scm ( "measurePosition")); + p->set_mus_property ("value", (new Moment (-$2->length_mom ()))->smobify_self ()); + delete $2; // ugh Context_specced_music * sp = new Context_specced_music (p); $$ =sp ; sp-> translator_type_str_ = "Score"; @@ -881,13 +886,13 @@ verbose_command_req: } | MARK STRING { Mark_req *m = new Mark_req; - m->mark_label_ = $2; + m->set_mus_property ("label", $2); $$ = m; } | MARK bare_unsigned { Mark_req *m = new Mark_req; - m->mark_label_ = gh_int2scm ($2); + m->set_mus_property ("label", gh_int2scm ($2)); $$ = m; } @@ -906,7 +911,7 @@ verbose_command_req: | SKIP duration_length { Skip_req * skip_p = new Skip_req; skip_p->duration_ = *$2; - delete $2; + delete $2; // ugh $$ = skip_p; } | tempo_request { @@ -923,7 +928,7 @@ verbose_command_req: | KEY NOTENAME_PITCH SCM_IDENTIFIER { Key_change_req *key_p= new Key_change_req; - key_p->pitch_alist_ = $3; + key_p->set_mus_property ("pitch-alist", $3); ((Music* )key_p)->transpose (* $2); $$ = key_p; } @@ -964,14 +969,14 @@ request_with_dir: if (Script_req * gs = dynamic_cast ($2)) gs->dir_ = Direction ($1); else if ($1) - $2->warning (_ ("Can't specify direction for this request")); + $2->origin ()->warning (_ ("Can't specify direction for this request")); $$ = $2; } ; verbose_request: REQUEST_IDENTIFIER { - $$ = (Request*)$1->access_content_Request (true); + $$ = dynamic_cast (unsmob_music ($1)->clone ()); $$->set_spot (THIS->here_input ()); } | TEXTSCRIPT STRING STRING { @@ -1268,77 +1273,68 @@ simple_element: n->cautionary_b_ = $3 % 2; n->forceacc_b_ = $2 % 2 || n->cautionary_b_; - Simultaneous_music*v = new Request_chord; + + Simultaneous_music*v = new Request_chord (gh_list (n->self_scm_, SCM_UNDEFINED)); v->set_spot ($1->spot ()); n->set_spot ($1->spot ()); - - v->add_music (n); - $$ = v; delete $1; delete $4; } | RESTNAME optional_notemode_duration { - Simultaneous_music* velt_p = new Request_chord; - velt_p->set_spot (THIS->here_input()); + SCM e = SCM_UNDEFINED; if (ly_scm2string ($1) =="s") { /* Space */ Skip_req * skip_p = new Skip_req; skip_p->duration_ = *$2; skip_p->set_spot (THIS->here_input()); - velt_p->add_music (skip_p); + e = skip_p->self_scm_; } else { Rest_req * rest_req_p = new Rest_req; rest_req_p->duration_ = *$2; rest_req_p->set_spot (THIS->here_input()); - - velt_p->add_music (rest_req_p); + e = rest_req_p->self_scm_; } + Simultaneous_music* velt_p = new Request_chord (gh_list (e,SCM_UNDEFINED)); + velt_p->set_spot (THIS->here_input()); - delete $2; + delete $2; // ugh $$ = velt_p; } | MEASURES optional_notemode_duration { Skip_req * sk = new Skip_req; sk->duration_ = *$2; - Music_list * ms = new Music_list; - Request_chord * rqc1 = new Request_chord; - Request_chord * rqc2 = new Request_chord; - Request_chord * rqc3 = new Request_chord; + Span_req *sp1 = new Span_req; Span_req *sp2 = new Span_req; sp1-> span_dir_ = START; sp2-> span_dir_ = STOP; sp1->span_type_str_ = sp2->span_type_str_ = "rest"; - rqc1->add_music (sp1); - rqc2->add_music (sk); - rqc3->add_music (sp2); - - ms->add_music (rqc1); - ms->add_music (rqc2); - ms->add_music (rqc3); + + Request_chord * rqc1 = new Request_chord (gh_list (sp1->self_scm_, SCM_UNDEFINED)); + Request_chord * rqc2 = new Request_chord (gh_list (sk->self_scm_, SCM_UNDEFINED));; + Request_chord * rqc3 = new Request_chord(gh_list (sp2->self_scm_, SCM_UNDEFINED));; + + SCM ms = gh_list (rqc1->self_scm_, rqc2->self_scm_, rqc3->self_scm_, SCM_UNDEFINED); $$ = new Sequential_music (ms); } | STRING optional_notemode_duration { if (!THIS->lexer_p_->lyric_state_b ()) THIS->parser_error (_ ("Have to be in Lyric mode for lyrics")); - Simultaneous_music* velt_p = new Request_chord; - Lyric_req* lreq_p = new Lyric_req; lreq_p ->text_str_ = ly_scm2string ($1); lreq_p->duration_ = *$2; lreq_p->set_spot (THIS->here_input()); + Simultaneous_music* velt_p = new Request_chord (gh_list (lreq_p->self_scm_, SCM_UNDEFINED)); - velt_p->add_music (lreq_p); - - delete $2; + delete $2; // ugh $$= velt_p; } diff --git a/lily/performer-group-performer.cc b/lily/performer-group-performer.cc index 6bc925a1bd..7a38830b53 100644 --- a/lily/performer-group-performer.cc +++ b/lily/performer-group-performer.cc @@ -32,17 +32,13 @@ Performer_group_performer::do_announces() } - Request dummy_req; + while (announce_info_arr_.size ()) { for (int j =0; j < announce_info_arr_.size(); j++) { Audio_element_info info = announce_info_arr_[j]; - - if (!info.req_l_) - info.req_l_ = &dummy_req; - for (Cons *p = trans_p_list_.head_; p; p = p->next_) { if (!dynamic_cast (p->car_)) diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 7f4d1777cc..f7127c425a 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -154,7 +154,7 @@ Piano_pedal_engraver::do_process_music () { if (!p->start_req_l_) { - p->req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", p->name_ )); + p->req_l_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: %s", p->name_ )); } else { @@ -166,7 +166,7 @@ Piano_pedal_engraver::do_process_music () { if (!p->start_req_l_) { - p->req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", p->name_ )); + p->req_l_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: %s", p->name_ )); } else { @@ -199,10 +199,10 @@ Piano_pedal_engraver::do_process_music () // todo: init with basic props. p->item_p_->add_offset_callback (Side_position::aligned_on_self, X_AXIS); p->item_p_->add_offset_callback (Side_position::centered_on_parent, X_AXIS); - announce_element (Score_element_info (p->item_p_, + announce_element (p->item_p_, p->req_l_drul_[START] ? p->req_l_drul_[START] - : p->req_l_drul_[STOP])); + : p->req_l_drul_[STOP]); } } } diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc index c3d2a1a0f4..6b1efab435 100644 --- a/lily/piano-pedal-performer.cc +++ b/lily/piano-pedal-performer.cc @@ -84,7 +84,7 @@ Piano_pedal_performer::do_process_music () { if (!p->start_req_l_) { - p->req_l_drul_[STOP]->warning (_f ("can't find start of piano pedal: %s", String (p->name_))); + p->req_l_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: %s", String (p->name_))); } else { diff --git a/lily/property-iterator.cc b/lily/property-iterator.cc index 06d34035ed..9f47bce0d1 100644 --- a/lily/property-iterator.cc +++ b/lily/property-iterator.cc @@ -17,9 +17,10 @@ void Property_iterator::do_process_and_next (Moment m) { - Translation_property const * prop = dynamic_cast (music_l_); - if (prop->var_str_.length_i ()) - report_to_l ()->set_property (prop->var_str_, prop->value_); + Translation_property * prop = dynamic_cast (music_l_); + SCM sym = prop->get_mus_property ("symbol"); + if (gh_symbol_p(sym)) + report_to_l ()->set_property (sym, prop->get_mus_property ("value")); Music_iterator::do_process_and_next (m); } diff --git a/lily/relative-octave-music.cc b/lily/relative-octave-music.cc index e2552b65a8..f786e7b0ed 100644 --- a/lily/relative-octave-music.cc +++ b/lily/relative-octave-music.cc @@ -20,7 +20,7 @@ Relative_octave_music::to_relative_octave (Musical_pitch) Relative_octave_music::Relative_octave_music(Music*p,Musical_pitch def) : Music_wrapper (p) { - last_pitch_ = element_l ()->to_relative_octave (def); + last_pitch_ = element ()->to_relative_octave (def); } void diff --git a/lily/repeat-engraver.cc b/lily/repeat-engraver.cc index dc66a1497a..9874744414 100644 --- a/lily/repeat-engraver.cc +++ b/lily/repeat-engraver.cc @@ -111,8 +111,8 @@ Repeat_engraver::do_try_music (Music* m) void Repeat_engraver::queue_events () { - Music_sequence* alt = repeated_music_l_->alternatives_p_; - Moment walk_mom = now_mom () + repeated_music_l_->repeat_body_p_->length_mom (); + Music_sequence* alt = repeated_music_l_->alternatives (); + Moment walk_mom = now_mom () + repeated_music_l_->body ()->length_mom (); SCM novolta = get_property ("noVoltaBraces"); bool create_volta = !to_boolean (novolta); @@ -135,8 +135,11 @@ Repeat_engraver::queue_events () appropriate timestamps. The volta spanner event (a number string) happens at the begin of the alt. The :| bar event at the ending. */ - for (Cons *i = alt->music_p_list_p_->head_; i; i = i->next_) - { + + for (SCM s = repeated_music_l_->alternatives ()->music_list (); + gh_pair_p (s); s = gh_cdr (s)) + { + Music *mus =unsmob_music (gh_car (s)); /* some idiot might typeset a repeat not starting on a @@ -155,17 +158,17 @@ Repeat_engraver::queue_events () Bar_create_event * c = new Bar_create_event (walk_mom, last_number+ 1, volta_number); - if (!i->next_) + if (!gh_pair_p (gh_cdr (s))) c->last_b_ = true; becel.append (c); last_number = volta_number; volta_number ++; SCM l (get_property ("voltaSpannerDuration")); - if (SMOB_IS_TYPE_B (Moment, l)) + if (unsmob_moment(l)) { - Moment vSD_mom = *SMOB_TO_TYPE (Moment,l); - if ( vSD_mom < i->car_->length_mom() ) // terminate volta early ? + Moment vSD_mom = *unsmob_moment (l); + if ( vSD_mom < mus->length_mom() ) // terminate volta early ? { vSD_mom += walk_mom; c->last_b_ = true; @@ -173,9 +176,9 @@ Repeat_engraver::queue_events () } } } - walk_mom += i->car_->length_mom(); + walk_mom += mus->length_mom(); - if (i->next_) + if (gh_pair_p (gh_cdr (s))) becel.append (new Bar_create_event (walk_mom, ":|")); else becel.append (new Bar_create_event (walk_mom, "stop")); @@ -235,7 +238,7 @@ Repeat_engraver::do_process_music () assert (!volta_span_p_); volta_span_p_ = new Spanner (get_property ("basicVoltaSpannerProperties")); Volta_spanner::set_interface (volta_span_p_); - announce_element (Score_element_info (volta_span_p_,0)); + announce_element (volta_span_p_,0); volta_span_p_->set_elt_property ("text", ly_str02scm (t.ch_C())); volta_span_p_->set_elt_property ("last-volta", diff --git a/lily/repeated-music.cc b/lily/repeated-music.cc index 82d1c9fe9c..f2e9b77daa 100644 --- a/lily/repeated-music.cc +++ b/lily/repeated-music.cc @@ -12,15 +12,29 @@ #include "musical-pitch.hh" #include "debug.hh" +Music * +Repeated_music::body ()const +{ + return unsmob_music (get_mus_property ("body")); +} + +Music_sequence* +Repeated_music::alternatives ()const +{ + return dynamic_cast (unsmob_music (get_mus_property ("alternatives"))); +} + Repeated_music::Repeated_music(Music *beg, int times, Music_sequence * alts) { - repeat_body_p_ = beg; + set_mus_property ("body", beg->self_scm_); fold_b_ = false; repeats_i_ = times; - alternatives_p_ = alts; volta_fold_b_ = true; if (alts) - alts->music_p_list_p_->truncate (times); + { + alts->truncate (times); + set_mus_property ("alternatives", alts->self_scm_); + } } Repeated_music::Repeated_music (Repeated_music const &s) @@ -30,16 +44,8 @@ Repeated_music::Repeated_music (Repeated_music const &s) fold_b_ = s.fold_b_; volta_fold_b_ = s.volta_fold_b_; type_ = s.type_; - repeat_body_p_ = s.repeat_body_p_ ? s.repeat_body_p_->clone () : 0; - alternatives_p_ = s.alternatives_p_ - ? dynamic_cast (s.alternatives_p_->clone ()):0; } -Repeated_music::~Repeated_music () -{ - delete repeat_body_p_; - delete alternatives_p_; -} void Repeated_music::do_print () const @@ -47,71 +53,69 @@ Repeated_music::do_print () const #ifndef NPRINT DEBUG_OUT << "Fold = " << fold_b_ << " reps: " << repeats_i_; - if (repeat_body_p_) - repeat_body_p_->print(); + if (body ()) + body ()->print(); - if (alternatives_p_) - alternatives_p_->print(); + if (alternatives ()) + alternatives ()->print(); #endif } Musical_pitch Repeated_music::to_relative_octave (Musical_pitch p) { - if (repeat_body_p_) - p = repeat_body_p_->to_relative_octave (p); + if (body ()) + p = body ()->to_relative_octave (p); Musical_pitch last = p ; - if (alternatives_p_) - for (Cons *i = alternatives_p_->music_p_list_p_->head_; i ; i = i->next_) - { - last = i->car_->to_relative_octave (p); - } + if (alternatives ()) + for (SCM s = alternatives ()->music_list (); gh_pair_p (s); s = gh_cdr (s)) + unsmob_music (gh_car (s))->to_relative_octave (p); + return last; } - - void Repeated_music::transpose (Musical_pitch p) { - if (repeat_body_p_) - repeat_body_p_->transpose (p); + if (body ()) + body ()->transpose (p); - if (alternatives_p_) - alternatives_p_->transpose (p); + if (alternatives ()) + alternatives ()->transpose (p); } void Repeated_music::compress (Moment p) { - if (repeat_body_p_) - repeat_body_p_->compress (p); + if (body ()) + body ()->compress (p); - if (alternatives_p_) - alternatives_p_->compress (p); + if (alternatives ()) + alternatives ()->compress (p); } Moment Repeated_music::alternatives_length_mom () const { - if (!alternatives_p_ ) + if (!alternatives () ) return 0; if (fold_b_) - return alternatives_p_->maximum_length (); + return alternatives ()->maximum_length (); Moment m =0; int done =0; - Cons *p = alternatives_p_->music_p_list_p_->head_; - while (p && done < repeats_i_) + + SCM p = alternatives ()->music_list (); + while (gh_pair_p (p) && done < repeats_i_) { - m = m + p->car_->length_mom (); + m = m + unsmob_music (gh_car (p))->length_mom (); done ++; if (volta_fold_b_ - || repeats_i_ - done < alternatives_p_->length_i ()) - p = p->next_; + || repeats_i_ - done < alternatives ()->length_i ()) + p = gh_cdr (p); } return m; } @@ -120,9 +124,9 @@ Moment Repeated_music::body_length_mom () const { Moment m = 0; - if (repeat_body_p_) + if (body ()) { - m = repeat_body_p_->length_mom (); + m = body ()->length_mom (); if (!fold_b_ && !volta_fold_b_) m *= Rational (repeats_i_); } diff --git a/lily/request-chord-iterator.cc b/lily/request-chord-iterator.cc index 65f3027077..7f0b00827f 100644 --- a/lily/request-chord-iterator.cc +++ b/lily/request-chord-iterator.cc @@ -30,7 +30,6 @@ Request_chord_iterator::elt_l () const Request_chord_iterator::Request_chord_iterator () { last_b_ = false; - cursor_ = 0; } @@ -63,18 +62,19 @@ Request_chord_iterator::do_process_and_next (Moment mom) { if (first_b_) { - for (Cons *i = elt_l ()->music_p_list_p_->head_; i; i = i->next_) + for (SCM s = dynamic_cast (music_l_)->music_list (); gh_pair_p (s); s = gh_cdr (s)) { - if (Request * req_l = dynamic_cast (i->car_)) + Music *mus = unsmob_music (gh_car (s)); + if (Request * req_l = dynamic_cast (mus)) { bool gotcha = try_music (req_l); if (!gotcha) - req_l->warning (_f ("Junking request: `%s'", classname( req_l))); + req_l->origin ()->warning (_f ("Junking request: `%s'", classname( req_l))); } else - i->car_->warning (_f ("Huh? Not a Request: `%s'", - classname (i->car_))); - } + mus->origin ()->warning (_f ("Huh? Not a Request: `%s'", + classname (mus))); + } first_b_ = false; } diff --git a/lily/request-iterator.cc b/lily/request-iterator.cc index 6cefe8b5b5..51c7604281 100644 --- a/lily/request-iterator.cc +++ b/lily/request-iterator.cc @@ -8,7 +8,7 @@ */ #include "request-iterator.hh" #include "music.hh" - +#include "input.hh" void Simple_music_iterator::do_process_and_next (Moment m) @@ -17,7 +17,7 @@ Simple_music_iterator::do_process_and_next (Moment m) { bool g= try_music (music_l_); if (!g) - music_l_->warning (_f ("Junking music: `%s'", classname(music_l_))); + music_l_->origin ()->warning (_f ("Junking music: `%s'", classname(music_l_))); first_b_ = false; } diff --git a/lily/rest-collision-engraver.cc b/lily/rest-collision-engraver.cc index e748b88c01..be91eb2306 100644 --- a/lily/rest-collision-engraver.cc +++ b/lily/rest-collision-engraver.cc @@ -42,7 +42,7 @@ Rest_collision_engraver::process_acknowledged () rest_collision_p_ = new Item (get_property ("basicRestCollisionProperties")); Rest_collision::set_interface (rest_collision_p_); - announce_element (Score_element_info (rest_collision_p_, 0)); + announce_element (rest_collision_p_, 0); for (int i=0; i< note_column_l_arr_.size (); i++) Rest_collision::add_column ( rest_collision_p_,note_column_l_arr_[i]); } diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index 1d615fccb3..259140717a 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -84,10 +84,10 @@ Rest_engraver::do_process_music () dot_p_->add_offset_callback (Dots::quantised_position_callback, Y_AXIS); dot_p_->set_elt_property ("dot-count", gh_int2scm (rest_req_l_->duration_.dots_i_)); - announce_element (Score_element_info (dot_p_,0)); + announce_element (dot_p_,0); } - announce_element (Score_element_info (rest_p_, rest_req_l_)); + announce_element (rest_p_, rest_req_l_); } } diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 82c02d9a4a..b72f6b1f99 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -54,7 +54,7 @@ Rhythmic_column_engraver::process_acknowledged () { ncol_p_ = new Item (get_property("basicNoteColumnProperties")); Note_column::set_interface (ncol_p_); - announce_element (Score_element_info (ncol_p_, 0)); + announce_element (ncol_p_, 0); } for (int i=0; i < rhead_l_arr_.size (); i++) diff --git a/lily/score-element.cc b/lily/score-element.cc index f53cd8e9b2..451c1f40be 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -10,6 +10,7 @@ #include #include +#include "input-smob.hh" #include "libc-extension.hh" #include "group-interface.hh" #include "misc.hh" @@ -78,12 +79,9 @@ Score_element::Score_element (Score_element const&s) Score_element::~Score_element() { - // this goes awry when score-elements are copied... - /* - Kijk goed naar hoe smobify en unsmobify werken. unsmobify_self - is te gebruiken wanneer C++ geheugen beheer weer overneemt van - GUILE. --hwn */ + do nothing scm-ish and no unprotecting here. + */ } @@ -248,10 +246,24 @@ Molecule Score_element::get_molecule () const { SCM proc = get_elt_property ("molecule-callback"); + + SCM mol = SCM_EOL; if (gh_procedure_p (proc)) - return create_molecule (gh_apply (proc, gh_list (this->self_scm_, SCM_UNDEFINED))); + mol = gh_apply (proc, gh_list (this->self_scm_, SCM_UNDEFINED)); + - return Molecule (); + SCM origin =get_elt_property ("origin"); + if (!unsmob_input (origin)) + origin =ly_symbol2scm ("no-origin"); + + if (gh_pair_p (mol)) + { + // ugr. + mol = gh_cons (gh_list (origin, gh_car (mol), SCM_UNDEFINED), gh_cdr (mol)); + } + + + return create_molecule (mol); } @@ -710,15 +722,17 @@ Score_element::mark_smob (SCM ses) programming_error ("SMOB marking gone awry"); return SCM_EOL; } - scm_gc_mark ( s->immutable_property_alist_); - - s->do_derived_mark (); + scm_gc_mark (s->immutable_property_alist_); + scm_gc_mark (s->mutable_property_alist_); + if (s->parent_l (Y_AXIS)) scm_gc_mark (s->parent_l (Y_AXIS)->self_scm_); if (s->parent_l (X_AXIS)) scm_gc_mark (s->parent_l (X_AXIS)->self_scm_); - return s->mutable_property_alist_; + if (s->original_l_) + scm_gc_mark (s->original_l_->self_scm_); + return s->do_derived_mark (); } int @@ -736,9 +750,10 @@ Score_element::print_smob (SCM s, SCM port, scm_print_state *) return 1; } -void +SCM Score_element::do_derived_mark () { + return SCM_EOL; } void diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 1e35503f42..c360b99649 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -267,6 +267,8 @@ Score_engraver::do_add_processing () pscore_p_ = new Paper_score; pscore_p_->paper_l_ = dynamic_cast(output_def_l_); - pscore_p_->typeset_line (new Line_of_score (get_property(ly_symbol2scm ("basicLineOfScoreProperties")))); + SCM props = get_property(ly_symbol2scm ("basicLineOfScoreProperties")); + + pscore_p_->typeset_line (new Line_of_score (props)); } diff --git a/lily/score.cc b/lily/score.cc index b9027e9288..8a4e348d0d 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -31,14 +31,15 @@ Score::Score() : Input() { header_p_ = 0; - music_p_ = 0; + music_ = SCM_EOL; errorlevel_i_ = 0; } Score::Score (Score const &s) : Input (s) { - music_p_ = (s.music_p_) ? s.music_p_->clone() : 0; + Music * m =unsmob_music (s.music_); + music_ = m?m->clone()->self_scm_ : SCM_EOL; for (int i=0; i < s.def_p_arr_.size (); i++) def_p_arr_.push(s.def_p_arr_[i]->clone()); errorlevel_i_ = s.errorlevel_i_; @@ -49,7 +50,6 @@ Score::~Score() { delete header_p_; junk_pointer_array (def_p_arr_); - delete music_p_; } void @@ -61,15 +61,17 @@ Score::run_translator (Music_output_def *odef_l) Global_translator * trans_p = odef_l->get_global_translator_p(); if (!trans_p) { - non_fatal_error (_("no toplevel translator")); + programming_error ("no toplevel translator"); return ; } progress_indication ("\n" + _("Interpreting music...")); - trans_p->final_mom_ = music_p_->length_mom (); + Music * music = unsmob_music (music_); + + trans_p->final_mom_ = music->length_mom (); - Music_iterator * iter = Music_iterator::static_get_iterator_p (music_p_); - iter->init_translator(music_p_, trans_p); + Music_iterator * iter = Music_iterator::static_get_iterator_p (music); + iter->init_translator(music, trans_p); iter->construct_children(); @@ -115,7 +117,7 @@ Score::run_translator (Music_output_def *odef_l) void Score::process() { - if (!music_p_) + if (!unsmob_music (music_)) return; print(); @@ -135,7 +137,7 @@ Score::print() const { #ifndef NPRINT DEBUG_OUT << "score {\n"; - music_p_ -> print (); + // music_p_ -> print (); for (int i=0; i < def_p_arr_.size (); i++) def_p_arr_[i]->print(); DEBUG_OUT << "}\n"; diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index 73da380668..23df7b72af 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -76,7 +76,7 @@ Script_column_engraver::process_acknowledged () scol_p_ = new Item (get_property ("basicScriptColumnProperties")); scol_p_->set_elt_property ("scripts", SCM_EOL); - announce_element (Score_element_info (scol_p_, 0)); + announce_element (scol_p_, 0); } if (scol_p_) diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index effd5b7123..db95e855f4 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -62,7 +62,7 @@ Script_engraver::do_process_music() if (list == SCM_BOOL_F) { - l->warning (_f ("Don't know how to interpret articulation `%s'", + l->origin ()->warning (_f ("Don't know how to interpret articulation `%s'", l->articulation_str_.ch_C ())); continue; } @@ -109,7 +109,7 @@ Script_engraver::do_process_music() script_p_arr_.push (p); - announce_element (Score_element_info (p, l)); + announce_element (p, l); } } diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 7cc7ad681a..eda666a9b4 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -41,7 +41,7 @@ Separating_line_group_engraver::do_creation_processing () { sep_span_p_ = new Spanner (get_property ("basicSeparatingGroupSpannerProperties")); Separating_group_spanner::set_interface (sep_span_p_); - announce_element (Score_element_info (sep_span_p_, 0)); + announce_element (sep_span_p_, 0); sep_span_p_->set_bound (LEFT, unsmob_element (get_property ("currentCommandColumn"))); } @@ -70,7 +70,7 @@ Separating_line_group_engraver::acknowledge_element (Score_element_info i) if (ib) p_ref_->set_elt_property ("breakable", SCM_BOOL_T); - announce_element (Score_element_info (p_ref_, 0)); + announce_element (p_ref_, 0); } Separation_item::add_item (p_ref_,it); } diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc index 8473d23cd6..d99381cf54 100644 --- a/lily/sequential-music-iterator.cc +++ b/lily/sequential-music-iterator.cc @@ -30,9 +30,9 @@ Sequential_music_iterator::Sequential_music_iterator () void Sequential_music_iterator::construct_children() { - cursor_ = dynamic_cast (music_l_)->music_p_list_p_->head_; + cursor_ = dynamic_cast (music_l_)->music_list (); - while (cursor_) + while (gh_pair_p (cursor_ )) { start_next_element(); if (!iter_p_->ok()) @@ -52,16 +52,16 @@ Sequential_music_iterator::leave_element() { delete iter_p_; iter_p_ =0; - Moment elt_time = cursor_->car_->length_mom (); + Moment elt_time = unsmob_music (gh_car (cursor_))->length_mom (); here_mom_ += elt_time; - cursor_ =cursor_->next_; + cursor_ =gh_cdr (cursor_); } void Sequential_music_iterator::start_next_element() { assert (!iter_p_); - iter_p_ = get_iterator_p (cursor_->car_); + iter_p_ = get_iterator_p (unsmob_music (gh_car (cursor_))); } void @@ -80,15 +80,12 @@ Sequential_music_iterator::~Sequential_music_iterator() if (iter_p_) { if (iter_p_->ok ()) - music_l_->warning (_ ("Must stop before this music ends")); + music_l_->origin ()->warning (_ ("Must stop before this music ends")); delete iter_p_; iter_p_ = 0; } } - - - void Sequential_music_iterator::do_process_and_next (Moment until) { @@ -112,7 +109,7 @@ Sequential_music_iterator::do_process_and_next (Moment until) set_sequential_music_translator(); leave_element(); - if (cursor_) + if (gh_pair_p (cursor_)) start_next_element(); else goto loopexit; @@ -138,7 +135,7 @@ Sequential_music_iterator::ok() const } Music_iterator* -Sequential_music_iterator::try_music_in_children (Music const *m) const +Sequential_music_iterator::try_music_in_children (Music *m) const { return iter_p_ ? iter_p_->try_music (m) : 0; } diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc index 7e60780cc9..5ea7f71218 100644 --- a/lily/simultaneous-music-iterator.cc +++ b/lily/simultaneous-music-iterator.cc @@ -28,10 +28,11 @@ Simultaneous_music_iterator::construct_children() int j = 0; Music_sequence const *sim = dynamic_cast (music_l_); - Cons *i = (sim->music_p_list_p_) ? sim->music_p_list_p_->head_ : 0; - for (; i; i = i->next_, j++) + SCM i = sim->music_list (); + for (; gh_pair_p(i); i = gh_cdr(i), j++) { - Music_iterator * mi = static_get_iterator_p (i->car_); + Music *mus = unsmob_music (gh_car (i)); + Music_iterator * mi = static_get_iterator_p (mus); /* if separate_contexts_b_ is set, create a new context with the number number as name */ @@ -44,7 +45,7 @@ Simultaneous_music_iterator::construct_children() if (!t) t = report_to_l (); - mi->init_translator (i->car_, t); + mi->init_translator (mus, t); mi->construct_children (); if (mi->ok()) @@ -106,7 +107,7 @@ Simultaneous_music_iterator::ok() const } Music_iterator* -Simultaneous_music_iterator::try_music_in_children (Music const*m) const +Simultaneous_music_iterator::try_music_in_children (Music *m) const { Music_iterator * b=0; for (Cons *p = children_p_list_.head_; !b && p; p = p->next_) diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 893c0c4bed..839b64649a 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -79,7 +79,7 @@ Slur_engraver::do_removal_processing () if (!wgb) for (int i=0; i < requests_arr_.size (); i++) { - requests_arr_[i]->warning (_ ("unterminated slur")); + requests_arr_[i]->origin ()->warning (_ ("unterminated slur")); } } @@ -95,7 +95,7 @@ Slur_engraver::do_process_music () { if (slur_l_stack_.empty ()) - slur_req_l->warning (_f ("can't find both ends of %s", _ ("slur"))); + slur_req_l->origin ()->warning (_f ("can't find both ends of %s", _ ("slur"))); else { Score_element* slur = slur_l_stack_.pop (); @@ -121,7 +121,7 @@ Slur_engraver::do_process_music () } start_slur_l_arr_.push (slur); requests_arr_.push (slur_req_l); - announce_element (Score_element_info (slur, slur_req_l)); + announce_element (slur, slur_req_l); } } for (int i=0; i < start_slur_l_arr_.size (); i++) diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index 4dc344b8c0..de4be78cb2 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -78,7 +78,7 @@ Spacing_engraver::do_creation_processing () spacing_p_ =new Spanner (get_property ("basicSpacingSpannerProperties")); Spacing_spanner::set_interface (spacing_p_); spacing_p_->set_bound (LEFT, unsmob_element (get_property ("currentCommandColumn"))); - announce_element (Score_element_info (spacing_p_, 0)); + announce_element (spacing_p_, 0); } void diff --git a/lily/span-bar-engraver.cc b/lily/span-bar-engraver.cc index dd40fd96e2..a228a1b298 100644 --- a/lily/span-bar-engraver.cc +++ b/lily/span-bar-engraver.cc @@ -66,7 +66,7 @@ Span_bar_engraver::acknowledge_element (Score_element_info i) spanbar_p_->set_parent (bar_l_arr_[0], Y_AXIS); spanbar_p_->set_parent (bar_l_arr_[0], X_AXIS); - announce_element (Score_element_info (spanbar_p_,0)); + announce_element (spanbar_p_,0); } } } diff --git a/lily/span-dynamic-performer.cc b/lily/span-dynamic-performer.cc index deef286259..5a1eadfe49 100644 --- a/lily/span-dynamic-performer.cc +++ b/lily/span-dynamic-performer.cc @@ -84,7 +84,7 @@ Span_dynamic_performer::do_process_music () { if (!span_start_req_l_) { - span_req_l_drul_[STOP]->warning (_ ("can't find start of (de)crescendo")); + span_req_l_drul_[STOP]->origin ()->warning (_ ("can't find start of (de)crescendo")); } else { diff --git a/lily/spanner.cc b/lily/spanner.cc index f9cb12f4c1..5c8f4a1977 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -260,9 +260,14 @@ Spanner::get_broken_left_end_align () const return 0.0; } -void +SCM Spanner::do_derived_mark () { + /* + We'd be fucked if this is called before spanned_drul_[] is inited. */ + if (status_i_ == ORPHAN) + return SCM_EOL; + Direction d = LEFT; do if (spanned_drul_[d]) @@ -271,6 +276,8 @@ Spanner::do_derived_mark () for (int i= broken_into_l_arr_.size () ; i--;) scm_gc_mark (broken_into_l_arr_[i]->self_scm_); + + return SCM_EOL; } void diff --git a/lily/staff-symbol-engraver.cc b/lily/staff-symbol-engraver.cc index 1078870c62..d5fb4860f2 100644 --- a/lily/staff-symbol-engraver.cc +++ b/lily/staff-symbol-engraver.cc @@ -48,7 +48,7 @@ Staff_symbol_engraver::do_creation_processing() span_p_->set_bound(LEFT, unsmob_element (get_property ("currentCommandColumn"))); - announce_element (Score_element_info (span_p_, 0)); + announce_element (span_p_, 0); } void diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index 2b5367aab2..1c3de7e27a 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -106,7 +106,7 @@ Stem_engraver::acknowledge_element(Score_element_info i) tremolo_p_ = new Item (get_property ("basicStemTremoloProperties")); Stem_tremolo::set_interface (tremolo_p_); - announce_element (Score_element_info (tremolo_p_, tremolo_req_l_)); + announce_element (tremolo_p_, tremolo_req_l_); /* The number of tremolo flags is the number of flags of the tremolo-type minus the number of flags of the note @@ -120,12 +120,12 @@ Stem_engraver::acknowledge_element(Score_element_info i) gh_int2scm (tremolo_flags)); } } - announce_element (Score_element_info (stem_p_, r)); + announce_element (stem_p_, r); } if (Stem::flag_i (stem_p_) != duration_log) { - r->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << Stem::flag_i (stem_p_))); + r->origin ()->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << Stem::flag_i (stem_p_))); } Stem::add_head (stem_p_,h); diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index 2f9c366195..35189db939 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -79,7 +79,7 @@ System_start_delimiter_engraver::do_creation_processing() delim_->set_elt_property ("glyph", s); } - announce_element (Score_element_info (delim_,0)); + announce_element (delim_,0); } void diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index 118f8ff2a9..f6661e2359 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -103,7 +103,7 @@ Text_engraver::do_process_music () text->set_elt_property ("no-spacing-rods" , SCM_BOOL_F); text->set_extent_callback (0, X_AXIS); } - announce_element (Score_element_info (text, r)); + announce_element (text, r); texts_.push (text); } } diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 0f3f3b2300..aa3180f7f6 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -184,7 +184,7 @@ Tie_engraver::process_acknowledged () Tie::set_head (p,RIGHT, dynamic_cast (unsmob_element (gh_cdr (pair)))); tie_p_arr_.push (p); - announce_element (Score_element_info (p, req_l_)); + announce_element (p, req_l_); } else for (SCM s = head_list; gh_pair_p (s); s = gh_cdr (s)) { @@ -195,12 +195,12 @@ Tie_engraver::process_acknowledged () Tie::set_head (p, RIGHT, dynamic_cast (unsmob_element (gh_cdar (s)))); tie_p_arr_.push (p); - announce_element (Score_element_info (p, req_l_)); + announce_element (p, req_l_); } if (!tie_p_arr_.size ()) { - req_l_->warning (_ ("No ties were created!")); + req_l_->origin ()->warning (_ ("No ties were created!")); } else if (tie_p_arr_.size () > 1 && !tie_column_p_) { @@ -208,7 +208,7 @@ Tie_engraver::process_acknowledged () Tie_column::set_interface (tie_column_p_); for (int i = tie_p_arr_.size (); i--; ) Tie_column::add_tie (tie_column_p_,tie_p_arr_ [i]); - announce_element (Score_element_info (tie_column_p_, 0)); + announce_element (tie_column_p_, 0); } } } diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index 51d1375d84..f1088d4c8e 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -106,7 +106,7 @@ Tie_performer::process_acknowledged () if (!tie_p_arr_.size ()) { - req_l_->warning (_("No ties were created!")); + req_l_->origin ()->warning (_("No ties were created!")); } } diff --git a/lily/time-scaled-music-iterator.cc b/lily/time-scaled-music-iterator.cc index da04bbf30f..6230181c88 100644 --- a/lily/time-scaled-music-iterator.cc +++ b/lily/time-scaled-music-iterator.cc @@ -22,7 +22,7 @@ Time_scaled_music_iterator::do_process_and_next (Moment m) if (yeah) set_translator (yeah->report_to_l ()); else - music_l_->warning ( _("no one to print a tuplet start bracket")); + music_l_->origin ()->warning ( _("no one to print a tuplet start bracket")); } Music_wrapper_iterator::do_process_and_next (m); diff --git a/lily/time-signature-engraver.cc b/lily/time-signature-engraver.cc index 9b44c6ded4..99f7898328 100644 --- a/lily/time-signature-engraver.cc +++ b/lily/time-signature-engraver.cc @@ -64,7 +64,7 @@ Time_signature_engraver::do_process_music() if (time_signature_p_) - announce_element (Score_element_info (time_signature_p_, req)); + announce_element (time_signature_p_, req); } void diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc index 9096284795..762ac771ba 100644 --- a/lily/timing-translator.cc +++ b/lily/timing-translator.cc @@ -33,8 +33,8 @@ Timing_translator::do_try_music (Music*r) return true; if (String (classname (timing_req_l_arr_[i])) == classname (r)) { - r->warning (_ ("conflicting timing request")); - timing_req_l_arr_[i]->warning (_("This is the other timing request")); + r->origin ()->warning (_ ("conflicting timing request")); + timing_req_l_arr_[i]->origin ()->warning (_("This is the other timing request")); return false; } } @@ -75,7 +75,7 @@ Timing_translator::do_process_music() { if (measure_position ()) { - tr_l ->warning (_f ("barcheck failed at: %s", + tr_l ->origin ()->warning (_f ("barcheck failed at: %s", measure_position ().str ())); // resync daddy_trans_l_->set_property("measurePosition", diff --git a/lily/translation-property.cc b/lily/translation-property.cc index 45f8de630c..cdd2579202 100644 --- a/lily/translation-property.cc +++ b/lily/translation-property.cc @@ -9,12 +9,5 @@ #include "translation-property.hh" #include "debug.hh" -void -Translation_property::do_print () const -{ -#ifndef NPRINT - DEBUG_OUT << "." << var_str_ << " = " ; - if (flower_dstream && !flower_dstream->silent_b ("Translation_property")) - ly_display_scm (value_); -#endif -} + + diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 62de8aa634..4303d0cbf4 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -459,6 +459,13 @@ Translator_group::get_property (SCM sym) const void Translator_group::set_property (String id, SCM val) { - properties_dict_->set (ly_symbol2scm (id.ch_C()), val); + set_property (ly_symbol2scm (id.ch_C()), val); } +void +Translator_group::set_property (SCM sym, SCM val) +{ + properties_dict_->set (sym, val); +} + + diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc index 6fcdba950e..0c38ef1d2a 100644 --- a/lily/tuplet-engraver.cc +++ b/lily/tuplet-engraver.cc @@ -44,7 +44,7 @@ Tuplet_engraver::do_try_music (Music *r) { if (Time_scaled_music * c = dynamic_cast (r)) { - Music *el = c->element_l (); + Music *el = c->element (); if (!dynamic_cast (el)) { time_scaled_music_arr_.push (c); @@ -84,7 +84,7 @@ Tuplet_engraver::do_process_music () glep->set_elt_property ("text", ly_str02scm (to_str (time_scaled_music_arr_[i]->den_i_).ch_C())); - announce_element (Score_element_info (glep, time_scaled_music_arr_ [i])); + announce_element (glep, time_scaled_music_arr_ [i]); } } diff --git a/lily/unfolded-repeat-iterator.cc b/lily/unfolded-repeat-iterator.cc index a51bbca2f6..6395987a1d 100644 --- a/lily/unfolded-repeat-iterator.cc +++ b/lily/unfolded-repeat-iterator.cc @@ -40,26 +40,26 @@ the alternative just set. void Unfolded_repeat_iterator::next_element () { - Repeated_music const* mus =dynamic_cast (music_l_); + Repeated_music * mus =dynamic_cast (music_l_); delete current_iter_p_; current_iter_p_ =0; if (do_main_b_) { - done_mom_ += mus->repeat_body_p_->length_mom (); + done_mom_ += mus->body ()->length_mom (); if (!mus->volta_fold_b_) done_count_ ++; - if (alternative_cons_l_) + if (gh_pair_p (alternative_cons_)) { - current_iter_p_ = get_iterator_p (alternative_cons_l_->car_); + current_iter_p_ = get_iterator_p (unsmob_music (gh_car (alternative_cons_))); do_main_b_ = false; } else if (done_count_ < mus->repeats_i_ && !mus->volta_fold_b_) { - current_iter_p_ = get_iterator_p (mus->repeat_body_p_); + current_iter_p_ = get_iterator_p (mus->body ()); do_main_b_ = true; } } @@ -69,13 +69,13 @@ Unfolded_repeat_iterator::next_element () we're not in the main part. So we're either in an alternative, or we just finished. */ - if (alternative_cons_l_) + if (alternative_cons_) { - done_mom_ += alternative_cons_l_->car_->length_mom (); + done_mom_ += unsmob_music (gh_car (alternative_cons_))->length_mom (); if (mus->volta_fold_b_ || mus->repeats_i_ - done_count_ < alternative_count_i_) - alternative_cons_l_ = alternative_cons_l_->next_; + alternative_cons_ = gh_cdr (alternative_cons_); /* we've done the main body as well, but didn't go over the other @@ -84,13 +84,13 @@ Unfolded_repeat_iterator::next_element () done_count_ ++; } - if (done_count_ < mus->repeats_i_ && alternative_cons_l_) + if (done_count_ < mus->repeats_i_ && gh_pair_p (alternative_cons_)) { if (mus->volta_fold_b_) - current_iter_p_ = get_iterator_p (alternative_cons_l_->car_); + current_iter_p_ = get_iterator_p (unsmob_music (gh_car (alternative_cons_))); else { - current_iter_p_ = get_iterator_p (mus->repeat_body_p_); + current_iter_p_ = get_iterator_p (mus->body ()); do_main_b_ = true; } } @@ -113,22 +113,23 @@ Unfolded_repeat_iterator::next_moment () const void Unfolded_repeat_iterator::construct_children () { - Repeated_music const* mus =dynamic_cast (music_l_); - alternative_cons_l_ = (mus->alternatives_p_) - ? mus->alternatives_p_->music_p_list_p_->head_ - : 0; + Repeated_music * mus =dynamic_cast (music_l_); + + alternative_cons_ = (mus->alternatives ()) + ? mus->alternatives ()->music_list () + : SCM_EOL; - for (Cons *p = alternative_cons_l_; p; p = p->next_) + for (SCM p = alternative_cons_; gh_pair_p (p); p = gh_cdr (p)) alternative_count_i_ ++; - if (mus->repeat_body_p_) + if (mus->body ()) { - current_iter_p_ = get_iterator_p (mus->repeat_body_p_); + current_iter_p_ = get_iterator_p (mus->body ()); do_main_b_ = true; } - else if (alternative_cons_l_) + else if (gh_pair_p (alternative_cons_)) { - current_iter_p_ = get_iterator_p (alternative_cons_l_->car_); + current_iter_p_ = get_iterator_p (unsmob_music (gh_car (alternative_cons_))); do_main_b_ = false; } } @@ -142,7 +143,7 @@ Unfolded_repeat_iterator::do_process_and_next (Moment m) if (yeah) set_translator (yeah->report_to_l ()); else - music_l_->warning ( _("no one to print a volta bracket")); + music_l_->origin ()->warning ( _("no one to print a volta bracket")); } while (1) { @@ -172,7 +173,7 @@ Unfolded_repeat_iterator::do_print () const } Music_iterator* -Unfolded_repeat_iterator::try_music_in_children (Music const * m) const +Unfolded_repeat_iterator::try_music_in_children (Music * m) const { return current_iter_p_->try_music (m); } diff --git a/ly/init.ly b/ly/init.ly index fd0a20c879..41308ac2cf 100644 --- a/ly/init.ly +++ b/ly/init.ly @@ -1,10 +1,7 @@ % Toplevel initialisation file. -foo = \tempo 4 = 100 ; - \version "1.3.59"; - \include "declarations.ly"; \maininput diff --git a/mf/feta-nummer-code.mf b/mf/feta-nummer-code.mf new file mode 100644 index 0000000000..a7664589ef --- /dev/null +++ b/mf/feta-nummer-code.mf @@ -0,0 +1,421 @@ +% feta-nummer.mf -- implement bold Orator numerals +% +% part of LilyPond's pretty-but-neat music font +% +% source file of the Feta (not the Font-En-Tja) music font +% +% (c) 1997--2000 Jan Nieuwenhuizen + +fet_begingroup("number") + +define_pixels(height,thick,thick,thin,hair,flare); +define_pixels(foot_top,foot_width); +define_pixels(kuulleke); + +def calc_kuulleke(expr w,alpha) = + begingroup; + save beta; beta=(alpha-90)/2; + save gamma; gamma=(90+alpha)/2; + + penpos1(w/cosd(alpha),alpha); + penpos2(hair,90+beta); + z2=z1l+(1/2hair/tand((alpha+90)/2))*dir(beta); + + penpos3(hair,gamma-90); + z3=z1r-(1/2hair/tand((90-alpha)/2))*dir(gamma); + z4=z1+kuulleke*dir(alpha-90); + endgroup; + enddef; + +% should make generic macro? +% +def draw_foot(expr xpos) = + begingroup; + clearxy; + penpos1(thick,0); + z1=(xpos,foot_top); + penpos2(foot_width,0); + z2=(x1,0); + penpos3(hair,-90); + z3r=z2r; + penpos4(hair,90); + z4l=z2l; + z5=(x1,kuulleke); + penlabels(1,2,3,4); + fill z1..{right}z1r{down}..{right}z3l..z3r{left}..z5 + ..{left}z4l..z4r{right}..{up}z1l{right}..z1..cycle; + endgroup; + enddef; + +def draw_six = + set_char_box(0, 2/3height#*widen, 0, height#); + message "w:"&decimal w; + message "h:"&decimal h; + + penpos1(thin,90); + z1=(thick,h/2+thin-hair/2); + penpos2(hair,90); + + z2=(w/2,y1); + penpos3(7/8thick,0); + % yup, should use the path fract [] "everywhere" + z3r=(w,1/2[0,y1]); + penpos4(hair,-90); + z4r=(x2,0); + penpos5(7/8thick,180); + z5r=(0,y1); + penpos6(hair,90); + z6r=(w-flare,h); + penpos7(7/8thick,180); + z7r=(0,h/2); + penpos10(7/8thick,180); + z10r=(0,y3); + penlabels(1,2,3,4,5,6,7,8,9,10,11); + save t; t=tense; + fill z7{right}..z2r{right}..tension t..z3r{down} + ..tension t..z4r{left} + ..tension t..z7r{up}..tension t..z6r{right} + ..z6l{left}..tension t..z7l{down}..z10l{up}..cycle; + draw_flare(z6r,0,-90,hair,flare); + unfill z2l{right}..tension t..z3l{down}..tension t + ..z4l{left}..tension t..z10l{up}..tension t..cycle; + enddef; + +save dot_diam; +dot_diam# = 7/8flare#; +define_pixels(dot_diam); + + +code := 43; % , = 44 + +% urg +fet_beginchar("Numeral comma", ",", "comma") + set_char_box(0, dot_diam#, 3/2dot_diam#, dot_diam#); + pickup pencircle scaled dot_diam; + draw (dot_diam/2,dot_diam/2); + z0=(w/3,0); + alpha=65; + penpos1(thin,alpha+90); + z1l=(w/2,-1.5h+hair); + z2=(w,h/2); + pickup pencircle; + filldraw z1l{dir(alpha)}..{up}z2..{z0-z2}z0{right}..{dir(180+alpha)}z1r..cycle; + labels(0,1,2); + penlabels(1); +fet_endchar; + +fet_beginchar("Numeral dash", "-", "dash") + set_char_box(0, height#/3, 0, height#); + pickup pencircle scaled thin; + lft x1 = -b; + rt x2 = w; + y1 = y2 = h/3; + draw z1 .. z2; +fet_endchar; + +fet_beginchar("Numeral dot", ".", "dot") + set_char_box(0, dot_diam#, 0, dot_diam#); + pickup pencircle scaled dot_diam; + draw (dot_diam/2,dot_diam/2); +fet_endchar; + + +% skip slash + +code := 47; % 0 = 48 + +fet_beginchar("Numeral 0", "0", "zero") +% set_char_box(0, 4/5height#*widen, 0, height#); + set_char_box(0, 11/15height#*widen, 0, height#); + message "w:"&decimal w; + message "h:"&decimal h; + penpos1(thin,90); + z1r=(w/2,h); + penpos2(thick,180); + z2r=(0,h/2); + penpos3(thin,-90); + z3r=(w/2,0); + penpos4(thick,0); + z4r=(w,h/2); + fill z1r..z2r..z3r..z4r..cycle; + save t; t=1/tense; + penlabels(1,2,3,4); + unfill z1l..tension t..z2l..tension t..z3l + ..tension t..z4l..tension t..cycle; +fet_endchar; + +fet_beginchar("Numeral 1", "1", "one") +% set_char_box(0, 19/30height#*widen, 0, height#); + set_char_box(0, 1/2foot_width#+3/2thick#+1/2hair#, 0, height#); + message "w:"&decimal w; + message "h:"&decimal h; + + save alpha; alpha=0; + calc_kuulleke(thick,alpha); + z1=(3/2thick,height); + + penpos5(thick,0); + z5=(x1,foot_top); + + z6=(0,h/2); + save beta; beta=angle(z1l-z6); + penpos7(thin,beta-90); + z7l=z6; + penpos8(thin/cosd(beta),-90); + z8l=z1l; + penpos9(thin,beta-90); + z9r=z8r+(thin/cosd(beta))*(0,-1); + penlabels(1,2,3,4,5,6,7,8,9); + save gamma; gamma=angle(length(z1r-z1),+2kuulleke); + fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l..z3r{down} + ..{down}z5r{left}..z5..{left}z5l{up}..{up}z2l..cycle; + fill z7l{dir(beta)}..{dir(beta)}z1l..z2r..z9r{up} + ..z9l{dir(180+beta)}..{dir(180+beta)}z7r..cycle; + penlabels(7,8,9); + + draw_foot(x1); +fet_endchar; + +fet_beginchar("Numeral 2", "2", "two") + set_char_box(0, 11/15height#*widen, 0, height#); + message "w:"&decimal w; + message "h:"&decimal h; + clearxy; + save alpha; alpha=-45*widen; + save beta; beta=85; + save gamma; gamma=beta-10; + save theta; theta=20/widen; + penpos1(hair,90+beta); + z1=(0,0)+(1/2sqrt(2)*hair)*dir(45); + penpos3(hair,90+gamma); + z3=(w,thick)+(1/2sqrt(2)*hair)*dir(-135); + penpos2(thick,90+alpha); + x2-x1=x3-x2; y2=11/16thick/widen; + fill z1r{dir(beta)}..{dir(alpha)}z2r..{dir(gamma)}z3r + ..z3l{dir(180+gamma)}..{dir(180+alpha)}z2l + ..{dir(180+beta)}z1l..cycle; + + penpos4(thick,0); + z4r=(w-thin/2,.72h); + penpos5(thin,90); + z5r=(1/2hair+flare,h); + penlabels(1,2,3,4); + penlabels(5,6); + save t; t=tense; + fill z1l{dir(beta)}..tension t..z4r{up} + ..tension t..z5r{left}..z5l{right} + ..z4l{down}..tension t + ..{dir(180+beta)}z1r..cycle; + draw_flare(z5r,180,90,thin,flare); +fet_endchar; + +fet_beginchar("Numeral 3", "3", "three") + set_char_box(0, 2/3height#*widen, 0, height#); + message "w:"&decimal w; + message "h:"&decimal h; + penpos1(hair,-90); + z1l=(17/16thick,h); + penpos2(7/8thick,180); + z2l=(w-thick/8,3/4h+thick/16); + penpos3(thin,90); + z3=(w/2,h/2+1/8thick); + penpos4(thin,90); + z4=(5/8thick+1/2thin,y3); + penpos5(thick,0); + z5r=(w,1/4h+thick/16); + penpos6(hair,-90); + z6r=(9/8thick,0); + penpos7(3/2thin,90); + z7=(x5,y3); + penlabels(1,2,3,4,5,6,7); + save alpha; alpha=25; + save t; t=tense; + fill z1l{right}..tension t..z2l{down}..z7r{dir(180+alpha)} + ..z7l{dir(-alpha)}..z5r{down}..tension t..z6r{left} + ..z6l{right}..tension t..z5l{up} + ..tension t..z3l{left}..z4l{left} + ..z4r{right}..z3r{right}..tension t..z2r{up} + ..tension t..z1r{left}..cycle; + draw_flare(z1l,180,90,hair,7/8flare); + draw_flare(z6r,180,-90,hair,flare); +fet_endchar; + +fet_beginchar("Numeral 4", "4", "four") + set_char_box(0, 4/5height#*widen, 0, height#); + message "w:"&decimal w; + message "h:"&decimal h; + + save alpha; alpha=0; + calc_kuulleke(3/2thick,alpha); + z1r=(w-3/4thick,height); + + z5=(thin,1/4height+thin); + save beta; beta=angle(z3r-z5); + penpos6(thin,-90); + z6l=z5; + penpos7(thin,-90); + y7=y6; x7=w-1/2thin; + penpos8(thin,-alpha); + z8r=z5; + penlabels(1,2,3,4,5,6,7); + save gamma; gamma=angle(length(z1r-z1),+2kuulleke); + fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l + ..z3r{dir(180+beta)}..{dir(180+beta)}z8r{right} + ..{right}z7l..z7r{left}..{left}z6r..z8l{dir(beta)} + ..{up}z2l..cycle; + + clearxy; + + save alpha; alpha=beta; + calc_kuulleke(thick,alpha); + z1r=(w-3/4thick,height-(3/2thin)/cosd(alpha)); + + penpos5(thick,0); + z5=(x1,foot_top); + + save gamma; gamma=angle(length(z1r-z1),+2kuulleke); + fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l + ..z3r{down}..{down}z5r{left}..z5..{left}z5l{up} + ..{up}z2l..cycle; + penlabels(1,2,3,4,5); + + draw_foot(x5); +fet_endchar; + +fet_beginchar("Numeral 5", "5", "five") + set_char_box(0, 7/10height#*widen, 0, height#); + message "w:"&decimal w; + message "h:"&decimal h; + calc_kuulleke(w-thin,0); + z1=(w/2+1/8thick,h); + save alpha; alpha=0; + penpos5(thin,0); + z5l=(x1l,h-15/16thick); + penpos6(hair,90-45); + z6=z5r+1/2hair*dir(-45); + penpos7(thin,0); + z7l=(x1l,h/2+thin-hair); + penlabels(1,2,3,4,5,6,7); + save gamma; gamma=angle(length(z1r-z1),+2kuulleke); + fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l + ..z3r{dir(-135)}..{left}z6r..z6l{down}..z7r{down} + ..z7l{up}..{up}z2l..cycle; + penpos8(thin,90); + z8l=(x7r,y7r-1/16thick); + penpos9(thin,90); + z9=(x11+3/16thick,10/16[y5,y7]); + penpos10(thick,0); + z10r=(w,1/2[y9r,y11r]); + penpos11(hair,-90); + z11r=(9/8thick,0); + penlabels(8,9,10,11); + save beta; beta=45; + save t; t=tense; + fill z8r{dir(beta)}..z9r{right}..tension t..z10r{down} + ..tension t..z11r{left} + ..z11l{right}..tension t..z10l{up}..tension t + ..z9l{left}..z8l{dir(180+beta+10)}..cycle; + draw_flare(z11r,180,-90,hair,flare); +fet_endchar; + +fet_beginchar("Numeral 6", "6", "six") + draw_six; +fet_endchar; + +fet_beginchar("Numeral 7", "7", "seven") + set_char_box(0, 11/15height#*widen, 0, height#); + message "w:"&decimal w; + message "h:"&decimal h; + + save alpha; alpha=-180; +if true: + penpos1(3/2thick,180+alpha); + penpos2(hair,180+alpha-45); + z2=z1l+(1/4sqrt(2)*hair)*dir(alpha-135); + penpos3(hair,180+alpha+45); + z3=z1r+(1/4sqrt(2)*hair)*dir(alpha-45); + z4=z1+kuulleke*dir(alpha-90); +else: + % shit, does not work + calc_kuulleke(3/2thick,-alpha); +fi + z1l=(thin,0); + + save beta; beta=55; + penpos5(thin,90+beta); + z5=(w,h)+(1/2sqrt(2)*thin)*dir(-135); + + save gamma; gamma=angle(length(z1r-z1),+2kuulleke); + save delta; delta=12; + pickup pencircle; + fill z3l{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z2r.. + z2l{dir(beta+delta)}..{dir(beta)}z5r + ..z5l{dir(180+beta)}..{dir(delta-90)}z3r..cycle; + penlabels(1,2,3,4,5); + + clearxy; + save alpha; alpha=-45*widen; + penpos1(1/2thick,90); + z1=(3/2thin,h-(thick+thin)/2); + penpos3(thin,90+beta); + z3=(w,h)+(1/2sqrt(2)*thin)*dir(-135); + penpos2(thick,90+alpha); + x2=1/2[x1,x3]-1/4thick; y2=h-15/16thick+thin*widen; + + penpos4(thin,0); + z4l=(0,h-thin/2); + penpos5(thin,0); + z5l=(0,h/2+thin/2); + + penpos6(9/8thick,90); + z6r=(thin,y1r+2/16thick); + + fill z1r{dir(beta)}..{dir(alpha)}z2r..{dir(beta)}z3r + ..z3l{dir(180+beta)}..{dir(180+alpha)}z2l + ..{dir(180+beta)}z1l..z6l{down}..{down}z5r + ..z5l{up}..{up}z4l..z4r{down}..{down}z6r..{right}cycle; + penlabels(1,2,3,4,5,6); +fet_endchar; + +fet_beginchar("Numeral 8", "8", "eight") + set_char_box(0, 11/15height#*widen, 0, height#); + message "w:"&decimal w; + message "h:"&decimal h; + save alpha; alpha=60; + save beta; beta=alpha-15; + z1=(w/2,h/2+thick/8); + penpos2(hair,90+180+beta); + z2=(w/3,h/2+thin); + penpos3(3/2thin,0); + z3l=(0,h/4+thin/2); + penpos4(hair,90); + z4l=(x1,0); + penpos5(thick,90+90+alpha); + z5=z1+w/4*dir(alpha-90); + penpos6(thick,90+90+alpha); + z6=z1+(w/4-thin/2)*dir(90+alpha); + penpos7(hair,90); + z7r=(x1,h); + penpos8(3/2thin,0); + z8r=(w-thin/2,3/4h+thin/2); + penpos9(hair,90+180+beta); + z9=(2/3w,h/2); + penlabels(1,2,3,4,5,6,7,8,9); + save t; t=tense; + fill z2r{dir(180+beta)}..z3r{down}..z4r{right} + ..z5r{dir(90+alpha)}..z6r{dir(90+alpha)} + ..tension t..z7r{right}..z8r{down}..z9r{dir(180+beta)} + ..z9l{dir(beta)}..z8l{up}..z7l{left}..z6l{dir(alpha-90)} + ..z5l{dir(alpha-90)}..tension t..z4l{left}..z3l{up} + ..z2l{dir(beta)}..cycle; +fet_endchar; + +fet_beginchar("Numeral 9", "9", "nine") + draw_six; +% xy_mirror_char; + currentpicture := currentpicture scaled -1; + currentpicture := currentpicture shifted (w,h); +fet_endchar; + +fet_endgroup("number") + diff --git a/mf/feta-nummer.mf b/mf/feta-nummer.mf index a7664589ef..476a2c43fa 100644 --- a/mf/feta-nummer.mf +++ b/mf/feta-nummer.mf @@ -1,421 +1,38 @@ -% feta-nummer.mf -- implement bold Orator numerals -% +% feta-nummer-generic.mf % part of LilyPond's pretty-but-neat music font -% -% source file of the Feta (not the Font-En-Tja) music font -% -% (c) 1997--2000 Jan Nieuwenhuizen -fet_begingroup("number") +test:=0; -define_pixels(height,thick,thick,thin,hair,flare); -define_pixels(foot_top,foot_width); -define_pixels(kuulleke); +input feta-autometric; +input feta-macros; +input feta-params; -def calc_kuulleke(expr w,alpha) = - begingroup; - save beta; beta=(alpha-90)/2; - save gamma; gamma=(90+alpha)/2; +%blot_diameter# = .4pt#; - penpos1(w/cosd(alpha),alpha); - penpos2(hair,90+beta); - z2=z1l+(1/2hair/tand((alpha+90)/2))*dir(beta); +fet_beginfont("feta-nummer", design_size); +mode_setup; - penpos3(hair,gamma-90); - z3=z1r-(1/2hair/tand((90-alpha)/2))*dir(gamma); - z4=z1+kuulleke*dir(alpha-90); - endgroup; - enddef; +height#:=designsize; -% should make generic macro? -% -def draw_foot(expr xpos) = - begingroup; - clearxy; - penpos1(thick,0); - z1=(xpos,foot_top); - penpos2(foot_width,0); - z2=(x1,0); - penpos3(hair,-90); - z3r=z2r; - penpos4(hair,90); - z4l=z2l; - z5=(x1,kuulleke); - penlabels(1,2,3,4); - fill z1..{right}z1r{down}..{right}z3l..z3r{left}..z5 - ..{left}z4l..z4r{right}..{up}z1l{right}..z1..cycle; - endgroup; - enddef; +font_x_height height#; -def draw_six = - set_char_box(0, 2/3height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; +save b,h; 4h+b=1.15; 10h+b=1; +fatten:=designsize*h+b; +save b,h; 4h+b=1.05; 10h+b=1; +widen:=designsize*h+b; +tense=0.85; +thick#:=7/30height#*fatten; +thin#:=thick#/4*fatten; +hair#:=blot_diameter#; +flare#:=9/8thick#/fatten; +save b,h; 4h+b=1/8; 10h+b=1/6; +kuulleke#:=thick#*designsize*h+b; +foot_top#:=thick#; +foot_width#:=9/4thick#; - penpos1(thin,90); - z1=(thick,h/2+thin-hair/2); - penpos2(hair,90); - - z2=(w/2,y1); - penpos3(7/8thick,0); - % yup, should use the path fract [] "everywhere" - z3r=(w,1/2[0,y1]); - penpos4(hair,-90); - z4r=(x2,0); - penpos5(7/8thick,180); - z5r=(0,y1); - penpos6(hair,90); - z6r=(w-flare,h); - penpos7(7/8thick,180); - z7r=(0,h/2); - penpos10(7/8thick,180); - z10r=(0,y3); - penlabels(1,2,3,4,5,6,7,8,9,10,11); - save t; t=tense; - fill z7{right}..z2r{right}..tension t..z3r{down} - ..tension t..z4r{left} - ..tension t..z7r{up}..tension t..z6r{right} - ..z6l{left}..tension t..z7l{down}..z10l{up}..cycle; - draw_flare(z6r,0,-90,hair,flare); - unfill z2l{right}..tension t..z3l{down}..tension t - ..z4l{left}..tension t..z10l{up}..tension t..cycle; - enddef; +input feta-nummer-code; -save dot_diam; -dot_diam# = 7/8flare#; -define_pixels(dot_diam); +fet_endfont("feta-nummer"); -code := 43; % , = 44 - -% urg -fet_beginchar("Numeral comma", ",", "comma") - set_char_box(0, dot_diam#, 3/2dot_diam#, dot_diam#); - pickup pencircle scaled dot_diam; - draw (dot_diam/2,dot_diam/2); - z0=(w/3,0); - alpha=65; - penpos1(thin,alpha+90); - z1l=(w/2,-1.5h+hair); - z2=(w,h/2); - pickup pencircle; - filldraw z1l{dir(alpha)}..{up}z2..{z0-z2}z0{right}..{dir(180+alpha)}z1r..cycle; - labels(0,1,2); - penlabels(1); -fet_endchar; - -fet_beginchar("Numeral dash", "-", "dash") - set_char_box(0, height#/3, 0, height#); - pickup pencircle scaled thin; - lft x1 = -b; - rt x2 = w; - y1 = y2 = h/3; - draw z1 .. z2; -fet_endchar; - -fet_beginchar("Numeral dot", ".", "dot") - set_char_box(0, dot_diam#, 0, dot_diam#); - pickup pencircle scaled dot_diam; - draw (dot_diam/2,dot_diam/2); -fet_endchar; - - -% skip slash - -code := 47; % 0 = 48 - -fet_beginchar("Numeral 0", "0", "zero") -% set_char_box(0, 4/5height#*widen, 0, height#); - set_char_box(0, 11/15height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - penpos1(thin,90); - z1r=(w/2,h); - penpos2(thick,180); - z2r=(0,h/2); - penpos3(thin,-90); - z3r=(w/2,0); - penpos4(thick,0); - z4r=(w,h/2); - fill z1r..z2r..z3r..z4r..cycle; - save t; t=1/tense; - penlabels(1,2,3,4); - unfill z1l..tension t..z2l..tension t..z3l - ..tension t..z4l..tension t..cycle; -fet_endchar; - -fet_beginchar("Numeral 1", "1", "one") -% set_char_box(0, 19/30height#*widen, 0, height#); - set_char_box(0, 1/2foot_width#+3/2thick#+1/2hair#, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - - save alpha; alpha=0; - calc_kuulleke(thick,alpha); - z1=(3/2thick,height); - - penpos5(thick,0); - z5=(x1,foot_top); - - z6=(0,h/2); - save beta; beta=angle(z1l-z6); - penpos7(thin,beta-90); - z7l=z6; - penpos8(thin/cosd(beta),-90); - z8l=z1l; - penpos9(thin,beta-90); - z9r=z8r+(thin/cosd(beta))*(0,-1); - penlabels(1,2,3,4,5,6,7,8,9); - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l..z3r{down} - ..{down}z5r{left}..z5..{left}z5l{up}..{up}z2l..cycle; - fill z7l{dir(beta)}..{dir(beta)}z1l..z2r..z9r{up} - ..z9l{dir(180+beta)}..{dir(180+beta)}z7r..cycle; - penlabels(7,8,9); - - draw_foot(x1); -fet_endchar; - -fet_beginchar("Numeral 2", "2", "two") - set_char_box(0, 11/15height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - clearxy; - save alpha; alpha=-45*widen; - save beta; beta=85; - save gamma; gamma=beta-10; - save theta; theta=20/widen; - penpos1(hair,90+beta); - z1=(0,0)+(1/2sqrt(2)*hair)*dir(45); - penpos3(hair,90+gamma); - z3=(w,thick)+(1/2sqrt(2)*hair)*dir(-135); - penpos2(thick,90+alpha); - x2-x1=x3-x2; y2=11/16thick/widen; - fill z1r{dir(beta)}..{dir(alpha)}z2r..{dir(gamma)}z3r - ..z3l{dir(180+gamma)}..{dir(180+alpha)}z2l - ..{dir(180+beta)}z1l..cycle; - - penpos4(thick,0); - z4r=(w-thin/2,.72h); - penpos5(thin,90); - z5r=(1/2hair+flare,h); - penlabels(1,2,3,4); - penlabels(5,6); - save t; t=tense; - fill z1l{dir(beta)}..tension t..z4r{up} - ..tension t..z5r{left}..z5l{right} - ..z4l{down}..tension t - ..{dir(180+beta)}z1r..cycle; - draw_flare(z5r,180,90,thin,flare); -fet_endchar; - -fet_beginchar("Numeral 3", "3", "three") - set_char_box(0, 2/3height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - penpos1(hair,-90); - z1l=(17/16thick,h); - penpos2(7/8thick,180); - z2l=(w-thick/8,3/4h+thick/16); - penpos3(thin,90); - z3=(w/2,h/2+1/8thick); - penpos4(thin,90); - z4=(5/8thick+1/2thin,y3); - penpos5(thick,0); - z5r=(w,1/4h+thick/16); - penpos6(hair,-90); - z6r=(9/8thick,0); - penpos7(3/2thin,90); - z7=(x5,y3); - penlabels(1,2,3,4,5,6,7); - save alpha; alpha=25; - save t; t=tense; - fill z1l{right}..tension t..z2l{down}..z7r{dir(180+alpha)} - ..z7l{dir(-alpha)}..z5r{down}..tension t..z6r{left} - ..z6l{right}..tension t..z5l{up} - ..tension t..z3l{left}..z4l{left} - ..z4r{right}..z3r{right}..tension t..z2r{up} - ..tension t..z1r{left}..cycle; - draw_flare(z1l,180,90,hair,7/8flare); - draw_flare(z6r,180,-90,hair,flare); -fet_endchar; - -fet_beginchar("Numeral 4", "4", "four") - set_char_box(0, 4/5height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - - save alpha; alpha=0; - calc_kuulleke(3/2thick,alpha); - z1r=(w-3/4thick,height); - - z5=(thin,1/4height+thin); - save beta; beta=angle(z3r-z5); - penpos6(thin,-90); - z6l=z5; - penpos7(thin,-90); - y7=y6; x7=w-1/2thin; - penpos8(thin,-alpha); - z8r=z5; - penlabels(1,2,3,4,5,6,7); - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l - ..z3r{dir(180+beta)}..{dir(180+beta)}z8r{right} - ..{right}z7l..z7r{left}..{left}z6r..z8l{dir(beta)} - ..{up}z2l..cycle; - - clearxy; - - save alpha; alpha=beta; - calc_kuulleke(thick,alpha); - z1r=(w-3/4thick,height-(3/2thin)/cosd(alpha)); - - penpos5(thick,0); - z5=(x1,foot_top); - - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l - ..z3r{down}..{down}z5r{left}..z5..{left}z5l{up} - ..{up}z2l..cycle; - penlabels(1,2,3,4,5); - - draw_foot(x5); -fet_endchar; - -fet_beginchar("Numeral 5", "5", "five") - set_char_box(0, 7/10height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - calc_kuulleke(w-thin,0); - z1=(w/2+1/8thick,h); - save alpha; alpha=0; - penpos5(thin,0); - z5l=(x1l,h-15/16thick); - penpos6(hair,90-45); - z6=z5r+1/2hair*dir(-45); - penpos7(thin,0); - z7l=(x1l,h/2+thin-hair); - penlabels(1,2,3,4,5,6,7); - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l - ..z3r{dir(-135)}..{left}z6r..z6l{down}..z7r{down} - ..z7l{up}..{up}z2l..cycle; - penpos8(thin,90); - z8l=(x7r,y7r-1/16thick); - penpos9(thin,90); - z9=(x11+3/16thick,10/16[y5,y7]); - penpos10(thick,0); - z10r=(w,1/2[y9r,y11r]); - penpos11(hair,-90); - z11r=(9/8thick,0); - penlabels(8,9,10,11); - save beta; beta=45; - save t; t=tense; - fill z8r{dir(beta)}..z9r{right}..tension t..z10r{down} - ..tension t..z11r{left} - ..z11l{right}..tension t..z10l{up}..tension t - ..z9l{left}..z8l{dir(180+beta+10)}..cycle; - draw_flare(z11r,180,-90,hair,flare); -fet_endchar; - -fet_beginchar("Numeral 6", "6", "six") - draw_six; -fet_endchar; - -fet_beginchar("Numeral 7", "7", "seven") - set_char_box(0, 11/15height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - - save alpha; alpha=-180; -if true: - penpos1(3/2thick,180+alpha); - penpos2(hair,180+alpha-45); - z2=z1l+(1/4sqrt(2)*hair)*dir(alpha-135); - penpos3(hair,180+alpha+45); - z3=z1r+(1/4sqrt(2)*hair)*dir(alpha-45); - z4=z1+kuulleke*dir(alpha-90); -else: - % shit, does not work - calc_kuulleke(3/2thick,-alpha); -fi - z1l=(thin,0); - - save beta; beta=55; - penpos5(thin,90+beta); - z5=(w,h)+(1/2sqrt(2)*thin)*dir(-135); - - save gamma; gamma=angle(length(z1r-z1),+2kuulleke); - save delta; delta=12; - pickup pencircle; - fill z3l{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z2r.. - z2l{dir(beta+delta)}..{dir(beta)}z5r - ..z5l{dir(180+beta)}..{dir(delta-90)}z3r..cycle; - penlabels(1,2,3,4,5); - - clearxy; - save alpha; alpha=-45*widen; - penpos1(1/2thick,90); - z1=(3/2thin,h-(thick+thin)/2); - penpos3(thin,90+beta); - z3=(w,h)+(1/2sqrt(2)*thin)*dir(-135); - penpos2(thick,90+alpha); - x2=1/2[x1,x3]-1/4thick; y2=h-15/16thick+thin*widen; - - penpos4(thin,0); - z4l=(0,h-thin/2); - penpos5(thin,0); - z5l=(0,h/2+thin/2); - - penpos6(9/8thick,90); - z6r=(thin,y1r+2/16thick); - - fill z1r{dir(beta)}..{dir(alpha)}z2r..{dir(beta)}z3r - ..z3l{dir(180+beta)}..{dir(180+alpha)}z2l - ..{dir(180+beta)}z1l..z6l{down}..{down}z5r - ..z5l{up}..{up}z4l..z4r{down}..{down}z6r..{right}cycle; - penlabels(1,2,3,4,5,6); -fet_endchar; - -fet_beginchar("Numeral 8", "8", "eight") - set_char_box(0, 11/15height#*widen, 0, height#); - message "w:"&decimal w; - message "h:"&decimal h; - save alpha; alpha=60; - save beta; beta=alpha-15; - z1=(w/2,h/2+thick/8); - penpos2(hair,90+180+beta); - z2=(w/3,h/2+thin); - penpos3(3/2thin,0); - z3l=(0,h/4+thin/2); - penpos4(hair,90); - z4l=(x1,0); - penpos5(thick,90+90+alpha); - z5=z1+w/4*dir(alpha-90); - penpos6(thick,90+90+alpha); - z6=z1+(w/4-thin/2)*dir(90+alpha); - penpos7(hair,90); - z7r=(x1,h); - penpos8(3/2thin,0); - z8r=(w-thin/2,3/4h+thin/2); - penpos9(hair,90+180+beta); - z9=(2/3w,h/2); - penlabels(1,2,3,4,5,6,7,8,9); - save t; t=tense; - fill z2r{dir(180+beta)}..z3r{down}..z4r{right} - ..z5r{dir(90+alpha)}..z6r{dir(90+alpha)} - ..tension t..z7r{right}..z8r{down}..z9r{dir(180+beta)} - ..z9l{dir(beta)}..z8l{up}..z7l{left}..z6l{dir(alpha-90)} - ..z5l{dir(alpha-90)}..tension t..z4l{left}..z3l{up} - ..z2l{dir(beta)}..cycle; -fet_endchar; - -fet_beginchar("Numeral 9", "9", "nine") - draw_six; -% xy_mirror_char; - currentpicture := currentpicture scaled -1; - currentpicture := currentpicture shifted (w,h); -fet_endchar; - -fet_endgroup("number") - +end. diff --git a/mf/feta-nummer10.mf b/mf/feta-nummer10.mf index f3f25459d8..1a802df0dd 100644 --- a/mf/feta-nummer10.mf +++ b/mf/feta-nummer10.mf @@ -1,9 +1,10 @@ + % feta-nummer10.mf % part of LilyPond's pretty-but-neat music font -size:=10; +design_size:=10; -input feta-nummer-generic; +input feta-nummer; end. diff --git a/mf/feta-nummer12.mf b/mf/feta-nummer12.mf index fe599fdbdc..315caebb43 100644 --- a/mf/feta-nummer12.mf +++ b/mf/feta-nummer12.mf @@ -1,9 +1,9 @@ % feta-nummer10.mf % part of LilyPond's pretty-but-neat music font -size:=12; +design_size:=12; -input feta-nummer-generic; +input feta-nummer; end. diff --git a/mf/feta-nummer14.mf b/mf/feta-nummer14.mf new file mode 100644 index 0000000000..dc966e6be4 --- /dev/null +++ b/mf/feta-nummer14.mf @@ -0,0 +1,2 @@ +design_size := 14.4; +input feta-nummer; diff --git a/mf/feta-nummer3.mf b/mf/feta-nummer3.mf index d9c79640cb..8ac70299c6 100644 --- a/mf/feta-nummer3.mf +++ b/mf/feta-nummer3.mf @@ -2,9 +2,9 @@ % part of LilyPond's pretty-but-neat music font % size:=4; -size:=16*3/15; +design_size:=16*3/15; -input feta-nummer-generic.mf; +input feta-nummer.mf; end. diff --git a/mf/feta-nummer4.mf b/mf/feta-nummer4.mf index efa2f9ac48..97b59333d3 100644 --- a/mf/feta-nummer4.mf +++ b/mf/feta-nummer4.mf @@ -2,9 +2,9 @@ % part of LilyPond's pretty-but-neat music font % size:=4; -size:=16*4/15; +design_size:=16*4/15; -input feta-nummer-generic.mf; +input feta-nummer.mf; end. diff --git a/mf/feta-nummer5.mf b/mf/feta-nummer5.mf index 0a9fb3ffa3..21c474f1a7 100644 --- a/mf/feta-nummer5.mf +++ b/mf/feta-nummer5.mf @@ -2,9 +2,9 @@ % part of LilyPond's pretty-but-neat music font % size:=5; -size:=20*4/15; +design_size:=20*4/15; -input feta-nummer-generic.mf; +input feta-nummer.mf; end. diff --git a/mf/feta-nummer6.mf b/mf/feta-nummer6.mf index 3daff78c4e..fbda92971a 100644 --- a/mf/feta-nummer6.mf +++ b/mf/feta-nummer6.mf @@ -2,9 +2,9 @@ % part of LilyPond's pretty-but-neat music font % size:=5; -size:=20*6/15; +design_size:=20*6/15; -input feta-nummer-generic.mf; +input feta-nummer.mf; end. diff --git a/mf/feta-nummer7.mf b/mf/feta-nummer7.mf index a098d0f62a..fcc15d6b8f 100644 --- a/mf/feta-nummer7.mf +++ b/mf/feta-nummer7.mf @@ -2,9 +2,9 @@ % part of LilyPond's pretty-but-neat music font % size:=5; -size:=26*4/15; +design_size:=26*4/15; -input feta-nummer-generic.mf; +input feta-nummer.mf; end. diff --git a/mf/feta-nummer8.mf b/mf/feta-nummer8.mf index 874cb8f8a0..d790057895 100644 --- a/mf/feta-nummer8.mf +++ b/mf/feta-nummer8.mf @@ -1,9 +1,7 @@ % feta-nummer8.mf % part of LilyPond's pretty-but-neat music font -size:=8; +design_size:=8; -input feta-nummer-generic.mf; - -end. +input feta-nummer.mf; diff --git a/scm/lily.scm b/scm/lily.scm index 7088dd1dab..99f21eb25b 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -395,6 +395,17 @@ (define (volta h w thick vert_start vert_end) (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end))) + (define (define-origin file line col) + ; use this for column positions + (string-append "\\special{src:" (number->string line) ":" + (number->string col) " " file "}") + + ; line numbers only: + ;(string-append "\\special{src:" (number->string line) " " file "}") +) + ; no-origin not yet supported by Xdvi + (define (no-origin) "") + ;; TeX ;; The procedures listed below form the public interface of TeX-scm. ;; (should merge the 2 lists) @@ -427,6 +438,8 @@ (define text ,text) (define tuplet ,tuplet) (define volta ,volta) + (define define-origin ,define-origin) + (define no-origin ,no-origin) )) ((eq? action-name 'beam) beam) @@ -645,6 +658,9 @@ "\n unknown\n") + (define (define-origin a b c ) "") + (define (no-origin) "") + ;; PS (cond ((eq? action-name 'all-definitions) `(begin @@ -676,6 +692,8 @@ (define stop-line ,stop-line) (define stop-last-line ,stop-line) (define text ,text) + (define no-origin ,no-origin) + (define define-origin ,define-origin) )) ((eq? action-name 'tuplet) tuplet) ((eq? action-name 'beam) beam) -- 2.39.5