2 grob-smob.cc -- implement GROB smob routines.
4 source file of the GNU LilyPond music typesetter
6 (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
13 #include "paper-score.hh"
15 #include "ly-smobs.icc"
17 IMPLEMENT_SMOBS (Grob);
18 IMPLEMENT_DEFAULT_EQUAL_P (Grob);
19 IMPLEMENT_TYPE_P (Grob, "ly:grob?");
22 Grob::mark_smob (SCM ses)
24 Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
25 scm_gc_mark (s->immutable_property_alist_);
28 scm_gc_mark (s->key_->self_scm ());
29 for (int a = 0; a < 2; a++)
31 scm_gc_mark (s->dim_cache_[a].offset_callbacks_);
32 scm_gc_mark (s->dim_cache_[a].dimension_);
33 scm_gc_mark (s->dim_cache_[a].dimension_callback_);
35 /* Do not mark the parents. The pointers in the mutable
36 property list form two tree like structures (one for X
37 relations, one for Y relations). Marking these can be done
38 in limited stack space. If we add the parents, we will jump
39 between X and Y in an erratic manner, leading to much more
40 recursion depth (and core dumps if we link to pthreads). */
44 scm_gc_mark (s->original_->self_scm ());
47 scm_gc_mark (s->pscore_->self_scm ());
50 scm_gc_mark (s->object_alist_);
51 scm_gc_mark (s->interfaces_);
53 return s->mutable_property_alist_;
57 Grob::print_smob (SCM s, SCM port, scm_print_state *)
59 Grob *sc = (Grob *) SCM_CELL_WORD_1 (s);
61 scm_puts ("#<Grob ", port);
62 scm_puts ((char *) sc->name ().to_str0 (), port);
64 /* Do not print properties, that is too much hassle. */
65 scm_puts (" >", port);
70 Grob::derived_mark () const