2 group-interface.cc -- implement Group_interface
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "group-interface.hh"
14 This special add_thing routine is slightly more efficient than
16 set_prop (name,cons (thing, get_prop (name)))
18 since it can reuse the handle returned by scm_assq().
22 Group_interface::add_thing (Grob*me, SCM sym, SCM thing)
24 SCM handle = scm_sloppy_assq (sym, me->mutable_property_alist_);
25 if (handle != SCM_BOOL_F)
27 gh_set_cdr_x (handle, gh_cons (thing, gh_cdr (handle)));
33 There is no mutable prop yet, so create an entry, and put it in front of the
36 handle = scm_sloppy_assq (sym, me->immutable_property_alist_);
37 SCM tail = (handle != SCM_BOOL_F) ? gh_cdr(handle) : SCM_EOL;
38 me->mutable_property_alist_ = gh_cons (gh_cons (sym, gh_cons (thing, tail)),
39 me->mutable_property_alist_);
44 Group_interface::add_thing (Grob*me, String name, SCM thing)
46 add_thing (me, ly_symbol2scm (name.ch_C()), thing);
50 Group_interface::count (Grob *me, String name)
52 return scm_ilength (me->get_grob_property (name.ch_C ()));
57 Pointer_group_interface::add_element (Grob*me, SCM name, Grob*p)
59 Group_interface::add_thing (me, name, p->self_scm ());