]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/global-context.cc
*** empty log message ***
[lilypond.git] / lily / global-context.cc
index ce3f9e9ef5b4e2f9aa9fab2b44b2bdec3b72606c..ee26880d4deeb366207740e1d042c1b953850dc2 100644 (file)
@@ -5,26 +5,25 @@
 
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-#include <stdio.h>
+
+#include "global-context.hh"
+
+#include <cstdio>
 
 #include "warn.hh"
-#include "music.hh"
 #include "event.hh"
 #include "music-list.hh"
 #include "music-iterator.hh"
-#include "global-context.hh"
 #include "score-context.hh"
 #include "context-def.hh"
 #include "output-def.hh"
 #include "lilypond-key.hh"
 
-Global_context::Global_context (Output_def *o, Moment final)
-  : Context (new Lilypond_context_key(0,
+Global_context::Global_context (Output_def *o, Moment final, Object_key *key)
+  : Context (new Lilypond_context_key(key,
                                      Moment(0),
-                                     "Global", ""))
+                                     "Global", "", 0))
 {
-  scm_gc_unprotect_object (key_->self_scm());
-  
   output_def_ = o;
   final_mom_ = final;
   definition_ = find_context_def (o, ly_symbol2scm ("Global"));
@@ -54,7 +53,7 @@ Global_context::add_moment_to_process (Moment m)
   if (m < now_mom_)
     programming_error ("Trying to freeze in time.");
   
-  for (int i=0; i <  extra_mom_pq_.size (); i++)
+  for (int i = 0; i <  extra_mom_pq_.size (); i++)
     if (extra_mom_pq_[i] == m)
       return;
   extra_mom_pq_.insert (m);
@@ -80,8 +79,10 @@ Global_context::prepare (Moment m)
   prev_mom_  = now_mom_;
   now_mom_ = m;
 
+  clear_key_disambiguations ();
   if (get_score_context ())
     get_score_context ()->prepare (m);
+  
 }
 
 Moment
@@ -161,11 +162,9 @@ Global_context::run_iterator_on_me (Music_iterator * iter)
          if (!t)
            error (_f ("can't find `%s' context", "Score"));
 
-         Object_key *key = new Lilypond_context_key (get_key(), now_mom(),
-                                                     "Score", "");
+         Object_key const *key = get_context_key ("Score", "");
          Context *c = t->instantiate (SCM_EOL, key);
          add_context (c);
-         scm_gc_unprotect_object (key->self_scm());
 
          Score_context *sc = dynamic_cast<Score_context*> (c);
          sc->prepare (w);