+Engraver::Engraver (Context *c)
+ : Translator (c)
+{
+}
+
+#ifdef DEBUG
+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.")
+{
+ LY_ASSERT_TYPE (ly_is_procedure, cb, 1);
+
+ creation_callback = cb;
+
+ return SCM_UNSPECIFIED;
+}
+#endif
+
+Grob *
+Engraver::internal_make_grob (SCM symbol,
+ SCM cause,
+ char const *file,
+ int line,
+ char const *fun)
+{
+#ifndef DEBUG
+ (void)file;
+ (void)line;
+ (void)fun;
+#endif
+
+ SCM props = Grob_property_info (context (), symbol).updated ();
+
+ 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 (scm_is_eq (klass, ly_symbol2scm ("Item")))
+ grob = new Item (props);
+ else if (scm_is_eq (klass, ly_symbol2scm ("Spanner")))
+ grob = new Spanner (props);
+ else if (scm_is_eq (klass, ly_symbol2scm ("Paper_column")))
+ grob = new Paper_column (props);
+
+ assert (grob);
+ announce_grob (grob, cause);
+
+#ifdef DEBUG
+ if (ly_is_procedure (creation_callback))
+ scm_call_4 (creation_callback,
+ grob->self_scm (), scm_from_utf8_string (file),
+ scm_from_int (line), scm_from_ascii_string (fun));
+#endif
+
+ return grob;