]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/translator.hh
patch::: 1.3.93.jcn2
[lilypond.git] / lily / include / translator.hh
index e9fc506a46b86e96537aa3346e09a54b93cd53b2..05f865082db658324bd60d73f03092f1c9e58f58 100644 (file)
@@ -3,45 +3,41 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.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"
-
-#define TRANSLATOR_CLONE(c)    VIRTUAL_COPY_CONS(c, Translator)
+#include "smobs.hh"
 
 /** Make some kind of #Element#s from Requests. Elements are made by
   hierarchically grouped #Translator#s
   */
 class Translator : public Input {
-  Dictionary<Scalar> properties_dict_;
+  void init ();
 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;
+
   
   /**
     try to fit the request in this engraver
@@ -52,25 +48,36 @@ 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 process_music();
   void post_move_processing();
   void removal_processing();
   /**
     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; }
 
-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,
@@ -80,36 +87,39 @@ protected:
     PROCESSED_REQS,
     ACKED_REQS,
     MOVE_DONE
-  } status;
+  } status_;                   // junkme
+protected:
 
   /*    
        @see{try_request}
        Default: always return false
        */
-  virtual bool do_try_request (Request *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_add_processing ();
+  virtual bool do_try_music (Music *req_l);
+  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();
 };
 
+
 /**
   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);
 
 Translator*get_translator_l (String s);
-
+Translator *unsmob_translator (SCM);
 #endif // TRANSLATOR_HH