]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/moment.cc
release: 1.3.45
[lilypond.git] / lily / moment.cc
index 94d65eab45908f2c7505172309927af96bde03fb..8495cdc47068a08230cd20bcaae09b78a9895bb8 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -13,7 +13,7 @@
 #include "warn.hh"
 
 SCM
-Moment::mark_smob (SCM s)
+Moment::mark_smob (SCM)
 {
   return SCM_EOL;
 }
@@ -27,7 +27,7 @@ Moment::~Moment()
 int
 Moment::print_smob (SCM s, SCM port, scm_print_state *)
 {
-  Moment  *r = (Moment *) SCM_CDR (s);
+  Moment  *r = (Moment *) gh_cdr (s);
      
   scm_puts ("#<Mom ", port);
   String str(r->str());
@@ -39,25 +39,32 @@ Moment::print_smob (SCM s, SCM port, scm_print_state *)
 
 void
 Moment::do_smobify_self ()
-{}
+{
+}
 
 SCM
 make_rational (SCM n, SCM d)
 {
+  Moment *r;
+  SCM retval = SCM_EOL;
   if (SCM_INUMP (n) && SCM_INUMP(d))
     {
-      Moment *r = new Moment (gh_scm2int (n), gh_scm2int (d));
-      return r->smobify_self ();
+      r= new Moment (gh_scm2int (n), gh_scm2int (d));
     }
   else
     {
-      ::error ("Not a number");
-      assert(false);
+      ::error ("make-moment takes two integer arguments.");
+      r = new Moment (1,1);
     }
+
+  retval = r->smobify_self ();
+  scm_unprotect_object (r->self_scm_);
+  return retval ;  
 }
 
 #include "ly-smobs.icc"
 
+IMPLEMENT_UNSMOB(Moment,moment);
 IMPLEMENT_SMOBS(Moment);
 
 void