]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/translator.cc
release: 1.5.4
[lilypond.git] / lily / translator.cc
index 90edc46fbbaa3423bc62f94c9b6612f2a3346e04..03adb249f91a22bb4065e746183fab71e21248e4 100644 (file)
@@ -3,21 +3,22 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
 #include "translator.hh"
 #include "debug.hh"
 #include "translator-group.hh"
+#include "translator-def.hh"
 
 #include "moment.hh"
 #include "ly-smobs.icc"
 
 char const*
-Translator::name() const
+Translator::name () const
 {
-  return classname(this);
+  return classname (this);
 }
 
 Translator::~Translator ()
@@ -27,7 +28,6 @@ Translator::~Translator ()
 void
 Translator::init ()
 {
-  status_ = ORPHAN;
   simple_trans_list_ = SCM_EOL;
   trans_group_list_ = SCM_EOL;
   properties_scm_ = SCM_EOL;
@@ -56,11 +56,17 @@ Translator::Translator (Translator const &s)
 bool
 Translator::is_alias_b (String s) const
 {
-  return s == type_str_;
+  bool b  = s == type_str_;
+
+  for (SCM a = unsmob_translator_def (definition_)->type_aliases_;
+       !b && gh_pair_p (a); a = gh_cdr (a))
+    b = b || s == ly_scm2string (gh_car (a));
+
+  return b;
 }
 
 bool
-Translator::do_try_music (Music *)
+Translator::try_music (Music *)
 {
   return false;
 }
@@ -73,104 +79,24 @@ Translator::now_mom () const
 }
 
 
-void
-Translator::add_processing ()
-{
-  if (status_ > ORPHAN)
-    return;
-  
-  do_add_processing ();
-  status_ = VIRGIN;
-}
-
-void
-Translator::do_add_processing ()
-{
-}
-
-void
-Translator::print () const
-{
-#ifndef NPRINT
-  DEBUG_OUT << classname (this) << " {";
-  if (classname (this) != type_str_)
-    DEBUG_OUT << "type = " << type_str_;
-  do_print ();
-  DEBUG_OUT << "}\n";
-#endif
-}
-
-void
-Translator::do_print () const
-{
-}
 
 
 
 
-void
-Translator::creation_processing ()
-{
-  if (status_ >= CREATION_INITED)
-    return ;
-  
-  do_creation_processing ();
-  status_ = CREATION_INITED;
-}
-
-void
-Translator::post_move_processing ()
-{
-  if (status_ >= MOVE_INITED)
-    return;
-
-  creation_processing ();
-  do_post_move_processing ();
-  status_ = MOVE_INITED;
-}
-
 void
 Translator::removal_processing ()
 {
-  if (status_ == ORPHAN)
-    return;
-  creation_processing ();
-  do_removal_processing ();
-  // elegancy ...
-  // status_ = ORPHAN;
+  finalize ();
 }
 
 
-bool
-Translator::try_music (Music * r)
-{
-  if (status_ < MOVE_INITED)
-    post_move_processing ();
-
-  return do_try_music (r);
-}
-
 void
-Translator::process_music ()
+Translator::announces ()
 {
-  if (status_ < PROCESSED_REQS)
-    post_move_processing ();
-  else if (status_ >= PROCESSED_REQS)
-    return; 
-  
-  status_ = PROCESSED_REQS;
-  do_process_music ();
-}
-
-void
-Translator::pre_move_processing ()
-{
-  do_pre_move_processing ();
-  status_ = CREATION_INITED;
+  do_announces ();
 }
 
 
-
 Music_output_def *
 Translator::output_def_l () const
 {
@@ -190,27 +116,27 @@ Translator::get_property (SCM sym) const
 }
 
 void
-Translator:: do_pre_move_processing ()
+Translator:: stop_translation_timestep ()
 {
 }
 
 void
-Translator::do_post_move_processing ()
+Translator::start_translation_timestep ()
 {
 }
 
 void
-Translator::do_process_music ()
+Translator::do_announces ()
 {
 }
 
 void
-Translator::do_creation_processing ()
+Translator::initialize ()
 {
 }
 
 void
-Translator::do_removal_processing ()
+Translator::finalize ()
 {
 }
 
@@ -223,7 +149,7 @@ Translator::do_removal_processing ()
 SCM
 Translator::mark_smob (SCM sm)
 {
-  Translator * me = (Translator*) SCM_CELL_WORD_1(sm);
+  Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
   scm_gc_mark (me->simple_trans_list_);
   scm_gc_mark (me->trans_group_list_);
   scm_gc_mark (me->definition_);  
@@ -245,14 +171,10 @@ Translator::print_smob (SCM s, SCM port, scm_print_state *)
     don't try to print properties, that is too much hassle.
    */
   scm_puts (" >", port);
-
-  
   
   return 1;
 }
 
-
-
-IMPLEMENT_UNSMOB(Translator, translator);
-IMPLEMENT_SMOBS(Translator);
-IMPLEMENT_DEFAULT_EQUAL_P(Translator);
+IMPLEMENT_UNSMOB (Translator, translator);
+IMPLEMENT_SMOBS (Translator);
+IMPLEMENT_DEFAULT_EQUAL_P (Translator);