Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / lily / protected-scm.cc
blob3a8b19a9d07397e90ca998c990f416054e5600ad
1 /*
2 protected-scm.cc -- implement Protected_scm
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "protected-scm.hh"
11 Protected_scm::Protected_scm ()
13 object_ = SCM_UNDEFINED;
16 Protected_scm::Protected_scm (SCM s)
18 object_ = SCM_NIMP (s) ? scm_gc_protect_object (s) : s;
21 Protected_scm::Protected_scm (Protected_scm const &s)
23 object_ = (SCM_NIMP (s.object_) ? scm_gc_protect_object (s.object_)
24 : s.object_);
27 Protected_scm::~Protected_scm ()
29 if (SCM_NIMP (object_))
30 scm_gc_unprotect_object (object_);
33 Protected_scm &
34 Protected_scm::operator = (SCM s)
36 if (object_ == s)
37 return *this;
39 if (SCM_NIMP (object_))
40 scm_gc_unprotect_object (object_);
42 object_ = SCM_NIMP (s) ? scm_gc_protect_object (s) : s;
43 return *this;
46 Protected_scm &
47 Protected_scm::operator = (Protected_scm const &s)
49 return operator = (s.object_);
52 Protected_scm::operator SCM () const
54 return object_;
57 SCM
58 Protected_scm::to_SCM () const
60 return object_;