]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/interpretation-context-handle.cc
2003 -> 2004
[lilypond.git] / lily / interpretation-context-handle.cc
index 3c1e38153ae250b76b472a20570f25e5b3d97a50..9f2242203d58381206ba36d09b65a7983a52492c 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
  */
 
 #include "interpretation-context-handle.hh"
 
 Interpretation_context_handle::Interpretation_context_handle ()
 {
-  report_to_ =0;
+  outlet_ =0;
 }
 
 Interpretation_context_handle::Interpretation_context_handle (Interpretation_context_handle const&s)
 {
-  report_to_ =0;
-  if (s.report_to_)
-    up (s.report_to_);
+  outlet_ =0;
+  if (s.outlet_)
+    up (s.outlet_);
 }
 
 Interpretation_context_handle*
 Interpretation_context_handle::clone () const
 {
   Interpretation_context_handle* handle = new Interpretation_context_handle;
-  handle->report_to_ = this->report_to_;
+  handle->outlet_ = this->outlet_;
   return handle;
 }
 
 Interpretation_context_handle::~Interpretation_context_handle ()
 {
-  if (report_to_)
-    down ();
+  /*
+    Don't do
+
+    if (outlet_)
+      down ();
+
+    with GC, this is asynchronous.
+   */
 }
 
 void
 Interpretation_context_handle::up (Translator_group*t)
 {
-  report_to_ = t;
+  outlet_ = t;
   t->iterator_count_ ++;
 }
 
 void
 Interpretation_context_handle::down ()
 {
-  report_to_->iterator_count_ --;
-  report_to_ = 0;
+  outlet_->iterator_count_ --;
+  outlet_ = 0;
+}
+
+void
+Interpretation_context_handle::quit ()
+{
+  if (outlet_)
+    {
+      outlet_->iterator_count_ --;
+      outlet_ = 0;
+    }
 }
 
 bool
 Interpretation_context_handle::try_music (Music *m)
 {
-  return  report_to_->try_music (m);
+  return outlet_->try_music (m);
 }
 
 void
 Interpretation_context_handle::operator = (Interpretation_context_handle const &s)
 {
-  set_translator (s.report_to_);
+  set_translator (s.outlet_);
 }
 
 void
 Interpretation_context_handle::set_translator (Translator_group*trans)
 {
-  if (report_to_ ==trans)
+  if (outlet_ ==trans)
     return;
-  if (report_to_)
+  if (outlet_)
     down ();
   if (trans)
     up (trans);
 }
 
 Translator_group*
-Interpretation_context_handle::report_to ()const
+Interpretation_context_handle::get_outlet () const
 {
-  return report_to_;
+  
+  return outlet_;
 }
 
-
+int
+Interpretation_context_handle::get_count () const
+{
+  return outlet_->iterator_count_ ;
+}