]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/translator.hh
release: 1.1.43
[lilypond.git] / lily / include / translator.hh
index 7671f96aa5f9b2c5703c03c6150a4f8a47541dc7..5c3cfec42b649ccb6a1f052ef006d5811049ced9 100644 (file)
@@ -3,13 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
 #ifndef TRANSLATOR_HH
 #define TRANSLATOR_HH
-
+#include "global-ctor.hh"
 #include "string.hh"
 #include "lily-proto.hh"
 #include "virtual-methods.hh"
   hierarchically grouped #Translator#s
   */
 class Translator : public Input {
-  Dictionary<Scalar> properties_dict_;
 public:
   Music_output_def * output_def_l_;
-  String  type_str_;
-
-  bool is_alias_b (String) const;
+  String type_str_;
   
-
+  virtual const char *name() const;
+  bool is_alias_b (String) const;
     
   VIRTUAL_COPY_CONS(Translator);
   Translator (Translator const &);
@@ -60,11 +58,9 @@ public:
   /**
     ask daddy for a feature
     */
-  Scalar get_property (String type_str, Translator const **where_found_l) const;
-  void set_property (String var_name, Scalar value);
   Music_output_def *output_def_l () const;
-  
-  virtual Moment now_moment () const;  
+  Scalar get_property (String, Translator_group **) const;
+  virtual Moment now_mom () const;  
 
 protected:
    enum { 
@@ -93,32 +89,21 @@ protected:
 };
 
 
-template<class T>
-class Translator_adder
-{
-public:
-  static Translator *ctor ()
-    {
-      T *t = new T;
-      t->type_str_ = classname (t);
-      return t;
-    }
-  Translator_adder () {        
-    add_constructor (ctor);
-  }                            
-};
-
 /**
   A macro to automate administration of translators.
  */
-#define ADD_THIS_TRANSLATOR(c)                         \
-  Translator_adder<c> _ ## c ## init;
+#define ADD_THIS_TRANSLATOR(T)                         \
+static void  _ ## T ## _adder () {\
+      T *t = new T;\
+      t->type_str_ = classname (t);\
+      add_translator (t);\
+}\
+ADD_GLOBAL_CTOR(_ ## T ## _adder);
+
 
-typedef Translator *(*Translator_ctor) ();
 
 extern Dictionary<Translator*> *global_translator_dict_p;
 void add_translator (Translator*trans_p);
-void add_constructor (Translator_ctor ctor);
 
 Translator*get_translator_l (String s);