Merge branch 'fret-diagram-details'
[lilypond/csorensen.git] / lily / grob-smob.cc
blob730faa780eafe2f6676a44b276f664db9a390a8f
1 /*
2 grob-smob.cc -- implement GROB smob routines.
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "grob.hh"
11 #include "paper-score.hh"
12 #include "warn.hh"
14 #include "ly-smobs.icc"
16 IMPLEMENT_SMOBS (Grob);
17 IMPLEMENT_DEFAULT_EQUAL_P (Grob);
18 IMPLEMENT_TYPE_P (Grob, "ly:grob?");
20 SCM
21 Grob::mark_smob (SCM ses)
23 ASSERT_LIVE_IS_ALLOWED ();
25 Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
26 scm_gc_mark (s->immutable_property_alist_);
28 /* Do not mark the parents. The pointers in the mutable
29 property list form two tree like structures (one for X
30 relations, one for Y relations). Marking these can be done
31 in limited stack space. If we add the parents, we will jump
32 between X and Y in an erratic manner, leading to much more
33 recursion depth (and core dumps if we link to pthreads). */
35 if (s->original ())
36 scm_gc_mark (s->original ()->self_scm ());
38 s->derived_mark ();
39 scm_gc_mark (s->object_alist_);
40 scm_gc_mark (s->interfaces_);
42 return s->mutable_property_alist_;
45 int
46 Grob::print_smob (SCM s, SCM port, scm_print_state *)
48 Grob *sc = (Grob *) SCM_CELL_WORD_1 (s);
50 scm_puts ("#<Grob ", port);
51 scm_puts ((char *) sc->name ().c_str (), port);
53 /* Do not print properties, that is too much hassle. */
54 scm_puts (" >", port);
55 return 1;
58 void
59 Grob::derived_mark () const