+ return smob;
+}
+
+
+
+/****************************************************
+ SMOB funcs
+ ****************************************************/
+
+
+IMPLEMENT_UNSMOB(Score_element, element);
+IMPLEMENT_SMOBS(Score_element);
+IMPLEMENT_DEFAULT_EQUAL_P(Score_element);
+
+SCM
+Score_element::mark_smob (SCM ses)
+{
+ Score_element * s = (Score_element*) SCM_CELL_WORD_1(ses);
+ scm_gc_mark (s->immutable_property_alist_);
+ scm_gc_mark (s->mutable_property_alist_);
+ scm_gc_mark (s->dim_cache_[X_AXIS].offset_callbacks_);
+ scm_gc_mark (s->dim_cache_[Y_AXIS].offset_callbacks_);
+
+ if (s->parent_l (Y_AXIS))
+ scm_gc_mark (s->parent_l (Y_AXIS)->self_scm ());
+ if (s->parent_l (X_AXIS))
+ scm_gc_mark (s->parent_l (X_AXIS)->self_scm ());
+
+ if (s->original_l_)
+ scm_gc_mark (s->original_l_->self_scm ());
+ return s->do_derived_mark ();
+}
+
+int
+Score_element::print_smob (SCM s, SCM port, scm_print_state *)
+{
+ Score_element *sc = (Score_element *) gh_cdr (s);
+
+ scm_puts ("#<Score_element ", port);
+ scm_puts ((char *)sc->name ().ch_C(), port);
+
+ /*
+ don't try to print properties, that is too much hassle.
+ */
+ scm_puts (" >", port);
+ return 1;
+}
+
+SCM
+Score_element::do_derived_mark ()
+{
+ return SCM_EOL;
+}
+
+
+SCM
+ly_set_elt_property (SCM elt, SCM sym, SCM val)
+{
+ Score_element * sc = unsmob_element (elt);
+
+ if (!gh_symbol_p (sym))
+ {
+ error ("Not a symbol");
+ ly_display_scm (sym);
+ return SCM_UNSPECIFIED;
+ }
+
+ if (sc)
+ {
+ sc->set_elt_property (sym, val);
+ }
+ else
+ {
+ error ("Not a score element");
+ ly_display_scm (elt);
+ }
+
+ return SCM_UNSPECIFIED;
+}
+
+
+SCM
+ly_get_elt_property (SCM elt, SCM sym)
+{
+ Score_element * sc = unsmob_element (elt);
+
+ if (sc)
+ {
+ return sc->get_elt_property (sym);
+ }
+ else
+ {
+ error ("Not a score element");
+ ly_display_scm (elt);
+ }
+ return SCM_UNSPECIFIED;
+}
+
+
+void
+Score_element::discretionary_processing()
+{
+}
+
+
+
+SCM
+spanner_get_bound (SCM slur, SCM dir)
+{
+ return dynamic_cast<Spanner*> (unsmob_element (slur))->get_bound (to_dir (dir))->self_scm ();
+}
+
+
+
+static SCM interfaces_sym;
+static void
+init_functions ()
+{
+ interfaces_sym = scm_permanent_object (ly_symbol2scm ("interfaces"));
+
+ scm_make_gsubr ("ly-get-elt-property", 2, 0, 0, (Scheme_function_unknown)ly_get_elt_property);
+ scm_make_gsubr ("ly-set-elt-property", 3, 0, 0, (Scheme_function_unknown)ly_set_elt_property);
+ scm_make_gsubr ("ly-get-spanner-bound", 2 , 0, 0, (Scheme_function_unknown) spanner_get_bound);
+}
+
+bool
+Score_element::has_interface (SCM k)
+{
+ // if (mutable_property_alist_ == SCM_EOL)
+ // return false;
+
+ SCM ifs = get_elt_property (interfaces_sym);
+
+ return scm_memq (k, ifs) != SCM_BOOL_F;
+}
+
+void
+Score_element::set_interface (SCM k)
+{
+ if (has_interface (k))
+ return ;
+ else
+ {
+ set_elt_property (interfaces_sym,
+ gh_cons (k, get_elt_property (interfaces_sym)));
+ }