From 38e7ae20892a0a52b97e29546a217bdb49e0512f Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 29 Oct 1996 00:51:44 +0000 Subject: [PATCH] lilypond-0.0.5 --- .dstreamrc | 4 +- TODO | 7 +--- maartje.ly | 17 ++++---- make_patch | 2 +- scommands.cc | 116 ++++++++++++++++++++++++++++++++++++++++++--------- suzan.ly | 3 +- 6 files changed, 113 insertions(+), 36 deletions(-) diff --git a/.dstreamrc b/.dstreamrc index b5fa669d14..fccd8d5c37 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -13,4 +13,6 @@ Parser 1 Lexer 1 parse_duration 1 parse_pitch 1 - +Col_configuration 1 +Command 1 +Score_commands 1 \ No newline at end of file diff --git a/TODO b/TODO index 3f91b6bbd8..cce684e09c 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,4 @@ -bug in BAR. -dot spacing -typeset direction. -beam -stem +melodie staff. +beam + stem diff --git a/maartje.ly b/maartje.ly index 49665efd4d..508389a12e 100644 --- a/maartje.ly +++ b/maartje.ly @@ -2,7 +2,9 @@ score { -% output "maartje.uit" + paper { + unitspace 3 cm + } rhythmstaff { voice { $ c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ } } @@ -11,12 +13,11 @@ score { r2 r4 r1 $ } } - - bar 2 bar 3 - bar 4.5 bar 5 bar 5.5 - bar 6 bar 7 bar 8 - - meter 2 4 4 % after bars. - + commands { + meter 4 4 + skip 3:0 + meter 2 4 + skip 8:0 + } } diff --git a/make_patch b/make_patch index 08f4936b56..c2a1e50f8a 100755 --- a/make_patch +++ b/make_patch @@ -28,4 +28,4 @@ fi #(cd $nm$old; touch depend; make clean) #(cd $nm$new; touch depend; make clean) (cd $nm$new; diff -P -c ../$nm$old . > ../patch-$new) -rm -rf $nm$old +rm -rf $nm$old $nm$new diff --git a/scommands.cc b/scommands.cc index 82fe9a1691..8f86ff6fad 100644 --- a/scommands.cc +++ b/scommands.cc @@ -1,5 +1,6 @@ #include "scommands.hh" #include "debug.hh" +#include "parseconstruct.hh" /* maybe it's time for a "narrowing" cursor? @@ -78,45 +79,74 @@ Score_commands::is_breakable(Real w) } return false; } + +void +Score_commands::insert_between(Command victim, PCursor firstc, + PCursor last) +{ + assert(last->when==firstc->when); + PCursor c(firstc+1); + while (c != last) { // hmm what if !last.ok()? + if (victim.priority > c->priority) { + c.insert(new Command(victim)); + return; + } + c++; + } + last.insert(new Command(victim)); + +} void Score_commands::add_command_to_break(Command pre, Command mid,Command post) { Real w = pre.when; - - Command k(w); - - PCursor c ( first(w)); + PCursor c ( first(w)), f(c), l(c); + while (!c->isbreak()) c++; - c.add(new Command(pre)); - + f = c++; while (!c->isbreak()) c++; - c.add(new Command(mid)); - + l = c++; + + insert_between(pre, f, l); + f = l; while (!c->isbreak()) c++; - c.add(new Command(post)); + l = c++; + insert_between(mid, f, l); + f = l; + while (!c->isbreak()) + c++; + l = c++; + insert_between(post, f, l); + assert(l.ok() && l->when ==w && l->code == BREAK_END); } void -Score_commands::add(Command c) +Score_commands::parser_add(Command *c) { - bool encapsulate =false; + bottom().add(c); +} - Command pre(c.when); - Command mid(c.when); - Command post(c.when); +void +Score_commands::process_add(Command c) +{ + bool encapsulate =false; + Real w = c.when; + Command pre(w); + Command mid(w); + Command post(w); if (c.code == TYPESET) { if (c.args[0] == "BAR") { - set_breakable(c.when); + set_breakable(w); encapsulate = true; mid = c; pre = c; } - if (c.args[0] == "METER" && is_breakable(c.when)) { + if (c.args[0] == "METER" && is_breakable(w)) { encapsulate = true; mid = c; pre = c; @@ -146,14 +176,14 @@ Score_commands::clean(Real l) c.code = TYPESET; c.args.add("BAR"); c.args.add("empty"); - add(c); + process_add(c); } PCursor bot(bottom()); while (bot.ok() && bot->when > l) { - - mtor <<"removing "<< bot->code <<" at " << bot->when<<'\n'; + mtor <<"removing "; + bot->print(); bot.del(); bot = bottom(); } @@ -163,7 +193,7 @@ Score_commands::clean(Real l) c.code = TYPESET; c.args.add("BAR"); c.args.add("||"); - add(c); + process_add(c); } OK(); } @@ -173,6 +203,8 @@ Score_commands::OK() const { for (PCursor cc(*this); cc.ok() && (cc+1).ok(); cc++) { assert(cc->when <= (cc+1)->when); + if (cc->when == (cc+1)->when && !cc->isbreak() && !(cc+1)->isbreak()) + assert(cc->priority >= (cc+1)->priority); } } @@ -183,3 +215,47 @@ Score_commands::print() const cc->print(); } } + +Score_commands* +Score_commands::parse(Real l) const +{ + Score_commands*nc = new Score_commands; + int beats_per_meas=4; + Real measlen = 1.0; // 4/4 by default + + Real inbar=0.0; + int barcount=0; + Real wholes=0.0; + Real stoppos=0.0; + + { + Command c(0.0); + c.code = TYPESET; + c.args.add("BAR"); + c.args.add("empty"); + nc->process_add(c); + } + for (PCursor cc(*this); cc.ok() && cc->when <= l; cc++) { + assert (cc->code==INTERPRET); + if (cc->args[0] == "METER") { + beats_per_meas=cc->args[1].value(); + int one_beat =cc->args[2].value (); + measlen = beats_per_meas/Real(one_beat); + nc->process_add(*get_meter_command(wholes,beats_per_meas, one_beat)); + } + if (cc->args[0] == "SKIP") { + stoppos = wholes + cc->args[1].value() * measlen + cc->args[2].fvalue(); + wholes += (measlen-inbar); // skip at least 1 measure + barcount++; + while (wholes <= stoppos) { + nc->process_add(*get_bar_command(wholes)); // liek + wholes += measlen; + barcount ++; + } + wholes = stoppos; + //something + } + } + + return nc; +} diff --git a/suzan.ly b/suzan.ly index 08c4ddf643..59eb0c7489 100644 --- a/suzan.ly +++ b/suzan.ly @@ -2,6 +2,7 @@ score{ rhythmstaff { - voice { $c2 c2 c2 c2$ } + voice { $ c2 c2 c4. c8 c4 c4 c4 c4 c4 c4 c2 c2$ } } + commands { meter 2 4 skip 2:0 meter 4 4 skip 2:0} } -- 2.39.5