source file of the GNU LilyPond music typesetter
- (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#ifndef LY_SMOBS_ICC
#define LY_SMOBS_ICC
+#define IMPLEMENT_UNSMOB(CL, name) \
+CL * \
+unsmob_ ## name ( SCM s) \
+{ \
+ if (SMOB_IS_TYPE_B(CL, s)) \
+ return SMOB_TO_TYPE(CL, s); \
+ else \
+ return 0; \
+}\
+SCM smobify (CL *cl)\
+{\
+ SCM s; \
+ \
+ SCM_NEWCELL(s); \
+ SCM_SETCAR(s,CL::smob_tag_); \
+ void * me_p = cl; \
+ SCM_SETCDR(s,me_p); \
+return s;\
+}\
+
+
+
#define IMPLEMENT_SMOBS(CL)\
long CL::smob_tag_;\
static scm_smobfuns CL ## _funs = { \
This is local. We don't assign to self_scm_ directly, to assure \
that S isn't GC-ed from under us. \
*/ \
- SCM s; \
- \
- SCM_NEWCELL(s); \
+ SCM s = smobify (this); \
self_scm_ = s; \
- \
- SCM_SETCAR(s,smob_tag_); \
- void * me_p = this; \
- SCM_SETCDR(s,me_p); \
scm_protect_object (s); \
\
/* no scm_done_malloc() ! */ \