]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/translator.hh
Issue 1375/1: Let Translator constructor take a Context argument
[lilypond.git] / lily / include / translator.hh
index d4ea41f93418e854fe42df12d8eacb80c5bd1716..ffd134efab66b96eb92f79a14e65546f6776ec0b 100644 (file)
@@ -26,6 +26,7 @@
 #include "callback.hh"
 #include "input.hh"             // for error reporting
 #include "smobs.hh"
+#include "stream-event.hh"
 #include "std-vector.hh"
 #include "protected-scm.hh"
 
@@ -38,8 +39,7 @@
   /* end #define */
 
 #define TRANSLATOR_INHERIT(BASE)                                        \
-  using BASE::method_finder;                                            \
-  using BASE::ack_finder;
+  using BASE::method_finder
 
 #define DECLARE_TRANSLATOR_CALLBACKS(NAME)                              \
   template <void (NAME::*mf)()>                                         \
   {                                                                     \
     return Callback_wrapper::make_smob<trampoline<NAME, mf> > ();       \
   }                                                                     \
-  template <void (NAME::*callback)(Grob_info)>                          \
-  static SCM ack_finder () { return ack_find_base<NAME, callback> (); } \
+  template <void (NAME::*mf)(Grob_info)>                                \
+  static SCM method_finder () {                                         \
+    return Callback2_wrapper::make_smob<trampoline <NAME, mf> > ();     \
+  }                                                                     \
   /* end #define */
 
 /*
@@ -75,7 +77,7 @@
     return static_get_acknowledger (sym, start_end);                    \
   }                                                                     \
 public:                                                                 \
-  NAME ();                                                              \
+  NAME (Context *);                                                     \
   static void boot ();                                                  \
   virtual SCM static_translator_description () const;                   \
   virtual SCM translator_description () const;                          \
@@ -104,13 +106,10 @@ public:
   SCM mark_smob () const;
   static const char * const type_p_name_;
   virtual ~Translator ();
-private:
-  void init ();
 
-public:
   Context *context () const { return daddy_context_; }
 
-  Translator ();
+  Translator (Context *);
   Translator (Translator const &);
 
   SCM internal_get_property (SCM symbol) const;
@@ -163,15 +162,6 @@ protected:                      // should be private.
   static SCM
   method_finder () { return SCM_UNDEFINED; }
 
-  // Overriden in Engraver.
-  template <class T, void (T::*callback)(Grob_info)>
-  static SCM
-  ack_find_base () { return SCM_UNDEFINED; }
-
-  template <void (Translator::*)(Grob_info)>
-  static SCM
-  ack_finder () { return SCM_UNDEFINED; }
-
   virtual void derived_mark () const;
   static SCM event_class_symbol (const char *ev_class);
   SCM static_translator_description (const char *grobs,