From: Han-Wen Nienhuys Date: Thu, 18 Aug 2005 14:55:12 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release/2.7.6~15 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1f2689d8aa3674159af6ad9039ea4aa902a58900;p=lilypond.git *** empty log message *** --- diff --git a/input/les-nereides.ly b/input/les-nereides.ly index 73ff6b60de..dea383a68c 100644 --- a/input/les-nereides.ly +++ b/input/les-nereides.ly @@ -260,7 +260,7 @@ theScore = \score{ \remove Bar_number_engraver } \context { - \type "Engraver_group_engraver" + \type "Engraver_group" \name Dynamics \consists "Output_property_engraver" minimumVerticalExtent = #'(-1 . 1) diff --git a/input/test/engraver-one-by-one.ly b/input/test/engraver-one-by-one.ly index 47f06bd859..694f84ac6b 100644 --- a/input/test/engraver-one-by-one.ly +++ b/input/test/engraver-one-by-one.ly @@ -1,5 +1,5 @@ -\version "2.6.0" +\version "2.7.6" \header { texidoc = "The notation problem, creating a certain symbol, @@ -32,7 +32,7 @@ Staff context. % MyStaff =\context { - \type "Engraver_group_engraver" + \type "Engraver_group" \name Staff \description "Handles clefs, bar lines, keys, accidentals. It can contain @@ -73,7 +73,7 @@ MyStaff =\context { MyVoice = \context { - \type "Engraver_group_engraver" + \type "Engraver_group" \name Voice \description " diff --git a/input/test/staff-container.ly b/input/test/staff-container.ly index 218693bc02..00c13dc796 100644 --- a/input/test/staff-container.ly +++ b/input/test/staff-container.ly @@ -1,4 +1,4 @@ -\version "2.6.0" +\version "2.7.6" \header { @@ -43,7 +43,7 @@ what you would expect.) \denies Staff } \context { - \type Engraver_group_engraver + \type Engraver_group \consists Clef_engraver \consists Time_signature_engraver \consists Separating_line_group_engraver diff --git a/input/test/time-signature-staff.ly b/input/test/time-signature-staff.ly index e176c9cc7d..a58cf37a17 100644 --- a/input/test/time-signature-staff.ly +++ b/input/test/time-signature-staff.ly @@ -6,14 +6,14 @@ used contemporary pieces with many time signature changes. " } -\version "2.6.0" +\version "2.7.6" \layout { raggedright = ##T } \layout{ \context { - \type "Engraver_group_engraver" + \type "Engraver_group" \consists "Time_signature_engraver" \consists "Axis_group_engraver" \name "TimeSig" diff --git a/lily/engraver-group-engraver.cc b/lily/engraver-group-engraver.cc deleted file mode 100644 index a3a5f99ec8..0000000000 --- a/lily/engraver-group-engraver.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* - engraver-group-engraver.cc -- implement Engraver_group - - source file of the GNU LilyPond music typesetter - - (c) 1997--2005 Han-Wen Nienhuys -*/ - -#include "engraver-group-engraver.hh" - -#include "warn.hh" -#include "paper-score.hh" -#include "grob.hh" -#include "context.hh" -#include "translator-dispatch-list.hh" - -void -Engraver_group::announce_grob (Grob_info info) -{ - announce_infos_.push (info); - - Engraver_group *dad_eng - = context_->get_parent_context () - ? dynamic_cast (context_->get_parent_context ()->implementation ()) - : 0; - if (dad_eng) - dad_eng->announce_grob (info); -} - -void -Engraver_group::acknowledge_grobs () -{ - if (!announce_infos_.size ()) - return; - - SCM name_sym = ly_symbol2scm ("name"); - SCM meta_sym = ly_symbol2scm ("meta"); - - for (int j = 0; j < announce_infos_.size (); j++) - { - Grob_info info = announce_infos_[j]; - - SCM meta = info.grob ()->internal_get_property (meta_sym); - SCM nm = scm_assoc (name_sym, meta); - if (scm_is_pair (nm)) - nm = scm_cdr (nm); - else - continue; - - SCM acklist = scm_hashq_ref (acknowledge_hash_table_, nm, SCM_BOOL_F); - Engraver_dispatch_list *dispatch - = Engraver_dispatch_list::unsmob (acklist); - - if (acklist == SCM_BOOL_F) - { - SCM ifaces - = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta)); - acklist = Engraver_dispatch_list::create (get_simple_trans_list (), - ifaces); - - dispatch - = Engraver_dispatch_list::unsmob (acklist); - - scm_hashq_set_x (acknowledge_hash_table_, nm, acklist); - } - - if (dispatch) - dispatch->apply (info); - } -} - -/* - Ugh. This is slightly expensive. We could/should cache the value of - the group count? -*/ -int -Engraver_group::pending_grob_count () const -{ - int count = announce_infos_.size (); - for (SCM s = context_->children_contexts (); - scm_is_pair (s); s = scm_cdr (s)) - { - Context *c = unsmob_context (scm_car (s)); - Engraver_group *group - = dynamic_cast (c->implementation ()); - - if (group) - count += group->pending_grob_count (); - } - return count; -} - -void -Engraver_group::do_announces () -{ - do - { - for (SCM s = context ()->children_contexts (); - scm_is_pair (s); s = scm_cdr (s)) - { - Context *c = unsmob_context (scm_car (s)); - Engraver_group *group - = dynamic_cast (c->implementation ()); - if (group) - group->do_announces (); - } - - while (1) - { - precomputed_translator_foreach (PROCESS_ACKNOWLEDGED); - if (announce_infos_.size () == 0) - break; - - acknowledge_grobs (); - announce_infos_.clear (); - } - } - while (pending_grob_count () > 0); -} - -Engraver_group::Engraver_group () -{ - acknowledge_hash_table_ = SCM_EOL; - acknowledge_hash_table_ = scm_c_make_hash_table (61); -} - -#include "translator.icc" - -ADD_TRANSLATOR_GROUP (Engraver_group, - /* doc */ "A group of engravers taken together", - /* create */ "", - /* accept */ "", - /* read */ "", - /* write */ ""); - -void -Engraver_group::derived_mark () const -{ - scm_gc_mark (acknowledge_hash_table_); -} diff --git a/lily/engraver-group.cc b/lily/engraver-group.cc new file mode 100644 index 0000000000..a3a5f99ec8 --- /dev/null +++ b/lily/engraver-group.cc @@ -0,0 +1,140 @@ +/* + engraver-group-engraver.cc -- implement Engraver_group + + source file of the GNU LilyPond music typesetter + + (c) 1997--2005 Han-Wen Nienhuys +*/ + +#include "engraver-group-engraver.hh" + +#include "warn.hh" +#include "paper-score.hh" +#include "grob.hh" +#include "context.hh" +#include "translator-dispatch-list.hh" + +void +Engraver_group::announce_grob (Grob_info info) +{ + announce_infos_.push (info); + + Engraver_group *dad_eng + = context_->get_parent_context () + ? dynamic_cast (context_->get_parent_context ()->implementation ()) + : 0; + if (dad_eng) + dad_eng->announce_grob (info); +} + +void +Engraver_group::acknowledge_grobs () +{ + if (!announce_infos_.size ()) + return; + + SCM name_sym = ly_symbol2scm ("name"); + SCM meta_sym = ly_symbol2scm ("meta"); + + for (int j = 0; j < announce_infos_.size (); j++) + { + Grob_info info = announce_infos_[j]; + + SCM meta = info.grob ()->internal_get_property (meta_sym); + SCM nm = scm_assoc (name_sym, meta); + if (scm_is_pair (nm)) + nm = scm_cdr (nm); + else + continue; + + SCM acklist = scm_hashq_ref (acknowledge_hash_table_, nm, SCM_BOOL_F); + Engraver_dispatch_list *dispatch + = Engraver_dispatch_list::unsmob (acklist); + + if (acklist == SCM_BOOL_F) + { + SCM ifaces + = scm_cdr (scm_assoc (ly_symbol2scm ("interfaces"), meta)); + acklist = Engraver_dispatch_list::create (get_simple_trans_list (), + ifaces); + + dispatch + = Engraver_dispatch_list::unsmob (acklist); + + scm_hashq_set_x (acknowledge_hash_table_, nm, acklist); + } + + if (dispatch) + dispatch->apply (info); + } +} + +/* + Ugh. This is slightly expensive. We could/should cache the value of + the group count? +*/ +int +Engraver_group::pending_grob_count () const +{ + int count = announce_infos_.size (); + for (SCM s = context_->children_contexts (); + scm_is_pair (s); s = scm_cdr (s)) + { + Context *c = unsmob_context (scm_car (s)); + Engraver_group *group + = dynamic_cast (c->implementation ()); + + if (group) + count += group->pending_grob_count (); + } + return count; +} + +void +Engraver_group::do_announces () +{ + do + { + for (SCM s = context ()->children_contexts (); + scm_is_pair (s); s = scm_cdr (s)) + { + Context *c = unsmob_context (scm_car (s)); + Engraver_group *group + = dynamic_cast (c->implementation ()); + if (group) + group->do_announces (); + } + + while (1) + { + precomputed_translator_foreach (PROCESS_ACKNOWLEDGED); + if (announce_infos_.size () == 0) + break; + + acknowledge_grobs (); + announce_infos_.clear (); + } + } + while (pending_grob_count () > 0); +} + +Engraver_group::Engraver_group () +{ + acknowledge_hash_table_ = SCM_EOL; + acknowledge_hash_table_ = scm_c_make_hash_table (61); +} + +#include "translator.icc" + +ADD_TRANSLATOR_GROUP (Engraver_group, + /* doc */ "A group of engravers taken together", + /* create */ "", + /* accept */ "", + /* read */ "", + /* write */ ""); + +void +Engraver_group::derived_mark () const +{ + scm_gc_mark (acknowledge_hash_table_); +} diff --git a/lily/performer-group-performer.cc b/lily/performer-group-performer.cc deleted file mode 100644 index ef4a9d8799..0000000000 --- a/lily/performer-group-performer.cc +++ /dev/null @@ -1,100 +0,0 @@ -/* - performer-group-performer.cc -- implement Performer_group - - source file of the GNU LilyPond music typesetter - - (c) 1996--2005 Han-Wen Nienhuys - Jan Nieuwenhuizen -*/ - -#include "performer-group-performer.hh" - -#include "context.hh" -#include "audio-element.hh" -#include "warn.hh" - -ADD_TRANSLATOR_GROUP (Performer_group, - /* doc */ "", - /* create */ "", - /* accept */ "", - /* read */ "", - /* write */ ""); - -void -Performer_group::announce_element (Audio_element_info info) -{ - announce_infos_.push (info); - Translator_group *t - = context ()->get_parent_context ()->implementation (); - - if (Performer_group *eg = dynamic_cast (t)) - eg->announce_element (info); -} - -void -Performer_group::acknowledge_audio_elements () -{ - for (int j = 0; j < announce_infos_.size (); j++) - { - Audio_element_info info = announce_infos_[j]; - - for (SCM p = get_simple_trans_list (); scm_is_pair (p); p = scm_cdr (p)) - { - Translator *t = unsmob_translator (scm_car (p)); - Performer *eng = dynamic_cast (t); - if (eng && eng != info.origin_trans_) - eng->acknowledge_audio_element (info); - } - } -} - -void -performer_each (SCM list, Performer_method method) -{ - for (SCM p = list; scm_is_pair (p); p = scm_cdr (p)) - { - Performer *e = dynamic_cast (unsmob_translator (scm_car (p))); - if (e) - (e->*method) (); - } -} - -void -Performer_group::do_announces () -{ - while (1) - { - performer_each (get_simple_trans_list (), - &Performer::create_audio_elements); - - if (!announce_infos_.size ()) - break; - - acknowledge_audio_elements (); - announce_infos_.clear (); - } -} - -void -Performer_group::play_element (Audio_element *e) -{ - Context *c = context_->get_parent_context (); - if (c) - { - Performer_group *pgp = dynamic_cast (c->implementation ()); - pgp->play_element (e); - } -} - -int -Performer_group::get_tempo () const -{ - Context *c = context_->get_parent_context (); - if (c) - { - Performer_group *pgp = dynamic_cast (c->implementation ()); - return pgp->get_tempo (); - } - return 60; -} - diff --git a/lily/performer-group.cc b/lily/performer-group.cc new file mode 100644 index 0000000000..ef4a9d8799 --- /dev/null +++ b/lily/performer-group.cc @@ -0,0 +1,100 @@ +/* + performer-group-performer.cc -- implement Performer_group + + source file of the GNU LilyPond music typesetter + + (c) 1996--2005 Han-Wen Nienhuys + Jan Nieuwenhuizen +*/ + +#include "performer-group-performer.hh" + +#include "context.hh" +#include "audio-element.hh" +#include "warn.hh" + +ADD_TRANSLATOR_GROUP (Performer_group, + /* doc */ "", + /* create */ "", + /* accept */ "", + /* read */ "", + /* write */ ""); + +void +Performer_group::announce_element (Audio_element_info info) +{ + announce_infos_.push (info); + Translator_group *t + = context ()->get_parent_context ()->implementation (); + + if (Performer_group *eg = dynamic_cast (t)) + eg->announce_element (info); +} + +void +Performer_group::acknowledge_audio_elements () +{ + for (int j = 0; j < announce_infos_.size (); j++) + { + Audio_element_info info = announce_infos_[j]; + + for (SCM p = get_simple_trans_list (); scm_is_pair (p); p = scm_cdr (p)) + { + Translator *t = unsmob_translator (scm_car (p)); + Performer *eng = dynamic_cast (t); + if (eng && eng != info.origin_trans_) + eng->acknowledge_audio_element (info); + } + } +} + +void +performer_each (SCM list, Performer_method method) +{ + for (SCM p = list; scm_is_pair (p); p = scm_cdr (p)) + { + Performer *e = dynamic_cast (unsmob_translator (scm_car (p))); + if (e) + (e->*method) (); + } +} + +void +Performer_group::do_announces () +{ + while (1) + { + performer_each (get_simple_trans_list (), + &Performer::create_audio_elements); + + if (!announce_infos_.size ()) + break; + + acknowledge_audio_elements (); + announce_infos_.clear (); + } +} + +void +Performer_group::play_element (Audio_element *e) +{ + Context *c = context_->get_parent_context (); + if (c) + { + Performer_group *pgp = dynamic_cast (c->implementation ()); + pgp->play_element (e); + } +} + +int +Performer_group::get_tempo () const +{ + Context *c = context_->get_parent_context (); + if (c) + { + Performer_group *pgp = dynamic_cast (c->implementation ()); + return pgp->get_tempo (); + } + return 60; +} + diff --git a/lily/translator-group-ctors.cc b/lily/translator-group-ctors.cc index 529a60184b..0f9656d8cd 100644 --- a/lily/translator-group-ctors.cc +++ b/lily/translator-group-ctors.cc @@ -11,6 +11,7 @@ #include "engraver-group-engraver.hh" #include "performer-group-performer.hh" #include "recording-group-engraver.hh" +#include "warn.hh" /* Quick & dirty. @@ -29,6 +30,11 @@ get_translator_group (SCM sym) else if (sym == ly_symbol2scm ("Recording_group_engraver")) return new Recording_group_engraver (); + programming_error ("Couldn't find type"); + scm_flush (scm_current_error_port ()); + scm_display (sym, scm_current_error_port ()); + scm_flush (scm_current_error_port ()); + assert (0); return 0; }