]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob-property.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / grob-property.cc
index ac452e36b220615be9f48500a294d6c341db0716..c4dce927b43f86f3265348779ede3ef846f6b1b9 100644 (file)
@@ -16,6 +16,7 @@
 #include "item.hh"
 #include "program-option.hh"
 #include "profile.hh"
+#include "simple-closure.hh"
 
 SCM
 Grob::get_property_alist_chain (SCM def) const
@@ -26,12 +27,6 @@ Grob::get_property_alist_chain (SCM def) const
                     SCM_UNDEFINED);
 }
 
-SCM
-Grob::get_interfaces () const
-{
-  return interfaces_;
-}
-
 
 extern void check_interfaces_for_property (Grob const *me, SCM sym);
 
@@ -59,6 +54,8 @@ Grob::internal_set_property (SCM sym, SCM v)
   if (do_internal_type_checking_global)
     {
       if (!ly_is_procedure (v)
+         && !is_simple_closure (v)
+         && v != ly_symbol2scm ("calculation-in-progress") 
          && !type_check_assignment (sym, v, ly_symbol2scm ("backend-type?")))
        abort ();
       check_interfaces_for_property (this, sym);
@@ -68,12 +65,6 @@ Grob::internal_set_property (SCM sym, SCM v)
 }
 
 //#define PROFILE_PROPERTY_ACCESSES
-
-/*
-  Ugh C&P Coding.
-
-  Retrieve property without triggering callback.
- */
 SCM
 Grob::get_property_data (SCM sym) const
 {
@@ -92,6 +83,7 @@ Grob::get_property_data (SCM sym) const
     {
       SCM val = scm_cdr (handle);
       if (!ly_is_procedure (val)
+         && !is_simple_closure (val)
          && !type_check_assignment (sym, val, 
                                  ly_symbol2scm ("backend-type?")))
        abort ();
@@ -106,7 +98,8 @@ SCM
 Grob::internal_get_property (SCM sym) const
 {
   SCM val = get_property_data (sym);
-  if (ly_is_procedure (val))
+  if (ly_is_procedure (val)
+      || is_simple_closure (val))
     {
       val = ((Grob*)this)->try_callback (sym, val);
     }
@@ -116,8 +109,9 @@ Grob::internal_get_property (SCM sym) const
 
 #ifndef NDEBUG
 #include "protected-scm.hh"
+
 Protected_scm grob_property_callback_stack = SCM_EOL;
-bool debug_property_callbacks = 1;
+bool debug_property_callbacks = 0;
 #endif
 
 SCM
@@ -135,7 +129,15 @@ Grob::try_callback (SCM sym, SCM proc)
   if (debug_property_callbacks)
     grob_property_callback_stack = scm_acons (sym, proc, grob_property_callback_stack);
 #endif
-  SCM value = scm_call_1 (proc, self_scm ());
+
+  SCM value = SCM_EOL;
+  if (ly_is_procedure (proc))
+    value = scm_call_1 (proc, self_scm ());
+  else if (is_simple_closure (proc))
+    {
+      value = evaluate_with_simple_closure (self_scm (),
+                                           simple_closure_expression (proc));
+    }
 #ifndef NDEBUG
   if (debug_property_callbacks)
     grob_property_callback_stack = scm_cdr (grob_property_callback_stack);
@@ -186,15 +188,15 @@ Grob::internal_get_object (SCM sym) const
   return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s);
 }
 
-void
-Grob::substitute_object_links (SCM crit, SCM orig)
+bool
+Grob::is_live () const
 {
-  set_break_subsititution (crit);
-  object_alist_ = substitute_object_alist (orig, object_alist_);
+  return immutable_property_alist_ != SCM_EOL;
 }
 
+
 bool
-Grob::is_live () const
+Grob::internal_has_interface (SCM k)
 {
-  return immutable_property_alist_ != SCM_EOL;
+  return scm_c_memq (k, interfaces_) != SCM_BOOL_F;
 }