]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/ly-smobs.icc
patch::: 1.3.96.jcn9
[lilypond.git] / lily / include / ly-smobs.icc
index 0bcb9d2e8dbabde1ac3bc00c3b0a4e2f89ebbc95..902f8c507fb5c394071a38a5b2a71467054ae71a 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,6 +38,15 @@ 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 ()                                              \
 {                                                              \