From 2d3f2388f528573472c1d79906439f41b4832d63 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 22:28:12 +0000 Subject: [PATCH] lilypond-1.3.0 --- flower/dstream.cc | 32 +++++++++++++++-- lily/moment.cc | 69 ++++++++++++++++++++++++++++++++++++ lily/translation-property.cc | 6 ++-- 3 files changed, 101 insertions(+), 6 deletions(-) create mode 100644 lily/moment.cc diff --git a/flower/dstream.cc b/flower/dstream.cc index ba46d69ed6..e51f97a39e 100644 --- a/flower/dstream.cc +++ b/flower/dstream.cc @@ -9,7 +9,7 @@ #include #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 index 0000000000..7b76747d73 --- /dev/null +++ b/lily/moment.cc @@ -0,0 +1,69 @@ +/* + moment.cc -- implement Moment + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + + +#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 ("#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); diff --git a/lily/translation-property.cc b/lily/translation-property.cc index 8811d85d9b..42e4364349 100644 --- a/lily/translation-property.cc +++ b/lily/translation-property.cc @@ -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 } -- 2.39.5