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"
22 Grob::get_property_alist_chain (SCM def) const
24 return scm_list_n (mutable_property_alist_,
25 immutable_property_alist_,
33 This special add_thing routine is slightly more efficient than
35 set_prop (name,cons (thing, get_prop (name)))
37 since it can reuse the handle returned by scm_assq ().
40 Grob::add_to_list_property (SCM sym, SCM thing)
43 = scm_sloppy_assq (sym, mutable_property_alist_)
46 if (handle != SCM_BOOL_F)
48 scm_set_cdr_x (handle, scm_cons (thing, scm_cdr (handle)));
53 There is no mutable prop yet, so create an entry, and put it in front of the
56 handle = scm_sloppy_assq (sym, immutable_property_alist_);
57 SCM tail = (handle != SCM_BOOL_F) ? scm_cdr (handle) : SCM_EOL;
58 SCM val = scm_cons (thing, tail);
60 mutable_property_alist_ = scm_cons (scm_cons (sym, val),
61 mutable_property_alist_);
66 extern void check_interfaces_for_property (Grob const *me, SCM sym);
69 Grob::internal_set_property (SCM s, SCM v)
71 /* Perhaps we simply do the assq_set, but what the heck. */
75 if (internal_type_checking_global_b)
77 if (!type_check_assignment (s, v, ly_symbol2scm ("backend-type?")))
79 check_interfaces_for_property (this, s);
82 mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v);
87 Grob::internal_get_property (SCM sym) const
89 SCM s = scm_sloppy_assq (sym, mutable_property_alist_);
93 s = scm_sloppy_assq (sym, immutable_property_alist_);
95 if (internal_type_checking_global_b && scm_is_pair (s))
97 if (!type_check_assignment (sym, scm_cdr (s),
98 ly_symbol2scm ("backend-type?")))
101 check_interfaces_for_property (this, sym);
104 return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s);
108 Grob::substitute_mutable_properties (SCM crit, SCM orig)
110 set_break_subsititution (crit);
111 mutable_property_alist_ = substitute_mutable_property_alist (orig);
116 Grob::is_live () const
118 return immutable_property_alist_ != SCM_EOL;