From 96d485f0de969547c4e6e506d7d04f2055f9e42a Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:27:45 +0000 Subject: [PATCH] lilypond-0.0.22 --- NEWS | 25 ++++++++++++++++----- Variables.make | 5 +++-- hdr/simplewalker.hh | 13 ++++++----- kortjakje.ly | 23 ++++++++++--------- src/getcommands.cc | 38 +++++++++++++++++++++++++++++-- src/simplewalker.cc | 55 +++++++++++++++++++++++++++------------------ 6 files changed, 112 insertions(+), 47 deletions(-) diff --git a/NEWS b/NEWS index def00e3b86..a2033eb366 100644 --- a/NEWS +++ b/NEWS @@ -1,19 +1,34 @@ +pl 22: + - doco from mpp + - repeat signs + - | checks for bar in a voice (Barcheck_req) +Internal changes: + - naming (Hungarian notation, svec vs. Array) + - huge memleak fixed; unearthed lots of bugs + - bug noteheadswap + - cleanup PScore, Score + - removed Staff_commands, plugging commands into Staff_column directly + pl 21: - - Move breaking stuff into a separate class Break_algorithm - - dependencies for Staff_elem's - scripts - texts - nplets (triplets!) +Internal changes: + - Move breaking stuff into a separate class Break_algorithm + - dependencies for Staff_elem's pl 20: - - Rational for time measurement - updated doco to .pod + - include files from .ly +Internal changes: + - Rational for time measurement - directionalspanner/textspanner - - include files pl 19: - - struct Moment - grouping code: LilyPond can set advanced multibeams. +Internal changes: + - struct Moment + pl 18: - robust Staff_commands diff --git a/Variables.make b/Variables.make index cd4a663b6e..eea032df7f 100644 --- a/Variables.make +++ b/Variables.make @@ -37,7 +37,7 @@ endif # version info MAJVER=0 MINVER=0 -PATCHLEVEL=21 +PATCHLEVEL=22 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL) CXXVER=`$(CXX) --version` @@ -77,7 +77,8 @@ DNAME=$(PACKAGENAME)-$(VERSION) othersrc=lexer.l parser.y SCRIPTS=make_version make_patch genheader IFILES=dimen.tex symbol.ini kortjakje.ly pavane.ly maartje.ly\ - lilyponddefs.tex test.tex .dstreamrc cadenza.ly + lilyponddefs.tex test.tex .dstreamrc cadenza.ly scales.ly\ + titledefs.tex pavane.tex OFILES=Makefile Variables.make Sources.make COPYING README NEWS DFILES=$(OFILES) $(IFILES) $(SCRIPTS) diff --git a/hdr/simplewalker.hh b/hdr/simplewalker.hh index 635b9fbbcc..34403e465c 100644 --- a/hdr/simplewalker.hh +++ b/hdr/simplewalker.hh @@ -12,22 +12,23 @@ struct Simple_walker: Staff_walker { Stem *stem_; - svecnoteheads; + Arraynoteheads; Local_key local_key_; Key key_; - svec *oldkey_undo; - svec typesetkey; + Array *oldkey_undo; + Array typesetkey; Beam *beam_; Local_key_item *local_key_item_; bool wantkey; // urgh + int processed_bar_priority; bool processed_key; bool processed_clef; Clef clef_; Rhythmic_grouping default_grouping; Rhythmic_grouping *current_grouping; - svec pending_slur_reqs; - svec pending_slurs; - + Array pending_slur_reqs; + Array pending_slurs; + /****************/ virtual void do_TYPESET_command(Command*); diff --git a/kortjakje.ly b/kortjakje.ly index f5e6d08139..ac78340c4f 100644 --- a/kortjakje.ly +++ b/kortjakje.ly @@ -11,17 +11,20 @@ melodie = music { \octave {} % set the default octave % the default note duratino is 4 %%% theme - c c g g a a - g2 % g2 means a "g-1" pitched half-note - f f e e d d c2 - g g f f e e d d g g f f e e d d + c c | % the '|' checks if there is a new measure here. + g g| + a a| + + g2| % g2 means a "g-1" pitched half-note + f f| e e| d d| c2 + g g| f f| e e| d d| g g| f f| e e| d d| %%% var 1 c r8 c8 % r8 means an 8th rest. - ( % start a slur + (| % start a slur % NOTE: the slurstart should be directly after the note ) % end a slur. - g r8 g8 ( ) a r8 a8 ( ) g r4 - f r8 f8 ( ) e4 r8 e8 ( ) d4 r8 d8 ( ) c4 r4 + g r8 g8 (| ) a r8 a8 (| ) g r4 + f r8 f8 (| ) e4 r8 e8 ( |) d4 r8 d8 (| ) c4 r4 $} % more of this. @@ -49,7 +52,6 @@ bstaf = staff { music { begeleiding } % use the declared music commands { % commands with Staff-wide impact. clef bass % bass-clef - } } @@ -57,6 +59,7 @@ bstaf = staff { vstaf = staff { melodic music { melodie } + commands { clef violin } % default clef is violin clef } @@ -69,8 +72,8 @@ score { } commands { meter 2 4 % a 2/4 meter. - skip 32:0 % skip 32 measures, and generate the bars - meter 6 8 % another meter + skip 33:0 % skip 32 measures, and generate the bars +% meter 6 8 % another meter } } diff --git a/src/getcommands.cc b/src/getcommands.cc index b415e0b1cf..6545c0ec1c 100644 --- a/src/getcommands.cc +++ b/src/getcommands.cc @@ -4,7 +4,7 @@ #include "command.hh" Command* -get_key_typeset_command(svecwhich) +get_key_typeset_command(Arraywhich) { Command*c = new Command; c->code = TYPESET; @@ -20,7 +20,6 @@ get_meter_command(int n, int m) { Command*c = new Command; -// c->when = w; c->code = TYPESET; c->args.add( "METER"); c->args.add( n ); @@ -29,3 +28,38 @@ get_meter_command(int n, int m) return c; } +Command +get_defaultbar_command() +{ + Command c; + c.code = TYPESET; + c.args.add("BAR"); + c.args.add("default"); + return c; +} + +void +split_bar_command(Command &pre_com, Command &no_break_com, Command &post_com, + String s) +{ + Command c; + c.code = TYPESET; + c.priority = (s=="default") ? 100: 110; + c.args.add("BAR"); + if(s=="default") + s = "|"; + + if (s == "|" || s == ":|" || s == "||") { + c.args.add(s); + pre_com= no_break_com= c; + } else if (s == ":|:") { + no_break_com=post_com=pre_com = c; + + pre_com.args.add( ":|"); + no_break_com.args.add( s); + post_com.args.add( "|:"); + }else if (s=="|:") { + c.args.add(s); + no_break_com=post_com=c; + } +} diff --git a/src/simplewalker.cc b/src/simplewalker.cc index 945f5151de..21ed11573a 100644 --- a/src/simplewalker.cc +++ b/src/simplewalker.cc @@ -1,5 +1,5 @@ /* - UGR + UGR!! CHAOS RULEZ */ #include "textspanner.hh" #include "script.hh" @@ -23,15 +23,15 @@ #include "textitem.hh" Rhythmic_grouping -parse_grouping(svec a, Moment one_beat) +parse_grouping(Array a, Moment one_beat) { - svec r; - for (int i= 0 ; i < a.sz(); i++) + Array r; + for (int i= 0 ; i < a.size(); i++) r.add(a[i]); Moment here =0.0; - svec children; - for (int i=0; i < r.sz(); i++) { + Array children; + for (int i=0; i < r.size(); i++) { Moment last = here; here += one_beat * r[i]; @@ -45,19 +45,19 @@ parse_grouping(svec a, Moment one_beat) void Simple_walker::do_INTERPRET_command(Command*com) { - svec args(com->args); + Array args(com->args); args.del(0); if (com->args[0] == "GROUPING") { default_grouping = parse_grouping(args, col()->tdescription_->one_beat); - }else if (com->args[0] == "BAR") { + }else if (com->args[0] == "NEWMEASURE") { local_key_.reset(key_); } else if (com->args[0] == "KEY") { if (col()->when() > Moment(0)) { assert(!oldkey_undo); - oldkey_undo = new svec( key_.oldkey_undo(args)); + oldkey_undo = new Array( key_.oldkey_undo(args)); } typesetkey = key_.read(args); @@ -84,7 +84,13 @@ Simple_walker::do_TYPESET_command(Command*com) if (processed_clef) return; } - + if (com->args[0] == "BAR") { + + if (processed_bar_priority > com->priority) + return; + else + processed_bar_priority = com->priority; + } Item* i = staff()->get_TYPESET_item(com); if (!i) @@ -132,11 +138,13 @@ Simple_walker::do_note(Note_info n) Item*rhythmic=0; if (n.rq->note()) { Note_req * req = n.rq->note() ; - const Voice *v = req->elt->voice_; + const Voice *v = req->elt_l_->voice_; Notehead*n = s->get_notehead(req, clef_.c0_pos); rhythmic=n; - stem_->add(n); + if (stem_) + stem_->add(n); + if (current_grouping) { current_grouping->add_child( c->tdescription_->whole_in_measure, req->duration()); @@ -168,14 +176,15 @@ Simple_walker::process_requests() error("Too many beams (t = " +String(c->when())+")"); beam_ = new Beam; + assert(!current_grouping); current_grouping = new Rhythmic_grouping; } - for (int i=0; i < c->slurs.sz(); i++) { + for (int i=0; i < c->slurs.size(); i++) { Slur_req*sl = c->slurs[i]; if (sl->spantype == Span_req::START) { - if (find_slur(sl->elt->voice_ )>=0) + if (find_slur(sl->elt_l_->voice_ )>=0) error_t("Too many slurs in voice", col()->when()); pending_slur_reqs.add(sl); pending_slurs.add(new Slur); @@ -190,7 +199,7 @@ Simple_walker::process_requests() stem_ = s->get_stem(c->stem_->stem(), c->stem_requester_len); } - for (int i = 0; i < c->notes.sz(); i ++) { + for (int i = 0; i < c->notes.size(); i ++) { do_note(c->notes[i]); } @@ -208,6 +217,7 @@ Simple_walker::process_requests() /* needed, otherwise placement of local_key fucks up */ } + if (c->beam_&& c->beam_->spantype == Span_req::STOP) { beam_->set_grouping(default_grouping, *current_grouping); pscore_->typeset_spanner(beam_, s->theline); @@ -223,7 +233,7 @@ Simple_walker::process_requests() delete current_grouping; current_grouping =0; } - for (int i = 0; i < noteheads.sz(); i++) { + for (int i = 0; i < noteheads.size(); i++) { c->typeset_item(noteheads[i]); } noteheads.set_size(0); @@ -235,13 +245,13 @@ Simple_walker::process_requests() if (stem_) { stem_ = 0; } - for (int i=0; i < c->slurs.sz(); i++) { + for (int i=0; i < c->slurs.size(); i++) { Slur_req *sl = c->slurs[i]; if (sl->spantype == Span_req::STOP) { - int idx = find_slur(sl->elt->voice_); + int idx = find_slur(sl->elt_l_->voice_); if (idx < 0) - error("can't find slur to end"); + error_t("can't find slur to end; ", c->when()); pscore_->typeset_spanner(pending_slurs[idx], s->theline); @@ -253,7 +263,7 @@ Simple_walker::process_requests() } Simple_walker::Simple_walker(Simple_staff*s) - : Staff_walker(s, s->theline->pscore_) + : Staff_walker(s, s->theline->pscore_l_) { stem_ = 0; beam_ =0; @@ -285,13 +295,14 @@ Simple_walker::reset() { processed_clef =false; processed_key = false; + processed_bar_priority = 0; } int Simple_walker::find_slur(const Voice *v) { - for (int i=0; i < pending_slur_reqs.sz(); i++) { - if (pending_slur_reqs[i]->elt->voice_ == v) + for (int i=0; i < pending_slur_reqs.size(); i++) { + if (pending_slur_reqs[i]->elt_l_->voice_ == v) return i; } return -1; -- 2.39.5