From: fred Date: Sun, 24 Mar 2002 19:56:09 +0000 (+0000) Subject: lilypond-0.1.11 X-Git-Tag: release/1.5.59~3980 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4327abea88a8cda2ce0ea98d7df0cccbc77145c3;p=lilypond.git lilypond-0.1.11 --- diff --git a/NEWS b/NEWS index 980752826c..b7e1b5bba1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,31 @@ + +pl 11 + - forms for Musical vocabulary + - ignore \r for windows + - Now paper{score,def} & midi{def,score} derived of class +Music_output[_def]. Score is almost empty. + - Engraver hacking: + * junk Text_engraver + * Timing_engraver + * barnumber now really counts the number of bars + * Separated Stem_engraver and Beam_engraver + * junk Stem_beam_engraver + * no need for Stem_reqs + - use Direction = {LEFT, RIGHT, UP, DOWN} iso. -1, 1 throughout source + - ties and slurs with Drul_array + - junked Spanner_elem_group + - bf: w32 fixes + - Spanner now spans items. + - more GNITting ( bla ) -> (bla), indentation + - Drul_array + - Paper_column now is derived of Horizontal_group_item. Items +are no longer hardwired into a Paper_column + - bf: stdin input + - PCol -> Paper_column + - Wtk-i, fugue1, prelude1 (SR) + +******* +aug 21 pl 10 - bf: init pending_indent_i_ - output header to TeX file. Who wants to write TeX to make it work? diff --git a/flower/VERSION b/flower/VERSION index 7aec79ceb0..2d9d483b19 100644 --- a/flower/VERSION +++ b/flower/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 26 +PATCH_LEVEL = 27 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/lib/duration-convert.cc b/lib/duration-convert.cc index e64ca663ea..9969e76341 100644 --- a/lib/duration-convert.cc +++ b/lib/duration-convert.cc @@ -19,322 +19,322 @@ int Duration_convert::no_smaller_than_i_s = 0; Array Duration_convert::dur_array_s; String -Duration_convert::dur2_str( Duration dur ) +Duration_convert::dur2_str(Duration dur) { - if ( dur.ticks_i_ ) - return String( "[" ) + String( dur.ticks_i_ ) + "]"; + if (dur.ticks_i_) + return String("[") + String(dur.ticks_i_) + "]"; - String str; - if (dur.durlog_i_ <= 0) - str="\\breve"; - else - str= String( type2_i(dur.durlog_i_) ); - str += String( '.', dur.dots_i_ ); - if ( dur.plet_b()) - str += String( "*" ) + String( dur.plet_.iso_i_ ) - + String( "/" ) + String( dur.plet_.type_i_ ); - return str; + String str; + if (dur.durlog_i_ <= 0) + str="\\breve"; + else + str= String(type2_i(dur.durlog_i_)); + str += String('.', dur.dots_i_); + if (dur.plet_b()) + str += String("*") + String(dur.plet_.iso_i_) + + String("/") + String(dur.plet_.type_i_); + return str; } #if 0 int -Duration_convert::dur2_i( Duration dur, int division_1_i ) +Duration_convert::dur2_i(Duration dur, int division_1_i) { - return dur2_mom( dur ) * Moment( division_1_i ); + return dur2_mom(dur) * Moment(division_1_i); } #endif int -Duration_convert::dur2ticks_i( Duration dur ) +Duration_convert::dur2ticks_i(Duration dur) { - if ( dur.ticks_i_ ) - return dur.ticks_i_; - return dur2_mom( dur ) * Moment( Duration::division_1_i_s ); + if (dur.ticks_i_) + return dur.ticks_i_; + return dur2_mom(dur) * Moment(Duration::division_1_i_s); } int Duration_convert::i2_type(int i) { - int t=0; - while (!(i & 1)) { - i >>= 1; - t++; - } - return t; + int t=0; + while (!(i & 1)) { + i >>= 1; + t++; + } + return t; } int Duration_convert::type2_i(int type) { - if (type<0) - return 0; - else - return 1 << type; + if (type<0) + return 0; + else + return 1 << type; } Moment -Duration_convert::dur2_mom( Duration dur ) +Duration_convert::dur2_mom(Duration dur) { - if ( dur.ticks_i_ ) - return Moment( dur.ticks_i_, Duration::division_1_i_s ); - - // or simply assert? - if ( dur.durlog_i_<-10 ) - return Moment( 0 ); - Moment mom; - if (dur.durlog_i_<0) - mom = Moment( type2_i( -dur.durlog_i_ ), 1 ); - else - mom = Moment( 1 , type2_i( dur.durlog_i_ ) ); - - Moment delta = mom; - while ( dur.dots_i_-- ) - { - delta /= 2.0; - mom += delta; - } - - return mom * plet_factor_mom( dur ); + if (dur.ticks_i_) + return Moment(dur.ticks_i_, Duration::division_1_i_s); + + // or simply assert? + if (dur.durlog_i_<-10) + return Moment(0); + Moment mom; + if (dur.durlog_i_<0) + mom = Moment(type2_i(-dur.durlog_i_), 1); + else + mom = Moment(1 , type2_i(dur.durlog_i_)); + + Moment delta = mom; + while (dur.dots_i_--) + { + delta /= 2.0; + mom += delta; + } + + return mom * plet_factor_mom(dur); } #if 0 Moment -Duration_convert::i2_mom( int time_i, int division_1_i ) +Duration_convert::i2_mom(int time_i, int division_1_i) { - if ( !time_i ) - return Moment( 0 ); + if (!time_i) + return Moment(0); - if ( division_1_i > 0 ) - return Moment( time_i, division_1_i ); - else - return Moment( -division_1_i, time_i ); + if (division_1_i > 0) + return Moment(time_i, division_1_i); + else + return Moment(-division_1_i, time_i); } #endif Duration -Duration_convert::mom2_dur( Moment mom ) +Duration_convert::mom2_dur(Moment mom) { - if (!mom) - { - Duration dur; - dur.set_plet(0,1); - return dur; - } + if (!mom) + { + Duration dur; + dur.set_plet(0,1); + return dur; + } - Duration dur = mom2standardised_dur( mom ); -// if ( !dur.mom() || ( dur.mom() == mom ) ) - if ( !dur.length() || ( dur.length() == mom ) ) - return dur; - assert( midi_as_plet_b_s ); - -// dur.set_plet( type_mom, Duration::division_1_i_s / 4 ); - -// Moment as_plet_mom = mom / dur.mom(); - Moment as_plet_mom = mom / dur.length(); - as_plet_mom *= dur.plet_.mom(); - long num = as_plet_mom.numerator().as_long(); - long den = as_plet_mom.denominator().as_long(); - dur.set_plet( num, den ); - return dur; + Duration dur = mom2standardised_dur(mom); + // if (!dur.mom() || (dur.mom() == mom)) + if (!dur.length() || (dur.length() == mom)) + return dur; + assert(midi_as_plet_b_s); + + // dur.set_plet(type_mom, Duration::division_1_i_s / 4); + + // Moment as_plet_mom = mom / dur.mom(); + Moment as_plet_mom = mom / dur.length(); + as_plet_mom *= dur.plet_.mom(); + long num = as_plet_mom.numerator().as_long(); + long den = as_plet_mom.denominator().as_long(); + dur.set_plet(num, den); + return dur; } Duration -Duration_convert::mom2standardised_dur( Moment mom ) +Duration_convert::mom2standardised_dur(Moment mom) { -// if ( !dur_array_s.length_i() ) - if ( !dur_array_s.size() ) - set_array(); - assert( dur_array_s.size() ); - for ( int i = 0; i < dur_array_s.size() - 1; i++ ) - { - Moment lower_mom = dur2_mom( dur_array_s[ i ] ); - if ( mom <= lower_mom ) - { - // all arbitrary, but 3/4 will get rid of the noise... - // kinda ok - if ( i || ( mom / lower_mom > Moment( 3, 4 ) ) ) - return dur_array_s[ i ]; - else - { - Duration d; - d.durlog_i_ = -100; - return d; - } - } - Moment upper_mom = dur2_mom( dur_array_s[ i + 1 ] ); - if ( ( mom < upper_mom ) - && ( ( mom - lower_mom ) / lower_mom - < ( upper_mom - mom ) / upper_mom ) ) - return dur_array_s[ i ]; - } - return dur_array_s[ dur_array_s.size() - 1 ]; + // if (!dur_array_s.length_i()) + if (!dur_array_s.size()) + set_array(); + assert(dur_array_s.size()); + for (int i = 0; i < dur_array_s.size() - 1; i++) + { + Moment lower_mom = dur2_mom(dur_array_s[ i ]); + if (mom <= lower_mom) + { + // all arbitrary, but 3/4 will get rid of the noise... + // kinda ok + if (i || (mom / lower_mom > Moment(3, 4))) + return dur_array_s[ i ]; + else + { + Duration d; + d.durlog_i_ = -100; + return d; + } + } + Moment upper_mom = dur2_mom(dur_array_s[ i + 1 ]); + if ((mom < upper_mom) + && ((mom - lower_mom) / lower_mom + < (upper_mom - mom) / upper_mom)) + return dur_array_s[ i ]; + } + return dur_array_s[ dur_array_s.size() - 1 ]; } void Duration_convert::set_array() { - dur_array_s.clear(); + dur_array_s.clear(); - Duration_iterator iter_dur; - assert( iter_dur ); - while ( iter_dur ) - dur_array_s.push( iter_dur++ ); + Duration_iterator iter_dur; + assert(iter_dur); + while (iter_dur) + dur_array_s.push(iter_dur++); } Moment -Duration_convert::plet_factor_mom( Duration dur ) +Duration_convert::plet_factor_mom(Duration dur) { - return dur.plet_.mom(); + return dur.plet_.mom(); } Real -Duration_convert::sync_f( Duration dur, Moment mom ) +Duration_convert::sync_f(Duration dur, Moment mom) { - return mom / dur2_mom( dur ); + return mom / dur2_mom(dur); } Duration -Duration_convert::ticks2_dur( int ticks_i ) +Duration_convert::ticks2_dur(int ticks_i) { -// Duration dur( 4, 0 ); -// dur.set_plet( ticks_i, Duration::division_1_i_s / 4 ); + // Duration dur(4, 0); + // dur.set_plet(ticks_i, Duration::division_1_i_s / 4); - Moment mom( ticks_i, Duration::division_1_i_s ); - if ( midi_as_plet_b_s ) - return mom2_dur( mom ); + Moment mom(ticks_i, Duration::division_1_i_s); + if (midi_as_plet_b_s) + return mom2_dur(mom); - Duration dur = mom2standardised_dur( mom ); + Duration dur = mom2standardised_dur(mom); -// if ( dur.mom() == mom ) - if ( dur.length() == mom ) - return dur; + // if (dur.mom() == mom) + if (dur.length() == mom) + return dur; // huh? #if 0 - dur.durlog_i_ = -100; - dur.dots_i_ = 0; - dur.set_ticks( ticks_i ); - return dur; + dur.durlog_i_ = -100; + dur.dots_i_ = 0; + dur.set_ticks(ticks_i); + return dur; #else - return mom2_dur( mom ); + return mom2_dur(mom); #endif } Duration -Duration_convert::ticks2standardised_dur( int ticks_i ) +Duration_convert::ticks2standardised_dur(int ticks_i) { - Moment mom( ticks_i, Duration::division_1_i_s ); - Duration dur = mom2standardised_dur( mom ); - return dur; + Moment mom(ticks_i, Duration::division_1_i_s); + Duration dur = mom2standardised_dur(mom); + return dur; } Duration_iterator::Duration_iterator() { - cursor_dur_.durlog_i_ = 7; - if ( Duration_convert::no_smaller_than_i_s ) - cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s; -// cursor_dur_.set_plet( 1, 1 ); + cursor_dur_.durlog_i_ = 7; + if (Duration_convert::no_smaller_than_i_s) + cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s; + // cursor_dur_.set_plet(1, 1); } Duration Duration_iterator::operator ++(int) { - return forward_dur(); + return forward_dur(); } Duration Duration_iterator::operator ()() { - return dur(); + return dur(); } Duration_iterator::operator bool() { - return ok(); + return ok(); } Duration Duration_iterator::dur() { - return cursor_dur_; + return cursor_dur_; } Duration Duration_iterator::forward_dur() { - /* should do smart table? guessing: - duration wholes - 16 0.0625 - 32.. 0.0703 - 8:2/3 0.0833 - 16. 0.0938 - 8 0.1250 - 16.. 0.1406 - 4:2/3 0.1667 - 8. 0.1875 + /* should do smart table? guessing: + duration wholes + 16 0.0625 + 32.. 0.0703 + 8:2/3 0.0833 + 16. 0.0938 + 8 0.1250 + 16.. 0.1406 + 4:2/3 0.1667 + 8. 0.1875 - */ - assert( ok() ); - - Duration dur = cursor_dur_; - - if ( !cursor_dur_.dots_i_ && !cursor_dur_.plet_b() ) - { - cursor_dur_.durlog_i_ += 1; - cursor_dur_.dots_i_ = 2; - } - else if ( cursor_dur_.dots_i_ == 2 ) - { - assert( !cursor_dur_.plet_b() ); - cursor_dur_.dots_i_ = 0; - cursor_dur_.durlog_i_ -=2; - cursor_dur_.set_plet( 2, 3 ); - } - else if ( cursor_dur_.plet_b() - && ( cursor_dur_.plet_.iso_i_ == 2 ) - && ( cursor_dur_.plet_.type_i_ == 3 ) ) - { - assert( !cursor_dur_.dots_i_ ); - cursor_dur_.set_plet( 1, 1 ); - cursor_dur_.durlog_i_ += 1; - cursor_dur_.dots_i_ = 1; - } - else if ( cursor_dur_.dots_i_ == 1 ) - { - assert( !cursor_dur_.plet_b() ); - cursor_dur_.dots_i_ = 0; - cursor_dur_.durlog_i_ -= 1; - } + */ + assert(ok()); + + Duration dur = cursor_dur_; + + if (!cursor_dur_.dots_i_ && !cursor_dur_.plet_b()) + { + cursor_dur_.durlog_i_ += 1; + cursor_dur_.dots_i_ = 2; + } + else if (cursor_dur_.dots_i_ == 2) + { + assert(!cursor_dur_.plet_b()); + cursor_dur_.dots_i_ = 0; + cursor_dur_.durlog_i_ -=2; + cursor_dur_.set_plet(2, 3); + } + else if (cursor_dur_.plet_b() + && (cursor_dur_.plet_.iso_i_ == 2) + && (cursor_dur_.plet_.type_i_ == 3)) + { + assert(!cursor_dur_.dots_i_); + cursor_dur_.set_plet(1, 1); + cursor_dur_.durlog_i_ += 1; + cursor_dur_.dots_i_ = 1; + } + else if (cursor_dur_.dots_i_ == 1) + { + assert(!cursor_dur_.plet_b()); + cursor_dur_.dots_i_ = 0; + cursor_dur_.durlog_i_ -= 1; + } - if ( Duration_convert::no_triplets_b_s - && cursor_dur_.plet_b() && ok() ) - forward_dur(); - if ( Duration_convert::no_double_dots_b_s - && ( cursor_dur_.dots_i_ == 2 ) && ok() ) - forward_dur(); - if ( Duration_convert::no_smaller_than_i_s - && ( cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s ) && ok() ) - forward_dur(); - if ( Duration_convert::no_smaller_than_i_s - && cursor_dur_.dots_i_ - && ( cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s ) - && ok() ) - forward_dur(); - if ( Duration_convert::no_smaller_than_i_s - && ( cursor_dur_.dots_i_ == 2 ) - && ( cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2 ) - && ok() ) - forward_dur(); - - return dur; + if (Duration_convert::no_triplets_b_s + && cursor_dur_.plet_b() && ok()) + forward_dur(); + if (Duration_convert::no_double_dots_b_s + && (cursor_dur_.dots_i_ == 2) && ok()) + forward_dur(); + if (Duration_convert::no_smaller_than_i_s + && (cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s) && ok()) + forward_dur(); + if (Duration_convert::no_smaller_than_i_s + && cursor_dur_.dots_i_ + && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s) + && ok()) + forward_dur(); + if (Duration_convert::no_smaller_than_i_s + && (cursor_dur_.dots_i_ == 2) + && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2) + && ok()) + forward_dur(); + + return dur; } bool Duration_iterator::ok() { - return ( cursor_dur_.durlog_i_ - && !( ( cursor_dur_.durlog_i_ == 0 ) && ( cursor_dur_.dots_i_ > 2 ) ) ); + return (cursor_dur_.durlog_i_ + && !((cursor_dur_.durlog_i_ == 0) && (cursor_dur_.dots_i_ > 2))); } diff --git a/lib/includable-lexer.cc b/lib/includable-lexer.cc index 73d00498a8..4e15405164 100644 --- a/lib/includable-lexer.cc +++ b/lib/includable-lexer.cc @@ -15,7 +15,7 @@ Includable_lexer::Includable_lexer() { - yy_current_buffer = 0; + yy_current_buffer = 0; } /** set the new input to s, remember old file. @@ -23,31 +23,28 @@ Includable_lexer::Includable_lexer() void Includable_lexer::new_input(String s, Sources * global_sources) { - Source_file * sl = global_sources->get_file_l(s); - if (!sl) - { - LexerError("Can't find file `" + s+ "'"); - return; - } + Source_file * sl = global_sources->get_file_l(s); + if (!sl) + { + LexerError("Can't find file `" + s+ "'"); + return; + } - char_count_stack_.push(0); - if (yy_current_buffer) - state_stack_.push(yy_current_buffer); - cout << "[" << s<istream_l(), YY_BUF_SIZE )); + */ + yy_switch_to_buffer(yy_create_buffer(sl->istream_l(), YY_BUF_SIZE)); } /** pop the inputstack. conceptually this is a destructor, but it @@ -55,14 +52,14 @@ Includable_lexer::new_input(String s, Sources * global_sources) bool Includable_lexer::close_input() { - include_stack_.pop(); - char_count_stack_.pop(); - cout << "]"<ch_C() + char_count_stack_.top(); + if (include_stack_.empty()) + return 0; + return include_stack_.top()->ch_C() + char_count_stack_.top(); } Includable_lexer::~Includable_lexer() { - while (!include_stack_.empty()) - { - close_input(); - }; + while (!include_stack_.empty()) + { + close_input(); + } } /** Since we don't create the buffer state from the bytes directly, we @@ -92,14 +89,14 @@ Includable_lexer::~Includable_lexer() void Includable_lexer::add_lexed_char(int count) { - char_count_stack_.top() += count; + char_count_stack_.top() += count; } Source_file* -Includable_lexer::source_file_l()const +Includable_lexer::source_file_l() const { - if (include_stack_.empty()) - return 0; - else - return include_stack_.top(); + if (include_stack_.empty()) + return 0; + else + return include_stack_.top(); } diff --git a/lib/source.cc b/lib/source.cc index dd1c5f27d6..3f2daf6a23 100644 --- a/lib/source.cc +++ b/lib/source.cc @@ -19,20 +19,20 @@ Sources::Sources() { - path_C_= 0; - binary_b_ = false; + path_C_= 0; + binary_b_ = false; } void Sources::set_binary(bool bo) { - binary_b_ = bo; + binary_b_ = bo; } void Sources::set_path(File_path *f_C) { - path_C_ = f_C; + path_C_ = f_C; } /** @@ -44,25 +44,25 @@ Sources::set_path(File_path *f_C) @return 0 if no file found */ Source_file* -Sources::get_file_l(String &file_str ) //UGH +Sources::get_file_l(String &file_str) //UGH { - if (path_C_) - { - String file_str_o = path_C_->find(file_str); - if ( ( file_str_o == "" ) && ( file_str != "" ) ) - return 0; - file_str = file_str_o; - } - Source_file * f_p= (!binary_b_) ? - new Source_file(file_str) : new Binary_source_file(file_str); - add(f_p); - return f_p; + if (path_C_) + { + String file_str_o = path_C_->find(file_str); + if ((file_str_o == "") && (file_str != "")) + return 0; + file_str = file_str_o; + } + Source_file * f_p= (!binary_b_) ? + new Source_file(file_str) : new Binary_source_file(file_str); + add(f_p); + return f_p; } void -Sources::add( Source_file* sourcefile_p ) +Sources::add(Source_file* sourcefile_p) { - sourcefile_p_list_.bottom().add( sourcefile_p ); + sourcefile_p_list_.bottom().add(sourcefile_p); } /** @@ -71,12 +71,12 @@ Sources::add( Source_file* sourcefile_p ) @return 0 if not found. */ Source_file* -Sources::sourcefile_l( char const* ch_C ) +Sources::sourcefile_l(char const* ch_C) { - PCursor sourcefile_l_pcur( sourcefile_p_list_.top() ); - for ( ; sourcefile_l_pcur.ok(); sourcefile_l_pcur++ ) - if ( sourcefile_l_pcur->in_b( ch_C ) ) - return *sourcefile_l_pcur; - return 0; + PCursor sourcefile_l_pcur(sourcefile_p_list_.top()); + for (; sourcefile_l_pcur.ok(); sourcefile_l_pcur++) + if (sourcefile_l_pcur->in_b(ch_C)) + return *sourcefile_l_pcur; + return 0; } diff --git a/lib/template.cc b/lib/template.cc index 4fefc0b563..90f9818d85 100644 --- a/lib/template.cc +++ b/lib/template.cc @@ -12,5 +12,5 @@ #include "cursor.tcc" #include "list.tcc" -template L_INSTANTIATE(void *); -template IPL_INSTANTIATE(Source_file); +template LIST_INSTANTIATE(void *); +template POINTERLIST_INSTANTIATE(Source_file);