]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.0
authorfred <fred>
Tue, 26 Mar 2002 22:28:12 +0000 (22:28 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:28:12 +0000 (22:28 +0000)
flower/dstream.cc
lily/moment.cc [new file with mode: 0644]
lily/translation-property.cc

index ba46d69ed6851890f0601eaa9e80011e16fd283b..e51f97a39e1ef5ea2f802d57f7f17c91f0f77e57 100644 (file)
@@ -9,7 +9,7 @@
 #include <fstream.h>
 #include "dictionary-iter.hh"
 #include "dstream.hh"
-#include "scalar.hh"
+
 #include "text-db.hh"
 #include "string-convert.hh"
 #include "rational.hh"
@@ -86,7 +86,7 @@ Dstream::operator<<(void const *v_l)
 }
 
 Dstream &
-Dstream::operator <<(Scalar s)
+Dstream::operator <<(String s)
 {
   output (s);
   return *this;
@@ -99,6 +99,32 @@ Dstream::operator <<(const char * s)
   return *this;
 }
 
+Dstream &
+Dstream::operator <<(char c)
+{
+  output (to_str (c));
+  return *this;
+}
+
+Dstream&
+Dstream::operator << (Real r)
+{
+  output (to_str  (r));
+  return *this;
+}
+Dstream &
+Dstream::operator <<(Rational c)
+{
+  output (c.str ());
+  return *this;
+}
+Dstream &
+Dstream::operator <<(int i)
+{
+  output (to_str(i));
+  return *this;
+}
+  
 void
 Dstream::output (String s)
 {
@@ -158,7 +184,7 @@ Dstream::Dstream (ostream *r, char const * cfg_nm)
        r.message (_ ("not enough fields in Dstream init"));
        continue;
       }
-    (*silent_dict_p_)[r[0]] = (bool)(int)(Scalar (r[1]));
+    (*silent_dict_p_)[r[0]] = r[1] == "1";
   }
 
   if ((*silent_dict_p_).elem_b ("Dstream_default_silence"))
diff --git a/lily/moment.cc b/lily/moment.cc
new file mode 100644 (file)
index 0000000..7b76747
--- /dev/null
@@ -0,0 +1,69 @@
+/*   
+  moment.cc --  implement Moment
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+
+#include "lily-guile.hh"
+#include "moment.hh"
+#include "warn.hh"
+
+SCM
+Moment::mark_smob (SCM s)
+{
+  return SCM_EOL;
+}
+
+
+Moment::~Moment()
+{
+  self_scm_ = SCM_EOL;
+}
+
+int
+Moment::print_smob (SCM s, SCM port, scm_print_state *)
+{
+  Moment  *r = (Moment *) SCM_CDR (s);
+     
+  scm_puts ("#<Mom ", port);
+  String str(r->str());
+  scm_puts ((char *)str.ch_C(), port);
+  scm_puts (" >", port);
+  
+  return 1;
+}
+
+void
+Moment::do_smobify_self ()
+{}
+
+SCM
+make_rational (SCM n, SCM d)
+{
+  if (SCM_INUMP (n) && SCM_INUMP(d))
+    {
+      Moment *r = new Moment (gh_scm2int (n), gh_scm2int (d));
+      return r->smobify_self ();
+    }
+  else
+    {
+      ::error ("Not a number");
+      assert(false);
+    }
+}
+
+#include "ly-smobs.icc"
+
+IMPLEMENT_SMOBS(Moment);
+
+void
+init_moments ()
+{
+  scm_make_gsubr ("make-moment", 2 , 0, 0,  (SCM(*)(...)) make_rational);
+}
+
+ADD_SCM_INIT_FUNC(moms,init_moments);
index 8811d85d9b0da17d733ee745a2c4ca15550ab83d..42e43643490e59a3c354fc2ca8f99d22f484b27a 100644 (file)
@@ -9,12 +9,12 @@
 #include "translation-property.hh"
 #include "debug.hh"
 
-
-
 void
 Translation_property::do_print () const
 {
 #ifndef NPRINT
-  DEBUG_OUT << "." << var_str_ << " = " << value_;
+  DEBUG_OUT << "." << var_str_ << " = " ;
+  if (flower_dstream && !flower_dstream->silent_b ("Translation_property"))
+    ly_display_scm (value_);
 #endif
 }