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"
21 Grob::get_property_alist_chain (SCM def) const
23 return scm_list_n (mutable_property_alist_,
24 immutable_property_alist_,
32 This special add_thing routine is slightly more efficient than
34 set_prop (name,cons (thing, get_prop (name)))
36 since it can reuse the handle returned by scm_assq ().
39 Grob::add_to_list_property (SCM sym, SCM thing)
42 = scm_sloppy_assq (sym, mutable_property_alist_)
45 if (handle != SCM_BOOL_F)
47 scm_set_cdr_x (handle, scm_cons (thing, scm_cdr (handle)));
52 There is no mutable prop yet, so create an entry, and put it in front of the
55 handle = scm_sloppy_assq (sym, immutable_property_alist_);
56 SCM tail = (handle != SCM_BOOL_F) ? scm_cdr (handle) : SCM_EOL;
57 SCM val = scm_cons (thing, tail);
59 mutable_property_alist_ = scm_cons (scm_cons (sym, val),
60 mutable_property_alist_);
65 extern void check_interfaces_for_property (Grob const *me, SCM sym);
68 Grob::internal_set_property (SCM s, SCM v)
70 /* Perhaps we simply do the assq_set, but what the heck. */
74 if (do_internal_type_checking_global)
76 if (!type_check_assignment (s, v, ly_symbol2scm ("backend-type?")))
78 check_interfaces_for_property (this, s);
81 mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v);
86 Grob::internal_get_property (SCM sym) const
88 SCM s = scm_sloppy_assq (sym, mutable_property_alist_);
92 s = scm_sloppy_assq (sym, immutable_property_alist_);
94 if (do_internal_type_checking_global && scm_is_pair (s))
96 if (!type_check_assignment (sym, scm_cdr (s),
97 ly_symbol2scm ("backend-type?")))
100 check_interfaces_for_property (this, sym);
103 return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s);
107 Grob::substitute_mutable_properties (SCM crit, SCM orig)
109 set_break_subsititution (crit);
110 mutable_property_alist_ = substitute_mutable_property_alist (orig);
115 Grob::is_live () const
117 return immutable_property_alist_ != SCM_EOL;