2 Implement storage and manipulation of grob properties.
9 #include "input-smob.hh"
10 #include "group-interface.hh"
12 #include "paper-score.hh"
13 #include "output-def.hh"
20 Grob::get_property_alist_chain (SCM def
) const
22 return scm_list_n (mutable_property_alist_
,
23 immutable_property_alist_
,
29 This special add_thing routine is slightly more efficient than
31 set_prop (name, cons (thing, get_prop (name)))
33 since it can reuse the handle returned by scm_assq ().
36 Grob::add_to_list_property (SCM sym
, SCM thing
)
39 = scm_sloppy_assq (sym
, mutable_property_alist_
);
41 if (handle
!= SCM_BOOL_F
)
43 scm_set_cdr_x (handle
, scm_cons (thing
, scm_cdr (handle
)));
48 There is no mutable prop yet, so create an entry, and put it in front of the
51 handle
= scm_sloppy_assq (sym
, immutable_property_alist_
);
52 SCM tail
= (handle
!= SCM_BOOL_F
) ? scm_cdr (handle
) : SCM_EOL
;
53 SCM val
= scm_cons (thing
, tail
);
55 mutable_property_alist_
= scm_cons (scm_cons (sym
, val
),
56 mutable_property_alist_
);
60 extern void check_interfaces_for_property (Grob
const *me
, SCM sym
);
63 Grob::internal_set_property (SCM s
, SCM v
)
65 /* Perhaps we simply do the assq_set, but what the heck. */
69 if (do_internal_type_checking_global
)
71 if (!type_check_assignment (s
, v
, ly_symbol2scm ("backend-type?")))
73 check_interfaces_for_property (this, s
);
76 mutable_property_alist_
= scm_assq_set_x (mutable_property_alist_
, s
, v
);
80 Grob::internal_get_property (SCM sym
) const
82 SCM s
= scm_sloppy_assq (sym
, mutable_property_alist_
);
86 s
= scm_sloppy_assq (sym
, immutable_property_alist_
);
88 if (do_internal_type_checking_global
&& scm_is_pair (s
))
90 if (!type_check_assignment (sym
, scm_cdr (s
),
91 ly_symbol2scm ("backend-type?")))
94 check_interfaces_for_property (this, sym
);
97 return (s
== SCM_BOOL_F
) ? SCM_EOL
: scm_cdr (s
);
101 Grob::substitute_mutable_properties (SCM crit
, SCM orig
)
103 set_break_subsititution (crit
);
104 mutable_property_alist_
= substitute_mutable_property_alist (orig
);
108 Grob::is_live () const
110 return immutable_property_alist_
!= SCM_EOL
;