2 ly-smobs.icc -- implement smob glue.
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
13 #define IMPLEMENT_SMOBS(CL)\
15 static scm_smobfuns CL ## _funs = { \
16 CL::mark_smob, CL::free_smob, \
22 smob_tag_ = scm_newsmob (&CL ## _funs); \
27 CL::unsmobify_self () \
30 scm_unprotect_object (s); \
32 SCM_CAR(self_scm_) = SCM_EOL; \
33 SCM_CDR(self_scm_) = SCM_EOL; \
34 self_scm_ = SCM_EOL; \
40 if (self_scm_ != SCM_EOL) \
44 This is local. We don't assign to self_scm_ directly, to assure \
45 that S isn't GC-ed from under us. \
52 SCM_SETCAR(s,smob_tag_); \
55 scm_protect_object (s); \
61 CL::free_smob (SCM ses) \
63 CL * s = (CL*) SCM_CDR(ses); \
64 /* someone else did the deed already; this might be an automatic var.*/ \
65 if (s->self_scm_ != ses)\
67 SCM_CAR(ses) = SCM_EOL;\
71 ADD_SCM_INIT_FUNC(CL, CL::init_smobs)\
74 #endif /* LY_SMOBS_ICC */