On Sat, 2006-09-16 at 16:29 +0200, Han-Wen Nienhuys wrote:
> Joe Neeman wrote:
> > Understanding the LilyPond source often boils down to figuring out what
> > is happening to the Grobs. Where (and why) are they being created,
> > modified and destroyed? I've spent many hours tracing Lily through a
> > debugger and it is mind-blowingly tedious.
> > 
> > So I quickly hacked a few things together and came up with something a
> > bit better. I added hooks into internal_grob_set_property and
> > make_grob_from_properties. You can register a scheme callback which will
> > get called whenever a Grob is modified or created. The scheme callback
> > will receive the file and line numbers in the C++ source where the call
> > was made. This can help you to trace cause and effect through the C++
> > source.
> 
> Of course, having written much of the code myself, I don't need it, but 
> this is extremely cool!
> 
> Some comments:
> 
> * can you add another macro layer, so __LINE__ and __FILE__ aren't 
> sprinkled around in the code? For good measure, you could also add 
> __FUNCTION__ .

This is done. I've removed all direct calls to internal_foo. I also
cleaned up make_{item,paper_column,spanner}.

> * similarly, can you add macro layering, so that passing around line 
> numbers/file  names is entirely optional, and doesn't happen for a 
> -DNDEBUG build?

I've done this, too but I'm not sure about it -- some of the ifndefs
start to inhibit readability.

What if I get rid of just the ifndef'ed prototypes? Ie. the line
numbers, etc will get passed around, but they won't get used when NDEBUG
is defined.

BTW, I removed the hooks from set_object because they weren't much use.
To get that information, I really need to hook into things like
Pointer_group_interface::add_grob.
diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc
index 39a66ba..09fbbfd 100644
--- a/lily/accidental-engraver.cc
+++ b/lily/accidental-engraver.cc
@@ -398,11 +398,7 @@ Accidental_engraver::make_standard_accid
     level, so that we get the property settings for
     Accidental from the respective Voice.
   */
-  Grob *a
-    = make_grob_from_properties (trans,
-				 ly_symbol2scm ("Accidental"),
-				 note_head->self_scm (),
-				 "Accidental");
+  Grob *a = trans->make_item ("Accidental", note_head->self_scm ());
 
   /*
     We add the accidentals to the support of the arpeggio,
@@ -438,11 +434,7 @@ Accidental_engraver::make_suggested_acci
 						Engraver *trans)
 {
   (void) note;
-  Grob *a
-    = make_grob_from_properties (trans,
-				 ly_symbol2scm ("AccidentalSuggestion"),
-				 note_head->self_scm (),
-				 "AccidentalSuggestion");
+  Grob *a = trans->make_item ("AccidentalSuggestion", note_head->self_scm ());
 
   Side_position_interface::add_support (a, note_head);
   if (Grob *stem = unsmob_grob (a->get_object ("stem")))
diff --git a/lily/align-interface.cc b/lily/align-interface.cc
index afe4702..4f1e83d 100644
--- a/lily/align-interface.cc
+++ b/lily/align-interface.cc
@@ -323,7 +323,7 @@ Align_interface::add_element (Grob *me, 
   SCM sym = axis_offset_symbol (a);
   SCM proc = axis_parent_positioning (a);
     
-  element->internal_set_property (sym, proc);
+  element->set_property (sym, proc);
   Axis_group_interface::add_element (me, element);
 }
 
diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc
index d74bf88..02e9001 100644
--- a/lily/axis-group-interface.cc
+++ b/lily/axis-group-interface.cc
@@ -34,10 +34,10 @@ Axis_group_interface::add_element (Grob 
       if (!e->get_parent (a))
 	e->set_parent (me, a);
 
-      e->internal_set_object ((a == X_AXIS)
-			      ? ly_symbol2scm ("axis-group-parent-X")
-			      : ly_symbol2scm ("axis-group-parent-Y"),
-			      me->self_scm ());
+      e->set_object ((a == X_AXIS)
+		     ? ly_symbol2scm ("axis-group-parent-X")
+		     : ly_symbol2scm ("axis-group-parent-Y"),
+		     me->self_scm ());
     }
 
   /* must be ordered, because Align_interface also uses
diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc
index e6a7935..461ead5 100644
--- a/lily/break-align-engraver.cc
+++ b/lily/break-align-engraver.cc
@@ -82,10 +82,7 @@ Break_align_engraver::acknowledge_break_
 	  /*
 	    Make left edge appear to come from same context as clef/bar-line etc.
 	  */
-	  left_edge_ = make_item_from_properties (random_source,
-						  ly_symbol2scm ("LeftEdge"),
-						  SCM_EOL,
-						  "LeftEdge");
+	  left_edge_ = random_source->make_item ("LeftEdge", SCM_EOL);
 	  add_to_group (left_edge_->get_property ("break-align-symbol"),
 			left_edge_);
 	}
diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc
index 0c1e996..b01f242 100644
--- a/lily/break-substitution.cc
+++ b/lily/break-substitution.cc
@@ -397,7 +397,7 @@ Spanner::fast_substitute_grob_array (SCM
       if (!unsmob_grob_array (newval))
 	{
 	  newval = Grob_array::make_array ();
-	  sc->internal_set_object (sym, newval);
+	  sc->set_object (sym, newval);
 	}
 
       Grob_array *new_array = unsmob_grob_array (newval);
@@ -500,14 +500,14 @@ Spanner::substitute_one_mutable_property
 	    if (!unsmob_grob_array (newval))
 	      {
 		newval = Grob_array::make_array ();
-		sc->internal_set_object (sym, newval);
+		sc->set_object (sym, newval);
 	      }
 	    substitute_grob_array (grob_array, unsmob_grob_array (newval));
 	  }
 	else
 	  {
 	    SCM newval = do_break_substitution (val);
-	    sc->internal_set_object (sym, newval);
+	    sc->set_object (sym, newval);
 	  }
       }
 }
diff --git a/lily/context-property.cc b/lily/context-property.cc
index 502fc92..851bbe0 100644
--- a/lily/context-property.cc
+++ b/lily/context-property.cc
@@ -118,7 +118,7 @@ execute_general_pushpop_property (Contex
 	{
 	  SCM base = updated_grob_properties (context, context_property);
 	  current_context_val = scm_cons (base, base);
-	  context->internal_set_property (context_property, current_context_val);
+	  context->set_property (context_property, current_context_val);
 	}
 
       if (!scm_is_pair (current_context_val))
@@ -180,7 +180,7 @@ execute_general_pushpop_property (Contex
       if (new_alist == daddy)
 	context->unset_property (context_property);
       else
-	context->internal_set_property (context_property, scm_cons (new_alist, daddy));
+	context->set_property (context_property, scm_cons (new_alist, daddy));
     }
 }
 
@@ -224,7 +224,7 @@ apply_property_operations (Context *tg, 
 	  execute_general_pushpop_property (tg, context_prop, grob_prop_path, val);
 	}
       else if (type == ly_symbol2scm ("assign"))
-	tg->internal_set_property (scm_car (entry), scm_cadr (entry));
+	tg->set_property (scm_car (entry), scm_cadr (entry));
     }
 }
 
@@ -274,51 +274,3 @@ updated_grob_properties (Context *tg, SC
       return copy;
     }
 }
-
-Grob *
-make_grob_from_properties (Engraver *tr, SCM symbol, SCM cause, char const *name)
-{
-  Context *context = tr->context ();
-
-  SCM props = updated_grob_properties (context, symbol);
-
-  Object_key const *key = context->get_grob_key (name);
-  Grob *grob = 0;
-
-  SCM handle = scm_sloppy_assq (ly_symbol2scm ("meta"), props);
-  SCM klass = scm_cdr (scm_sloppy_assq (ly_symbol2scm ("class"), scm_cdr (handle)));
-
-  if (klass == ly_symbol2scm ("Item"))
-    grob = new Item (props, key);
-  else if (klass == ly_symbol2scm ("Spanner"))
-    grob = new Spanner (props, key);
-  else if (klass == ly_symbol2scm ("Paper_column"))
-    grob = new Paper_column (props, key);
-
-  assert (grob);
-  dynamic_cast<Engraver *> (tr)->announce_grob (grob, cause);
-
-  return grob;
-}
-
-Item *
-make_item_from_properties (Engraver *tr, SCM x, SCM cause, char const *name)
-{
-  Item *it = dynamic_cast<Item *> (make_grob_from_properties (tr, x, cause, name));
-  assert (it);
-  return it;
-}
-
-Paper_column *
-make_paper_column_from_properties (Engraver *tr, SCM x, char const *name)
-{
-  return dynamic_cast<Paper_column *> (make_grob_from_properties (tr, x, SCM_EOL, name));
-}
-
-Spanner *
-make_spanner_from_properties (Engraver *tr, SCM x, SCM cause, char const *name)
-{
-  Spanner *sp = dynamic_cast<Spanner *> (make_grob_from_properties (tr, x, cause, name));
-  assert (sp);
-  return sp;
-}
diff --git a/lily/context-scheme.cc b/lily/context-scheme.cc
index 92240a9..9827c8b 100644
--- a/lily/context-scheme.cc
+++ b/lily/context-scheme.cc
@@ -84,7 +84,7 @@ LY_DEFINE (ly_context_set_property, "ly:
   SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
   SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol");
 
-  tr->internal_set_property (name, val);
+  tr->set_property (name, val);
 
   return SCM_UNSPECIFIED;
 }
diff --git a/lily/context.cc b/lily/context.cc
index 5211cbb..5e0c29c 100644
--- a/lily/context.cc
+++ b/lily/context.cc
@@ -238,7 +238,7 @@ Context::set_property_from_event (SCM se
       if (val != SCM_EOL)
 	ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?"));
       if (ok)
-	internal_set_property (sym, val);
+	set_property (sym, val);
     }
 }
 
@@ -444,7 +444,7 @@ Context::internal_send_stream_event (SCM
   Stream_event *e = new Stream_event (type, origin);
   for (int i = 0; props[i]; i += 2)
     {
-      e->internal_set_property (props[i], props[i+1]);
+      e->set_property (props[i], props[i+1]);
     }
   event_source_->broadcast (e);
   e->unprotect ();
@@ -469,7 +469,7 @@ Context::add_alias (SCM sym)
 }
 
 void
-Context::internal_set_property (SCM sym, SCM val)
+Context::internal_set_property (SCM sym, SCM val, char const *file, int line, char const *fun)
 {
 #ifndef NDEBUG
   if (do_internal_type_checking_global)
@@ -737,7 +737,7 @@ measure_position (Context const *context
 void
 set_context_property_on_children (Context *trans, SCM sym, SCM val)
 {
-  trans->internal_set_property (sym, ly_deep_copy (val));
+  trans->set_property (sym, ly_deep_copy (val));
   for (SCM p = trans->children_contexts (); scm_is_pair (p); p = scm_cdr (p))
     {
       Context *trg = unsmob_context (scm_car (p));
diff --git a/lily/engraver.cc b/lily/engraver.cc
index cf2eebb..2453188 100644
--- a/lily/engraver.cc
+++ b/lily/engraver.cc
@@ -9,9 +9,11 @@
 #include "engraver.hh"
 
 #include "context.hh"
+#include "international.hh"
 #include "item.hh"
 #include "lilypond-key.hh"
 #include "music.hh"
+#include "paper-column.hh"
 #include "score-engraver.hh"
 #include "spanner.hh"
 #include "stream-event.hh"
@@ -86,6 +88,78 @@ Engraver::Engraver ()
 {
 }
 
+#ifndef NDEBUG
+static SCM creation_callback = SCM_EOL;
+LY_DEFINE (ly_set_grob_creation_callback, "ly:set-grob-creation-callback",
+	   1, 0, 0, (SCM cb),
+	   "Specify a procedure that will be called every time a new grob "
+	   "is created. The callback will receive as arguments the grob "
+	   "that was created, the name of the C++ source file that caused "
+	   "the grob to be created and the corresponding line number in the "
+	   "C++ source file.")
+{
+  if (!ly_is_procedure (cb))
+    warning (_ ("not setting creation callback: not a procedure"));
+  else
+    creation_callback = cb;
+
+  return SCM_EOL;
+}
+#endif
+
+Grob *
+Engraver::internal_make_grob (SCM symbol, SCM cause, char const *name, char const *file, int line, char const *fun)
+{
+  SCM props = updated_grob_properties (context (), symbol);
+
+  Object_key const *key = context ()->get_grob_key (name);
+  Grob *grob = 0;
+
+  SCM handle = scm_sloppy_assq (ly_symbol2scm ("meta"), props);
+  SCM klass = scm_cdr (scm_sloppy_assq (ly_symbol2scm ("class"), scm_cdr (handle)));
+
+  if (klass == ly_symbol2scm ("Item"))
+    grob = new Item (props, key);
+  else if (klass == ly_symbol2scm ("Spanner"))
+    grob = new Spanner (props, key);
+  else if (klass == ly_symbol2scm ("Paper_column"))
+    grob = new Paper_column (props, key);
+
+  assert (grob);
+  announce_grob (grob, cause);
+
+#ifndef NDEBUG
+  if (ly_is_procedure (creation_callback))
+    scm_apply_0 (creation_callback,
+		 scm_list_n (grob->self_scm (), scm_makfrom0str (file),
+			     scm_from_int (line), scm_makfrom0str (fun), SCM_UNDEFINED));
+#endif
+
+  return grob;
+}
+
+Item *
+Engraver::internal_make_item (SCM x, SCM cause, char const *name, char const *file, int line, char const *fun)
+{
+  Item *it = dynamic_cast<Item *> (internal_make_grob (x, cause, name, file, line, fun));
+  assert (it);
+  return it;
+}
+
+Paper_column *
+Engraver::internal_make_column (SCM x, char const *name, char const *file, int line, char const *fun)
+{
+  return dynamic_cast<Paper_column *> (internal_make_grob (x, SCM_EOL, name, file, line, fun));
+}
+
+Spanner *
+Engraver::internal_make_spanner (SCM x, SCM cause, char const *name, char const *file, int line, char const *fun)
+{
+  Spanner *sp = dynamic_cast<Spanner *> (internal_make_grob (x, cause, name, file, line, fun));
+  assert (sp);
+  return sp;
+}
+
 #include "translator.icc"
 
 ADD_TRANSLATOR (Engraver,
diff --git a/lily/grob-closure.cc b/lily/grob-closure.cc
index 81bd393..9dddc06 100644
--- a/lily/grob-closure.cc
+++ b/lily/grob-closure.cc
@@ -37,8 +37,7 @@ add_offset_callback (Grob *g, SCM proc, 
       && !ly_is_procedure (data)
       && !is_simple_closure (data))
     {
-      g->internal_set_property (axis_offset_symbol (a),
-				proc);
+      g->set_property (axis_offset_symbol (a), proc);
       return ;
     }
 
@@ -53,8 +52,7 @@ add_offset_callback (Grob *g, SCM proc, 
     proc = ly_make_simple_closure (scm_list_1 (proc));
   
   SCM expr = scm_list_3 (plus, proc, data);
-  g->internal_set_property (axis_offset_symbol (a),
-			    ly_make_simple_closure (expr));
+  g->set_property (axis_offset_symbol (a), ly_make_simple_closure (expr));
 }
 
 
@@ -81,9 +79,9 @@ chain_offset_callback (Grob *g, SCM proc
     data = scm_from_int (0);
   
   SCM expr = scm_list_2 (proc, data);
-  g->internal_set_property (axis_offset_symbol (a),
-			    
-			    // twice: one as a wrapper for grob property routines,
-			    // once for the actual delayed binding. 
-			    ly_make_simple_closure (ly_make_simple_closure (expr)));
+  g->set_property (axis_offset_symbol (a),
+		   
+		   // twice: one as a wrapper for grob property routines,
+		   // once for the actual delayed binding. 
+		   ly_make_simple_closure (ly_make_simple_closure (expr)));
 }
diff --git a/lily/grob-property.cc b/lily/grob-property.cc
index cfa2183..9f321b8 100644
--- a/lily/grob-property.cc
+++ b/lily/grob-property.cc
@@ -11,12 +11,34 @@ #include "misc.hh"
 #include "paper-score.hh"
 #include "output-def.hh"
 #include "spanner.hh"
+#include "international.hh"
 #include "item.hh"
 #include "misc.hh"
 #include "item.hh"
 #include "program-option.hh"
 #include "profile.hh"
 #include "simple-closure.hh"
+#include "warn.hh"
+
+#ifndef NDEBUG
+static SCM modification_callback = SCM_EOL;
+
+LY_DEFINE (ly_set_grob_modification_callback, "ly:set-grob-modification-callback",
+	   1, 0, 0, (SCM cb),
+	   "Specify a procedure that will be called every time lilypond modifies "
+	   "a grob property. The callback will receive as arguments "
+	   "the grob that is being modified, the name of the C++ file in which "
+	   "the modification was requested, the line number in the C++ file in "
+	   "which the modification was requested, the property to be changed and "
+	   "the new value for the property.")
+{
+  if (!ly_is_procedure (cb))
+    warning (_ ("not setting modification callback: not a procedure"));
+  else
+    modification_callback = cb;
+  return SCM_EOL;
+}
+#endif
 
 SCM
 Grob::get_property_alist_chain (SCM def) const
@@ -31,7 +53,7 @@ Grob::get_property_alist_chain (SCM def)
 extern void check_interfaces_for_property (Grob const *me, SCM sym);
 
 void
-Grob::internal_set_property (SCM sym, SCM v)
+Grob::internal_set_property (SCM sym, SCM v, char const *file, int line, char const *fun)
 {
 #ifndef NDEBUG
   SCM grob_p = ly_lily_module_constant ("ly:grob?");
@@ -61,6 +83,16 @@ #endif
       check_interfaces_for_property (this, sym);
     }
 
+#ifndef NDEBUG
+  if (ly_is_procedure (modification_callback))
+      scm_apply_0 (modification_callback,
+		   scm_list_n (self_scm (),
+			       scm_makfrom0str (file),
+			       scm_from_int (line),
+			       scm_makfrom0str (fun),
+			       sym, v, SCM_UNDEFINED));
+#endif
+
   mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, sym, v);
 }
 
@@ -155,7 +187,7 @@ #endif
 	mutable_property_alist_ = scm_assq_remove_x (mutable_property_alist_, marker);
     }
   else
-    internal_set_property (sym, value);
+    set_property (sym, value);
 	  
   return value;
 }
@@ -171,7 +203,7 @@ Grob::internal_set_object (SCM s, SCM v)
 }
 
 void
-Grob::del_property (SCM sym)
+Grob::internal_del_property (SCM sym, char const *, int, char const *)
 {
   mutable_property_alist_ = scm_assq_remove_x (mutable_property_alist_, sym);
 }
diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc
index bca86f5..0c56e1f 100644
--- a/lily/grob-scheme.cc
+++ b/lily/grob-scheme.cc
@@ -42,7 +42,7 @@ LY_DEFINE (ly_grob_set_property_x, "ly:g
       && !type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")))
     error ("typecheck failed");
 
-  sc->internal_set_property (sym, val);
+  sc->set_property (sym, val);
   return SCM_UNSPECIFIED;
 }
 
diff --git a/lily/include/context.hh b/lily/include/context.hh
index 1a9c0c2..60909d1 100644
--- a/lily/include/context.hh
+++ b/lily/include/context.hh
@@ -87,7 +87,7 @@ public:
   /* properties:  */
   SCM internal_get_property (SCM name_sym) const;
   SCM properties_as_alist () const;
-  void internal_set_property (SCM var_sym, SCM value);
+  void internal_set_property (SCM var_sym, SCM value, char const *file, int line, char const *fun);
   Context *where_defined (SCM name_sym, SCM *value) const;
   void unset_property (SCM var_sym);
 
diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh
index 04a7623..bb2cf9d 100644
--- a/lily/include/engraver.hh
+++ b/lily/include/engraver.hh
@@ -19,6 +19,8 @@ #include "translator.hh"
 */
 class Engraver : public Translator
 {
+  Grob *internal_make_grob (SCM sym, SCM cause, char const *name,
+			    char const *f, int l, char const *fun);
 
   friend class Engraver_group;
 protected:
@@ -40,18 +42,22 @@ public:
   void announce_grob (Grob *, SCM cause);
   void announce_end_grob (Grob *, SCM cause);
 
+  Item *internal_make_item (SCM sym, SCM cause, char const *name,
+			    char const *f, int l, char const *fun);
+  Spanner *internal_make_spanner (SCM sym, SCM cause, char const *name,
+				  char const *f, int l, char const *fun);
+  Paper_column *internal_make_column (SCM sym, char const *name,
+				      char const *f, int l, char const *fun);
+
   /**
      override other ctor
   */
   TRANSLATOR_DECLARATIONS (Engraver);
 };
 
-#define make_item(x, cause) make_item_from_properties (this, ly_symbol2scm (x), cause, x)
-#define make_spanner(x, cause) make_spanner_from_properties (this, ly_symbol2scm (x), cause, x)
-#define make_paper_column(x) make_paper_column_from_properties (this, ly_symbol2scm (x), x)
-Grob *make_grob_from_properties (Engraver *tr, SCM symbol, SCM cause, char const *name);
-Item *make_item_from_properties (Engraver *tg, SCM x, SCM cause, char const *name);
-Spanner *make_spanner_from_properties (Engraver *tg, SCM x, SCM cause, char const *name);
-Paper_column *make_paper_column_from_properties (Engraver *tg, SCM x, char const *name);
+#define make_item(x, cause) internal_make_item (ly_symbol2scm (x), cause, x, __FILE__, __LINE__, __FUNCTION__)
+#define make_spanner(x, cause) internal_make_spanner (ly_symbol2scm (x), cause, x, __FILE__, __LINE__, __FUNCTION__)
+#define make_paper_column(x) internal_make_column (ly_symbol2scm (x), x, __FILE__, __LINE__, __FUNCTION__)
+
 
 #endif // ENGRAVER_HH
diff --git a/lily/include/grob.hh b/lily/include/grob.hh
index e2bc015..0300c41 100644
--- a/lily/include/grob.hh
+++ b/lily/include/grob.hh
@@ -80,8 +80,8 @@ public:
   SCM internal_get_property (SCM symbol) const;
   SCM get_property_data (SCM symbol) const;
   SCM internal_get_object (SCM symbol) const;
-  void del_property (SCM symbol); 
-  void internal_set_property (SCM sym, SCM val);
+  void internal_del_property (SCM symbol, char const *file, int line, char const *fun); 
+  void internal_set_property (SCM sym, SCM val, char const *file, int line, char const *fun);
   void internal_set_object (SCM sym, SCM val);
 
   /* messages */  
@@ -146,5 +146,4 @@ void chain_offset_callback (Grob *g, SCM
 SCM axis_offset_symbol (Axis a);
 SCM axis_parent_positioning (Axis a);
 
-
 #endif /* GROB_HH */
diff --git a/lily/include/lily-guile-macros.hh b/lily/include/lily-guile-macros.hh
index ef0db47..cebdd10 100644
--- a/lily/include/lily-guile-macros.hh
+++ b/lily/include/lily-guile-macros.hh
@@ -29,6 +29,14 @@ #endif
 
 #ifdef CACHE_SYMBOLS
 
+/* this lets us "overload" macros such as get_property to take
+   symbols as well as strings */
+inline SCM
+scm_or_str2symbol (char const *c) { return scm_str2symbol (c); }
+
+inline SCM
+scm_or_str2symbol (SCM s) { return s; }
+
 /* Using this trick we cache the value of scm_str2symbol ("fooo") where
    "fooo" is a constant string. This is done at the cost of one static
    variable per ly_symbol2scm() use, and one boolean evaluation for
@@ -43,10 +51,10 @@ #define ly_symbol2scm(x)						\
     if (__builtin_constant_p ((x)))					\
       {									\
 	if (!cached)							\
-	  value = cached = scm_gc_protect_object (scm_str2symbol ((x))); \
+	  value = cached = scm_gc_protect_object (scm_or_str2symbol (x)); \
       }									\
     else								\
-      value = scm_str2symbol ((char *) (x));				\
+      value = scm_or_str2symbol (x);					\
     value;								\
   })
 #else
@@ -150,7 +158,8 @@ #define LY_DEFINE_MEMBER_FUNCTION(CLASS,
 
 #define get_property(x) internal_get_property (ly_symbol2scm (x))
 #define get_object(x) internal_get_object (ly_symbol2scm (x))
-#define set_property(x, y) internal_set_property (ly_symbol2scm (x), y)
+#define del_property(x) internal_del_property (ly_symbol2scm (x), __FILE__, __LINE__, __FUNCTION__)
+#define set_property(x, y) internal_set_property (ly_symbol2scm (x), y, __FILE__, __LINE__, __FUNCTION__)
 #define set_object(x, y) internal_set_object (ly_symbol2scm (x), y)
 
 #endif /* LILY_GUILE_MACROS_HH */
diff --git a/lily/include/prob.hh b/lily/include/prob.hh
index 141aba4..cb0adcd 100644
--- a/lily/include/prob.hh
+++ b/lily/include/prob.hh
@@ -40,7 +40,7 @@ public:
   SCM type () const { return type_; }
   SCM get_property_alist (bool mutble) const;
   SCM internal_get_property (SCM sym) const;
-  void internal_set_property (SCM sym, SCM val);
+  void internal_set_property (SCM sym, SCM val, const char *file, int line, char const *fun);
 };
 DECLARE_UNSMOB(Prob,prob);
 SCM ly_prob_set_property_x (SCM system, SCM sym, SCM value);
diff --git a/lily/parenthesis-engraver.cc b/lily/parenthesis-engraver.cc
index 01ea191..ba2e606 100644
--- a/lily/parenthesis-engraver.cc
+++ b/lily/parenthesis-engraver.cc
@@ -40,10 +40,7 @@ Parenthesis_engraver::acknowledge_grob (
 	  if (Item *victim = dynamic_cast<Item*> (info.grob ()))
 	    {
 	      Engraver *eng = dynamic_cast<Engraver*> (info.origin_translator ());
-	      Item *paren = make_item_from_properties (eng,
-						       ly_symbol2scm ("ParenthesesItem"),
-						       victim->self_scm (),
-						       "ParenthesesItem");
+	      Item *paren = eng->make_item ("ParenthesesItem", victim->self_scm ());
 
 	      Pointer_group_interface::add_grob (paren, ly_symbol2scm ("elements"), victim);
 	      
diff --git a/lily/parser.yy b/lily/parser.yy
index 3f06738..63f38ae 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -2471,7 +2471,7 @@ void
 set_music_properties (Music *p, SCM a)
 {
   for (SCM k = a; scm_is_pair (k); k = scm_cdr (k))
- 	p->internal_set_property (scm_caar (k), scm_cdar (k));
+ 	p->set_property (scm_caar (k), scm_cdar (k));
 }
 
 
diff --git a/lily/pointer-group-interface.cc b/lily/pointer-group-interface.cc
index 1ab1d02..2d58941 100644
--- a/lily/pointer-group-interface.cc
+++ b/lily/pointer-group-interface.cc
@@ -42,7 +42,7 @@ Pointer_group_interface::get_grob_array 
     {
       scm_arr = Grob_array::make_array ();
       arr = unsmob_grob_array (scm_arr);
-      me->internal_set_object (sym, scm_arr);
+      me->set_object (sym, scm_arr);
     }
   return arr;
 }
diff --git a/lily/prob-scheme.cc b/lily/prob-scheme.cc
index ceadabd..bfa355d 100644
--- a/lily/prob-scheme.cc
+++ b/lily/prob-scheme.cc
@@ -16,7 +16,7 @@ LY_DEFINE (ly_prob_set_property_x, "ly:p
   SCM_ASSERT_TYPE (ps, obj, SCM_ARG1, __FUNCTION__, "Prob");
   SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
 
-  ps->internal_set_property (sym, value);
+  ps->set_property (sym, value);
   return SCM_UNSPECIFIED;
 }
 
@@ -70,7 +70,7 @@ LY_DEFINE (ly_make_prob, "ly:make-prob",
       SCM sym = scm_car (s);
       SCM val = scm_cadr (s);
 
-      pr->internal_set_property (sym, val);
+      pr->set_property (sym, val);
     }
   
   return pr->unprotect ();
diff --git a/lily/prob.cc b/lily/prob.cc
index 2640bdf..5d8b9b4 100644
--- a/lily/prob.cc
+++ b/lily/prob.cc
@@ -99,7 +99,7 @@ Prob::internal_get_property (SCM sym) co
 }
 
 void
-Prob::internal_set_property (SCM sym, SCM val) 
+Prob::internal_set_property (SCM sym, SCM val, char const *file, int line, char const *fun) 
 {
   if (do_internal_type_checking_global)
     type_check_assignment (sym, val);
diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc
index f16bf45..e25405b 100644
--- a/lily/script-engraver.cc
+++ b/lily/script-engraver.cc
@@ -81,7 +81,7 @@ copy_property (Grob *g, SCM sym, SCM ali
     {
       SCM entry = scm_assoc (sym, alist);
       if (scm_is_pair (entry))
-	g->internal_set_property (sym, scm_cdr (entry));
+	g->set_property (sym, scm_cdr (entry));
     }
 }
 
@@ -133,7 +133,7 @@ make_script_from_event (Grob *p,  Contex
       SCM preset = p->get_property_data (sym);
       if (val == SCM_EOL
 	  || scm_call_1 (type, preset) == SCM_BOOL_F)
-	p->internal_set_property (sym, val);
+	p->set_property (sym, val);
     }
 
   if (!priority_found)
diff --git a/lily/span-bar-engraver.cc b/lily/span-bar-engraver.cc
index 503bdf2..c46b3d1 100644
--- a/lily/span-bar-engraver.cc
+++ b/lily/span-bar-engraver.cc
@@ -65,7 +65,7 @@ Span_bar_engraver::stop_translation_time
       SCM vissym = ly_symbol2scm ("break-visibility");
       SCM vis = bars_[0]->internal_get_property (vissym);
       if (ly_is_equal (spanbar_->internal_get_property (vissym), vis))
-	spanbar_->internal_set_property (vissym, vis);
+	spanbar_->set_property (vissym, vis);
 
       spanbar_ = 0;
     }
diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc
index b03c1d2..dd21511 100644
--- a/lily/system-start-delimiter-engraver.cc
+++ b/lily/system-start-delimiter-engraver.cc
@@ -76,8 +76,7 @@ void
 Bracket_nesting_group::create_grobs (Engraver *engraver, SCM default_type)
 {
   SCM type = scm_is_symbol (symbol_) ? symbol_ : default_type;
-  delimiter_ = make_spanner_from_properties (engraver, type,
-					     SCM_EOL, ly_symbol2string (type).c_str ());
+  delimiter_ = engraver->make_spanner (ly_symbol2string (type).c_str (), SCM_EOL);
 
   for (vsize i = 0 ; i < children_.size (); i++)
     {
diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc
index fa5d9a9..68852c8 100644
--- a/lily/tuplet-bracket.cc
+++ b/lily/tuplet-bracket.cc
@@ -70,7 +70,7 @@ flatten_number_pair_property (Grob *me,
     = robust_scm2drul (me->internal_get_property (sym), zero);
   pair[xdir] = 0.0;
   
-  me->internal_set_property (sym, ly_interval2scm (pair));
+  me->set_property (sym, ly_interval2scm (pair));
 }
 
 
diff --git a/lily/tweak-engraver.cc b/lily/tweak-engraver.cc
index 9843dce..1749228 100644
--- a/lily/tweak-engraver.cc
+++ b/lily/tweak-engraver.cc
@@ -33,7 +33,7 @@ Tweak_engraver::acknowledge_grob (Grob_i
       for (SCM s = music->get_property ("tweaks");
 	   scm_is_pair (s); s = scm_cdr (s))
 	{
-	  info.grob ()->internal_set_property (scm_caar (s), scm_cdar (s));
+	  info.grob ()->set_property (scm_caar (s), scm_cdar (s));
 	}
     }
 }
diff --git a/lily/volta-repeat-iterator.cc b/lily/volta-repeat-iterator.cc
index 31f6295..1828dfd 100644
--- a/lily/volta-repeat-iterator.cc
+++ b/lily/volta-repeat-iterator.cc
@@ -69,7 +69,7 @@ Volta_repeat_iterator::add_repeat_comman
       && current_reps == SCM_EOL || scm_is_pair (current_reps))
     {
       current_reps = scm_cons (what, current_reps);
-      where->internal_set_property (reps, current_reps);
+      where->set_property (reps, current_reps);
     }
 }
 
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to