]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/context.cc
Some clean up about grace-settings in music-functions.scm
[lilypond.git] / lily / context.cc
index d2c93155a578964e5cf439400fe626236b611ca3..583b2eac89b7705762fb32968e310c6fb7e202ac 100644 (file)
@@ -86,12 +86,12 @@ Context::Context ()
   implementation_ = 0;
   properties_scm_ = SCM_EOL;
   accepts_list_ = SCM_EOL;
+  default_child_ = SCM_EOL;
   context_list_ = SCM_EOL;
   definition_ = SCM_EOL;
   definition_mods_ = SCM_EOL;
   event_source_ = 0;
   events_below_ = 0;
-  ancestor_lookup_ = SCM_UNDEFINED;
 
   smobify_self ();
 
@@ -256,8 +256,8 @@ Context::set_property_from_event (SCM sev)
       }
           
       bool ok = true;
-      if (val != SCM_EOL)
-        ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?"));
+      ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?"));
+
       if (ok)
         set_property (sym, val);
     }
@@ -401,9 +401,7 @@ Context::create_context (Context_def *cdef,
 SCM
 Context::default_child_context_name () const
 {
-  return scm_is_pair (accepts_list_)
-         ? scm_car (accepts_list_)
-         : SCM_EOL;
+  return default_child_;
 }
 
 bool
@@ -480,7 +478,9 @@ be called from any other place than the send_stream_event macro.
 void
 Context::internal_send_stream_event (SCM type, Input *origin, SCM props[])
 {
-  Stream_event *e = new Stream_event (make_event_class (type), origin);
+  Stream_event *e = new Stream_event
+    (scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), type),
+     origin);
   for (int i = 0; props[i]; i += 2)
     {
       e->set_property (props[i], props[i + 1]);
@@ -492,10 +492,9 @@ Context::internal_send_stream_event (SCM type, Input *origin, SCM props[])
 bool
 Context::is_alias (SCM sym) const
 {
-  if (sym == ly_symbol2scm ("Bottom")
-      && !scm_is_pair (accepts_list_))
-    return true;
-  if (sym == unsmob_context_def (definition_)->get_context_name ())
+  if (scm_is_eq (sym, ly_symbol2scm ("Bottom")))
+    return is_bottom_context ();
+  if (scm_is_eq (sym, context_name_symbol ()))
     return true;
 
   return scm_c_memq (sym, aliases_) != SCM_BOOL_F;
@@ -621,14 +620,6 @@ Context::get_score_context () const
     return 0;
 }
 
-SCM
-Context::make_event_class (SCM event_type)
-{
-  if (SCM_UNBNDP (ancestor_lookup_))
-    ancestor_lookup_ = get_global_context ()->ancestor_lookup_;
-  return scm_hashq_ref (ancestor_lookup_, event_type, SCM_EOL);
-}
-
 Output_def *
 Context::get_output_def () const
 {
@@ -687,6 +678,7 @@ Context::mark_smob (SCM sm)
   scm_gc_mark (me->definition_mods_);
   scm_gc_mark (me->properties_scm_);
   scm_gc_mark (me->accepts_list_);
+  scm_gc_mark (me->default_child_);
 
   if (me->implementation_)
     scm_gc_mark (me->implementation_->self_scm ());
@@ -697,8 +689,6 @@ Context::mark_smob (SCM sm)
   if (me->events_below_)
     scm_gc_mark (me->events_below_->self_scm ());
 
-  scm_gc_mark (me->ancestor_lookup_);
-
   return me->properties_scm_;
 }