]> git.donarmstrong.com Git - lilypond.git/blob - lily/grob-smob.cc
(parse_symbol_list): Bugfix.
[lilypond.git] / lily / grob-smob.cc
1 /*
2   grob-smob.cc -- implement GROB smob routines.
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "grob.hh"
10
11 #include "paper-score.hh"
12
13 #include "ly-smobs.icc"
14
15 IMPLEMENT_SMOBS (Grob);
16 IMPLEMENT_DEFAULT_EQUAL_P (Grob);
17 IMPLEMENT_TYPE_P (Grob, "ly:grob?");
18
19 SCM
20 Grob::mark_smob (SCM ses)
21 {
22   Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
23   scm_gc_mark (s->immutable_property_alist_);
24
25   if (s->key_)
26     scm_gc_mark (s->key_->self_scm ());
27   for (int a = 0; a < 2; a++)
28     {
29       scm_gc_mark (s->dim_cache_[a].offset_callbacks_);
30       scm_gc_mark (s->dim_cache_[a].dimension_);
31       scm_gc_mark (s->dim_cache_[a].dimension_callback_);
32
33       /* Do not mark the parents.  The pointers in the mutable
34          property list form two tree like structures (one for X
35          relations, one for Y relations).  Marking these can be done
36          in limited stack space.  If we add the parents, we will jump
37          between X and Y in an erratic manner, leading to much more
38          recursion depth (and core dumps if we link to pthreads).  */
39     }
40
41   if (s->original_)
42     scm_gc_mark (s->original_->self_scm ());
43
44   s->derived_mark ();
45   scm_gc_mark (s->object_alist_);
46   scm_gc_mark (s->interfaces_);
47
48   return s->mutable_property_alist_;
49 }
50
51 int
52 Grob::print_smob (SCM s, SCM port, scm_print_state *)
53 {
54   Grob *sc = (Grob *) SCM_CELL_WORD_1 (s);
55
56   scm_puts ("#<Grob ", port);
57   scm_puts ((char *) sc->name ().to_str0 (), port);
58
59   /* Do not print properties, that is too much hassle.  */
60   scm_puts (" >", port);
61   return 1;
62 }
63
64 void
65 Grob::derived_mark () const
66 {
67 }