]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/ly-smobs.icc
patch::: 1.3.126.jcn3
[lilypond.git] / lily / include / ly-smobs.icc
index 0bcb9d2e8dbabde1ac3bc00c3b0a4e2f89ebbc95..c38d5458293d5f26b3d7eca2d622f23e0b3701c7 100644 (file)
@@ -20,6 +20,12 @@ unsmob_ ## name ( SCM s)                     \
 return  CL::unsmob (s);                                \
 }
 
+#define IMPLEMENT_TYPE_P(CL, FUNCNAME)\
+void init_type_p_ ## CL ()\
+{\
+  scm_make_gsubr (FUNCNAME, 1, 0, 0, (Scheme_function_unknown) CL::smob_p);\
+}\
+ADD_SCM_INIT_FUNC(init_type_p_ ## CL, init_type_p_ ## CL)
 
 #ifndef SCM_CELL_TYPE
 #define SCM_CELL_TYPE(X) SCM_CAR(X)
@@ -32,11 +38,21 @@ return  CL::unsmob (s);                             \
 
 #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); \
+     #CL, 0, CL::mark_smob, CL::free_smob, CL::print_smob,     \
+     CL::equal_p);                                              \
 }                                                              \
 SCM CL::smobbed_self () const                                  \
 {                                                              \