]> 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 dd0659bf50866ec4a9e03e86565deffc0299f7dd..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"
 
 
 #define DECLARE_TRANSLATOR_CALLBACKS(NAME)                              \
   template <void (NAME::*mf)()>                                         \
-  static SCM method_finder () { return method_find_base<NAME, mf> (); } \
+  static SCM method_finder ()                                           \
+  {                                                                     \
+    return Callback0_wrapper::make_smob<NAME, mf> ();                   \
+  }                                                                     \
+  template <void (NAME::*mf)(Stream_event *)>                           \
+  static SCM method_finder ()                                           \
+  {                                                                     \
+    return Callback_wrapper::make_smob<trampoline<NAME, mf> > ();       \
+  }                                                                     \
+  template <void (NAME::*mf)(Grob_info)>                                \
+  static SCM method_finder () {                                         \
+    return Callback2_wrapper::make_smob<trampoline <NAME, mf> > ();     \
+  }                                                                     \
   /* end #define */
 
 /*
@@ -64,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;                          \
@@ -93,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;
@@ -146,10 +156,6 @@ protected:                      // should be private.
     return SCM_UNSPECIFIED;
   }
 
-  template <class T, void (T::*mf)()>
-  static SCM
-  method_find_base () { return Callback0_wrapper::make_smob<T, mf> (); }
-
   // Fallback for non-overriden callbacks for which &T::x degrades to
   // &Translator::x
   template <void (Translator::*)()>