]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/translator.hh
release: 1.1.43
[lilypond.git] / lily / include / translator.hh
index e9fc506a46b86e96537aa3346e09a54b93cd53b2..5c3cfec42b649ccb6a1f052ef006d5811049ced9 100644 (file)
@@ -3,13 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.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"
 #include "parray.hh"
 #include "input.hh"
 
-#define TRANSLATOR_CLONE(c)    VIRTUAL_COPY_CONS(c, Translator)
 
 /** Make some kind of #Element#s from Requests. Elements are made by
   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_;
   
-
-  DECLARE_MY_RUNTIME_TYPEINFO;  
-  TRANSLATOR_CLONE(Translator);
+  virtual const char *name() const;
+  bool is_alias_b (String) const;
+    
+  VIRTUAL_COPY_CONS(Translator);
   Translator (Translator const &);
   Translator ();
   virtual ~Translator ();
   
   Translator_group * daddy_trans_l_ ;
  
-  virtual void add_processing ();
   void print () const;
   
   /**
@@ -52,8 +48,9 @@ public:
     true: request swallowed. Don't try to put the request elsewhere.
 
     */
-  bool try_request (Request*);
+  bool try_music (Music*);
   void pre_move_processing();
+  void add_processing ();
   void creation_processing ();
   void process_requests();
   void post_move_processing();
@@ -61,14 +58,9 @@ public:
   /**
     ask daddy for a feature
     */
-  Scalar get_property (String type_str);
-  void set_property (String var_name, Scalar value);
   Music_output_def *output_def_l () const;
-  
-  virtual Moment now_moment () const;  
-  virtual Engraver *engraver_l () { return 0; }
-  virtual Performer *performer_l() { return 0; }
-  virtual Translator_group * group_l () { return 0; }
+  Scalar get_property (String, Translator_group **) const;
+  virtual Moment now_mom () const;  
 
 protected:
    enum { 
@@ -86,7 +78,8 @@ protected:
        @see{try_request}
        Default: always return false
        */
-  virtual bool do_try_request (Request *req_l);
+  virtual void do_add_processing ();
+  virtual bool do_try_music (Music *req_l);
   virtual void do_print () const;
   virtual void do_pre_move_processing(){}
   virtual void do_post_move_processing(){}
@@ -95,17 +88,19 @@ protected:
   virtual void do_removal_processing() {}
 };
 
+
 /**
   A macro to automate administration of translators.
  */
-#define ADD_THIS_TRANSLATOR(c)                         \
-struct c ## init {                                     \
-    c ## init() {                                      \
-         Translator *t = new c;\
-        t-> type_str_ = c::static_name ();\
-       add_translator (t);\
-    }                                                  \
-} _ ## 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);
+
+
 
 extern Dictionary<Translator*> *global_translator_dict_p;
 void add_translator (Translator*trans_p);