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>
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_
)
28 Protected_scm::~Protected_scm ()
30 if (SCM_NIMP (object_
))
31 scm_gc_unprotect_object (object_
);
35 Protected_scm::operator = (SCM s
)
40 if (SCM_NIMP (object_
))
41 scm_gc_unprotect_object (object_
);
43 object_
= SCM_NIMP (s
) ? scm_gc_protect_object (s
) : s
;
48 Protected_scm::operator = (Protected_scm
const &s
)
50 return operator= (s
.object_
);
53 Protected_scm::operator SCM () const
59 Protected_scm::to_SCM () const