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