]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.45
authorfred <fred>
Sun, 24 Mar 2002 19:36:50 +0000 (19:36 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:36:50 +0000 (19:36 +0000)
lily/command-request.cc
lily/my-lily-parser.cc

index 92e7097c4351d2433a3f9526496751a8ef9d20d1..7d95dd980dbb3fd5b2d759462ee6f9fbe6d0d13b 100644 (file)
@@ -11,6 +11,8 @@
 #include "musical-request.hh"
 
 
+IMPLEMENT_STATIC_NAME(Cadenza_req);
+
 void
 Cadenza_req::do_print()const
 {
@@ -30,6 +32,8 @@ Bar_req::compare(Bar_req const &c1)const
     return type_str_ == c1.type_str_;
 }
 
+IMPLEMENT_STATIC_NAME(Bar_req);
+
 void
 Bar_req::do_print() const
 {
@@ -46,28 +50,25 @@ Partial_measure_req::Partial_measure_req(Moment m)
     duration_ =m;
 }
 /* *************** */
-Meter_change_req::Meter_change_req()
-{
-    beats_i_ = 0;
-    one_beat_i_ =0;
-}
-void
-Meter_change_req::set(int b,int o)
-{
-    beats_i_=b;
-    one_beat_i_=o;
-}
+
+IMPLEMENT_STATIC_NAME(Timing_req);
 
 void
 Timing_req::do_print()const{}
 
+IMPLEMENT_STATIC_NAME(Command_req);
+
 void
 Command_req::do_print()const{}
 /* *************** */
+IMPLEMENT_STATIC_NAME(Barcheck_req);
+
 void
 Barcheck_req::do_print() const{}
 
 /* *************** */
+IMPLEMENT_STATIC_NAME(Clef_change_req);
+
 void
 Clef_change_req::do_print() const
 {
@@ -79,6 +80,8 @@ Clef_change_req::Clef_change_req(String s)
     clef_str_ = s;
 }
 /* *************** */
+IMPLEMENT_STATIC_NAME(Group_feature_req);
+
 void
 Group_feature_req::do_print() const
 {
@@ -90,32 +93,61 @@ Group_feature_req::Group_feature_req()
     stemdir_i_ = 0;
 }
 
+IMPLEMENT_STATIC_NAME(Group_change_req);
+
 void
 Group_change_req::do_print()const
 {
     mtor << "id : " << newgroup_str_;
 }
 /* *************** */
+IMPLEMENT_STATIC_NAME(Terminate_voice_req);
+
 void
 Terminate_voice_req::do_print()const
 {
 }
 
 /* *************** */
+IMPLEMENT_STATIC_NAME(Partial_measure_req);
+
 void
 Partial_measure_req::do_print() const
 {
     mtor << duration_;
 }
 
+IMPLEMENT_STATIC_NAME(Meter_change_req);
+
 void
 Meter_change_req::do_print() const
 {
-    mtor << beats_i_ << "*" << one_beat_i_;
+    mtor << beats_i_ << "/" << one_beat_i_;
+}
+
+int
+Meter_change_req::compare(Meter_change_req const &m)
+{
+    return m.beats_i_ == beats_i_ && one_beat_i_ == m.one_beat_i_;
+}
+
+Meter_change_req::Meter_change_req()
+{
+    beats_i_ = 0;
+    one_beat_i_ =0;
+}
+
+void
+Meter_change_req::set(int b,int o)
+{
+    beats_i_=b;
+    one_beat_i_=o;
 }
 
 /* *************** */
 
+IMPLEMENT_STATIC_NAME(Measure_grouping_req);
+
 void
 Measure_grouping_req::do_print() const
 {
@@ -134,6 +166,8 @@ Key_change_req::transpose(Melodic_req const & d)const
     }
 }
 
+IMPLEMENT_STATIC_NAME(Key_change_req);
+
 void
 Key_change_req::do_print() const
 {
@@ -144,16 +178,51 @@ Key_change_req::do_print() const
 
 Key_change_req::Key_change_req()
 {
+       minor_b_ = false;
 }
+
 Key_change_req::Key_change_req(Key_change_req const&c)
 {
-    for (int i=0; i < c.melodic_p_arr_.size(); i++) {
-       melodic_p_arr_.push( c.melodic_p_arr_[i]->clone()->melodic() );
-    }
+       for (int i=0; i < c.melodic_p_arr_.size(); i++) 
+               melodic_p_arr_.push( c.melodic_p_arr_[i]->clone()->melodic() );
+       minor_b_ = c.minor_b_;
 }
 
 Key_change_req::~Key_change_req()
 {
-    for (int i=0; i < melodic_p_arr_.size(); i++)
-       delete melodic_p_arr_[i];
+       for (int i=0; i < melodic_p_arr_.size(); i++)
+               delete melodic_p_arr_[i];
+}
+
+int
+Key_change_req::flats_i()
+{
+       int flats_i = 0;
+       for ( int i = 0; i < melodic_p_arr_.size(); i++ ) {
+               Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
+               assert( mel_l );
+               if ( mel_l->accidental_i_ < 0 )
+                       flats_i++;
+       }
+       return flats_i;
+}
+
+int
+Key_change_req::minor_b()
+{
+       return minor_b_;        
 }
+
+int
+Key_change_req::sharps_i()
+{
+       int sharps_i = 0;
+       for ( int i = 0; i < melodic_p_arr_.size(); i++ ) {
+               Melodic_req* mel_l = melodic_p_arr_[i]->melodic();
+               assert( mel_l );
+               if ( mel_l->accidental_i_ > 0 )
+                       sharps_i++;
+       }
+       return sharps_i;
+}
+
index 6340a918b844914ea771be91909b0381d7ee7770..9924a78a7e39f2405ff44c5c5d24c0c89abf962e 100644 (file)
@@ -109,8 +109,7 @@ My_lily_parser::get_word_element(Text_def* tdef_p, Duration * duration_p)
     Lyric_req* lreq_p = new Lyric_req(tdef_p);
 
     lreq_p->duration_ = *duration_p;
-    lreq_p->print();
-    lreq_p->defined_ch_C_ = here_ch_C();
+     lreq_p->defined_ch_C_ = here_ch_C();
 
     velt_p->add(lreq_p);
 
@@ -126,8 +125,7 @@ My_lily_parser::get_rest_element(String,  Duration * duration_p )
 
     Rest_req * rest_req_p = new Rest_req;
     rest_req_p->duration_ = *duration_p;
-    rest_req_p->print();
-    rest_req_p->defined_ch_C_ = here_ch_C();
+     rest_req_p->defined_ch_C_ = here_ch_C();
 
     velt_p->add(rest_req_p);
     delete duration_p;
@@ -210,7 +208,7 @@ My_lily_parser::My_lily_parser(Sources * source_l)
     source_l_ = source_l;
     lexer_p_ = 0;
     default_duration_.type_i_ = 4;
-    default_octave_i_=0;
+    default_octave_i_ = 3; // retain old default
     textstyle_str_="roman";            // in lexer?
     error_level_i_ = 0;
     last_duration_mode = false;