From: Han-Wen Nienhuys Date: Sat, 28 Sep 2002 12:54:28 +0000 (+0000) Subject: * scm/engraver-documentation-lib.scm X-Git-Tag: release/1.7.1~8 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1b9fc29140bd1d9345f784595afd22158876dfb7;p=lilypond.git * scm/engraver-documentation-lib.scm (engraver-accepts-music-types?): add links from music to engraver, from music-type to engraver. * lily/include/command-request.hh: removed lily/include/musical-request.hh: removed. Removed all _req classes except Key_change_req. Changes throughout. --- diff --git a/ChangeLog b/ChangeLog index 9c99565c10..64a4fd9a93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-09-28 Han-Wen Nienhuys + + * scm/engraver-documentation-lib.scm + (engraver-accepts-music-types?): add links from music to engraver, + from music-type to engraver. + + * lily/include/command-request.hh: removed + lily/include/musical-request.hh: removed. Removed all _req classes + except Key_change_req. Changes throughout. + 2002-09-28 Jan Nieuwenhuizen * lily/tuplet-engraver.cc (try_music): Compile kludge. diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 49d0a20577..803fa1a524 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -5,8 +5,8 @@ Modified 2001-2002 by Rune Zedeler */ -#include "musical-request.hh" -#include "command-request.hh" +#include "request.hh" + #include "item.hh" #include "tie.hh" #include "rhythmic-head.hh" diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc index 9d5468cb92..5a664a8cc2 100644 --- a/lily/ambitus-engraver.cc +++ b/lily/ambitus-engraver.cc @@ -10,7 +10,7 @@ #include "item.hh" #include "note-head.hh" #include "staff-symbol-referencer.hh" -#include "musical-request.hh" +#include "request.hh" #include "pitch.hh" /* diff --git a/lily/arpeggio-engraver.cc b/lily/arpeggio-engraver.cc index 93767fc0dd..008b8a0057 100644 --- a/lily/arpeggio-engraver.cc +++ b/lily/arpeggio-engraver.cc @@ -9,7 +9,7 @@ #include "engraver.hh" #include "group-interface.hh" #include "item.hh" -#include "musical-request.hh" +#include "request.hh" #include "arpeggio.hh" #include "stem.hh" #include "rhythmic-head.hh" diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 932cadc95e..2d16ffcf0b 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -8,7 +8,7 @@ */ #include "beaming.hh" -#include "musical-request.hh" +#include "request.hh" #include "beam.hh" #include "stem.hh" #include "warn.hh" @@ -18,6 +18,7 @@ #include "engraver.hh" #include "item.hh" #include "spanner.hh" +#include "duration.hh" /* TODO: figure what to do in grace? diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index a2ab5be5e5..64f67ca43a 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -10,7 +10,7 @@ #include "music.hh" #include "auto-change-iterator.hh" #include "translator-group.hh" -#include "musical-request.hh" +#include "request.hh" diff --git a/lily/bar-check-iterator.cc b/lily/bar-check-iterator.cc index 3de1771365..5dd0266768 100644 --- a/lily/bar-check-iterator.cc +++ b/lily/bar-check-iterator.cc @@ -9,7 +9,7 @@ */ #include "simple-music-iterator.hh" -#include "command-request.hh" +#include "request.hh" #include "translator-group.hh" /* diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index 926654e4a9..8b4cc844e7 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -9,7 +9,7 @@ #include "bar-line.hh" #include "score-engraver.hh" -#include "musical-request.hh" +#include "request.hh" #include "engraver-group-engraver.hh" #include "warn.hh" #include "item.hh" diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index bb9ac59bc3..a4ad770400 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -8,7 +8,7 @@ */ #include "engraver-group-engraver.hh" #include "engraver.hh" -#include "musical-request.hh" +#include "request.hh" #include "beam.hh" #include "stem.hh" #include "warn.hh" diff --git a/lily/break-algorithm.cc b/lily/break-algorithm.cc index 65cd2825d3..bfacc859f3 100644 --- a/lily/break-algorithm.cc +++ b/lily/break-algorithm.cc @@ -13,7 +13,7 @@ #include "paper-score.hh" #include "paper-column.hh" #include "cpu-timer.hh" -#include "command-request.hh" + #include "simple-spacer.hh" #include "group-interface.hh" diff --git a/lily/breathing-sign-engraver.cc b/lily/breathing-sign-engraver.cc index 4ea98cf970..97c6cb4ecf 100644 --- a/lily/breathing-sign-engraver.cc +++ b/lily/breathing-sign-engraver.cc @@ -15,12 +15,12 @@ TODO: #include "staff-symbol-referencer.hh" #include "breathing-sign.hh" -#include "musical-request.hh" -#include "command-request.hh" +#include "request.hh" + #include "engraver-group-engraver.hh" #include "item.hh" #include "engraver.hh" -#include "command-request.hh" + class Breathing_sign_engraver : public Engraver { public: diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 79ad18fc2b..3985c2467b 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -9,7 +9,7 @@ #include "engraver.hh" #include "chord-name.hh" #include "chord.hh" -#include "musical-request.hh" +#include "request.hh" #include "paper-def.hh" #include "font-interface.hh" #include "paper-def.hh" diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 9781fa377d..d94d752553 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -13,7 +13,7 @@ #include "stem.hh" #include "rhythmic-head.hh" #include "engraver-group-engraver.hh" -#include "musical-request.hh" +#include "request.hh" #include "warn.hh" #include "misc.hh" #include "note-head.hh" diff --git a/lily/chord.cc b/lily/chord.cc index 196cf0e0f4..adc2315048 100644 --- a/lily/chord.cc +++ b/lily/chord.cc @@ -7,11 +7,11 @@ */ #include "chord.hh" -#include "musical-request.hh" +#include "request.hh" #include "warn.hh" #include "music-list.hh" -#include "musical-request.hh" +#include "request.hh" SCM diff --git a/lily/command-request.cc b/lily/command-request.cc index 5d15bc66dc..e69de29bb2 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -1,101 +0,0 @@ -/* - command-request.cc -- implement non-musical reqs - - source file of the GNU LilyPond music typesetter - - (c) 1997--2002 Han-Wen Nienhuys -*/ - -#include "command-request.hh" - -#include "musical-request.hh" - - - -LY_DEFINE(transpose_key_alist,"transpose-key-alist", - 2, 0,0, (SCM l, SCM pitch), - "Make a new key alist of @var{l} transposed by pitch @var{pitch}") -{ - SCM newlist = SCM_EOL; - Pitch *p = unsmob_pitch (pitch); - - for (SCM s = l; gh_pair_p (s); s = ly_cdr (s)) - { - SCM key = ly_caar (s); - SCM alter = ly_cdar (s); - if (gh_pair_p (key)) - { - Pitch orig (gh_scm2int (ly_car (key)), - gh_scm2int (ly_cdr (key)), - gh_scm2int (alter)); - - orig.transpose (*p); - - SCM key = gh_cons (scm_int2num (orig.get_octave ()), - scm_int2num (orig.notename_)); - - newlist = gh_cons (gh_cons (key, scm_int2num (orig.alteration_)), - newlist); - } - else if (gh_number_p (key)) - { - Pitch orig (0, gh_scm2int (key), gh_scm2int (alter)); - orig.transpose (*p); - - key =scm_int2num (orig.notename_); - alter = scm_int2num (orig.alteration_); - newlist = gh_cons (gh_cons (key, alter), newlist); - } - } - return scm_reverse_x (newlist, SCM_EOL); -} - -void -Key_change_req::transpose (Pitch p) -{ - SCM pa = get_mus_property ("pitch-alist"); - - set_mus_property ("pitch-alist", transpose_key_alist (pa, p.smobbed_copy())); -} - - -bool -alist_equal_p (SCM a, SCM b) -{ - for (SCM s = a; - gh_pair_p (s); s = ly_cdr (s)) - { - SCM key = ly_caar (s); - SCM val = ly_cdar (s); - SCM l = scm_assoc (key, b); - - if (l == SCM_BOOL_F - || !gh_equal_p ( ly_cdr (l), val)) - - return false; - } - return true; -} - -bool -Key_change_req::do_equal_b (Request const * m )const -{ - Key_change_req const * kc =dynamic_cast (m); - - if(!kc) - return false; - return alist_equal_p (get_mus_property ("pitch-alist"), - kc->get_mus_property ("pitch-alist")); -} - - - -ADD_MUSIC (Articulation_req); -ADD_MUSIC (Key_change_req); -ADD_MUSIC (Lyric_req); -ADD_MUSIC (Porrectus_req); -ADD_MUSIC (Rhythmic_req); -ADD_MUSIC (Script_req); -ADD_MUSIC (Span_req); -ADD_MUSIC (Text_script_req); -ADD_MUSIC (Tremolo_req); diff --git a/lily/completion-note-heads-engraver.cc b/lily/completion-note-heads-engraver.cc index 8b8257cc0b..a9caf8a7ac 100644 --- a/lily/completion-note-heads-engraver.cc +++ b/lily/completion-note-heads-engraver.cc @@ -8,7 +8,7 @@ #include "rhythmic-head.hh" #include "paper-def.hh" -#include "musical-request.hh" +#include "request.hh" #include "dots.hh" #include "dot-column.hh" #include "staff-symbol-referencer.hh" diff --git a/lily/custos-engraver.cc b/lily/custos-engraver.cc index eb70aada0e..504b31567f 100644 --- a/lily/custos-engraver.cc +++ b/lily/custos-engraver.cc @@ -15,7 +15,7 @@ #include "note-head.hh" #include "staff-symbol-referencer.hh" #include "warn.hh" -#include "musical-request.hh" +#include "request.hh" /* This class implements an engraver for custos symbols. diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 301628e2c6..95eea397fe 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -8,7 +8,7 @@ #include "warn.hh" #include "dimensions.hh" #include "hairpin.hh" -#include "musical-request.hh" +#include "request.hh" #include "paper-column.hh" #include "note-column.hh" #include "item.hh" @@ -43,7 +43,7 @@ class Dynamic_engraver : public Engraver Spanner * finished_cresc_; Spanner * cresc_; - Text_script_req* script_req_; + Music* script_req_; Music * current_cresc_req_; Drul_array accepted_spanreqs_drul_; @@ -95,10 +95,12 @@ Dynamic_engraver::start_translation_timestep () bool Dynamic_engraver::try_music (Music * m) { - if (dynamic_cast (m) - && m->get_mus_property ("text-type") == ly_symbol2scm ("dynamic")) + if (m->is_mus_type ("dynamic-event")) { - script_req_ = dynamic_cast (m); + /* + TODO: probably broken. + */ + script_req_ = m; return true; } else if (m->is_mus_type ("abort-event")) @@ -162,8 +164,9 @@ Dynamic_engraver::process_music () script_ = new Item (get_property ("DynamicText")); script_->set_grob_property ("text", script_req_->get_mus_property ("text")); + - if (Direction d = script_req_->get_direction ()) + if (Direction d = to_dir (script_req_->get_mus_property ("direction"))) Directional_element_interface::set (line_spanner_, d); Axis_group_interface::add_element (line_spanner_, script_); diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc index 0825066013..ed60b2165f 100644 --- a/lily/dynamic-performer.cc +++ b/lily/dynamic-performer.cc @@ -7,8 +7,8 @@ */ #include "performer.hh" -#include "command-request.hh" -#include "musical-request.hh" + +#include "request.hh" #include "audio-item.hh" /* @@ -124,8 +124,7 @@ Dynamic_performer::try_music (Music* r) { if (!script_req_) { - if (dynamic_cast (r) - && r->get_mus_property ("text-type") == ly_symbol2scm ("dynamic")) + if (r->is_mus_type ("dynamic-event")) // fixme. { script_req_ = r; return true; diff --git a/lily/extender-engraver.cc b/lily/extender-engraver.cc index e11ec694a6..6bde55b284 100644 --- a/lily/extender-engraver.cc +++ b/lily/extender-engraver.cc @@ -7,7 +7,7 @@ */ #include "flower-proto.hh" -#include "musical-request.hh" +#include "request.hh" #include "lyric-extender.hh" #include "paper-column.hh" #include "item.hh" diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc index a2baf1831c..9020cf334e 100644 --- a/lily/figured-bass-engraver.cc +++ b/lily/figured-bass-engraver.cc @@ -1,6 +1,6 @@ #include "engraver.hh" #include "text-item.hh" -#include "musical-request.hh" +#include "request.hh" #include "item.hh" class Figured_bass_engraver : public Engraver diff --git a/lily/fingering-engraver.cc b/lily/fingering-engraver.cc index 2610f49b8b..b571126763 100644 --- a/lily/fingering-engraver.cc +++ b/lily/fingering-engraver.cc @@ -11,7 +11,7 @@ #include "engraver.hh" #include "side-position-interface.hh" #include "item.hh" -#include "musical-request.hh" +#include "request.hh" #include "stem.hh" #include "rhythmic-head.hh" diff --git a/lily/grob-pitch-tuple.cc b/lily/grob-pitch-tuple.cc index fc6e450f99..f55c4f4b7f 100644 --- a/lily/grob-pitch-tuple.cc +++ b/lily/grob-pitch-tuple.cc @@ -8,7 +8,7 @@ source file of the GNU LilyPond music typesetter */ #include "grob-pitch-tuple.hh" #include "pitch.hh" -#include "musical-request.hh" +#include "request.hh" int compare (Grob_pitch_tuple const &a, Grob_pitch_tuple const &b) diff --git a/lily/hyphen-engraver.cc b/lily/hyphen-engraver.cc index c557055288..0ba903ee83 100644 --- a/lily/hyphen-engraver.cc +++ b/lily/hyphen-engraver.cc @@ -5,7 +5,7 @@ */ #include "flower-proto.hh" -#include "musical-request.hh" +#include "request.hh" #include "hyphen-spanner.hh" #include "paper-column.hh" #include "item.hh" diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh deleted file mode 100644 index 7345900a7a..0000000000 --- a/lily/include/command-request.hh +++ /dev/null @@ -1,46 +0,0 @@ -/* - command-request.hh -- declare non-musical requests - - source file of the GNU LilyPond music typesetter - - (c) 1997--2002 Han-Wen Nienhuys -*/ - - -#ifndef COMMANDREQUEST_HH -#define COMMANDREQUEST_HH - -#include "request.hh" -#include "array.hh" -#include "duration.hh" -#include "pitch.hh" - - -class Break_req : public Request { -public: -protected: - VIRTUAL_COPY_CONS (Music); -}; - -class Porrectus_req : public Request { - VIRTUAL_COPY_CONS (Music); -}; - -/** - Handle key changes. -*/ -class Key_change_req : public Request -{ -public: - SCM pitch_alist (); - -protected: - VIRTUAL_COPY_CONS (Music); - bool do_equal_b (Request const * ) const; - void transpose (Pitch d); -}; - -SCM transpose_key_alist (SCM,SCM); - -#endif // COMMANDREQUEST_HH - diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 3dea8a1b68..194398eecd 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -15,7 +15,6 @@ class Adobe_font_metric; class All_font_metrics; -class Articulation_req; class Audio_column; class Audio_dynamic; class Audio_element; @@ -34,30 +33,23 @@ class Auto_change_music; class Axis_group_engraver; class Bar_engraver; class Bar_req_collect_engraver; -class Barcheck_req; class Base_span_bar_engraver; class Beaming_info_list; class Bezier; class Bezier_bow; class Break_algorithm; -class Break_req; -class Breathing_sign_req; -class Busy_playing_req; class Change_iterator; class Change_translator; class Chord_tremolo_iterator; - class Column_x_positions; class Context_specced_music; class Engraver; class Engraver; class Engraver_group_engraver; -class Extender_req; class Folded_repeat_iterator; class Font_metric; class Font_size_engraver; class Global_translator; -class Glissando_req; class Gourlay_breaking; class Grace_engraver_group; class Grace_iterator; @@ -65,13 +57,10 @@ class Grace_music; class Grace_performer_group; class Hara_kiri_engraver; class Hara_kiri_line_group_engraver; -class Hyphen_req; - class Includable_lexer; class Input_file_results; class Input; class Item; -class Key_change_req; class Key_performer; class Keyword_ent; class Keyword_table; @@ -86,11 +75,6 @@ class Lyric_combine_music_iterator; class Lyric_engraver; class Lyric_performer; class Lyric_phrasing_engraver; -class Lyric_req; -class Mark_req; -class Melisma_playing_req; -class Melisma_req; -class Melodic_req; class Mensural_ligature_engraver; class Midi_chunk; class Midi_def; @@ -120,7 +104,6 @@ class Music_sequence; class Music_wrapper; class Music_wrapper_iterator; class Pitch; -class Musical_req; class My_lily_lexer; class Note_performer; class Output_property; @@ -133,9 +116,7 @@ class Performance; class Performer; class Performer_group_performer; class Piano_bar_engraver; - class Pitch_squash_engraver; -class Porrectus_req; class Property_iterator; class Rational; class Relative_octave_music; @@ -143,24 +124,19 @@ class Repeated_music; class Request; class Request_chord; class Request_chord_iterator; -class Rest_req; -class Rhythmic_req; class Scaled_font_metric; class Scheme_hash_table; class Score; class Grob; class Score_engraver; class Score_performer; -class Script_req; class Sequential_music; class Sequential_music_iterator; class Simple_music_iterator; class Simple_spacer; class Simultaneous_music; class Simultaneous_music_iterator; -class Skip_req; class Slur_bezier_bow; -class Span_req; class Span_score_bar_engraver; class Spanner; class Staff_group_bar_engraver; @@ -168,12 +144,9 @@ class Staff_performer; class Swallow_engraver; class Swallow_performer; class Tempo_performer; -class Tempo_req; class Tex_font_metric; -class Text_script_req; class Tie; class Tie_performer; -class Tie_req; class Time_scaled_music; class Time_scaled_music_iterator; class Time_signature_performer; @@ -184,7 +157,6 @@ class Translator; class Translator_change; class Translator_group; class Transposed_music; -class Tremolo_req; class Type_swallow_translator; class yyFlexLexer; #endif // LILY_PROTO_HH; diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh index 1dcaaeb818..3f957eef8b 100644 --- a/lily/include/music-list.hh +++ b/lily/include/music-list.hh @@ -34,7 +34,6 @@ class Request_chord : public Simultaneous_music { public: VIRTUAL_COPY_CONS (Music); - virtual Pitch to_relative_octave (Pitch); virtual Moment start_mom () const; Request_chord (); diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh deleted file mode 100644 index a90c9dcf68..0000000000 --- a/lily/include/musical-request.hh +++ /dev/null @@ -1,84 +0,0 @@ -/* - musical-request.hh -- declare Musical requests - - source file of the GNU LilyPond music typesetter - - (c) 1997--2002 Han-Wen Nienhuys -*/ - - -#ifndef MUSICALREQUESTS_HH -#define MUSICALREQUESTS_HH - -#include "lily-proto.hh" -#include "request.hh" -#include "duration.hh" -#include "pitch.hh" -#include "array.hh" - -/** a request with a duration. - This request is used only used as a base class. - */ -class Rhythmic_req : public virtual Request { -public: - void compress (Moment); - virtual Moment length_mom () const; - static int compare (Rhythmic_req const&,Rhythmic_req const&); - VIRTUAL_COPY_CONS (Music); -}; - - - -struct Tremolo_req : public Request { - VIRTUAL_COPY_CONS (Music); - Tremolo_req (); -}; - -struct Chord_tremolo_notify_req : public Request -{ - Rational factor_; - VIRTUAL_COPY_CONS(Chord_tremolo_notify_req); - Chord_tremolo_notify_req(); -}; - - -/** - a syllable or lyric is a string with rhythm. - */ -class Lyric_req : public Rhythmic_req -{ -protected: - VIRTUAL_COPY_CONS (Music); -}; - - -class Articulation_req : public Script_req -{ -public: - String get_articulation_string (); -protected: - virtual bool do_equal_b (Request const*) const; - VIRTUAL_COPY_CONS (Music); -}; - -class Text_script_req : public Script_req -{ -protected: - VIRTUAL_COPY_CONS (Music); - virtual bool do_equal_b (Request const*) const; -}; - -/// request which has some kind of pitch -struct Melodic_req :virtual Request -{ - static int compare (Melodic_req const&,Melodic_req const&); - -protected: - virtual bool do_equal_b (Request const*) const; - - VIRTUAL_COPY_CONS (Music); -}; - - - -#endif // MUSICALREQUESTS_HH diff --git a/lily/include/request.hh b/lily/include/request.hh index 34bbf79f6a..eb8f3f0467 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -15,62 +15,41 @@ #include "virtual-methods.hh" #include "input.hh" #include "music.hh" -#include "direction.hh" - +#include "duration.hh" +#include "pitch.hh" /** An atom of musical information. This is an abstract class for any piece of music that does not contain other Music. - Hungarian postfix: req */ class Request : public Music { public: Request (); VIRTUAL_COPY_CONS (Music); - bool equal_b (Request const*) const; -protected: - virtual bool do_equal_b (Request const*) const; - -}; - - - -class Script_req : public virtual Request -{ -public: - void set_direction (Direction d); - Direction get_direction () const; - VIRTUAL_COPY_CONS (Music); - Script_req (); + virtual void compress (Moment); + virtual void transpose (Pitch); + virtual Moment length_mom () const; + virtual Pitch to_relative_octave (Pitch); }; /** - Requests to start or stop something. - This type of request typically results in the creation of a #Spanner# + Handle key changes. */ -class Span_req : public virtual Request { +class Key_change_req : public Request +{ public: - String get_span_type_string () const; - void set_span_type_string (String); - void set_span_dir (Direction d); - Direction get_span_dir () const; + SCM pitch_alist (); - Span_req (); protected: - - virtual bool do_equal_b (Request const*) const; - VIRTUAL_COPY_CONS (Music); + bool do_equal_b (Request const * ) const; + void transpose (Pitch d); }; -/** - Start a tie at this note, end it at the next - */ -class Tie_req : public Request { -public: - VIRTUAL_COPY_CONS (Music); -}; +SCM transpose_key_alist (SCM,SCM); + + #endif diff --git a/lily/include/tuplet-bracket.hh b/lily/include/tuplet-bracket.hh index 8dbc232184..e76633b938 100644 --- a/lily/include/tuplet-bracket.hh +++ b/lily/include/tuplet-bracket.hh @@ -8,6 +8,7 @@ #define Tuplet_bracket_HH #include "lily-guile.hh" +#include "lily-proto.hh" /* diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index ba13f999f7..aa6488e72b 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -7,8 +7,8 @@ */ -#include "command-request.hh" -#include "musical-request.hh" + +#include "request.hh" #include "item.hh" #include "bar-line.hh" #include "staff-symbol-referencer.hh" @@ -86,13 +86,6 @@ Key_engraver::try_music (Music * req) { if (Key_change_req *kc = dynamic_cast (req)) { - if (keyreq_ && !keyreq_->equal_b (kc)) - { - kc->origin ()->warning (_ ("Conflicting key signatures found.")); - keyreq_->origin ()->warning (_ ("This was the other key definition.")); - return false; - } - if (!keyreq_) { /* diff --git a/lily/key-performer.cc b/lily/key-performer.cc index c04ea1a592..ce8c330ad3 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -7,7 +7,7 @@ */ #include "lily-guile.hh" -#include "command-request.hh" + #include "audio-item.hh" #include "performer.hh" #include "warn.hh" diff --git a/lily/lexer.ll b/lily/lexer.ll index c058cbc7e3..a08b3bfab6 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -40,7 +40,7 @@ #include "parser.hh" #include "warn.hh" #include "main.hh" -#include "musical-request.hh" +#include "request.hh" #include "version.hh" #include "lilypond-input-version.hh" #include "translator-def.hh" diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc index 702ed023fb..5f3598186c 100644 --- a/lily/lyric-combine-music-iterator.cc +++ b/lily/lyric-combine-music-iterator.cc @@ -10,7 +10,7 @@ #include "translator-group.hh" #include "lyric-combine-music-iterator.hh" #include "lyric-combine-music.hh" -#include "musical-request.hh" +#include "request.hh" #include "note-head.hh" #include "grob.hh" diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index 1da3c69a4b..3e04babe2a 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -8,7 +8,7 @@ */ #include "engraver.hh" -#include "musical-request.hh" +#include "request.hh" #include "item.hh" #include "paper-def.hh" #include "font-metric.hh" @@ -29,7 +29,7 @@ protected: public: TRANSLATOR_DECLARATIONS(Lyric_engraver); private: - Lyric_req * req_; + Music * req_; Item* text_; }; @@ -45,11 +45,11 @@ Lyric_engraver::Lyric_engraver () bool Lyric_engraver::try_music (Music*r) { - if (Lyric_req* l = dynamic_cast (r)) + if (r->is_mus_type ("lyric-event")) { if (req_) return false; - req_ =l; + req_ =r; return true; } return false; @@ -98,7 +98,7 @@ Lyric_engraver::start_translation_timestep () ENTER_DESCRIPTION(Lyric_engraver, /* descr */ "", /* creats*/ "", -/* accepts */ "general-music", +/* accepts */ "lyric-event", /* acks */ "", /* reads */ "", /* write */ ""); diff --git a/lily/lyric-performer.cc b/lily/lyric-performer.cc index 415fc9ce4d..3403be404c 100644 --- a/lily/lyric-performer.cc +++ b/lily/lyric-performer.cc @@ -6,7 +6,7 @@ (c) 1997--2002 Jan Nieuwenhuizen */ -#include "musical-request.hh" +#include "request.hh" #include "audio-item.hh" #include "lily-proto.hh" #include "performer.hh" @@ -22,7 +22,7 @@ protected: virtual void create_audio_elements (); private: - Link_array lreqs_; + Link_array lreqs_; Audio_text* audio_; }; @@ -65,12 +65,12 @@ Lyric_performer::stop_translation_timestep () bool Lyric_performer::try_music (Music* req) { - if (Lyric_req *lr = dynamic_cast (req)) + if (req->is_mus_type ("lyric-event")) { - lreqs_.push (lr); + lreqs_.push (req); return true; } return false; } -ENTER_DESCRIPTION(Lyric_performer,"","","general-music","","",""); +ENTER_DESCRIPTION(Lyric_performer,"","","lyric-event","","",""); diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 335fea8bda..96ca4ffcba 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -8,7 +8,7 @@ #include #include "bar-line.hh" -#include "command-request.hh" + #include "staff-symbol.hh" #include "engraver-group-engraver.hh" #include "engraver.hh" diff --git a/lily/melisma-engraver.cc b/lily/melisma-engraver.cc index 4ab16941e2..e01d83a9f8 100644 --- a/lily/melisma-engraver.cc +++ b/lily/melisma-engraver.cc @@ -8,7 +8,7 @@ */ #include "engraver.hh" -#include "musical-request.hh" +#include "request.hh" #include "grob.hh" #include "translator-group.hh" diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc index 457e9532a9..3c5e9adb92 100644 --- a/lily/mensural-ligature-engraver.cc +++ b/lily/mensural-ligature-engraver.cc @@ -8,7 +8,7 @@ #include "mensural-ligature.hh" #include "ligature-engraver.hh" -#include "musical-request.hh" +#include "request.hh" #include "warn.hh" #include "item.hh" #include "spanner.hh" diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 93a33b0a00..c44c0738e8 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -5,7 +5,7 @@ Han-Wen Nienhuys */ -#include "musical-request.hh" +#include "request.hh" #include "multi-measure-rest.hh" #include "paper-column.hh" #include "engraver-group-engraver.hh" @@ -32,9 +32,9 @@ protected: virtual void finalize (); private: - Span_req * new_req_; - Span_req * busy_span_req_; - Span_req * stop_req_; + Music * new_req_; + Music * busy_span_req_; + Music * stop_req_; int start_measure_; Moment start_moment_; @@ -55,22 +55,18 @@ Multi_measure_rest_engraver::Multi_measure_rest_engraver () bool Multi_measure_rest_engraver::try_music (Music* req) { - if (Span_req * sp = dynamic_cast (req)) + if (req->is_mus_type ("multi-measure-rest-event")) { - - if (scm_equal_p (sp->get_mus_property ("span-type"), - scm_makfrom0str ("rest")) == SCM_BOOL_T) + Direction d = to_dir (req->get_mus_property ("span-direction")); + if (d == STOP) { - if (sp->get_span_dir () == STOP) - { - stop_req_ = sp; - } - else if (sp->get_span_dir () == START && !new_req_) - { - new_req_ = sp; - } - return true; + stop_req_ = req; } + else if (d == START&& !new_req_) + { + new_req_ = req; + } + return true; } return false; } @@ -181,7 +177,7 @@ ENTER_DESCRIPTION(Multi_measure_rest_engraver, measurePosition and currentBarNumber to determine what number to print over the MultiMeasureRest ", /* creats*/ "MultiMeasureRest", -/* accepts */ "general-music", +/* accepts */ "multi-measure-rest-event", /* acks */ "", /* reads */ "currentBarNumber currentCommandColumn measurePosition", /* write */ ""); diff --git a/lily/music.cc b/lily/music.cc index 159f431090..d95603ad81 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -31,11 +31,6 @@ ly_deep_mus_copy (SCM m) return m; } - - - - - bool Music::internal_is_music_type (SCM k)const { @@ -44,6 +39,17 @@ Music::internal_is_music_type (SCM k)const return scm_memq (k, ifs) != SCM_BOOL_F; } +void +Music::transpose (Pitch) +{ +} + +void +Music::compress (Moment) +{ +} + + Music::Music (Music const &m) { immutable_property_alist_ = m.immutable_property_alist_; @@ -83,17 +89,6 @@ Music::mark_smob (SCM m) return SCM_EOL; } -void -Music::compress (Moment f) -{ - SCM l = get_mus_property ("compress-procedure"); - if (gh_procedure_p (l)) - { - SCM res = gh_call2 (l, self_scm (), f.smobbed_copy()); - } -} - - Moment Music::length_mom () const { @@ -159,25 +154,6 @@ Music::to_relative_octave (Pitch m) } -void -Music::transpose (Pitch delta) -{ - Pitch *p = unsmob_pitch (get_mus_property ("pitch")); - if (!p) - return ; - - Pitch np = *p; - np.transpose (delta); - - if (abs (np.alteration_) > 2) - { - warning (_f ("Transposition by %s makes accidental larger than two", - delta.string ())); - } - - set_mus_property ("pitch", np.smobbed_copy ()); -} - IMPLEMENT_TYPE_P (Music, "music?"); IMPLEMENT_SMOBS (Music); diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 700e4ceeb8..e69de29bb2 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -1,109 +0,0 @@ -/* - request.cc -- implement all musical requests. - - source file of the GNU LilyPond music typesetter - - (c) 1997--2002 Han-Wen Nienhuys -*/ - -#include "musical-request.hh" -#include "misc.hh" -#include "warn.hh" -#include "music-list.hh" - - -Tremolo_req::Tremolo_req () -{ -} - -LY_DEFINE(music_duration_length, "music-duration-length", 1, 0,0, - (SCM mus), - "Extract the duration field from @var{mus}, and return the length.") -{ - Music* m = unsmob_music(mus); - SCM_ASSERT_TYPE(m, mus, SCM_ARG1, __FUNCTION__, "Music"); - - Duration *d = unsmob_duration (m->get_mus_property ("duration")); - - Moment l ; - - if (d) - { - l = d->length_mom (); - } - else - programming_error("Rhythmic_req has no duration"); - return l.smobbed_copy(); - -} - - -LY_DEFINE(music_duration_compress, "music-duration-compress", 2, 0,0, - (SCM mus, SCM factor), - "Extract the duration field from @var{mus}, and compress it.") -{ - Music* m = unsmob_music(mus); - Moment * f = unsmob_moment (factor); - SCM_ASSERT_TYPE(m, mus, SCM_ARG1, __FUNCTION__, "Music"); - SCM_ASSERT_TYPE(f, factor, SCM_ARG2, __FUNCTION__, "Moment"); - - Duration *d = unsmob_duration (m->get_mus_property ("duration")); - if (d) - m->set_mus_property ("duration", d->compressed (f->main_part_).smobbed_copy()); - return SCM_UNSPECIFIED; -} - - -Moment -Rhythmic_req::length_mom () const -{ - Duration *d = unsmob_duration (get_mus_property ("duration")); - if (!d) - { - Moment m ; - programming_error("Rhythmic_req has no duration"); - return m; - } - return d->length_mom (); -} - -void -Rhythmic_req::compress (Moment m) -{ - Duration *d = unsmob_duration (get_mus_property ("duration")); - if (d) - set_mus_property ("duration", d ->compressed (m.main_part_).smobbed_copy ()); -} - - - -bool -Span_req::do_equal_b (Request const*r) const -{ - Span_req const* s = dynamic_cast (r); - return s && get_span_dir () == s->get_span_dir (); -} - -Span_req::Span_req () -{ -} - - -bool -Text_script_req::do_equal_b (Request const* r) const -{ - Text_script_req const* t = dynamic_cast (r); - return t && gh_equal_p (get_mus_property ("text"), - t->get_mus_property ("text")); -} - -bool -Articulation_req::do_equal_b (Request const* r) const -{ - Articulation_req const* a = dynamic_cast (r); - - return a && gh_equal_p (get_mus_property ("articulation-type"), - r->get_mus_property ("articulation-type")) - && get_direction () == a->get_direction (); -} - diff --git a/lily/new-accidental-engraver.cc b/lily/new-accidental-engraver.cc index 1e5fd92acc..f7b108334a 100644 --- a/lily/new-accidental-engraver.cc +++ b/lily/new-accidental-engraver.cc @@ -9,8 +9,8 @@ */ -#include "musical-request.hh" -#include "command-request.hh" +#include "request.hh" + #include "item.hh" #include "tie.hh" #include "rhythmic-head.hh" @@ -555,7 +555,7 @@ events. Due to interaction with ties (which don't come together with note heads), this needs to be in a context higher than Tie_engraver.", "Accidental", -/* accepts */ "general-music", +/* accepts */ "", "rhythmic-head-interface tie-interface arpeggio-interface", "localKeySignature localKeySignatureChanges extraNatural autoAccidentals autoCautionaries", "localKeySignature localKeySignatureChanges"); diff --git a/lily/note-head-line-engraver.cc b/lily/note-head-line-engraver.cc index 065de4cdb8..25f4a7b850 100644 --- a/lily/note-head-line-engraver.cc +++ b/lily/note-head-line-engraver.cc @@ -9,7 +9,7 @@ #include "engraver.hh" #include "group-interface.hh" #include "item.hh" -#include "musical-request.hh" +#include "request.hh" #include "spanner.hh" #include "stem.hh" #include "rhythmic-head.hh" diff --git a/lily/note-head.cc b/lily/note-head.cc index a95827d98d..4e60f3c5fc 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -14,7 +14,7 @@ #include "warn.hh" #include "font-interface.hh" #include "molecule.hh" -#include "musical-request.hh" +#include "request.hh" #include "rhythmic-head.hh" #include "staff-symbol-referencer.hh" #include "lookup.hh" diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index 7ce9a433de..afb341178e 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -7,7 +7,7 @@ #include "rhythmic-head.hh" #include "paper-def.hh" -#include "musical-request.hh" +#include "request.hh" #include "dots.hh" #include "dot-column.hh" #include "staff-symbol-referencer.hh" diff --git a/lily/note-name-engraver.cc b/lily/note-name-engraver.cc index bfd6fafb49..3d4a1833bf 100644 --- a/lily/note-name-engraver.cc +++ b/lily/note-name-engraver.cc @@ -8,7 +8,7 @@ */ #include "engraver.hh" -#include "musical-request.hh" +#include "request.hh" #include "item.hh" class Note_name_engraver : public Engraver @@ -74,7 +74,7 @@ Note_name_engraver::Note_name_engraver() ENTER_DESCRIPTION(Note_name_engraver, /* descr */ "", /* creats*/ "NoteName", -/* accepts */ "general-music", +/* accepts */ "note-event", /* acks */ "", /* reads */ "", /* write */ ""); diff --git a/lily/note-performer.cc b/lily/note-performer.cc index 91509a9734..35b93e58bd 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -7,7 +7,7 @@ */ #include "performer.hh" -#include "musical-request.hh" +#include "request.hh" #include "audio-item.hh" #include "audio-column.hh" #include "global-translator.hh" @@ -125,7 +125,7 @@ Note_performer::try_music (Music* req) return false; } -ENTER_DESCRIPTION(Note_performer,"","","general-music","","",""); +ENTER_DESCRIPTION(Note_performer,"","","note-event","","",""); Note_performer::Note_performer() { diff --git a/lily/output-property-engraver.cc b/lily/output-property-engraver.cc index fc6b297a6e..cfdf4f32a2 100644 --- a/lily/output-property-engraver.cc +++ b/lily/output-property-engraver.cc @@ -39,8 +39,7 @@ protected: bool Output_property_engraver::try_music (Music* m) { - if (m->get_mus_property ("iterator-ctor") == - Output_property_music_iterator::constructor_proc) + if (m->is_mus_type ("layout-instruction")) { props_.push (m); return true; @@ -84,7 +83,7 @@ ENTER_DESCRIPTION(Output_property_engraver, /* descr */ "Interpret Music of Output_property type, and apply a function to any Graphic objects that satisfies the predicate.", /* creats*/ "", -/* accepts */ "general-music", -/* acks */ "grob-interface", +/* accepts */ "layout-instruction", +/* acks */ "grob-interface", /* reads */ "", /* write */ ""); diff --git a/lily/parser.yy b/lily/parser.yy index c81ec16121..03ad891732 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -37,8 +37,8 @@ this. #include "file-path.hh" #include "warn.hh" #include "dimensions.hh" -#include "command-request.hh" -#include "musical-request.hh" + +#include "request.hh" #include "my-lily-parser.hh" #include "context-specced-music.hh" #include "score.hh" @@ -106,6 +106,16 @@ set_property_music (SCM sym, SCM value) return p; } +Music* +make_span_req (SCM name) +{ + static SCM proc; + if (!proc) + proc = scm_c_eval_string ("old-span-request->event"); + SCM m = scm_call_1 (proc, name); + scm_gc_protect_object (m); + return unsmob_music (m); +} // needed for bison.simple's malloc () and free () @@ -1315,10 +1325,9 @@ shorthand_command_req: ; verbose_command_req: - COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */ - Music * sp = MY_MAKE_MUSIC("SpanEvent"); + COMMANDSPANREQUEST bare_int STRING { + Music *sp = make_span_req ($3); sp->set_mus_property ("span-direction", gh_int2scm (Direction ($2))); - sp->set_mus_property ("span-type",$3); sp->set_spot (THIS->here_input ()); $$ = sp; } @@ -1428,9 +1437,9 @@ verbose_request: $$ = d; } | SPANREQUEST bare_int STRING { - Music * sp = MY_MAKE_MUSIC("SpanEvent"); + + Music * sp = make_span_req ($3); sp->set_mus_property ("span-direction", gh_int2scm ( $2)); - sp->set_mus_property ("span-type", $3); sp->set_spot (THIS->here_input ()); $$ = sp; } @@ -1576,15 +1585,13 @@ close_request: close_request_parens: '(' { - Music * s= MY_MAKE_MUSIC("SpanEvent"); + Music * s= MY_MAKE_MUSIC("SlurEvent"); $$ = s; - s->set_mus_property ("span-type", scm_makfrom0str ( "slur")); s->set_spot (THIS->here_input()); } | E_OPEN { - Music * s= MY_MAKE_MUSIC("SpanEvent"); + Music * s= MY_MAKE_MUSIC("PhrasingSlurEvent"); $$ = s; - s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur")); s->set_spot (THIS->here_input()); } | E_SMALLER { @@ -1616,14 +1623,13 @@ open_request_parens: $$ = s; } | ')' { - Music * s= MY_MAKE_MUSIC("SpanEvent"); + Music * s= MY_MAKE_MUSIC("SlurEvent"); $$ = s; - s->set_mus_property ("span-type", scm_makfrom0str ( "slur")); s->set_spot (THIS->here_input()); } | E_CLOSE { - Music * s= MY_MAKE_MUSIC("SpanEvent"); + Music * s= MY_MAKE_MUSIC("PhrasingSlurEvent"); $$ = s; s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur")); s->set_spot (THIS->here_input()); @@ -1934,16 +1940,12 @@ simple_element: Music * sk = MY_MAKE_MUSIC("SkipEvent"); sk->set_mus_property ("duration", $2); - Music *sp1 = MY_MAKE_MUSIC("SpanEvent"); - Music *sp2 = MY_MAKE_MUSIC("SpanEvent"); + Music *sp1 = MY_MAKE_MUSIC("MultiMeasureRestEvent"); + Music *sp2 = MY_MAKE_MUSIC("MultiMeasureRestEvent"); sp1-> set_mus_property ("span-direction", gh_int2scm (START)) ; sp2-> set_mus_property ("span-direction", gh_int2scm (STOP)) ; - SCM r = scm_makfrom0str ("rest"); - sp1->set_mus_property ("span-type", r); - sp2->set_mus_property ("span-type", r); - Music *rqc1 = MY_MAKE_MUSIC("RequestChord"); rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED)); Music *rqc2 = MY_MAKE_MUSIC("RequestChord"); diff --git a/lily/part-combine-music-iterator.cc b/lily/part-combine-music-iterator.cc index fcc99f05ba..31959d48d5 100644 --- a/lily/part-combine-music-iterator.cc +++ b/lily/part-combine-music-iterator.cc @@ -9,7 +9,7 @@ #include "part-combine-music.hh" #include "part-combine-music-iterator.hh" #include "translator-group.hh" -#include "musical-request.hh" +#include "request.hh" #include "music-sequence.hh" #include "lily-guile.hh" #include "warn.hh" @@ -159,7 +159,7 @@ get_music_info (Moment m, Music_iterator* iter, SCM *pitches, SCM *durations) { SCM d = m->get_mus_property ("duration"); if (d == SCM_EOL) - m->origin ()->warning ("Rhythmic_req has no duration\n"); + m->origin ()->warning ("Music has no duration\n"); else *durations = gh_cons (d, *durations); } diff --git a/lily/percent-repeat-engraver.cc b/lily/percent-repeat-engraver.cc index 1f9023ae72..2a589e8cd5 100644 --- a/lily/percent-repeat-engraver.cc +++ b/lily/percent-repeat-engraver.cc @@ -240,7 +240,7 @@ Percent_repeat_engraver::stop_translation_timestep () ENTER_DESCRIPTION(Percent_repeat_engraver, /* descr */ "Make beat, whole bar and double bar repeats.", /* creats*/ "PercentRepeat RepeatSlash DoublePercentRepeat", -/* accepts */ "general-music", +/* accepts */ "repeated-music", /* acks */ "", /* reads */ "measureLength currentCommandColumn", /* write */ ""); diff --git a/lily/phrasing-slur-engraver.cc b/lily/phrasing-slur-engraver.cc index 8495817d09..609a707a07 100644 --- a/lily/phrasing-slur-engraver.cc +++ b/lily/phrasing-slur-engraver.cc @@ -4,7 +4,7 @@ (c) 1997--2002 Han-Wen Nienhuys */ -#include "musical-request.hh" +#include "request.hh" #include "slur.hh" #include "warn.hh" #include "note-column.hh" @@ -14,8 +14,8 @@ class Phrasing_slur_engraver : public Engraver { - Link_array requestses_; - Link_array new_phrasing_slur_reqs_; + Link_array requestses_; + Link_array new_phrasing_slur_reqs_; Link_array phrasing_slur_l_stack_; Link_array end_phrasing_slurs_; Moment last_start_; @@ -41,11 +41,8 @@ Phrasing_slur_engraver::Phrasing_slur_engraver () bool Phrasing_slur_engraver::try_music (Music *req) { - if (Span_req *sl = dynamic_cast (req)) + if (req->is_mus_type ("abort-event")) { - String t = ly_scm2string (sl->get_mus_property ("span-type")); - if (t == "abort") - { for (int i = 0; i < phrasing_slur_l_stack_.size (); i++) { phrasing_slur_l_stack_[i]->suicide (); @@ -58,27 +55,29 @@ Phrasing_slur_engraver::try_music (Music *req) end_phrasing_slurs_.clear (); requestses_.clear (); new_phrasing_slur_reqs_.clear (); - } - else if (t == "phrasing-slur") + } + else if (req->is_mus_type ("phrasing-slur-event")) + { + /* + Let's not start more than one phrasing slur per moment. + */ + + Direction d = to_dir (req->get_mus_property ("span-direction")); + + if (d == START) { - /* - Let's not start more than one phrasing slur per moment. - */ - if (sl->get_span_dir () == START) + if (now_mom () > last_start_) { - if (now_mom () > last_start_) - { - new_phrasing_slur_reqs_.push (sl); - last_start_ = now_mom (); - return true; - } - } - else - { - new_phrasing_slur_reqs_.push (sl); + new_phrasing_slur_reqs_.push (req); + last_start_ = now_mom (); return true; } } + else + { + new_phrasing_slur_reqs_.push (req); + return true; + } } return false; } @@ -124,9 +123,12 @@ Phrasing_slur_engraver::process_acknowledged_grobs () Link_array start_phrasing_slurs; for (int i=0; i< new_phrasing_slur_reqs_.size (); i++) { - Span_req* phrasing_slur_req = new_phrasing_slur_reqs_[i]; + Music* phrasing_slur_req = new_phrasing_slur_reqs_[i]; // end phrasing slur: move the phrasing slur to other array - if (phrasing_slur_req->get_span_dir () == STOP) + + Direction d = to_dir (phrasing_slur_req->get_mus_property ("span-direction")); + + if (d == STOP) { if (phrasing_slur_l_stack_.empty ()) phrasing_slur_req->origin ()->warning (_f ("can't find start of phrasing slur")); @@ -137,7 +139,7 @@ Phrasing_slur_engraver::process_acknowledged_grobs () requestses_.pop (); } } - else if (phrasing_slur_req->get_span_dir () == START) + else if (d == START) { // push a new phrasing_slur onto stack. // (use temp. array to wait for all phrasing_slur STOPs) @@ -174,7 +176,7 @@ Phrasing_slur_engraver::start_translation_timestep () ENTER_DESCRIPTION(Phrasing_slur_engraver, /* descr */ "Print phrasing slurs. Similar to Slur_engraver", /* creats*/ "PhrasingSlur", -/* accepts */ "general-music", -/* acks */ "note-column-interface", +/* accepts */ "phrasing-slur-event", +/* acks */ "note-column-interface", /* reads */ "slurMelismaBusy", /* write */ ""); diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index 4f478bea9b..b68359a4d7 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -10,7 +10,7 @@ */ #include "engraver.hh" -#include "musical-request.hh" +#include "request.hh" #include "grob.hh" #include "item.hh" #include "lily-guile.hh" @@ -25,8 +25,8 @@ struct Pedal_info { char const * name_; - Span_req* start_req_; - Drul_array req_l_drul_; + Music* start_req_; + Drul_array req_l_drul_; Item* item_; Spanner* bracket_; // A single portion of a pedal bracket Spanner* finished_bracket_; @@ -36,7 +36,7 @@ struct Pedal_info */ Spanner* line_spanner_; Spanner* finished_line_spanner_; - Span_req* current_bracket_req_; + Music* current_bracket_req_; }; @@ -150,23 +150,28 @@ Piano_pedal_engraver::acknowledge_grob (Grob_info info) bool Piano_pedal_engraver::try_music (Music *m) { - if (Span_req * s = dynamic_cast (m)) + if (m->is_mus_type ("abort-event")) { for (Pedal_info*p = info_list_; p->name_; p ++) { - if (ly_scm2string (s->get_mus_property ("span-type")) == "abort") - { - p->req_l_drul_[START] = 0; - p->req_l_drul_[STOP] = 0; - + p->req_l_drul_[START] = 0; + p->req_l_drul_[STOP] = 0; + if (p->bracket_) p->bracket_->suicide (); /* as in dynamic-engraver.cc */ p->bracket_ = 0; - } - if (scm_equal_p (s->get_mus_property ("span-type"), - scm_makfrom0str (p->name_))==SCM_BOOL_T) + } + } + else if (m->is_mus_type ("pedal-event")) + { + for (Pedal_info*p = info_list_; p->name_; p ++) + { + String nm = p->name_ + String ("Event"); + if (gh_equal_p (m->get_mus_property ("name") , + scm_makfrom0str (nm.to_str0()))) { - p->req_l_drul_[s->get_span_dir ()] = s; + Direction d = to_dir (m->get_mus_property ("span-direction")); + p->req_l_drul_[d] = m; return true; } } @@ -509,7 +514,7 @@ Piano_pedal_engraver::start_translation_timestep () ENTER_DESCRIPTION (Piano_pedal_engraver, /* descr */ "Engrave piano pedal symbols and brackets.", /* creats*/ "SostenutoPedal SustainPedal UnaCordaPedal SostenutoPedalLineSpanner SustainPedalLineSpanner UnaCordaPedalLineSpanner", -/* accepts */ "general-music", +/* accepts */ "pedal-event abort-event", /* acks */ "note-column-interface", /* reads */ "pedalSostenutoStrings pedalSustainStrings pedalUnaCordaStrings", /* write */ ""); diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc index 940a148285..707bac9733 100644 --- a/lily/piano-pedal-performer.cc +++ b/lily/piano-pedal-performer.cc @@ -7,8 +7,8 @@ */ #include "performer.hh" -#include "command-request.hh" -#include "musical-request.hh" + +#include "request.hh" #include "audio-item.hh" /** @@ -19,8 +19,8 @@ class Piano_pedal_performer : public Performer struct Pedal_info { char const *name_; - Span_req* start_req_; - Drul_array req_l_drul_; + Music* start_req_; + Drul_array req_l_drul_; }; public: @@ -125,14 +125,16 @@ Piano_pedal_performer::start_translation_timestep () bool Piano_pedal_performer::try_music (Music* r) { - if (Span_req * s = dynamic_cast (r)) + if (r->is_mus_type ("pedal-event")) { for (Pedal_info*p = info_alist_; p->name_; p ++) { - if (scm_equal_p (s->get_mus_property ("span-type"), - scm_makfrom0str (p->name_)) == SCM_BOOL_T) + String nm = p->name_ + String ("Event"); + if (gh_equal_p (r->get_mus_property ("name") , + scm_makfrom0str (nm.to_str0()))) { - p->req_l_drul_[s->get_span_dir ()] = s; + Direction d = to_dir (r->get_mus_property ("span-direction")); + p->req_l_drul_[d] = r; return true; } } @@ -141,5 +143,5 @@ Piano_pedal_performer::try_music (Music* r) } ENTER_DESCRIPTION (Piano_pedal_performer, "","", - "general-music", + "pedal-event", "","","" ); diff --git a/lily/pitch-squash-engraver.cc b/lily/pitch-squash-engraver.cc index 002d28440e..4961e70f19 100644 --- a/lily/pitch-squash-engraver.cc +++ b/lily/pitch-squash-engraver.cc @@ -40,7 +40,7 @@ the locations of accidentals stay the same. Set the position field of all note heads to zero. This useful for making a single line staff that demonstrates the rhythm of a melody.", /* creats*/ "", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "note-head-interface", /* reads */ "squashedPosition", /* write */ ""); diff --git a/lily/porrectus-engraver.cc b/lily/porrectus-engraver.cc index eb5737d1db..b06806eeb5 100644 --- a/lily/porrectus-engraver.cc +++ b/lily/porrectus-engraver.cc @@ -31,8 +31,8 @@ #include "staff-symbol-referencer.hh" #include "porrectus.hh" -#include "musical-request.hh" -#include "command-request.hh" +#include "request.hh" + #include "rhythmic-head.hh" #include "item.hh" #include "engraver.hh" @@ -55,7 +55,7 @@ protected: private: PQueue past_notes_pq_; - Porrectus_req *porrectus_req_; + Music *porrectus_req_; Array left_heads_; Array right_heads_; Link_array porrectuses_; @@ -69,9 +69,9 @@ Porrectus_engraver::Porrectus_engraver () bool Porrectus_engraver::try_music (Music *m) { - if (Porrectus_req *req_ = dynamic_cast (m)) + if (m->is_mus_type ("porrectus-event")) { - porrectus_req_ = req_; + porrectus_req_ = m; return true; } else @@ -167,7 +167,7 @@ Porrectus_engraver::start_translation_timestep () ENTER_DESCRIPTION(Porrectus_engraver, /* descr */ "Join adjacent notes to a porrectus ligature.", /* creats*/ "Porrectus", -/* accepts */ "general-music", +/* accepts */ "porrectus-event", /* acks */ "rhythmic-head-interface", /* reads */ "", /* write */ ""); diff --git a/lily/repeat-acknowledge-engraver.cc b/lily/repeat-acknowledge-engraver.cc index 0c6921feca..40ad495452 100644 --- a/lily/repeat-acknowledge-engraver.cc +++ b/lily/repeat-acknowledge-engraver.cc @@ -114,7 +114,7 @@ ENTER_DESCRIPTION(Repeat_acknowledge_engraver, /* descr */ "Acknowledge repeated music, and convert the contents of repeatCommands ainto an appropriate setting for whichBar", /* creats*/ "", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "", /* reads */ "repeatCommands whichBar", /* write */ ""); diff --git a/lily/request-chord.cc b/lily/request-chord.cc index 2cf46c91cd..619c1bc406 100644 --- a/lily/request-chord.cc +++ b/lily/request-chord.cc @@ -1,37 +1,12 @@ #include "pitch.hh" #include "request-chord-iterator.hh" #include "music-list.hh" -#include "musical-request.hh" +#include "request.hh" Request_chord::Request_chord () { } -Pitch -Request_chord::to_relative_octave (Pitch last) -{ - for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) - { - Music * mus = unsmob_music (ly_car (s)); - - if (mus->is_mus_type ("melodic-event") - || mus->is_mus_type ("rest-event")) - { - Pitch *old_pit = unsmob_pitch (mus->get_mus_property ("pitch")); - if (!old_pit) - continue; - - Pitch new_pit = *old_pit; - new_pit.to_relative_octave (last); - mus->set_mus_property ("pitch", new_pit.smobbed_copy ()); - - return new_pit; - } - - } - return last; -} - Moment Request_chord::start_mom () const { diff --git a/lily/request.cc b/lily/request.cc index 152a67aa88..840f891c4f 100644 --- a/lily/request.cc +++ b/lily/request.cc @@ -9,16 +9,61 @@ #include "request.hh" #include "warn.hh" -bool -Request::equal_b (Request const* r) const + + + +Moment +Request::length_mom () const { - return r->do_equal_b (this) || this->do_equal_b (r) ; + Duration *d = unsmob_duration (get_mus_property ("duration")); + if (!d) + { + Moment m ; + return m; + } + return d->length_mom (); } -bool -Request::do_equal_b (Request const*) const +void +Request::compress (Moment m) { - return true; + Duration *d = unsmob_duration (get_mus_property ("duration")); + if (d) + set_mus_property ("duration", d ->compressed (m.main_part_).smobbed_copy ()); +} + +void +Request::transpose (Pitch delta) +{ + Pitch *p = unsmob_pitch (get_mus_property ("pitch")); + if (!p) + return ; + + Pitch np = *p; + np.transpose (delta); + + if (abs (np.alteration_) > 2) + { + warning (_f ("Transposition by %s makes accidental larger than two", + delta.string ())); + } + + set_mus_property ("pitch", np.smobbed_copy ()); +} + +Pitch + Request::to_relative_octave (Pitch last) +{ + Pitch *old_pit = unsmob_pitch (get_mus_property ("pitch")); + if (old_pit) + { + Pitch new_pit = *old_pit; + new_pit.to_relative_octave (last); + set_mus_property ("pitch", new_pit.smobbed_copy ()); + + return new_pit; + } + return last; } Request::Request () @@ -26,37 +71,128 @@ Request::Request () { } -Script_req::Script_req () +ADD_MUSIC(Request); +LY_DEFINE(music_duration_length, "music-duration-length", 1, 0,0, + (SCM mus), + "Extract the duration field from @var{mus}, and return the length.") { - set_direction (CENTER); + Music* m = unsmob_music(mus); + SCM_ASSERT_TYPE(m, mus, SCM_ARG1, __FUNCTION__, "Music"); + + Duration *d = unsmob_duration (m->get_mus_property ("duration")); + + Moment l ; + + if (d) + { + l = d->length_mom (); + } + else + programming_error("Music has no duration"); + return l.smobbed_copy(); + } -void -Script_req::set_direction (Direction d) + +LY_DEFINE(music_duration_compress, "music-duration-compress", 2, 0,0, + (SCM mus, SCM factor), + "Extract the duration field from @var{mus}, and compress it.") { - set_mus_property ("direction", gh_int2scm (d)); + Music* m = unsmob_music(mus); + Moment * f = unsmob_moment (factor); + SCM_ASSERT_TYPE(m, mus, SCM_ARG1, __FUNCTION__, "Music"); + SCM_ASSERT_TYPE(f, factor, SCM_ARG2, __FUNCTION__, "Moment"); + + Duration *d = unsmob_duration (m->get_mus_property ("duration")); + if (d) + m->set_mus_property ("duration", d->compressed (f->main_part_).smobbed_copy()); + return SCM_UNSPECIFIED; } -Direction -Script_req::get_direction () const + + + + + + +#include "request.hh" + + + +LY_DEFINE(transpose_key_alist,"transpose-key-alist", + 2, 0,0, (SCM l, SCM pitch), + "Make a new key alist of @var{l} transposed by pitch @var{pitch}") +{ + SCM newlist = SCM_EOL; + Pitch *p = unsmob_pitch (pitch); + + for (SCM s = l; gh_pair_p (s); s = ly_cdr (s)) + { + SCM key = ly_caar (s); + SCM alter = ly_cdar (s); + if (gh_pair_p (key)) + { + Pitch orig (gh_scm2int (ly_car (key)), + gh_scm2int (ly_cdr (key)), + gh_scm2int (alter)); + + orig.transpose (*p); + + SCM key = gh_cons (scm_int2num (orig.get_octave ()), + scm_int2num (orig.notename_)); + + newlist = gh_cons (gh_cons (key, scm_int2num (orig.alteration_)), + newlist); + } + else if (gh_number_p (key)) + { + Pitch orig (0, gh_scm2int (key), gh_scm2int (alter)); + orig.transpose (*p); + + key =scm_int2num (orig.notename_); + alter = scm_int2num (orig.alteration_); + newlist = gh_cons (gh_cons (key, alter), newlist); + } + } + return scm_reverse_x (newlist, SCM_EOL); +} + +void +Key_change_req::transpose (Pitch p) { - SCM d = get_mus_property ("direction"); + SCM pa = get_mus_property ("pitch-alist"); - return (ly_dir_p (d)) ? to_dir (d) : CENTER; + set_mus_property ("pitch-alist", transpose_key_alist (pa, p.smobbed_copy())); } -Direction -Span_req::get_span_dir () const + +bool +alist_equal_p (SCM a, SCM b) { - SCM d = get_mus_property ("span-direction"); + for (SCM s = a; + gh_pair_p (s); s = ly_cdr (s)) + { + SCM key = ly_caar (s); + SCM val = ly_cdar (s); + SCM l = scm_assoc (key, b); - return (ly_dir_p (d)) ? to_dir (d) : CENTER; + if (l == SCM_BOOL_F + || !gh_equal_p ( ly_cdr (l), val)) + + return false; + } + return true; } -void -Span_req::set_span_dir (Direction d) +bool +Key_change_req::do_equal_b (Request const * m )const { - set_mus_property ("span-direction", gh_int2scm (d)); + Key_change_req const * kc =dynamic_cast (m); + + if(!kc) + return false; + return alist_equal_p (get_mus_property ("pitch-alist"), + kc->get_mus_property ("pitch-alist")); } -ADD_MUSIC(Request); +ADD_MUSIC (Key_change_req); diff --git a/lily/rest-collision-engraver.cc b/lily/rest-collision-engraver.cc index cff3fbff87..b4d76b06d9 100644 --- a/lily/rest-collision-engraver.cc +++ b/lily/rest-collision-engraver.cc @@ -65,7 +65,7 @@ Rest_collision_engraver::stop_translation_timestep () ENTER_DESCRIPTION(Rest_collision_engraver, /* descr */ "Handles collisions of rests.", /* creats*/ "RestCollision", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "note-column-interface", /* reads */ "", /* write */ ""); diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index 3aabd92441..8f694da5ef 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -7,7 +7,7 @@ */ #include "item.hh" #include "staff-symbol-referencer.hh" -#include "musical-request.hh" +#include "request.hh" #include "dots.hh" #include "rhythmic-head.hh" #include "engraver.hh" diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 20c86a3b11..2861bb9cc1 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -13,7 +13,7 @@ #include "stem.hh" #include "note-column.hh" #include "dot-column.hh" -#include "musical-request.hh" +#include "request.hh" #include "item.hh" #include "group-interface.hh" @@ -182,7 +182,7 @@ Rhythmic_column_engraver::start_translation_timestep () ENTER_DESCRIPTION(Rhythmic_column_engraver, /* descr */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.", /* creats*/ "NoteColumn NoteSpacing", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "stem-interface rhythmic-head-interface dot-column-interface", /* reads */ "", /* write */ ""); diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 52afa1b0b8..6e0ebb7534 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -15,7 +15,7 @@ #include "score-engraver.hh" #include "paper-score.hh" #include "paper-column.hh" -#include "command-request.hh" + #include "paper-def.hh" #include "axis-group-interface.hh" #include "translator-def.hh" diff --git a/lily/score-performer.cc b/lily/score-performer.cc index 686574f9d1..f98395e7e6 100644 --- a/lily/score-performer.cc +++ b/lily/score-performer.cc @@ -21,7 +21,7 @@ ENTER_DESCRIPTION(Score_performer, /* descr */ "", /* creats*/ "", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "", /* reads */ "", /* write */ ""); diff --git a/lily/script-column-engraver.cc b/lily/script-column-engraver.cc index 7af91365b7..f5d70c5f0b 100644 --- a/lily/script-column-engraver.cc +++ b/lily/script-column-engraver.cc @@ -87,7 +87,7 @@ Script_column_engraver::process_acknowledged_grobs () ENTER_DESCRIPTION(Script_column_engraver, /* descr */ "", /* creats*/ "ScriptColumn", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "side-position-interface", /* reads */ "", /* write */ ""); diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index a153242688..e7511c5579 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -6,7 +6,7 @@ #include "script.hh" #include "side-position-interface.hh" -#include "musical-request.hh" +#include "request.hh" #include "stem.hh" #include "rhythmic-head.hh" #include "engraver.hh" @@ -15,7 +15,7 @@ class Script_engraver : public Engraver { Link_array scripts_; - Link_array script_reqs_; + Link_array script_reqs_; public: TRANSLATOR_DECLARATIONS(Script_engraver); @@ -37,14 +37,9 @@ Script_engraver::initialize () bool Script_engraver::try_music (Music *r) { - if (Articulation_req *mr = dynamic_cast (r)) + if (r->is_mus_type ("articulation-event")) { - for (int i=0; i < script_reqs_.size (); i++) - { - if (script_reqs_[i]->equal_b (mr)) - return true; - } - script_reqs_.push (mr); + script_reqs_.push (r); return true; } return false; @@ -55,7 +50,7 @@ Script_engraver::process_music () { for (int i=0; i < script_reqs_.size (); i++) { - Articulation_req* l=script_reqs_[i]; + Music* l=script_reqs_[i]; SCM alist = get_property ("scriptDefinitions"); SCM art = scm_assoc (l->get_mus_property ("articulation-type"), alist); @@ -209,7 +204,7 @@ ENTER_DESCRIPTION(Script_engraver, /* descr */ " Handles note ornaments generated by @code{\\script}. ", /* creats*/ "Script", -/* accepts */ "general-music", +/* accepts */ "script-event articulation-event", /* acks */ "stem-interface rhythmic-head-interface note-column-interface", /* reads */ "scriptDefinitions scriptHorizontal", /* write */ ""); diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index cd1fa23a02..c4ed87df91 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -213,7 +213,7 @@ Separating_line_group_engraver::stop_translation_timestep () ENTER_DESCRIPTION(Separating_line_group_engraver, /* descr */ "Generates objects for computing spacing parameters.", /* creats*/ "SeparationItem SeparatingGroupSpanner", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "item-interface", /* reads */ "", /* write */ ""); diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index b703078f62..d5e9f673c1 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -4,7 +4,7 @@ (c) 1997--2002 Han-Wen Nienhuys */ -#include "musical-request.hh" +#include "request.hh" #include "slur.hh" #include "warn.hh" #include "note-column.hh" @@ -17,8 +17,8 @@ */ class Slur_engraver : public Engraver { - Link_array requests_; - Link_array new_slur_reqs_; + Link_array requests_; + Link_array new_slur_reqs_; Link_array slur_stack_; Link_array end_slurs_; Moment last_start_; @@ -45,56 +45,57 @@ Slur_engraver::Slur_engraver () bool Slur_engraver::try_music (Music *req) { - if (Span_req *sl = dynamic_cast (req)) + if (req->is_mus_type ("abort-event")) { - String t = ly_scm2string (sl->get_mus_property ("span-type")); - if (t == "abort") + for (int i = 0; i < slur_stack_.size (); i++) { - for (int i = 0; i < slur_stack_.size (); i++) - { - slur_stack_[i]->suicide (); - } - slur_stack_.clear (); - for (int i = 0; i < end_slurs_.size (); i++) + slur_stack_[i]->suicide (); + } + slur_stack_.clear (); + for (int i = 0; i < end_slurs_.size (); i++) + { + end_slurs_[i]->suicide (); + } + end_slurs_.clear (); + requests_.clear (); + new_slur_reqs_.clear (); + } + else if (req->is_mus_type ("slur-event")) + { + /* + Let's not start more than one slur per moment. + */ + Direction d = to_dir (req->get_mus_property ("span-direction")); + if (d == START) + { + if (now_mom () > last_start_) { - end_slurs_[i]->suicide (); + new_slur_reqs_.push (req); + last_start_ = now_mom (); } - end_slurs_.clear (); - requests_.clear (); - new_slur_reqs_.clear (); + + /* + But we swallow other slur requests. + */ + + return true; + } - else if (t == "slur") + else if (d == STOP) { /* - Let's not start more than one slur per moment. - */ - if (sl->get_span_dir () == START) + Swallow other requests. + */ + for (int j = new_slur_reqs_.size(); j--;) { - if (now_mom () > last_start_) - { - new_slur_reqs_.push (sl); - last_start_ = now_mom (); - } - - /* - But we swallow other slur requests. - */ + Direction nd = to_dir (new_slur_reqs_[j]->get_mus_property ("span-direction")); - return true; - + if (nd == STOP) + return true; } - else if (sl->get_span_dir () == STOP) - { - /* - Swallow other requests. - */ - for (int j = new_slur_reqs_.size(); j--;) - if (new_slur_reqs_[j]->get_span_dir() == STOP) - return true; - new_slur_reqs_.push (sl); - return true; - } + new_slur_reqs_.push (req); + return true; } } return false; @@ -147,9 +148,10 @@ Slur_engraver::process_acknowledged_grobs () Link_array start_slurs; for (int i=0; i< new_slur_reqs_.size (); i++) { - Span_req* slur_req = new_slur_reqs_[i]; + Music* slur_req = new_slur_reqs_[i]; // end slur: move the slur to other array - if (slur_req->get_span_dir () == STOP) + Direction d = to_dir (slur_req->get_mus_property ("span-direction")); + if (d== STOP) { if (slur_stack_.empty ()) /* How to shut up this warning, when Voice_devnull_engraver has @@ -163,7 +165,7 @@ Slur_engraver::process_acknowledged_grobs () requests_.pop (); } } - else if (slur_req->get_span_dir () == START) + else if (d == START) { // push a new slur onto stack. // (use temp. array to wait for all slur STOPs) @@ -205,7 +207,7 @@ Slur_engraver::start_translation_timestep () ENTER_DESCRIPTION (Slur_engraver, /* descr */ "Build slurs from Slur_reqs", /* creats*/ "Slur", -/* accepts */ "general-music", +/* accepts */ "slur-event", /* acks */ "note-column-interface", /* reads */ "slurMelismaBusy", /* write */ ""); diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index 9903b10070..9fc77d7239 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -7,7 +7,7 @@ */ -#include "musical-request.hh" +#include "request.hh" #include "paper-column.hh" #include "engraver.hh" #include "pqueue.hh" @@ -106,7 +106,8 @@ Spacing_engraver::acknowledge_grob (Grob_info i) */ if (!now_.grace_part_) { - if (Rhythmic_req * r = dynamic_cast (i.music_cause ())) + Music *r = i.music_cause (); + if (r && r->is_mus_type ("rhythmic-event")) { Moment len = r->length_mom (); Rhythmic_tuple t (i, now_mom () + len); @@ -171,7 +172,7 @@ Spacing_engraver::start_translation_timestep () ENTER_DESCRIPTION(Spacing_engraver, /* descr */ "make a SpacingSpanner and do bookkeeping of shortest starting and playing notes ", /* creats*/ "SpacingSpanner", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "grob-interface", /* reads */ "", /* write */ ""); diff --git a/lily/span-arpeggio-engraver.cc b/lily/span-arpeggio-engraver.cc index 92f6d0f42b..715decd948 100644 --- a/lily/span-arpeggio-engraver.cc +++ b/lily/span-arpeggio-engraver.cc @@ -105,7 +105,7 @@ Span_arpeggio_engraver::stop_translation_timestep () ENTER_DESCRIPTION(Span_arpeggio_engraver, /* descr */ "", /* creats*/ "Arpeggio", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "arpeggio-interface", /* reads */ "connectArpeggios", /* write */ ""); diff --git a/lily/span-bar-engraver.cc b/lily/span-bar-engraver.cc index 503e563a1d..10c6b30e6d 100644 --- a/lily/span-bar-engraver.cc +++ b/lily/span-bar-engraver.cc @@ -93,7 +93,7 @@ ENTER_DESCRIPTION(Span_bar_engraver, /* descr */ "This engraver makes cross-staff barlines: It catches all normal bar lines, and draws a single span-bar across them.", /* creats*/ "SpanBar", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "bar-line-interface", /* reads */ "", /* write */ ""); diff --git a/lily/span-dynamic-performer.cc b/lily/span-dynamic-performer.cc index 6c53867584..e568cae2e4 100644 --- a/lily/span-dynamic-performer.cc +++ b/lily/span-dynamic-performer.cc @@ -7,8 +7,8 @@ */ #include "performer.hh" -#include "command-request.hh" -#include "musical-request.hh" + +#include "request.hh" #include "audio-item.hh" struct Audio_dynamic_tuple @@ -35,8 +35,8 @@ protected: private: Audio_dynamic* audio_; Real last_volume_; - Span_req* span_start_req_; - Drul_array span_req_l_drul_; + Music* span_start_req_; + Drul_array span_req_l_drul_; Array dynamic_tuples_; Array finished_dynamic_tuples_; Direction dir_; @@ -173,18 +173,15 @@ Span_dynamic_performer::start_translation_timestep () bool Span_dynamic_performer::try_music (Music* r) { - if (Span_req * s = dynamic_cast (r)) + if (r->is_mus_type ("dynamic-event")) // fixme. { - String t = ly_scm2string (s->get_mus_property ("span-type")); - if (t == "crescendo" || t == "decrescendo") - { - span_req_l_drul_[s->get_span_dir ()] = s; - return true; - } + Direction d = to_dir (r->get_mus_property ("span-direction")); + span_req_l_drul_[d] = r; + return true; } return false; } ENTER_DESCRIPTION (Span_dynamic_performer, "", "", - "general-music", + "dynamic-event", "", "", ""); diff --git a/lily/staff-collecting-engraver.cc b/lily/staff-collecting-engraver.cc index 23792a7332..920a06c196 100644 --- a/lily/staff-collecting-engraver.cc +++ b/lily/staff-collecting-engraver.cc @@ -40,7 +40,7 @@ ENTER_DESCRIPTION(Staff_collecting_engraver, /* descr */ "Maintain the stavesFound variable", /* creats*/ "", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "staff-symbol-interface", /* reads */ "stavesFound", /* write */ "stavesFound"); diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index d666fb6064..800ccafe11 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -42,7 +42,7 @@ private: }; ENTER_DESCRIPTION (Staff_performer, "", "", - "general-music", + "", "", "", ""); Staff_performer::Staff_performer () diff --git a/lily/staff-symbol-engraver.cc b/lily/staff-symbol-engraver.cc index 956f9a0c5b..9f601d1551 100644 --- a/lily/staff-symbol-engraver.cc +++ b/lily/staff-symbol-engraver.cc @@ -74,7 +74,7 @@ ENTER_DESCRIPTION(Staff_symbol_engraver, /* descr */ "create the constellation of five (default) staff lines.", /* creats*/ "StaffSymbol", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "grob-interface", /* reads */ "", /* write */ ""); diff --git a/lily/stanza-number-engraver.cc b/lily/stanza-number-engraver.cc index 9e1f3d1fc1..46f1ef291b 100644 --- a/lily/stanza-number-engraver.cc +++ b/lily/stanza-number-engraver.cc @@ -94,7 +94,7 @@ Stanza_number_engraver::create_text (SCM txt) ENTER_DESCRIPTION(Stanza_number_engraver, /* descr */ "", /* creats*/ "StanzaNumber", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "", /* reads */ "stz stanza", /* write */ ""); diff --git a/lily/stem-engraver.cc b/lily/stem-engraver.cc index 8d08ee0dd8..c9d1ab58ec 100644 --- a/lily/stem-engraver.cc +++ b/lily/stem-engraver.cc @@ -9,7 +9,7 @@ #include "staff-symbol-referencer.hh" #include "rhythmic-head.hh" #include "stem.hh" -#include "musical-request.hh" +#include "request.hh" #include "misc.hh" #include "stem-tremolo.hh" #include "item.hh" @@ -32,8 +32,8 @@ protected: private: Grob *stem_; Grob *tremolo_; - Rhythmic_req *rhythmic_req_; - Tremolo_req* tremolo_req_; + Music *rhythmic_req_; + Music* tremolo_req_; }; Stem_engraver::Stem_engraver () @@ -161,9 +161,9 @@ Stem_engraver::stop_translation_timestep () bool Stem_engraver::try_music (Music* r) { - if (Tremolo_req* a = dynamic_cast (r)) + if (r->is_mus_type ("tremolo-event")) { - tremolo_req_ = a; + tremolo_req_ = r; return true; } return false; @@ -173,7 +173,7 @@ ENTER_DESCRIPTION(Stem_engraver, /* descr */ "Create stems and single-stem tremolos. It also works together with the beam engraver for overriding beaming.", /* creats*/ "Stem StemTremolo", -/* accepts */ "general-music", +/* accepts */ "tremolo-event", /* acks */ "rhythmic-head-interface", /* reads */ "tremoloFlags stemLeftBeamCount stemRightBeamCount", /* write */ ""); diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index 682cf4f069..1bfd7c22ab 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -87,7 +87,7 @@ System_start_delimiter_engraver::finalize () ENTER_DESCRIPTION(System_start_delimiter_engraver, /* descr */ "Creates a system start delimiter (ie. SystemStart@{Bar,Brace,Bracket@} spanner", /* creats*/ "SystemStartBar SystemStartBrace SystemStartBracket", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "system-start-delimiter-interface staff-symbol-interface", /* reads */ "systemStartDelimiter", /* write */ ""); diff --git a/lily/tab-note-heads-engraver.cc b/lily/tab-note-heads-engraver.cc index fb2b29101a..60333dbc75 100644 --- a/lily/tab-note-heads-engraver.cc +++ b/lily/tab-note-heads-engraver.cc @@ -8,7 +8,7 @@ #include "rhythmic-head.hh" #include "paper-def.hh" -#include "musical-request.hh" +#include "request.hh" #include "dots.hh" #include "dot-column.hh" #include "staff-symbol-referencer.hh" diff --git a/lily/tempo-performer.cc b/lily/tempo-performer.cc index f457b42898..96ba3fa880 100644 --- a/lily/tempo-performer.cc +++ b/lily/tempo-performer.cc @@ -6,7 +6,7 @@ (c) 1997--2002 Jan Nieuwenhuizen */ -#include "command-request.hh" + #include "audio-item.hh" #include "performer.hh" diff --git a/lily/text-engraver.cc b/lily/text-engraver.cc index 505a74505a..57acc8c4c7 100644 --- a/lily/text-engraver.cc +++ b/lily/text-engraver.cc @@ -11,7 +11,7 @@ #include "engraver.hh" #include "side-position-interface.hh" #include "item.hh" -#include "musical-request.hh" +#include "request.hh" #include "stem.hh" #include "rhythmic-head.hh" @@ -21,7 +21,7 @@ */ class Text_engraver : public Engraver { - Link_array reqs_; + Link_array reqs_; Link_array texts_; public: TRANSLATOR_DECLARATIONS(Text_engraver); @@ -36,11 +36,9 @@ protected: bool Text_engraver::try_music (Music *m) { - if (dynamic_cast (m) - && m->get_mus_property ("text-type") != ly_symbol2scm ("finger") - && m->get_mus_property ("text-type") != ly_symbol2scm ("dynamic")) + if (m->is_mus_type ("text-script-event")) { - reqs_.push (dynamic_cast (m)); + reqs_.push (m); return true; } return false; @@ -84,7 +82,7 @@ Text_engraver::process_acknowledged_grobs () return; for (int i=0; i < reqs_.size (); i++) { - Text_script_req * r = reqs_[i]; + Music * r = reqs_[i]; // URG: Text vs TextScript String basic = "TextScript"; @@ -110,8 +108,9 @@ Text_engraver::process_acknowledged_grobs () text->set_grob_property ("script-priority", gh_int2scm (priority)); - if (r->get_direction ()) - Side_position_interface::set_direction (text, r->get_direction ()); + Direction dir = to_dir (r->get_mus_property ("direction")); + if (dir) + Side_position_interface::set_direction (text, dir); text->set_grob_property ("text", r->get_mus_property ("text")); announce_grob (text, r->self_scm ()); @@ -144,7 +143,7 @@ Text_engraver::Text_engraver(){} ENTER_DESCRIPTION(Text_engraver, /* descr */ "Create text-scripts", /* creats*/ "TextScript", -/* accepts */ "general-music", +/* accepts */ "text-script-event", /* acks */ "rhythmic-head-interface stem-interface", /* reads */ "scriptHorizontal", /* write */ ""); diff --git a/lily/text-spanner-engraver.cc b/lily/text-spanner-engraver.cc index 0ac0944fa7..294545aa45 100644 --- a/lily/text-spanner-engraver.cc +++ b/lily/text-spanner-engraver.cc @@ -7,7 +7,7 @@ */ #include "dimensions.hh" -#include "musical-request.hh" +#include "request.hh" #include "paper-column.hh" #include "note-column.hh" #include "item.hh" @@ -34,8 +34,8 @@ protected: private: Spanner *span_; Spanner *finished_; - Span_req *current_req_; - Drul_array req_drul_; + Music *current_req_; + Drul_array req_drul_; void typeset_all (); }; @@ -59,23 +59,22 @@ Text_spanner_engraver::start_translation_timestep () bool Text_spanner_engraver::try_music (Music *m) { - if (Span_req *s = dynamic_cast (m)) + if (m->is_mus_type ("text-span-event")) { - String t = ly_scm2string (s->get_mus_property ("span-type")); - if (t == "abort") - { - req_drul_[LEFT] = 0; - req_drul_[RIGHT] = 0; - if (span_) - span_->suicide (); - span_ = 0; - } - else if (t == "text") - { - req_drul_[s->get_span_dir ()] = s; - return true; - } + + Direction d = to_dir (m->get_mus_property ("span-direction")); + req_drul_[d] = m; + return true; } + else if (m->is_mus_type ("abort-event")) + { + req_drul_[LEFT] = 0; + req_drul_[RIGHT] = 0; + if (span_) + span_->suicide (); + span_ = 0; + } + return false; } @@ -175,9 +174,9 @@ Text_spanner_engraver::finalize () } ENTER_DESCRIPTION(Text_spanner_engraver, -/* descr */ "Create text spanner from a Span_req.", +/* descr */ "Create text spanner from a Music.", /* creats*/ "TextSpanner", -/* accepts */ "general-music", +/* accepts */ "text-span-event", /* acks */ "note-column-interface", /* reads */ "", /* write */ ""); diff --git a/lily/thread-devnull-engraver.cc b/lily/thread-devnull-engraver.cc index 569b911a32..2c1e13716b 100644 --- a/lily/thread-devnull-engraver.cc +++ b/lily/thread-devnull-engraver.cc @@ -8,7 +8,7 @@ #include "engraver.hh" #include "item.hh" -#include "musical-request.hh" +#include "request.hh" #include "translator-group.hh" class Thread_devnull_engraver : public Engraver @@ -58,7 +58,7 @@ identical, it tells the @code{Thread_devnull_engraver} to discard everything in the second thread. ", /* creats*/ "", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "grob-interface", /* reads */ "", /* write */ ""); diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 64d17c63ff..31ef2079ba 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -7,8 +7,8 @@ */ -#include "command-request.hh" -#include "musical-request.hh" + +#include "request.hh" #include "tie.hh" #include "translator-group.hh" #include "spanner.hh" diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index d76b71c4d8..f1531ea677 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -7,9 +7,9 @@ */ -#include "command-request.hh" + #include "audio-item.hh" -#include "musical-request.hh" +#include "request.hh" #include "pqueue.hh" #include "performer.hh" diff --git a/lily/time-scaled-music-iterator.cc b/lily/time-scaled-music-iterator.cc index cbba1e4f03..35f0eef493 100644 --- a/lily/time-scaled-music-iterator.cc +++ b/lily/time-scaled-music-iterator.cc @@ -9,9 +9,9 @@ #include "time-scaled-music-iterator.hh" #include "time-scaled-music.hh" -#include "musical-request.hh" +#include "request.hh" #include "translator-group.hh" -#include "command-request.hh" + void Time_scaled_music_iterator::process (Moment m) diff --git a/lily/time-signature-engraver.cc b/lily/time-signature-engraver.cc index d761129066..11bc922e4c 100644 --- a/lily/time-signature-engraver.cc +++ b/lily/time-signature-engraver.cc @@ -7,7 +7,7 @@ */ #include "time-signature.hh" -#include "command-request.hh" + #include "engraver.hh" #include "engraver-group-engraver.hh" diff --git a/lily/time-signature-performer.cc b/lily/time-signature-performer.cc index e9a556807c..482a9d7507 100644 --- a/lily/time-signature-performer.cc +++ b/lily/time-signature-performer.cc @@ -67,4 +67,4 @@ Time_signature_performer::stop_translation_timestep () } } -ENTER_DESCRIPTION(Time_signature_performer,"","","general-music","","",""); +ENTER_DESCRIPTION(Time_signature_performer,"","","","","",""); diff --git a/lily/timing-engraver.cc b/lily/timing-engraver.cc index 741956cbf3..7150ca4699 100644 --- a/lily/timing-engraver.cc +++ b/lily/timing-engraver.cc @@ -6,7 +6,7 @@ (c) 1997--2002 Han-Wen Nienhuys */ #include "translator-group.hh" -#include "command-request.hh" + #include "grob-info.hh" #include "multi-measure-rest.hh" #include "timing-translator.hh" @@ -95,7 +95,7 @@ Normally in @code{Score}. In order to create polyrhythmic music, this engraver should be removed from @code{Score} and placed in @code{Staff}.", /* creats*/ "", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "", /* reads */ "timeSignatureFraction barNonAuto whichBar barAlways defaultBarType skipBars timing oneBeat measureLength measurePosition currentBarNumber", /* write */ ""); diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc index 01a67a8eff..d720399572 100644 --- a/lily/timing-translator.cc +++ b/lily/timing-translator.cc @@ -9,7 +9,7 @@ #include "warn.hh" #include "timing-translator.hh" -#include "command-request.hh" + #include "translator-group.hh" #include "global-translator.hh" #include "multi-measure-rest.hh" @@ -152,4 +152,4 @@ Timing_translator::start_translation_timestep () daddy_trans_->set_property ("measurePosition", measposp.smobbed_copy ()); } -ENTER_DESCRIPTION(Timing_translator,"","","general-music","","",""); +ENTER_DESCRIPTION(Timing_translator,"","","","","",""); diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc index 68313e8492..891d809f61 100644 --- a/lily/tuplet-engraver.cc +++ b/lily/tuplet-engraver.cc @@ -8,7 +8,7 @@ */ -#include "command-request.hh" + #include "tuplet-bracket.hh" #include "note-column.hh" #include "time-scaled-music.hh" @@ -23,7 +23,7 @@ public: TRANSLATOR_DECLARATIONS(Tuplet_engraver); protected: - Link_array time_scaled_musics_; + Link_array time_scaled_musics_; /// when does the scaled music stop? Array order is synced with time_scaled_musics_ Array stop_moments_; /// when does the current spanner stop? Array order is synced with time_scaled_musics_ @@ -40,18 +40,12 @@ protected: }; bool -Tuplet_engraver::try_music (Music *r) +Tuplet_engraver::try_music (Music *c) { -#if 1 - if (Time_scaled_music * c = dynamic_cast (r)) - { - Music *el = c->element (); -#else - if (r->is_mus_type ("time-scaled-music")) + if (c->is_mus_type ("time-scaled-music")) { Music *el = unsmob_music (c->get_mus_property ("element")); -#endif - if (!dynamic_cast (el)) + if (el && !el->is_mus_type ("request-chord")) { time_scaled_musics_.push (c); Rational m = now_mom ().main_part_ + c->length_mom ().main_part_; diff --git a/lily/type-swallow-translator.cc b/lily/type-swallow-translator.cc index 0c77e982a9..dbdf93f488 100644 --- a/lily/type-swallow-translator.cc +++ b/lily/type-swallow-translator.cc @@ -7,7 +7,7 @@ */ #include "translator.hh" -#include "musical-request.hh" +#include "request.hh" class Skip_req_swallow_translator : public virtual Translator { diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index a607a32f3c..9c2ac952ca 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -69,7 +69,7 @@ Vertical_align_engraver::acknowledge_grob (Grob_info i) ENTER_DESCRIPTION(Vertical_align_engraver, /* descr */ "Catch Vertical axis groups and stack them.", /* creats*/ "VerticalAlignment", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "axis-group-interface", /* reads */ "", /* write */ ""); diff --git a/lily/voice-devnull-engraver.cc b/lily/voice-devnull-engraver.cc index e8a5a3aa15..084d658447 100644 --- a/lily/voice-devnull-engraver.cc +++ b/lily/voice-devnull-engraver.cc @@ -8,7 +8,7 @@ #include "engraver.hh" #include "item.hh" -#include "musical-request.hh" +#include "request.hh" #include "translator-group.hh" class Voice_devnull_engraver : public Engraver @@ -22,7 +22,14 @@ protected: }; +/* + +ARGH . + + +This really sucks. + */ static char const *eat_spanners[] = { "beam", "crescendo", @@ -49,9 +56,9 @@ Voice_devnull_engraver::try_music (Music *m) && (to_boolean (get_property ("unison")) || to_boolean (get_property ("unisilence"))))) { - if (Span_req *s = dynamic_cast (m)) + if (m->is_mus_type ("span-event")) { - SCM t = s->get_mus_property ("span-type"); + SCM t = m->get_mus_property ("span-type"); for (char const **p = eat_spanners; *p; p++) { @@ -123,7 +130,7 @@ Voice_devnull_engraver::Voice_devnull_engraver(){} ENTER_DESCRIPTION(Voice_devnull_engraver, /* descr */ "Kill off certain items and spanners if we're Voice `two' and unison or unisilence is set.", /* creats*/ "", -/* accepts */ "general-music tie-event", +/* accepts */ "general-music", /*UGH.*/ /* acks */ "grob-interface", /* reads */ "", /* write */ ""); diff --git a/lily/volta-engraver.cc b/lily/volta-engraver.cc index fd65be42e0..14acbf4249 100644 --- a/lily/volta-engraver.cc +++ b/lily/volta-engraver.cc @@ -211,7 +211,7 @@ Volta_engraver::stop_translation_timestep () ENTER_DESCRIPTION(Volta_engraver, /* descr */ "Make volta brackets", /* creats*/ "VoltaBracket", -/* accepts */ "general-music", +/* accepts */ "", /* acks */ "bar-line-interface staff-symbol-interface note-column-interface", /* reads */ "repeatCommands voltaSpannerDuration stavesFound", /* write */ ""); diff --git a/scm/backend-documentation-lib.scm b/scm/backend-documentation-lib.scm index 1a4144f3c3..46b042197d 100644 --- a/scm/backend-documentation-lib.scm +++ b/scm/backend-documentation-lib.scm @@ -63,10 +63,6 @@ )) )) -(define (engraver-makes-grob? name-symbol grav) - (memq name-symbol (assoc 'grobs-created (ly-translator-description grav))) - ) - (define (all-grobs-doc) (make #:name "All Graphical objects" diff --git a/scm/engraver-documentation-lib.scm b/scm/engraver-documentation-lib.scm index aac8ed15e2..a6cd45000e 100644 --- a/scm/engraver-documentation-lib.scm +++ b/scm/engraver-documentation-lib.scm @@ -7,10 +7,23 @@ ;;; Jan Nieuwenhuizen +(define (engraver-makes-grob? name-symbol grav) + (memq name-symbol (assoc 'grobs-created (ly-translator-description grav))) + ) +(define (engraver-accepts-music-type? name-symbol grav) + (memq name-symbol (assoc 'events-accepted (ly-translator-description grav))) + + ) + +(define (engraver-accepts-music-types? types grav) + (if (null? types) + #f + (or + (engraver-accepts-music-type? (car types) grav) + (engraver-accepts-music-types? (cdr types) grav))) + ) -;; First level Engraver description and -;; second level Context description (define (engraver-doc-string engraver) (let* ( (propsr (cdr (assoc 'properties-read (ly-translator-description engraver)))) diff --git a/scm/music-documentation-lib.scm b/scm/music-documentation-lib.scm index 5be708e768..af39ea7641 100644 --- a/scm/music-documentation-lib.scm +++ b/scm/music-documentation-lib.scm @@ -1,6 +1,4 @@ - - (define (music-props-doc) (make #:name "Music properties" @@ -20,7 +18,7 @@ (map (lambda (entry) (let* ( - (types (assoc 'types (cdr entry) )) + (types (cdr (assoc 'types (cdr entry) ))) ) (map (lambda (type) (hashq-set! music-types->names type @@ -37,7 +35,6 @@ "Convert table t to list" (apply append (vector->list t) - )) (define (strip-description x) @@ -56,6 +53,13 @@ (sort (map (lambda (x) (ref-ify (symbol->string x))) (cdr entry)) stringalist music-types->names) alist - #:name (symbol->string (car obj)) - #:text (string-append - (object-property (car obj) 'music-description) +(define (music-doc-str obj) + (let* + ( + (namesym (car obj)) + (props (cdr obj)) + (types (cdr (assoc 'types props))) + ) + + (string-append + (object-property namesym 'music-description) + "\n\nMusic types:\n" + (human-listify (map ref-ify (map symbol->string types))) + "\n\n" + "\n\nAccepted by: " + (human-listify + (map ref-ify + (map ly-translator-name + (filter-list + (lambda (x) (engraver-accepts-music-types? types x)) all-engravers-list)))) "\n\nProperties: \n" (description-list->texi (map - (lambda (x) (document-property x 'music (cdr obj))) - (map car (cdr obj)))) - )) -) + (lambda (x) (document-property x 'music props)) + (map car props))) + + ) + )) + +(define (music-object-doc obj) + (make + #:name (symbol->string (car obj)) + #:text (music-doc-str obj) + )) (define (music-expressions-doc) (make @@ -89,7 +114,6 @@ (map music-object-doc music-descriptions) )) - (define (music-doc-node) (make #:name "Music definitions" diff --git a/scm/music-types.scm b/scm/music-types.scm index b2392bd2c2..b3d31c8d7a 100644 --- a/scm/music-types.scm +++ b/scm/music-types.scm @@ -4,7 +4,7 @@ (AbortEvent . ( (description . "Abort currently running spanners.") - (internal-class-name . "Span_req") + (internal-class-name . "Request") (span-type . "abort") (types . (general-music event abort-event)) )) @@ -14,13 +14,32 @@ (internal-class-name . "Request") (types . (general-music arpeggio-event event)) )) + + ;; todo: use articulation-event for slur as well. + ;; separate non articulation scripts (ArticulationEvent . ( (description . "") - (internal-class-name . "Articulation_req") + (internal-class-name . "Request") (types . (general-music event articulation-event script-event)) )) + (AutoChangeMusic + . ( + (description . "") + + (internal-class-name . "Music_wrapper") + (iterator-ctor . ,Auto_change_iterator::constructor) + (types . (general-music music-wrapper-music auto-change-instruction)) + )) + (BarCheck + . ( + (description . "") + + (internal-class-name . "Music") + (types . (general-music bar-check)) + (iterator-ctor . ,Bar_check_iterator::constructor) + )) (BassFigureEvent . ( (description . "") @@ -58,7 +77,28 @@ (internal-class-name . "Request") (types . (general-music event busy-playing-event)) )) - (ExtenderEvent + (ContextSpeccedMusic + . ( + (description . "") + + (internal-class-name . "Context_specced_music") + (types . (context-specification general-music music-wrapper-music)) + )) + (CrescendoEvent + . ( + (description . "") + + (internal-class-name . "Request") + (types . (general-music dynamic-event crescendo-event event)) + )) + (DecrescendoEvent + . ( + (description . "") + + (internal-class-name . "Request") + (types . (general-music dynamic-event decrescendo-event event)) + )) + (ExtenderEvent . ( (description . "") @@ -94,12 +134,24 @@ (internal-class-name . "Key_change_req") (types . (general-music key-change-event event)) )) - (LyricEvent + (LyricCombineMusic . ( (description . "") - (internal-class-name . "Lyric_req") - (types . (general-music rhythmic-event event)) + (internal-class-name . "Lyric_combine_music") + (types . (general-music lyric-combine-music)) + (iterator-ctor . ,Lyric_combine_music_iterator::constructor) + )) + + (LyricEvent + . ( + (description . "A lyric syllable. Must be entered in lyrics mode, i.e. +@code{\lyrics @{ twinkle4 twinkle4 @} } .") + + (length . ,music-duration-length) + (compress-procedure . ,music-duration-compress) + (internal-class-name . "Request") + (types . (general-music rhythmic-event lyric-event event)) )) (LigatureEvent . ( @@ -130,6 +182,13 @@ (internal-class-name . "Request") (types . (general-music event)) )) + (MultiMeasureRestEvent + . ( + (description . "Rests that may be compressed into Multi rests. Syntax +@code{R2.*4} for 4 measures in 3/4 time. Note the capital R.") + (internal-class-name . "Request") + (types . (general-music event multi-measure-rest-event)) + )) (Music . ( (description . "") @@ -146,12 +205,52 @@ (compress-procedure . ,music-duration-compress) (types . (general-music event note-event rhythmic-event melodic-event)) )) - (PorrectusEvent + (OverrideProperty + . ( + (description . "") + + (internal-class-name . "Music") + (types . (general-music layout-instruction)) + (iterator-ctor . , Push_property_iterator::constructor) + )) + + (PartCombineMusic . ( (description . "") - (internal-class-name . "Porrectus_req") - (types . (general-music event)) + (internal-class-name . "Part_combine_music") + (types . (general-music part-combine-music)) + (iterator-ctor . ,Part_combine_music_iterator::constructor) + )) + (PhrasingSlurEvent + . ( + (description . "Start or end phrasing slur. Syntax NOTE \( and \) NOTE") + (internal-class-name . "Request") + (types . (general-music span-event phrasing-slur-event slur-event)) + )) + (PropertySet + . ( + (description . "") + (internal-class-name . "Music") + (types . (layout-instruction general-music)) + (iterator-ctor . ,Property_iterator::constructor) + ) + ) + (PropertyUnset + . ( + (description . "") + + (internal-class-name . "Music") + (types . (layout-instruction general-music)) + (iterator-ctor . ,Property_unset_iterator::constructor) + ) + ) + (PorrectusEvent + . ( + (description . "") + + (internal-class-name . "Request") + (types . (general-music porrectus-event event)) )) (RepeatedMusic . ( @@ -159,7 +258,7 @@ (internal-class-name . "Repeated_music") (type . repeated-music) - (types . (general-music repeat-music)) + (types . (general-music repeated-music)) )) (Request . ( @@ -177,18 +276,9 @@ (compress-procedure . ,music-duration-compress) (types . (general-music event rhythmic-event rest-event)) )) - (RhythmicEvent - . ( - (description . "") - - (internal-class-name . "Rhythmic_req") - (length . ,music-duration-length) - (compress-procedure . ,music-duration-compress) - (types . (general-music rhythmic-event event)) - )) (SequentialMusic . ( - (description . "") + (description . "Music expressions concatenated. Syntax \sequential @{..@} or simply @{..@} .") (internal-class-name . "Sequential_music") (iterator-ctor . ,Sequential_music_iterator::constructor) @@ -196,55 +286,21 @@ )) (SimultaneousMusic . ( - (description . "") + (description . "Music playing together. Syntax: \simultaneous @{ .. @} or < .. >.") (internal-class-name . "Simultaneous_music") (iterator-ctor . ,Simultaneous_music_iterator::constructor) (types . (general-music simultaneous-music)) )) - (PropertySet - . ( - (description . "") - - (internal-class-name . "Music") - (types . (layout-instruction general-music)) - (iterator-ctor . ,Property_iterator::constructor) - ) - ) - (PropertyUnset + (SlurEvent . ( - (description . "") - - (internal-class-name . "Music") - (types . (layout-instruction general-music)) - (iterator-ctor . ,Property_unset_iterator::constructor) - ) - ) - (VoiceSeparator - . ( - (description . "") - - (internal-class-name . "Music") - (types . (separator general-music)) - )) - (BarCheck - . ( - (description . "") - - (internal-class-name . "Music") - (types . (general-music bar-check)) - (iterator-ctor . ,Bar_check_iterator::constructor) - )) - (OverrideProperty - . ( - (description . "") + (description . "Start or end slur. Syntax NOTE( and )NOTE") + (internal-class-name . "Request") + (types . (general-music span-event slur-event)) + )) - (internal-class-name . "Music") - (types . (general-music layout-instruction)) - (iterator-ctor . , Push_property_iterator::constructor) - )) - (RevertProperty + (RevertProperty . ( (description . "") @@ -261,20 +317,12 @@ (iterator-ctor . ,Output_property_music_iterator::constructor) (types . (general-music layout-instruction)) )) - (ContextSpeccedMusic + + (TextSpanEvent . ( - (description . "") - - (internal-class-name . "Context_specced_music") - (types . (context-specification general-music music-wrapper-music)) - )) - (AutoChangeMusic - . ( - (description . "") - - (internal-class-name . "Music_wrapper") - (iterator-ctor . ,Auto_change_iterator::constructor) - (types . (general-music music-wrapper-music auto-change-instruction)) + (description . "Start a text spanner like 8va.....|") + (internal-class-name . "Request") + (types . (general-music span-event text-span-event)) )) (TranslatorChange . ( @@ -287,7 +335,6 @@ (TimeScaledMusic . ( (description . "") - (internal-class-name . "Time_scaled_music") (iterator-ctor . ,Time_scaled_music_iterator::constructor) (types . (time-scaled-music music-wrapper-music general-music)) @@ -324,30 +371,14 @@ (types . (music-wrapper-music general-music relative-octave-music)) )) - (LyricCombineMusic - . ( - (description . "") - - (internal-class-name . "Lyric_combine_music") - (types . (general-music lyric-combine-music)) - (iterator-ctor . ,Lyric_combine_music_iterator::constructor) - )) - - (PartCombineMusic - . ( - (description . "") - - (internal-class-name . "Part_combine_music") - (types . (general-music part-combine-music)) - (iterator-ctor . ,Part_combine_music_iterator::constructor) - )) + (RequestChord . ( (description . "") (internal-class-name . "Request_chord") (iterator-ctor . ,Request_chord_iterator::constructor) - (types . (general-music simultaneous-music)) + (types . (general-music request-chord simultaneous-music)) ) ) @@ -355,7 +386,7 @@ . ( (description . "") - (internal-class-name . "Script_req") + (internal-class-name . "Request") (types . (general-music event)) )) (SkipEvent @@ -368,26 +399,30 @@ (types . (general-music event rhythmic-event skip-event)) )) (SpanEvent - . ( - (description . "") - - (internal-class-name . "Span_req") - (types . (general-music event)) - )) - (DecrescendoEvent - . ( - (description . "") - - (internal-class-name . "Request") - (types . (general-music dynamic-event decrescendo-event event)) - )) - (CrescendoEvent . ( (description . "") (internal-class-name . "Request") - (types . (general-music dynamic-event crescendo-event event)) + (types . (general-music event)) )) + (SustainPedalEvent + . ( + (description . "") + (internal-class-name . "Request") + (types . (general-music pedal-event sustain-pedal-event)) + )) + (SostenutoEvent + . ( + (description . "") + (internal-class-name . "Request") + (types . (general-music pedal-event sostenuto-pedal-event)) + )) + (UnaCordaEvent + . ( + (description . "") + (internal-class-name . "Request") + (types . (general-music pedal-event una-corda-pedal-event)) + )) (StringNumberEvent . ( (description . "") @@ -405,7 +440,7 @@ (TextScriptEvent . ( (description . "") - (internal-class-name . "Text_script_req") + (internal-class-name . "Request") (types . (general-music script-event text-script-event event)) )) (TieEvent @@ -414,6 +449,20 @@ (internal-class-name . "Request") (types . (general-music tie-event event)) )) + (TremoloEvent + . ( + (description . "Un measured tremolo.") + (internal-class-name . "Request") + (types . (general-music event tremolo-event)) + )) + (VoiceSeparator + . ( + (description . "") + + (internal-class-name . "Music") + (types . (separator general-music)) + )) + )) (set! music-descriptions @@ -457,3 +506,24 @@ (ly-make-bare-music name props) )) + +(define-public (old-span-request->event name) + (let + ( + (entry (assoc + name + '( + ("text" . TextSpanEvent) + ("decrescendo" . DecrescendoEvent) + ("crescendo" . CrescendoEvent) + ("Sustain" . SustainPedalEvent) + ("UnaCorda" . UnaCordaEvent) + ("Sostenuto" . SostenutoEvent) + ))) + ) + (if (eq? entry #f) + (error (format "Could not find span type ~a" name)) + + (make-music-by-name (cdr entry)) + ) + ))