Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / lily / protected-scm.cc
blob4447371a8318336d909cb4e10cc59e518423cf5a
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1998--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
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.
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.
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/>.
20 #include "protected-scm.hh"
22 Protected_scm::Protected_scm ()
24 object_ = SCM_UNDEFINED;
27 Protected_scm::Protected_scm (SCM s)
29 object_ = SCM_NIMP (s) ? scm_gc_protect_object (s) : s;
32 Protected_scm::Protected_scm (Protected_scm const &s)
34 object_ = (SCM_NIMP (s.object_) ? scm_gc_protect_object (s.object_)
35 : s.object_);
38 Protected_scm::~Protected_scm ()
40 if (SCM_NIMP (object_))
41 scm_gc_unprotect_object (object_);
44 Protected_scm &
45 Protected_scm::operator = (SCM s)
47 if (object_ == s)
48 return *this;
50 if (SCM_NIMP (object_))
51 scm_gc_unprotect_object (object_);
53 object_ = SCM_NIMP (s) ? scm_gc_protect_object (s) : s;
54 return *this;
57 Protected_scm &
58 Protected_scm::operator = (Protected_scm const &s)
60 return operator = (s.object_);
63 Protected_scm::operator SCM () const
65 return object_;
68 SCM
69 Protected_scm::to_SCM () const
71 return object_;