From: fred Date: Thu, 19 Dec 1996 10:14:43 +0000 (+0000) Subject: lilypond-0.0.18 X-Git-Tag: release/1.5.59~6553 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1d37b09bc312cba9fe676873079d3c9f26890a33;p=lilypond.git lilypond-0.0.18 --- diff --git a/hdr/command.hh b/hdr/command.hh index e2ece4a6fa..26e47ffa1f 100644 --- a/hdr/command.hh +++ b/hdr/command.hh @@ -16,7 +16,7 @@ enum Commandcode { struct Command { Commandcode code; - Real when; +// Real when; /// analogous to argv[] svec args; @@ -28,7 +28,7 @@ struct Command { /****************/ Command(); - Command(Real w); +// Command(Real w); bool isbreak()const; void print() const; }; diff --git a/hdr/getcommand.hh b/hdr/getcommand.hh index eb6f624966..79e6bd407a 100644 --- a/hdr/getcommand.hh +++ b/hdr/getcommand.hh @@ -9,7 +9,7 @@ #include "proto.hh" -Command* get_meter_command( Real,int,int); +Command* get_meter_command(int,int); diff --git a/hdr/staffcommands.hh b/hdr/staffcommands.hh index b7cdef0f9b..7573595a37 100644 --- a/hdr/staffcommands.hh +++ b/hdr/staffcommands.hh @@ -9,28 +9,38 @@ #include "vray.hh" #include "plist.hh" + +struct Staff_commands_at : public IPointerList { + Real when; + + /****************/ + + bool is_breakable(); + + Staff_commands_at(Real); + void set_breakable(); + void add_command_to_break(Command pre, Command mid,Command post); + void print() const; + void OK() const; + void insert_between(Command victim, PCursor firstc, + PCursor last); + void add(Command c); + +}; + /// the list of commands in Score -struct Staff_commands : public IPointerList { - void process_add(Command); - void add_seq(svec,bool); +struct Staff_commands : public IPointerList +{ + Staff_commands_at*find(Real); + void add(Command,Real); void clean(Real last); - void set_breakable(Real when); - bool is_breakable(Real w); - PCursor last_insertion(Real w); - PCursor first(Real w); - void add_command_to_break(Command pre, Command mid,Command post); void OK() const; void print() const; Real last() const; - void insert_between(Command victim, PCursor firstc, - PCursor last); }; /** the list of commands in Score. Put in a separate class, since it otherwise clutters the methods of Score. - This class serves two purposes: it stores the commands (via - parser_add()) in the yacc parser. at a later stage, some 'high - level' commands are converted (method: parse()) */ #endif diff --git a/src/getcommands.cc b/src/getcommands.cc index 1ac2cc0bcb..b415e0b1cf 100644 --- a/src/getcommands.cc +++ b/src/getcommands.cc @@ -16,11 +16,11 @@ get_key_typeset_command(svecwhich) } Command * -get_meter_command(Real w, int n, int m) +get_meter_command(int n, int m) { Command*c = new Command; - c->when = w; +// c->when = w; c->code = TYPESET; c->args.add( "METER"); c->args.add( n ); diff --git a/src/inputcommands.cc b/src/inputcommands.cc index c7f7aaff56..3a27b3801f 100644 --- a/src/inputcommands.cc +++ b/src/inputcommands.cc @@ -13,7 +13,7 @@ void Commands_at::print() const { #ifndef NPRINT - mtor << "{ at "< cc(*this); cc.ok(); cc++) @@ -47,7 +47,7 @@ Commands_at::Commands_at(Real dt, Commands_at* prev) } void -Commands_at::add(Input_command *i ) +Commands_at::add(Input_command *i) { bottom().add(i); if (i->args[0] == "METER") { // should check for other meterchanges here. @@ -81,7 +81,6 @@ Commands_at::setpartial(Real p) } Real Commands_at::barleft() - { return whole_per_measure-whole_in_measure; } @@ -180,19 +179,19 @@ Input_commands::parse() const Staff_commands*nc = new Staff_commands; { /* all pieces should start with a breakable. */ - Command c(0.0); + Command c;//(0.0); c.code = INTERPRET; c.args.add("BAR"); c.args.add("empty"); - nc->process_add(c); + nc->add(c,0.0); } for (PCursor i(*this); i.ok(); i++) for (PCursor cc(**i); cc.ok(); cc++) { if (cc->args.sz() && cc->args[0] !="") { Command c = **cc; - c.when = i->when; - nc->process_add(c); +// c.when = i->when; + nc->add(c, i->when); } } diff --git a/src/keyitem.cc b/src/keyitem.cc index 71f1654f19..26ad1745e3 100644 --- a/src/keyitem.cc +++ b/src/keyitem.cc @@ -11,7 +11,6 @@ Keyitem::Keyitem(int c) c_position = c; } - void Keyitem::read(svec s) { @@ -30,7 +29,8 @@ Keyitem::add(int p, int a) } void -Keyitem::preprocess() { +Keyitem::preprocess() +{ brew_molecole(); } diff --git a/src/simplewalker.cc b/src/simplewalker.cc index f275cd272e..fcf2558aac 100644 --- a/src/simplewalker.cc +++ b/src/simplewalker.cc @@ -16,25 +16,48 @@ #include "slur.hh" #include "localkeyitem.hh" +Rhythmic_grouping +parse_grouping(svec a) +{ + Rhythmic_grouping ret; + Real one_beat =a[0]; + a.del(0); + svec r; + for (int i= 0 ; i < a.sz(); i++) + r.add(a[i]); + Real here =0.0; + for (int i=0; i < r.sz(); i++) { + ret.divisions.add(here); + Real last = here; + here += one_beat * r[i]; + Rhythmic_grouping *child =new Rhythmic_grouping(Interval(last, here)); + child->split(r[i]); + ret.children.add(child); + } + ret.divisions.add(here); +} + void Simple_walker::do_INTERPRET_command(Command*com) { - if (com->args[0] == "BAR") { + svec args(com->args); + args.del(0); + if (com->args[0] == "GROUPING") { + default_grouping = parse_grouping(args); + }else if (com->args[0] == "BAR") { local_key_.reset(key_); + current_grouping = default_grouping; } else if (com->args[0] == "KEY") { - svecs(com->args); - s.del(0); - if (com->when) { + + if (col()->when()) { assert(!oldkey_undo); - oldkey_undo = new svec( key_.oldkey_undo(s)); + oldkey_undo = new svec( key_.oldkey_undo(args)); } - typesetkey = key_.read(s); + typesetkey = key_.read(args); local_key_.reset(key_); } else if (com->args[0] == "CLEF") { - svecs(com->args); - s.del(0); - clef_.read(s); + clef_.read(args); } else { WARN << " ignoring INTERPRET command: " << com->args[0]<< '\n'; } diff --git a/src/staff.cc b/src/staff.cc index cbe0e59bbb..f3d6a063be 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -98,9 +98,10 @@ Staff::setup_staffcols() } } - for (PCursor cc(*staff_commands_); cc.ok(); cc++) { + for (PCursor cc(*staff_commands_); cc.ok(); cc++) { Staff_column *sc=get_col(cc->when,false); - sc->s_commands.add(cc); + for (PCursor i(**cc); i.ok(); i++) + sc->s_commands.add(i); } }