]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/translator.hh
patch::: 1.3.93.jcn2
[lilypond.git] / lily / include / translator.hh
index f089df51b417f464f570999971bb6e25d7dcca74..05f865082db658324bd60d73f03092f1c9e58f58 100644 (file)
@@ -3,42 +3,41 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 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 "scalar.hh"
-#include "dictionary.hh"
+#include "lily-guile.hh"
 #include "parray.hh"
 #include "input.hh"
-
+#include "smobs.hh"
 
 /** Make some kind of #Element#s from Requests. Elements are made by
   hierarchically grouped #Translator#s
   */
 class Translator : public Input {
+  void init ();
 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 &);
   Translator ();
-  virtual ~Translator ();
   
   Translator_group * daddy_trans_l_ ;
  
-  void print () const;
+
   
   /**
     try to fit the request in this engraver
@@ -53,17 +52,32 @@ public:
   void pre_move_processing();
   void add_processing ();
   void creation_processing ();
-  void process_requests();
+  void process_music();
   void post_move_processing();
   void removal_processing();
   /**
     ask daddy for a feature
     */
   Music_output_def *output_def_l () const;
-  Scalar get_property (String, Translator_group **) const;
-  virtual Moment now_moment () const;  
 
-protected:
+  SCM get_property (const char *) const;
+  SCM get_property (SCM symbol) const;
+  
+  virtual Moment now_mom () const;  
+
+  /*
+    ugh: bubbled up from Translator_group. 
+   */
+  SCM simple_trans_list_;
+  SCM trans_group_list_;
+  SCM definition_;
+  
+  SCM properties_scm_;
+  DECLARE_SMOBS(Translator, dummy);
+public:
+  /*
+    UGH. Clean this up.
+   */
    enum { 
     ORPHAN,
     VIRGIN,
@@ -73,7 +87,8 @@ protected:
     PROCESSED_REQS,
     ACKED_REQS,
     MOVE_DONE
-  } status;
+  } status_;                   // junkme
+protected:
 
   /*    
        @see{try_request}
@@ -81,42 +96,30 @@ protected:
        */
   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(){}
-  virtual void do_process_requests () {}
-  virtual void do_creation_processing() {}
-  virtual void do_removal_processing() {}
+  virtual void do_pre_move_processing();
+  virtual void do_post_move_processing();
+  virtual void do_process_music () ;
+  virtual void do_creation_processing() ;
+  virtual void do_removal_processing();
 };
 
 
-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);
-
+Translator *unsmob_translator (SCM);
 #endif // TRANSLATOR_HH