From fac5dc1f38cade0d2c45d9f1944e7feb336b8159 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Mon, 20 Apr 2015 18:33:16 +0200 Subject: [PATCH] Issue 4351/2: Rename Translator_void_method_ptr to Translator::Callback This is somewhat more descriptive. --- lily/include/lily-proto.hh | 2 -- lily/include/translator-group.hh | 4 +-- lily/include/translator.hh | 3 ++- lily/include/translator.icc | 42 ++++++++++++++++---------------- lily/translator-group.cc | 2 +- 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 98c805ad2c..a76022b434 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -173,6 +173,4 @@ class Timing_translator; class Translator; class Translator_group; -typedef void (Translator::*Translator_void_method_ptr) (); - #endif /* LILY_PROTO_HH */ diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index c45e29de0a..068a3bbcae 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -30,12 +30,12 @@ typedef void (*Translator_group_void_method) (Translator_group *); struct Translator_method_binding { Translator *translator_; - Translator_void_method_ptr method_; + Translator::Callback method_; Translator_method_binding () { } - Translator_method_binding (Translator *tr, Translator_void_method_ptr ptr) + Translator_method_binding (Translator *tr, Translator::Callback ptr) { translator_ = tr; method_ = ptr; diff --git a/lily/include/translator.hh b/lily/include/translator.hh index 92f411d508..d089f78d03 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -54,7 +54,7 @@ typedef struct translator_listener_record VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \ static SCM static_description_; \ static Drul_array > acknowledge_static_array_drul_; \ - virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]); \ + virtual void fetch_precomputable_methods (Callback methods[]); \ virtual SCM static_translator_description () const; \ virtual SCM translator_description () const; \ static Grob_info_callback static_get_acknowledger (SCM sym); \ @@ -111,6 +111,7 @@ public: // otherwise get into a circular mess with regard to the definitions // as the timing of Engraver is exercised from within Translator typedef void (Translator::*Grob_info_callback) (Grob_info); + typedef void (Translator::*Callback) (void); int print_smob (SCM, scm_print_state *); SCM mark_smob (); static const char type_p_name_[]; diff --git a/lily/include/translator.icc b/lily/include/translator.icc index 114cda85ab..9f4def39e0 100644 --- a/lily/include/translator.icc +++ b/lily/include/translator.icc @@ -78,31 +78,31 @@ DEFINE_TRANSLATOR_DOC(classname, desc, grobs, read, write) \ DEFINE_ACKNOWLEDGERS(classname) \ DEFINE_TRANSLATOR_LISTENER_LIST(classname) \ - + #define IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(T) \ void \ - T::fetch_precomputable_methods (Translator_void_method_ptr ptrs[]) \ + T::fetch_precomputable_methods (Translator::Callback ptrs[]) \ { \ ptrs[START_TRANSLATION_TIMESTEP] = \ - ((Translator_void_method_ptr) & T::start_translation_timestep == \ - (Translator_void_method_ptr) & Translator::start_translation_timestep) \ - ? 0 \ - : (Translator_void_method_ptr) & T::start_translation_timestep; \ - \ - ptrs[STOP_TRANSLATION_TIMESTEP] = \ - ((Translator_void_method_ptr) & T::stop_translation_timestep == (Translator_void_method_ptr) & Translator::stop_translation_timestep) \ - ? 0 \ - : (Translator_void_method_ptr) & T::stop_translation_timestep; \ - \ - ptrs[PROCESS_MUSIC] = \ - ((Translator_void_method_ptr) & T::process_music == (Translator_void_method_ptr) & Translator::process_music) \ - ? 0 \ - : (Translator_void_method_ptr) & T::process_music; \ - \ - ptrs[PROCESS_ACKNOWLEDGED] = \ - ((Translator_void_method_ptr) & T::process_acknowledged == (Translator_void_method_ptr) & Translator::process_acknowledged) \ - ? 0 \ - : (Translator_void_method_ptr) & T::process_acknowledged; \ + (&T::start_translation_timestep \ + == &Translator::start_translation_timestep) \ + ? 0 \ + : static_cast (&T::start_translation_timestep); \ + \ + ptrs[STOP_TRANSLATION_TIMESTEP] = \ + (& T::stop_translation_timestep == & Translator::stop_translation_timestep) \ + ? 0 \ + : static_cast (&T::stop_translation_timestep); \ + \ + ptrs[PROCESS_MUSIC] = \ + (&T::process_music == &Translator::process_music) \ + ? 0 \ + : static_cast (&T::process_music); \ + \ + ptrs[PROCESS_ACKNOWLEDGED] = \ + (&T::process_acknowledged == &Translator::process_acknowledged) \ + ? 0 \ + : static_cast (&T::process_acknowledged); \ } void add_acknowledger (Translator::Grob_info_callback ptr, diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 5a5b5695f0..2e6039a9af 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -303,7 +303,7 @@ Translator_group::precompute_method_bindings () for (SCM s = simple_trans_list_; scm_is_pair (s); s = scm_cdr (s)) { Translator *tr = Translator::unsmob (scm_car (s)); - Translator_void_method_ptr ptrs[TRANSLATOR_METHOD_PRECOMPUTE_COUNT]; + Translator::Callback ptrs[TRANSLATOR_METHOD_PRECOMPUTE_COUNT]; tr->fetch_precomputable_methods (ptrs); assert (tr); -- 2.39.2