]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.18
authorfred <fred>
Thu, 19 Dec 1996 10:14:43 +0000 (10:14 +0000)
committerfred <fred>
Thu, 19 Dec 1996 10:14:43 +0000 (10:14 +0000)
hdr/command.hh
hdr/getcommand.hh
hdr/staffcommands.hh
src/getcommands.cc
src/inputcommands.cc
src/keyitem.cc
src/simplewalker.cc
src/staff.cc

index e2ece4a6fa6352fb2c173c626bb2cde2a4aaa944..26e47ffa1f244eb0b44ec0c987589be15a67632a 100644 (file)
@@ -16,7 +16,7 @@ enum Commandcode {
 struct Command {
     Commandcode code;
 
-    Real when;
+//    Real when;
     /// analogous to argv[]
     svec<Scalar> args;
 
@@ -28,7 +28,7 @@ struct Command {
     /****************/
     
     Command();
-    Command(Real w);
+//    Command(Real w);
     bool isbreak()const;
     void print() const;
 };
index eb6f624966fa117bb15f9febdbfe3d71aee06239..79e6bd407a2b9f5c85fc0e02743a305ae15f6aaa 100644 (file)
@@ -9,7 +9,7 @@
 #include "proto.hh"
 
 
-Command* get_meter_command( Real,int,int);
+Command* get_meter_command(int,int);
 
 
 
index b7cdef0f9b72585531874e56329f2b87c33b0230..7573595a373f468cad253c18b7d44c336535724e 100644 (file)
@@ -9,28 +9,38 @@
 #include "vray.hh"
 #include "plist.hh"
 
+
+struct Staff_commands_at : public IPointerList<Command*> {
+    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<Command*> firstc,
+                       PCursor<Command*> last);
+    void add(Command c);
+
+};
+
 /// the list of commands in Score
-struct Staff_commands : public IPointerList<Command*> {
-    void process_add(Command);
-    void add_seq(svec<Command>,bool);
+struct Staff_commands : public IPointerList<Staff_commands_at*>
+{
+    Staff_commands_at*find(Real);
+    void add(Command,Real);
     void clean(Real last);
-    void set_breakable(Real when);
-    bool is_breakable(Real w);
-    PCursor<Command*> last_insertion(Real w);
-    PCursor<Command*> 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<Command*> firstc,
-                       PCursor<Command*> 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
index 1ac2cc0bcb9af7deb4ddd34e0785692d3e8fc4df..b415e0b1cfb5d0a1cef5376a4bdeca5bb6acbb9b 100644 (file)
@@ -16,11 +16,11 @@ get_key_typeset_command(svec<Scalar>which)
 }
 
 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 );
index c7f7aaff5632c5c1e58e880c1a165ba0fd9d8685..3a27b3801f93c337e04d5e1bd47348e50d73c83d 100644 (file)
@@ -13,7 +13,7 @@ void
 Commands_at::print() const
 {
 #ifndef NPRINT
-    mtor << "{ at "<<when<<'\n'; 
+    mtor << "Commands_at { at "<<when<<'\n'; 
     mtor << "meter " << whole_per_measure
         << " pos "<< bars << ":" << whole_in_measure <<'\n';
     for (PCursor<Input_command *> 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<Commands_at*> i(*this); i.ok(); i++)
        for (PCursor<Input_command *> 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);
            }
        }
     
index 71f1654f19fad49ea16ca5c0c27d76459018db7a..26ad1745e3ada7a5b2842c9a44184584b311a8d3 100644 (file)
@@ -11,7 +11,6 @@ Keyitem::Keyitem(int c)
     c_position = c;
 }
 
-
 void
 Keyitem::read(svec<int> s)
 {
@@ -30,7 +29,8 @@ Keyitem::add(int p, int a)
 }
 
 void
-Keyitem::preprocess() {
+Keyitem::preprocess()
+{
     brew_molecole();
 }
 
index f275cd272e9b275f39964f10b02f95f25b18dc1e..fcf2558aac4cccf06b098655d319576b0ea75c09 100644 (file)
 #include "slur.hh"
 #include "localkeyitem.hh"
 
+Rhythmic_grouping
+parse_grouping(svec<Scalar> a)
+{
+    Rhythmic_grouping ret;
+    Real one_beat =a[0];
+    a.del(0);
+    svec<int> 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<Scalar> 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") {
-       svec<Scalar>s(com->args);
-       s.del(0);
-       if (com->when) {
+       
+       if (col()->when()) {
            assert(!oldkey_undo);
-           oldkey_undo = new svec<int>( key_.oldkey_undo(s));
+           oldkey_undo = new svec<int>( key_.oldkey_undo(args));
        }
        
-       typesetkey = key_.read(s);
+       typesetkey = key_.read(args);
        local_key_.reset(key_); 
     } else if (com->args[0] == "CLEF") {
-       svec<Scalar>s(com->args);
-       s.del(0);
-       clef_.read(s);
+       clef_.read(args);
     } else {
        WARN << " ignoring INTERPRET command: " << com->args[0]<< '\n';
     }
index cbe0e59bbb77130da3d916c76c82ce6776488d78..f3d6a063bea159b868c0473dd2535582cff20aa2 100644 (file)
@@ -98,9 +98,10 @@ Staff::setup_staffcols()
        }       
     }
 
-    for (PCursor<Command*> cc(*staff_commands_); cc.ok(); cc++) {
+    for (PCursor<Staff_commands_at*> cc(*staff_commands_); cc.ok(); cc++) {
        Staff_column *sc=get_col(cc->when,false);
-       sc->s_commands.add(cc);
+       for (PCursor<Command*> i(**cc); i.ok(); i++)
+           sc->s_commands.add(i);
     }
 }