]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/moment.cc
2002-07-13 Han-Wen <hanwen@cs.uu.nl>
[lilypond.git] / lily / moment.cc
index c305c9edc48fb42641593538655d138654a9df81..d44af366e2c294c8b9401b625eedd12253d248dd 100644 (file)
@@ -13,7 +13,6 @@
 #include "warn.hh"
 #include "ly-smobs.icc"
 
-
 IMPLEMENT_SIMPLE_SMOBS (Moment);
 IMPLEMENT_TYPE_P (Moment, "moment?");
 
@@ -48,8 +47,15 @@ Moment::print_smob (SCM s, SCM port, scm_print_state *)
 /*
   TODO: add optional factor argument.
  */
-SCM
-make_rational (SCM n, SCM d)
+LY_DEFINE (make_moment,"make-moment", 2,0,0, (SCM n, SCM d),
+          "create the rational number with main timing @var{n}/@var{d}. 
+
+
+Moment is a point in musical time. It is consists of a pair of
+rationals (@var{m},@var{g}), where @var{m} is the timing for the  main
+notes, and @var{g} the timing for  grace notes. In absence of grace
+notes, @var{g} is zero.
+")
 {
   Moment m (Rational (1,1));
 
@@ -65,15 +71,6 @@ make_rational (SCM n, SCM d)
   return m.smobbed_copy ();
 }
 
-
-void
-init_moments ()
-{
-  scm_c_define_gsubr ("make-moment", 2 , 0, 0, (Scheme_function_unknown) make_rational);
-}
-
-ADD_SCM_INIT_FUNC (moms,init_moments);
-
 SCM
 Moment::equal_p (SCM a, SCM b)
 {
@@ -199,14 +196,17 @@ Moment
 Moment::operator - () const
 {
   Moment m;
-  m.grace_part_ = -grace_part_;
-  m.main_part_ = -main_part_;
+  m.grace_part_ = - grace_part_;
+  m. main_part_ = - main_part_ ;
   return m;
 }
 
-ostream &
-operator << (ostream &os, Moment const &m)
+
+#ifdef STREAM_SUPPORT
+std::ostream &
+operator << (std::ostream &os, Moment const &m)
 {
   os << m.str ();
   return os;
 }
+#endif