]> git.donarmstrong.com Git - lilypond.git/blob - lily/grob-smob.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / grob-smob.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2005--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "grob.hh"
21
22 #include "paper-score.hh"
23 #include "warn.hh"
24
25 #include "ly-smobs.icc"
26
27 IMPLEMENT_SMOBS (Grob);
28 IMPLEMENT_DEFAULT_EQUAL_P (Grob);
29 IMPLEMENT_TYPE_P (Grob, "ly:grob?");
30
31 SCM
32 Grob::mark_smob (SCM ses)
33 {
34   ASSERT_LIVE_IS_ALLOWED (ses);
35
36   Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
37   scm_gc_mark (s->immutable_property_alist_);
38
39   /* Do not mark the parents.  The pointers in the mutable
40      property list form two tree like structures (one for X
41      relations, one for Y relations).  Marking these can be done
42      in limited stack space.  If we add the parents, we will jump
43      between X and Y in an erratic manner, leading to much more
44      recursion depth (and core dumps if we link to pthreads).  */
45
46   if (s->original ())
47     scm_gc_mark (s->original ()->self_scm ());
48
49   s->derived_mark ();
50   scm_gc_mark (s->object_alist_);
51   scm_gc_mark (s->interfaces_);
52
53   return s->mutable_property_alist_;
54 }
55
56 int
57 Grob::print_smob (SCM s, SCM port, scm_print_state *)
58 {
59   Grob *sc = (Grob *) SCM_CELL_WORD_1 (s);
60
61   scm_puts ("#<Grob ", port);
62   scm_puts ((char *) sc->name ().c_str (), port);
63
64   /* Do not print properties, that is too much hassle.  */
65   scm_puts (" >", port);
66   return 1;
67 }
68
69 void
70 Grob::derived_mark () const
71 {
72 }