+ void \
+ CL::init_smobs () \
+ { \
+ smob_tag_ = scm_make_smob_type (#CL, 0); \
+ scm_set_smob_mark (smob_tag_, CL::mark_smob); \
+ scm_set_smob_free (smob_tag_, CL::free_smob); \
+ scm_set_smob_print (smob_tag_, CL::print_smob); \
+ scm_set_smob_equalp (smob_tag_, CL::equal_p); \
+ } \
+ \
+ size_t \
+ CL::free_smob (SCM ses) \
+ { \
+ CL *s = (CL *) SCM_CELL_WORD_1 (ses); \
+ delete s; \
+ /* scm_gc_unregister_collectable_memory (s, sizeof (CL), #CL " smob"); */ \
+ return SMOB_FREE_RETURN_VAL (CL); \
+ } \
+ \
+ ADD_SCM_INIT_FUNC (CL, CL::init_smobs)
+
+#define IMPLEMENT_SIMPLE_SMOBS(CL) \
+ IMPLEMENT_BASE_SMOBS (CL); \
+ SCM CL::smobbed_copy () const \
+ { \
+ CL *ptr = new CL (*this); \
+ SCM s; \
+ s = scm_cons (SCM_PACK (CL::smob_tag_), SCM_PACK (ptr)); \
+ scm_gc_register_collectable_memory ((CL *)this, sizeof (CL), #CL " smob"); \
+ \
+ return s; \
+ }
+
+#define IMPLEMENT_SMOBS(CL) \
+ IMPLEMENT_BASE_SMOBS (CL) \
+ void \
+ CL::smobify_self () \
+ { \
+ protection_cons_ = SCM_EOL; \
+ self_scm_ = unprotected_smobify_self (); \
+ protect (); \
+ } \
+ void \
+ CL::protect () \
+ { \
+ protect_smob (self_scm_, &protection_cons_); \
+ } \
+ SCM \
+ CL::unprotect () \
+ { \
+ unprotect_smob (self_scm_, &protection_cons_); \
+ return self_scm_; \
+ } \
+ SCM \
+ CL::unprotected_smobify_self () \
+ { \
+ /* \
+ This is local. We don't assign to self_scm_ directly, to assure \
+ that S isn't GC-ed from under us. \