2 protected-scm.cc -- implement Protected_scm
4 source file of the GNU LilyPond music typesetter
6 (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "protected-scm.hh"
12 #include <libguile/gc.h>
16 Protected_scm::Protected_scm ()
21 Protected_scm::Protected_scm (SCM s)
23 object_ = s ? scm_protect_object (s): 0;
26 Protected_scm::Protected_scm (Protected_scm const &s)
28 object_ = s.object_ ? scm_protect_object (s.object_) : 0;
32 Protected_scm::operator =(Protected_scm const &s)
37 scm_unprotect_object(object_);
39 object_ = (s.object_) ? scm_protect_object (s.object_): 0;
43 Protected_scm::~Protected_scm ()
47 scm_unprotect_object (object_);
48 object_ =0L; // be nice to conservative GC
52 Protected_scm::operator SCM () const
58 Protected_scm::to_SCM () const