]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/smobs.hh
2003 -> 2004
[lilypond.git] / lily / include / smobs.hh
index a29547361678655216db03a42f27097a860682de..c0155ee1fd771f3aef54c179dda33dcbd4437d37 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -110,7 +110,12 @@ private:\
        static int print_smob (SCM s, SCM p, scm_print_state*); \
 public: \
        static SCM equal_p (SCM a, SCM b);\
-       static CL * unsmob (SCM);\
+       static CL * unsmob (SCM s){\
+  if (SCM_NIMP (s) && SCM_CELL_TYPE (s) == smob_tag_)          \
+    return (CL*) SCM_CELL_WORD_1 (s);                          \
+  else                                                         \
+    return 0;                                                  \
+}                                                              \
        static SCM smob_p (SCM);\
        static void init_smobs ();                              \
 private:
@@ -128,6 +133,14 @@ public: \
        SCM self_scm () const { return self_scm_; } \
 private:
 
+#define DECLARE_UNSMOB(CL,name) \
+inline CL *                                            \
+unsmob_ ## name (SCM s)                        \
+{                                              \
+return  CL::unsmob (s);                                \
+}
+
+
 
 #endif /* SMOBS_HH */