2 moment.cc -- implement Moment
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "lily-guile.hh"
16 Moment::mark_smob (SCM)
28 Moment::print_smob (SCM s, SCM port, scm_print_state *)
30 Moment *r = (Moment *) gh_cdr (s);
32 scm_puts ("#<Mom ", port);
34 scm_puts ((char *)str.ch_C(), port);
35 scm_puts (" >", port);
41 Moment::do_smobify_self ()
46 make_rational (SCM n, SCM d)
50 if (SCM_INUMP (n) && SCM_INUMP(d))
52 r= new Moment (gh_scm2int (n), gh_scm2int (d));
56 ::error ("make-moment takes two integer arguments.");
60 retval = r->smobify_self ();
61 scm_unprotect_object (r->self_scm_);
65 #include "ly-smobs.icc"
67 IMPLEMENT_SMOBS(Moment);
72 scm_make_gsubr ("make-moment", 2 , 0, 0, (SCM(*)(...)) make_rational);
75 ADD_SCM_INIT_FUNC(moms,init_moments);
78 Moment::equal_p (SCM a, SCM b)
80 Moment *m1 = SMOB_TO_TYPE(Moment, a);
81 Moment *m2 = SMOB_TO_TYPE(Moment, b);
83 return (*m1 == *m2) ? SCM_BOOL_T : SCM_BOOL_F;