-#define IMPLEMENT_SIMPLE_SMOBS(CL) \
-long CL::smob_tag_; \
-SCM \
-CL::smob_p (SCM s) \
-{ \
- if (SCM_NIMP(s) && SCM_CELL_TYPE(s) == smob_tag_) \
- return SCM_BOOL_T; \
- else \
- return SCM_BOOL_F; \
- \
-} \
-void \
-CL::init_smobs () \
-{ \
- smob_tag_ = scm_make_smob_type_mfpe ( \
- #CL, 0, CL::mark_smob, CL::free_smob, CL::print_smob, 0); \
-} \
-SCM CL::smobbed_self () const \
-{ \
- SCM s; \
- s = gh_cons (SCM_PACK(CL::smob_tag_), SCM_PACK(this)); \
- scm_done_malloc(sizeof(CL)); \
- \
- return s; \
-} \
-CL * \
-CL::unsmob (SCM s) \
-{ \
- if (SCM_NIMP(s) && SCM_CELL_TYPE(s) == smob_tag_) \
- return (CL*) SCM_CELL_WORD_1(s); \
- else \
- return 0; \
-} \
-scm_sizet \
-CL::free_smob (SCM ses) \
-{ \
- CL * s = (CL*) SCM_CDR(ses); \
- delete s; \
- return sizeof (CL); \
-} \
-ADD_SCM_INIT_FUNC(CL, CL::init_smobs)
+#define IMPLEMENT_BASE_SMOBS(CL) \
+ void \
+ CL ## _type_adder () \
+ {\
+ ly_add_type_predicate ((void*) &CL::unsmob, #CL); \
+ }\
+ ADD_SCM_INIT_FUNC(CL ## _type_adder_ctor, \
+ CL ## _type_adder);\
+ const char *CL::smob_name_ = #CL; \
+ scm_t_bits CL::smob_tag_; \
+ SCM \
+ CL::smob_p (SCM s) \
+ { \
+ if (SCM_NIMP (s) && SCM_CELL_TYPE (s) == smob_tag_) \
+ return SCM_BOOL_T; \
+ else \
+ return SCM_BOOL_F; \
+ \
+ } \
+ \
+ 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)