X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgroup-interface.cc;h=c7991793faece177e63b7fea8fe6161dfd9c5dac;hb=c896840a71d1e5e644d4258fe70e986d0cb5ec0a;hp=b82807d5b23f8f8d1067ecf113aac85220d8632e;hpb=5175fb07679b964a62202f6c900451e88d120f69;p=lilypond.git diff --git a/lily/group-interface.cc b/lily/group-interface.cc index b82807d5b2..c7991793fa 100644 --- a/lily/group-interface.cc +++ b/lily/group-interface.cc @@ -3,57 +3,58 @@ source file of the GNU LilyPond music typesetter - (c) 1999--2000 Han-Wen Nienhuys + (c) 1999--2002 Han-Wen Nienhuys */ #include "group-interface.hh" -#include "score-element.hh" +#include "grob.hh" + /* - ugh: clean me, junk elt_l_ field - */ -Group_interface::Group_interface (Score_element * e) -{ - elt_l_ = (Score_element*)e; - name_ = "elements"; -} + This special add_thing routine is slightly more efficient than + set_prop (name,cons (thing, get_prop (name))) -Group_interface::Group_interface (Score_element *e, String s) -{ - elt_l_ =(Score_element*)e; - name_ = s; -} -bool -Group_interface::has_interface () -{ - SCM el = elt_l_->get_elt_property (name_.ch_C()); + since it can reuse the handle returned by scm_assq(). +*/ - return el == SCM_EOL || gh_pair_p (el); +void +Group_interface::add_thing (Grob*me, SCM sym, SCM thing) +{ + SCM handle = scm_sloppy_assq (sym, me->mutable_property_alist_); + if (handle != SCM_BOOL_F) + { + gh_set_cdr_x (handle, gh_cons (thing, gh_cdr (handle))); + + } + else + { + /* + There is no mutable prop yet, so create an entry, and put it in front of the + mutable prop list. + */ + handle = scm_sloppy_assq (sym, me->immutable_property_alist_); + SCM tail = (handle != SCM_BOOL_F) ? gh_cdr(handle) : SCM_EOL; + me->mutable_property_alist_ = gh_cons (gh_cons (sym, gh_cons (thing, tail)), + me->mutable_property_alist_); + } } - - void -Group_interface::add_thing (SCM s) +Group_interface::add_thing (Grob*me, String name, SCM thing) { - elt_l_->set_elt_property (name_.ch_C (), - gh_cons (s, elt_l_->get_elt_property (name_.ch_C()))); + add_thing (me, ly_symbol2scm (name.ch_C()), thing); } - int -Group_interface::count () +Group_interface::count (Grob *me, String name) { - return scm_ilength (elt_l_->get_elt_property (name_.ch_C())); + return scm_ilength (me->get_grob_property (name.ch_C ())); } + void -Group_interface::set_interface () +Pointer_group_interface::add_grob (Grob*me, SCM name, Grob*p) { - if (!has_interface ()) - { - - } + Group_interface::add_thing (me, name, p->self_scm ()); } -