(all-grob-descriptions): remove gap from
[lilypond.git] / lily / protected-scm.cc
blob93b29a48d4a8648d57bf2beb46f754ae9906ea94
1 /*
2 protected-scm.cc -- implement Protected_scm
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
9 #include "protected-scm.hh"
10 #include "lily-guile.hh"
12 Protected_scm::Protected_scm ()
14 object_ = SCM_UNDEFINED;
17 Protected_scm::Protected_scm (SCM s)
19 object_ = SCM_NIMP (s) ? scm_gc_protect_object (s): s;
22 Protected_scm::Protected_scm (Protected_scm const &s)
24 object_ = SCM_NIMP (s.object_) ? scm_gc_protect_object (s.object_) : s.object_;
27 Protected_scm &
28 Protected_scm::operator = (SCM s)
30 if (object_ == s)
31 return *this;
33 if (SCM_NIMP (object_))
34 scm_gc_unprotect_object (object_);
36 object_ = SCM_NIMP (s) ? scm_gc_protect_object (s): s;
37 return *this;
40 Protected_scm&
41 Protected_scm::operator = (Protected_scm const &s)
43 return operator= (s.object_);
47 Protected_scm::~Protected_scm ()
49 if (SCM_NIMP (object_))
51 scm_gc_unprotect_object (object_);
55 Protected_scm::operator SCM () const
57 return object_;
60 SCM
61 Protected_scm::to_SCM () const
63 return object_;