From 18d9bcf40f630efefdeb42e3d15653c7aae73ec3 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Mon, 27 Apr 2015 21:11:31 +0200 Subject: [PATCH] Issue 4357/3: Run preparatory script replacing listener macros This script is for i in $(git grep -l 'IMPLEMENT_LISTENER (') do sed -i '/IMPLEMENT_LISTENER ([^)]*$/{N;s/\n\s*/ /}' $i sedscript=$(git grep -h 'IMPLEMENT_LISTENER (' $i| sed 's|^.*IMPLEMENT_LISTENER (\([^,]*\), \([^)]*\)).*$|s/GET_LISTENER (\\([_a-z]\\+->\\)\\?\2)/\\1GET_LISTENER (\1, \2)/|') sed -i "$sedscript" $i done sed -i '/IMPLEMENT_LISTENER (/d' $(git grep -l 'IMPLEMENT_LISTENER (') sed -i 's/DECLARE_LISTENER (\([^)]*\));\?/void \1 (SCM);/' $(git grep -l 'DECLARE_LISTENER (') --- lily/context.cc | 20 +++++++------------- lily/dispatcher.cc | 9 ++++----- lily/engraver-group.cc | 10 ++++------ lily/global-context.cc | 3 +-- lily/grace-engraver.cc | 7 +++---- lily/include/context.hh | 12 ++++++------ lily/include/dispatcher.hh | 2 +- lily/include/engraver-group.hh | 4 ++-- lily/include/global-context.hh | 2 +- lily/include/listener.hh | 5 ++--- lily/include/scheme-listener.hh | 2 +- lily/include/score-engraver.hh | 6 +++--- lily/include/score-performer.hh | 6 +++--- lily/include/translator-group.hh | 2 +- lily/include/translator.hh | 2 +- lily/include/translator.icc | 3 +-- lily/lyric-combine-music-iterator.cc | 12 +++++------- lily/midi-control-function-performer.cc | 8 +++----- lily/part-combine-iterator.cc | 7 +++---- lily/scheme-listener.cc | 1 - lily/score-engraver.cc | 15 ++++++--------- lily/score-performer.cc | 15 ++++++--------- lily/translator-group.cc | 5 ++--- 23 files changed, 66 insertions(+), 92 deletions(-) diff --git a/lily/context.cc b/lily/context.cc index 9dad38f269..4c0caac040 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -226,14 +226,12 @@ Context::find_create_context (SCM n, const string &id, SCM operations) return ret; } -IMPLEMENT_LISTENER (Context, acknowledge_infant); void Context::acknowledge_infant (SCM sev) { infant_event_ = Stream_event::unsmob (sev); } -IMPLEMENT_LISTENER (Context, set_property_from_event); void Context::set_property_from_event (SCM sev) { @@ -257,7 +255,6 @@ Context::set_property_from_event (SCM sev) } } -IMPLEMENT_LISTENER (Context, unset_property_from_event); void Context::unset_property_from_event (SCM sev) { @@ -272,7 +269,6 @@ Context::unset_property_from_event (SCM sev) Creates a new context from a CreateContext event, and sends an AnnounceNewContext event to this context. */ -IMPLEMENT_LISTENER (Context, create_context_from_event); void Context::create_context_from_event (SCM sev) { @@ -302,19 +298,19 @@ Context::create_context_from_event (SCM sev) /* We want to be the first ones to hear our own events. Therefore, wait before registering events_below_ */ new_context->event_source ()-> - add_listener (GET_LISTENER (new_context->create_context_from_event), + add_listener (new_context->GET_LISTENER (Context, create_context_from_event), ly_symbol2scm ("CreateContext")); new_context->event_source ()-> - add_listener (GET_LISTENER (new_context->remove_context), + add_listener (new_context->GET_LISTENER (Context, remove_context), ly_symbol2scm ("RemoveContext")); new_context->event_source ()-> - add_listener (GET_LISTENER (new_context->change_parent), + add_listener (new_context->GET_LISTENER (Context, change_parent), ly_symbol2scm ("ChangeParent")); new_context->event_source ()-> - add_listener (GET_LISTENER (new_context->set_property_from_event), + add_listener (new_context->GET_LISTENER (Context, set_property_from_event), ly_symbol2scm ("SetProperty")); new_context->event_source ()-> - add_listener (GET_LISTENER (new_context->unset_property_from_event), + add_listener (new_context->GET_LISTENER (Context, unset_property_from_event), ly_symbol2scm ("UnsetProperty")); new_context->events_below_->register_as_listener (new_context->event_source_); @@ -362,7 +358,7 @@ Context::create_context (Context_def *cdef, /* TODO: This is fairly misplaced. We can fix this when we have taken out all iterator specific stuff from the Context class */ event_source_-> - add_listener (GET_LISTENER (acknowledge_infant), + add_listener (GET_LISTENER (Context, acknowledge_infant), ly_symbol2scm ("AnnounceNewContext")); /* The CreateContext creates a new context, and sends an announcement of the new context through another event. That event will be stored in @@ -372,7 +368,7 @@ Context::create_context (Context_def *cdef, ly_symbol2scm ("type"), cdef->get_context_name (), ly_symbol2scm ("id"), ly_string2scm (id)); event_source_-> - remove_listener (GET_LISTENER (acknowledge_infant), + remove_listener (GET_LISTENER (Context, acknowledge_infant), ly_symbol2scm ("AnnounceNewContext")); assert (infant_event_); @@ -551,7 +547,6 @@ Context::unset_property (SCM sym) properties_dict ()->remove (sym); } -IMPLEMENT_LISTENER (Context, change_parent); void Context::change_parent (SCM sev) { @@ -565,7 +560,6 @@ Context::change_parent (SCM sev) /* Die. The next GC sweep should take care of the actual death. */ -IMPLEMENT_LISTENER (Context, remove_context); void Context::remove_context (SCM) { diff --git a/lily/dispatcher.cc b/lily/dispatcher.cc index a394a4b7a8..2d18b393ad 100644 --- a/lily/dispatcher.cc +++ b/lily/dispatcher.cc @@ -72,7 +72,6 @@ Event dispatching: combination of dispatchers, even if it matches more than one event type. */ -IMPLEMENT_LISTENER (Dispatcher, dispatch); void Dispatcher::dispatch (SCM sev) { @@ -230,7 +229,7 @@ Dispatcher::internal_add_listener (Listener l, SCM ev_class, int priority) { int priority = scm_to_int (scm_cdar (disp)); Dispatcher *d = Dispatcher::unsmob (scm_caar (disp)); - d->internal_add_listener (GET_LISTENER (dispatch), ev_class, priority); + d->internal_add_listener (GET_LISTENER (Dispatcher, dispatch), ev_class, priority); } listen_classes_ = scm_cons (ev_class, listen_classes_); } @@ -275,7 +274,7 @@ Dispatcher::remove_listener (Listener l, SCM ev_class) for (SCM disp = dispatchers_; scm_is_pair (disp); disp = scm_cdr (disp)) { Dispatcher *d = Dispatcher::unsmob (scm_caar (disp)); - d->remove_listener (GET_LISTENER (dispatch), ev_class); + d->remove_listener (GET_LISTENER (Dispatcher, dispatch), ev_class); } listen_classes_ = scm_delq_x (ev_class, listen_classes_); } @@ -300,7 +299,7 @@ Dispatcher::register_as_listener (Dispatcher *disp) dispatchers_ = scm_acons (disp->self_scm (), scm_from_int (priority), dispatchers_); - Listener list = GET_LISTENER (dispatch); + Listener list = GET_LISTENER (Dispatcher, dispatch); for (SCM cl = listen_classes_; scm_is_pair (cl); cl = scm_cdr (cl)) { disp->internal_add_listener (list, scm_car (cl), priority); @@ -313,7 +312,7 @@ Dispatcher::unregister_as_listener (Dispatcher *disp) { dispatchers_ = scm_assq_remove_x (dispatchers_, disp->self_scm ()); - Listener listener = GET_LISTENER (dispatch); + Listener listener = GET_LISTENER (Dispatcher, dispatch); for (SCM cl = listen_classes_; scm_is_pair (cl); cl = scm_cdr (cl)) { disp->remove_listener (listener, scm_car (cl)); diff --git a/lily/engraver-group.cc b/lily/engraver-group.cc index 50009bd53d..b7de6e9e77 100644 --- a/lily/engraver-group.cc +++ b/lily/engraver-group.cc @@ -26,7 +26,6 @@ #include "translator-dispatch-list.hh" #include "warn.hh" -IMPLEMENT_LISTENER (Engraver_group, override); void Engraver_group::override (SCM sev) { @@ -37,7 +36,6 @@ Engraver_group::override (SCM sev) ev->get_property ("value")); } -IMPLEMENT_LISTENER (Engraver_group, revert); void Engraver_group::revert (SCM sev) { @@ -51,15 +49,15 @@ void Engraver_group::connect_to_context (Context *c) { Translator_group::connect_to_context (c); - c->event_source ()->add_listener (GET_LISTENER (override), ly_symbol2scm ("Override")); - c->event_source ()->add_listener (GET_LISTENER (revert), ly_symbol2scm ("Revert")); + c->event_source ()->add_listener (GET_LISTENER (Engraver_group, override), ly_symbol2scm ("Override")); + c->event_source ()->add_listener (GET_LISTENER (Engraver_group, revert), ly_symbol2scm ("Revert")); } void Engraver_group::disconnect_from_context () { - context ()->event_source ()->remove_listener (GET_LISTENER (override), ly_symbol2scm ("Override")); - context ()->event_source ()->remove_listener (GET_LISTENER (revert), ly_symbol2scm ("Revert")); + context ()->event_source ()->remove_listener (GET_LISTENER (Engraver_group, override), ly_symbol2scm ("Override")); + context ()->event_source ()->remove_listener (GET_LISTENER (Engraver_group, revert), ly_symbol2scm ("Revert")); Translator_group::disconnect_from_context (); } diff --git a/lily/global-context.cc b/lily/global-context.cc index 5e940a670d..9125a7e07e 100644 --- a/lily/global-context.cc +++ b/lily/global-context.cc @@ -42,7 +42,7 @@ Global_context::Global_context (Output_def *o) /* We only need the most basic stuff to bootstrap the context tree */ event_source ()->add_listener (GET_LISTENER (create_context_from_event), ly_symbol2scm ("CreateContext")); - event_source ()->add_listener (GET_LISTENER (prepare), + event_source ()->add_listener (GET_LISTENER (Global_context, prepare), ly_symbol2scm ("Prepare")); events_below ()->register_as_listener (event_source_); @@ -88,7 +88,6 @@ Global_context::get_moments_left () const return extra_mom_pq_.size (); } -IMPLEMENT_LISTENER (Global_context, prepare); void Global_context::prepare (SCM sev) { diff --git a/lily/grace-engraver.cc b/lily/grace-engraver.cc index 4249a922a4..42b6742dbc 100644 --- a/lily/grace-engraver.cc +++ b/lily/grace-engraver.cc @@ -38,7 +38,7 @@ protected: virtual void finalize (); TRANSLATOR_DECLARATIONS (Grace_engraver); - DECLARE_LISTENER (grace_change); + void grace_change (SCM); }; Grace_engraver::Grace_engraver () @@ -48,7 +48,6 @@ Grace_engraver::Grace_engraver () } // The iterator should usually come before process_music -IMPLEMENT_LISTENER (Grace_engraver, grace_change); void Grace_engraver::grace_change (SCM) { @@ -139,7 +138,7 @@ Grace_engraver::consider_change_grace_settings () if (last_moment_ == Rational (-1)) { Dispatcher *d = context ()->event_source (); - d->add_listener (GET_LISTENER (grace_change), ly_symbol2scm ("GraceChange")); + d->add_listener (GET_LISTENER (Grace_engraver, grace_change), ly_symbol2scm ("GraceChange")); } last_moment_ = now; } @@ -150,7 +149,7 @@ Grace_engraver::finalize () if (last_moment_ != Rational (-1)) { Dispatcher *d = context ()->event_source (); - d->remove_listener (GET_LISTENER (grace_change), ly_symbol2scm ("GraceChange")); + d->remove_listener (GET_LISTENER (Grace_engraver, grace_change), ly_symbol2scm ("GraceChange")); } } diff --git a/lily/include/context.hh b/lily/include/context.hh index dc13314277..62c77017bf 100644 --- a/lily/include/context.hh +++ b/lily/include/context.hh @@ -79,8 +79,8 @@ protected: // UGH! initialises implementation_ friend SCM ly_make_global_translator (SCM); - DECLARE_LISTENER (set_property_from_event); - DECLARE_LISTENER (unset_property_from_event); + void set_property_from_event (SCM); + void unset_property_from_event (SCM); public: string id_string () const { return id_string_; } @@ -109,10 +109,10 @@ public: void internal_set_property (SCM var_sym, SCM value); Context *create_context (Context_def *, const string&, SCM); - DECLARE_LISTENER (create_context_from_event); - DECLARE_LISTENER (acknowledge_infant); - DECLARE_LISTENER (remove_context); - DECLARE_LISTENER (change_parent); + void create_context_from_event (SCM); + void acknowledge_infant (SCM); + void remove_context (SCM); + void change_parent (SCM); void disconnect_from_parent (); void check_removal (); string context_name () const; diff --git a/lily/include/dispatcher.hh b/lily/include/dispatcher.hh index f4fe9156bc..5ce2081d97 100644 --- a/lily/include/dispatcher.hh +++ b/lily/include/dispatcher.hh @@ -38,7 +38,7 @@ private: (dist . priority) pair. */ SCM dispatchers_; SCM listen_classes_; - DECLARE_LISTENER (dispatch); + void dispatch (SCM); /* priority counter. Listeners with low priority receive events first. */ int priority_count_; diff --git a/lily/include/engraver-group.hh b/lily/include/engraver-group.hh index bbb759b1ac..ec7c8f330d 100644 --- a/lily/include/engraver-group.hh +++ b/lily/include/engraver-group.hh @@ -28,8 +28,8 @@ class Engraver_group : public Translator_group protected: vector announce_infos_; Drul_array acknowledge_hash_table_drul_; - DECLARE_LISTENER (override); - DECLARE_LISTENER (revert); + void override (SCM); + void revert (SCM); public: DECLARE_CLASSNAME (Engraver_group); Engraver_group (); diff --git a/lily/include/global-context.hh b/lily/include/global-context.hh index 49436bcf87..e5dbc82deb 100644 --- a/lily/include/global-context.hh +++ b/lily/include/global-context.hh @@ -42,7 +42,7 @@ public: void apply_finalizations (); void add_finalization (SCM); - DECLARE_LISTENER (prepare); + void prepare (SCM); virtual SCM get_output (); virtual Output_def *get_output_def () const; virtual Moment now_mom () const; diff --git a/lily/include/listener.hh b/lily/include/listener.hh index 3652a271b9..24407e2939 100644 --- a/lily/include/listener.hh +++ b/lily/include/listener.hh @@ -30,7 +30,7 @@ - declare the method using the DECLARE_LISTENER macro. class Foo { - DECLARE_LISTENER (method); + void method (SCM); ... }; This macro declares the method to take a SCM as parameter, and to @@ -38,7 +38,6 @@ touched. - implement the method using IMPLEMENT_LISTENER: - IMPLEMENT_LISTENER (Foo, method) void method (SCM e) { write ("Foo hears an event!"); @@ -51,7 +50,7 @@ Foo *foo = (...); Stream_distributor *d = (...); - Listener l = GET_LISTENER (foo->method); + Listener l = foo->GET_LISTENER (Foo, method); d->register_listener (l, "EventClass"); Whenever d hears a stream-event ev of class "EventClass", diff --git a/lily/include/scheme-listener.hh b/lily/include/scheme-listener.hh index f7d8eac8b5..fecc95d508 100644 --- a/lily/include/scheme-listener.hh +++ b/lily/include/scheme-listener.hh @@ -33,7 +33,7 @@ public: SCM mark_smob (); virtual ~Scheme_listener (); Scheme_listener (SCM callback); - DECLARE_LISTENER (call); + void call (SCM); private: SCM callback_; }; diff --git a/lily/include/score-engraver.hh b/lily/include/score-engraver.hh index b52f589f93..9b7927ddab 100644 --- a/lily/include/score-engraver.hh +++ b/lily/include/score-engraver.hh @@ -32,9 +32,9 @@ class Score_engraver : public Engraver_group void typeset_all (); protected: - DECLARE_LISTENER (finish); - DECLARE_LISTENER (prepare); - DECLARE_LISTENER (one_time_step); + void finish (SCM); + void prepare (SCM); + void one_time_step (SCM); /* Engraver_group_engraver interface */ virtual void connect_to_context (Context *); diff --git a/lily/include/score-performer.hh b/lily/include/score-performer.hh index b97c673688..5830953aff 100644 --- a/lily/include/score-performer.hh +++ b/lily/include/score-performer.hh @@ -37,9 +37,9 @@ public: Score_performer (); protected: - DECLARE_LISTENER (finish); - DECLARE_LISTENER (prepare); - DECLARE_LISTENER (one_time_step); + void finish (SCM); + void prepare (SCM); + void one_time_step (SCM); /* Engraver_group_engraver interface */ virtual void connect_to_context (Context *); diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 068a3bbcae..97906c1602 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -64,7 +64,7 @@ private: SCM protected_events_; - DECLARE_LISTENER (create_child_translator); + void create_child_translator (SCM); public: DECLARE_CLASSNAME (Translator_group); diff --git a/lily/include/translator.hh b/lily/include/translator.hh index d089f78d03..54a7f318f7 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -87,7 +87,7 @@ inline void listen_ ## m (Stream_event *); \ static void _internal_declare_ ## m (); \ private: \ static Listener _get_ ## m ## _listener (void *, SCM); \ -DECLARE_LISTENER (_listen_scm_ ## m); +void _listen_scm_ ## m (SCM); #define DECLARE_ACKNOWLEDGER(x) public : void acknowledge_ ## x (Grob_info); protected: #define DECLARE_END_ACKNOWLEDGER(x) public : void acknowledge_end_ ## x (Grob_info); protected: diff --git a/lily/include/translator.icc b/lily/include/translator.icc index 9f4def39e0..087fb4da19 100644 --- a/lily/include/translator.icc +++ b/lily/include/translator.icc @@ -146,10 +146,9 @@ Listener \ { \ cl *obj = (cl *) me; \ (void) unused; \ - return obj->GET_LISTENER (_listen_scm_ ## m); \ + return obj->GET_LISTENER (cl, _listen_scm_ ## m); \ } \ \ -IMPLEMENT_LISTENER (cl, _listen_scm_ ## m) \ void \ cl::_listen_scm_ ## m (SCM sev) \ { \ diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc index 031e6aabf0..d0b31c4963 100644 --- a/lily/lyric-combine-music-iterator.cc +++ b/lily/lyric-combine-music-iterator.cc @@ -59,8 +59,8 @@ protected: private: bool start_new_syllable () const; Context *find_voice (); - DECLARE_LISTENER (set_busy); - DECLARE_LISTENER (check_new_context); + void set_busy (SCM); + void check_new_context (SCM); bool music_found_; bool lyrics_found_; @@ -93,7 +93,6 @@ Lyric_combine_music_iterator::Lyric_combine_music_iterator () associatedVoice switching, this routine may be triggered for the wrong music_context_ */ -IMPLEMENT_LISTENER (Lyric_combine_music_iterator, set_busy) void Lyric_combine_music_iterator::set_busy (SCM se) { @@ -113,13 +112,13 @@ Lyric_combine_music_iterator::set_music_context (Context *to) if (music_context_) { music_context_->events_below ()-> - remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("rhythmic-event")); + remove_listener (GET_LISTENER (Lyric_combine_music_iterator, set_busy), ly_symbol2scm ("rhythmic-event")); } music_context_ = to; if (to) { - to->events_below ()->add_listener (GET_LISTENER (set_busy), + to->events_below ()->add_listener (GET_LISTENER (Lyric_combine_music_iterator, set_busy), ly_symbol2scm ("rhythmic-event")); } } @@ -218,7 +217,7 @@ Lyric_combine_music_iterator::construct_children () delayed when voices are created implicitly. */ Global_context *g = get_outlet ()->get_global_context (); - g->events_below ()->add_listener (GET_LISTENER (check_new_context), ly_symbol2scm ("CreateContext")); + g->events_below ()->add_listener (GET_LISTENER (Lyric_combine_music_iterator, check_new_context), ly_symbol2scm ("CreateContext")); /* We do not create a Lyrics context, because the user might @@ -227,7 +226,6 @@ Lyric_combine_music_iterator::construct_children () */ } -IMPLEMENT_LISTENER (Lyric_combine_music_iterator, check_new_context) void Lyric_combine_music_iterator::check_new_context (SCM /*sev*/) { diff --git a/lily/midi-control-function-performer.cc b/lily/midi-control-function-performer.cc index 0a02668c30..c35286c1eb 100644 --- a/lily/midi-control-function-performer.cc +++ b/lily/midi-control-function-performer.cc @@ -39,7 +39,7 @@ class Midi_control_function_performer : public Performer { public: TRANSLATOR_DECLARATIONS (Midi_control_function_performer); - DECLARE_LISTENER (announce_function_value_change); + void announce_function_value_change (SCM); ~Midi_control_function_performer (); void connect_to_context (Context *c); @@ -58,7 +58,7 @@ void Midi_control_function_performer::connect_to_context (Context *c) { c->events_below ()-> - add_listener (GET_LISTENER (announce_function_value_change), + add_listener (GET_LISTENER (Midi_control_function_performer, announce_function_value_change), ly_symbol2scm ("SetProperty")); } @@ -66,12 +66,10 @@ void Midi_control_function_performer::disconnect_from_context (Context *c) { c->events_below ()-> - remove_listener (GET_LISTENER (announce_function_value_change), + remove_listener (GET_LISTENER (Midi_control_function_performer, announce_function_value_change), ly_symbol2scm ("SetProperty")); } -IMPLEMENT_LISTENER (Midi_control_function_performer, - announce_function_value_change) void Midi_control_function_performer::announce_function_value_change (SCM sev) { diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc index f84e70cc9a..a96306d084 100644 --- a/lily/part-combine-iterator.cc +++ b/lily/part-combine-iterator.cc @@ -54,7 +54,7 @@ protected: private: /* used by try_process */ - DECLARE_LISTENER (set_busy); + void set_busy (SCM); bool busy_; bool notice_busy_; @@ -123,7 +123,7 @@ Part_combine_iterator::do_quit () { Context *c = handles_[i].get_context (); if (c->is_alias (ly_symbol2scm ("Voice"))) - c->event_source ()->remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event")); + c->event_source ()->remove_listener (GET_LISTENER (Part_combine_iterator, set_busy), ly_symbol2scm ("music-event")); handles_[i].set_context (0); } } @@ -322,7 +322,7 @@ Part_combine_iterator::construct_children () c = c->find_create_context (type, outlet_names_[i], SCM_EOL); handles_[i].set_context (c); if (c->is_alias (ly_symbol2scm ("Voice"))) - c->event_source ()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event")); + c->event_source ()->add_listener (GET_LISTENER (Part_combine_iterator, set_busy), ly_symbol2scm ("music-event")); } SCM lst = get_music ()->get_property ("elements"); @@ -336,7 +336,6 @@ Part_combine_iterator::construct_children () set_context (shared); } -IMPLEMENT_LISTENER (Part_combine_iterator, set_busy); void Part_combine_iterator::set_busy (SCM se) { diff --git a/lily/scheme-listener.cc b/lily/scheme-listener.cc index 9df6960bdf..32c3dd1e63 100644 --- a/lily/scheme-listener.cc +++ b/lily/scheme-listener.cc @@ -19,7 +19,6 @@ #include "scheme-listener.hh" -IMPLEMENT_LISTENER (Scheme_listener, call) void Scheme_listener::call (SCM ev) { diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 08f7b9c460..0415d5e4a1 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -49,14 +49,12 @@ Score_engraver::derived_mark () const Engraver_group::derived_mark (); } -IMPLEMENT_LISTENER (Score_engraver, prepare); void Score_engraver::prepare (SCM) { precomputed_recurse_over_translators (context (), START_TRANSLATION_TIMESTEP, DOWN); } -IMPLEMENT_LISTENER (Score_engraver, finish); void Score_engraver::finish (SCM) { @@ -105,9 +103,9 @@ Score_engraver::connect_to_context (Context *c) Engraver_group::connect_to_context (c); Dispatcher *d = c->get_global_context ()->event_source (); - d->add_listener (GET_LISTENER (one_time_step), ly_symbol2scm ("OneTimeStep")); - d->add_listener (GET_LISTENER (prepare), ly_symbol2scm ("Prepare")); - d->add_listener (GET_LISTENER (finish), ly_symbol2scm ("Finish")); + d->add_listener (GET_LISTENER (Score_engraver, one_time_step), ly_symbol2scm ("OneTimeStep")); + d->add_listener (GET_LISTENER (Score_engraver, prepare), ly_symbol2scm ("Prepare")); + d->add_listener (GET_LISTENER (Score_engraver, finish), ly_symbol2scm ("Finish")); } /* @@ -128,9 +126,9 @@ void Score_engraver::disconnect_from_context () { Dispatcher *d = context ()->get_global_context ()->event_source (); - d->remove_listener (GET_LISTENER (one_time_step), ly_symbol2scm ("OneTimeStep")); - d->remove_listener (GET_LISTENER (prepare), ly_symbol2scm ("Prepare")); - d->remove_listener (GET_LISTENER (finish), ly_symbol2scm ("Finish")); + d->remove_listener (GET_LISTENER (Score_engraver, one_time_step), ly_symbol2scm ("OneTimeStep")); + d->remove_listener (GET_LISTENER (Score_engraver, prepare), ly_symbol2scm ("Prepare")); + d->remove_listener (GET_LISTENER (Score_engraver, finish), ly_symbol2scm ("Finish")); Engraver_group::disconnect_from_context (); } @@ -143,7 +141,6 @@ Score_engraver::finalize () typeset_all (); } -IMPLEMENT_LISTENER (Score_engraver, one_time_step); void Score_engraver::one_time_step (SCM) { diff --git a/lily/score-performer.cc b/lily/score-performer.cc index 7546cbd630..0d0aa457a7 100644 --- a/lily/score-performer.cc +++ b/lily/score-performer.cc @@ -86,23 +86,22 @@ Score_performer::connect_to_context (Context *c) Performer_group::connect_to_context (c); Dispatcher *d = c->get_global_context ()->event_source (); - d->add_listener (GET_LISTENER (one_time_step), ly_symbol2scm ("OneTimeStep")); - d->add_listener (GET_LISTENER (prepare), ly_symbol2scm ("Prepare")); - d->add_listener (GET_LISTENER (finish), ly_symbol2scm ("Finish")); + d->add_listener (GET_LISTENER (Score_performer, one_time_step), ly_symbol2scm ("OneTimeStep")); + d->add_listener (GET_LISTENER (Score_performer, prepare), ly_symbol2scm ("Prepare")); + d->add_listener (GET_LISTENER (Score_performer, finish), ly_symbol2scm ("Finish")); } void Score_performer::disconnect_from_context () { Dispatcher *d = context ()->get_global_context ()->event_source (); - d->remove_listener (GET_LISTENER (one_time_step), ly_symbol2scm ("OneTimeStep")); - d->remove_listener (GET_LISTENER (prepare), ly_symbol2scm ("Prepare")); - d->remove_listener (GET_LISTENER (finish), ly_symbol2scm ("Finish")); + d->remove_listener (GET_LISTENER (Score_performer, one_time_step), ly_symbol2scm ("OneTimeStep")); + d->remove_listener (GET_LISTENER (Score_performer, prepare), ly_symbol2scm ("Prepare")); + d->remove_listener (GET_LISTENER (Score_performer, finish), ly_symbol2scm ("Finish")); Performer_group::disconnect_from_context (); } -IMPLEMENT_LISTENER (Score_performer, prepare); void Score_performer::prepare (SCM sev) { @@ -114,7 +113,6 @@ Score_performer::prepare (SCM sev) precomputed_recurse_over_translators (context (), START_TRANSLATION_TIMESTEP, UP); } -IMPLEMENT_LISTENER (Score_performer, finish); void Score_performer::finish (SCM) { @@ -127,7 +125,6 @@ Score_performer::finish (SCM) UP); } -IMPLEMENT_LISTENER (Score_performer, one_time_step); void Score_performer::one_time_step (SCM) { diff --git a/lily/translator-group.cc b/lily/translator-group.cc index df3eb64565..24f1efaae9 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -58,7 +58,7 @@ Translator_group::connect_to_context (Context *c) } context_ = c; - c->event_source ()->add_listener (GET_LISTENER (create_child_translator), + c->event_source ()->add_listener (GET_LISTENER (Translator_group, create_child_translator), ly_symbol2scm ("AnnounceNewContext")); for (SCM tr_list = simple_trans_list_; scm_is_pair (tr_list); tr_list = scm_cdr (tr_list)) { @@ -75,7 +75,7 @@ Translator_group::disconnect_from_context () Translator *tr = Translator::unsmob (scm_car (tr_list)); tr->disconnect_from_context (context_); } - context_->event_source ()->remove_listener (GET_LISTENER (create_child_translator), + context_->event_source ()->remove_listener (GET_LISTENER (Translator_group, create_child_translator), ly_symbol2scm ("AnnounceNewContext")); context_ = 0; protected_events_ = SCM_EOL; @@ -145,7 +145,6 @@ Translator_group::protect_event (SCM ev) Create a new translator for a newly created child context. Triggered by AnnounceNewContext events. */ -IMPLEMENT_LISTENER (Translator_group, create_child_translator); void Translator_group::create_child_translator (SCM sev) { -- 2.39.2