2 protected-scm.cc -- implement Protected_scm
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
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_)
27 Protected_scm::~Protected_scm ()
29 if (SCM_NIMP (object_))
30 scm_gc_unprotect_object (object_);
34 Protected_scm::operator = (SCM s)
39 if (SCM_NIMP (object_))
40 scm_gc_unprotect_object (object_);
42 object_ = SCM_NIMP (s) ? scm_gc_protect_object (s) : s;
47 Protected_scm::operator = (Protected_scm const &s)
49 return operator = (s.object_);
52 Protected_scm::operator SCM () const
58 Protected_scm::to_SCM () const