2 Implement storage and manipulation of grob properties.
9 #include "input-smob.hh"
11 #include "group-interface.hh"
13 #include "paper-score.hh"
14 #include "paper-def.hh"
25 Grob::get_property_alist_chain (SCM def) const
27 return scm_list_n (mutable_property_alist_,
28 immutable_property_alist_,
36 This special add_thing routine is slightly more efficient than
38 set_prop (name,cons (thing, get_prop (name)))
40 since it can reuse the handle returned by scm_assq().
43 Grob::add_to_list_property (SCM sym, SCM thing)
46 = scm_sloppy_assq (sym, mutable_property_alist_)
49 if (handle != SCM_BOOL_F)
51 gh_set_cdr_x (handle, gh_cons (thing, gh_cdr (handle)));
56 There is no mutable prop yet, so create an entry, and put it in front of the
59 handle = scm_sloppy_assq (sym, immutable_property_alist_);
60 SCM tail = (handle != SCM_BOOL_F) ? gh_cdr(handle) : SCM_EOL;
61 SCM val = gh_cons (thing, tail);
63 mutable_property_alist_ = gh_cons (gh_cons (sym, val),
64 mutable_property_alist_);
69 extern void check_interfaces_for_property (Grob const *me, SCM sym);
72 Grob::internal_set_grob_property (SCM s, SCM v)
74 /* Perhaps we simply do the assq_set, but what the heck. */
78 if (internal_type_checking_global_b)
80 if (type_check_assignment (s, v, ly_symbol2scm ("backend-type?")))
82 check_interfaces_for_property (this, s);
85 mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v);
90 Grob::internal_get_grob_property (SCM sym) const
92 SCM s = scm_sloppy_assq (sym, mutable_property_alist_);
96 s = scm_sloppy_assq (sym, immutable_property_alist_);
98 if (internal_type_checking_global_b && gh_pair_p (s))
100 if (!type_check_assignment (sym, gh_cdr (s),
101 ly_symbol2scm ("backend-type?")))
103 check_interfaces_for_property (this, sym);
106 return (s == SCM_BOOL_F) ? SCM_EOL : ly_cdr (s);
110 Grob::substitute_mutable_properties (SCM crit, SCM orig)
112 set_break_subsititution(crit);
113 mutable_property_alist_ = substitute_mutable_property_alist (orig);
120 return immutable_property_alist_ != SCM_EOL;