* lily/ledger-line-engraver.cc: new file.
[lilypond.git] / lily / protected-scm.cc
blob56bd2def2fef8f6a190510208cef89b45eb2baf1
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_)
25 : s.object_);
28 Protected_scm::~Protected_scm ()
30 if (SCM_NIMP (object_))
31 scm_gc_unprotect_object (object_);
34 Protected_scm &
35 Protected_scm::operator = (SCM s)
37 if (object_ == s)
38 return *this;
40 if (SCM_NIMP (object_))
41 scm_gc_unprotect_object (object_);
43 object_ = SCM_NIMP (s) ? scm_gc_protect_object (s) : s;
44 return *this;
47 Protected_scm&
48 Protected_scm::operator = (Protected_scm const &s)
50 return operator= (s.object_);
53 Protected_scm::operator SCM () const
55 return object_;
58 SCM
59 Protected_scm::to_SCM () const
61 return object_;