]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/inputcommand.cc
release: 0.0.31
[lilypond.git] / src / inputcommand.cc
index fda5ceefcf5b85d853e0b5393a737251c5c1463c..aab0ea4a8b8a69ec599ce3da8a52c16611806abb 100644 (file)
@@ -10,7 +10,7 @@ Input_command::Input_command()
 Input_command::operator Command()
 {
     Command c;
-    if (!args.sz())
+    if (!args.size())
        return c;
     
     c.code = INTERPRET;
@@ -39,29 +39,47 @@ Input_command*
 get_partial_command(Moment u)
 {
     Input_command*c = new Input_command;
-    c->args.add("PARTIAL");
-    c->args.add(u);
+    c->args.push("PARTIAL");
+    c->args.push(u);
     return c;
 }
 
 Input_command*
-get_grouping_command(svec<int>a ) 
+get_goto_command(String s)
 {
     Input_command*c = new Input_command;
-    c->args.add("GROUPING");    
-    for (int i=0; i < a.sz(); i ++)
-       c->args.add(a[i]);
+    c->args.push("GOTO");
+    c->args.push(s);
+    return c;
+}
+
+Input_command*
+get_cadenza_toggle(int i)
+{
+    
+    Input_command*c = new Input_command;
+    c->args.push("CADENZA");
+    c->args.push(i);
+    return c;
+}
+Input_command*
+get_grouping_command(Array<int>a ) 
+{
+    Input_command*c = new Input_command;
+    c->args.push("GROUPING");    
+    for (int i=0; i < a.size(); i ++)
+       c->args.push(a[i]);
 
     return c;
 }
 
 Input_command*
-get_key_interpret_command(svec<int >a ) 
+get_key_interpret_command(Array<int >a ) 
 {
     Input_command*c = new Input_command;
-    c->args.add("KEY");
-    for (int i=0; i < a.sz(); i ++) {
-       c->args.add(a[i]);
+    c->args.push("KEY");
+    for (int i=0; i < a.size(); i ++) {
+       c->args.push(a[i]);
     }
     return c;
 }
@@ -70,7 +88,7 @@ Input_command*
 get_reset_command()
 {
     Input_command*c = new Input_command;
-    c->args.add("RESET");
+    c->args.push("RESET");
     return c;
 }
 
@@ -79,21 +97,18 @@ get_meterchange_command(int n, int m)
 {
     Input_command*c = new Input_command;
 
-    c->args.add( "METER");
-    c->args.add( n );
-    c->args.add( m );
+    c->args.push( "METER");
+    c->args.push( n );
+    c->args.push( m );
 
     return c;
 }
 
 Input_command *
-get_bar_command()
+get_newmeasure_command()
 {
     Input_command*c = new Input_command;
-
-    c->args.add( "BAR");
-    c->args.add( "|");
-
+    c->args.push( "NEWMEASURE");
     return c;
 }
 
@@ -102,9 +117,9 @@ get_skip_command(int n, Moment m)
 {
     Input_command*c = new Input_command;
     
-    c->args.add( "SKIP");
-    c->args.add( n );
-    c->args.add( m );
+    c->args.push( "SKIP");
+    c->args.push( n );
+    c->args.push( m );
 
     return c;
 }
@@ -113,37 +128,54 @@ get_skip_command(int n, Moment m)
 void
 Input_command::print()const
 {
+#ifndef NPRINT
     mtor << "{ ";
-    if (args.sz()) {
+    if (args.size()) {
        mtor<< " args: ";
-       for (int i = 0; i<args.sz(); i++)
+       for (int i = 0; i<args.size(); i++)
            mtor << "`"<<args[i] <<"',";
     }
     mtor << "}\n";
+#endif    
 }
 
 Input_command*
 get_clef_interpret_command(String w)
 {
     Input_command*c = new Input_command;
-    c->args.add("CLEF");
-    c->args.add(w);
+    c->args.push("CLEF");
+    c->args.push(w);
+    return c;
+}
+
+Input_command*
+get_bar_command(String w)
+{
+    Input_command*c = new Input_command;
+    c->args.push("BAR");
+    c->args.push(w);
     return c;
 }
 
-svec<int>
-get_default_grouping(int count)
+Array<int>
+get_default_grouping(int count, int one_beat_note)
 {
-    svec<int> s;
+    Array<int> s;
     if (!(count % 3 )) {
-       for (int i=0; i < count/3; i++)
-           s.add(3);
+       for (int i=0; i < count/3; i++) {
+           s.push(3);
+           s.push(one_beat_note);
+       }
     } else if (!(count %2)) {
-       for (int i=0; i < count/2; i++)
-           s.add(2);
+       for (int i=0; i < count/2; i++) {
+           s.push(2);
+           s.push(one_beat_note);
+       }
+           
     }else {
-       s.add(2);
-       s.concat(get_default_grouping(count-2));
+       s.push(2);
+       s.push(one_beat_note);
+       s.concat(get_default_grouping(count-2, one_beat_note));
     }
     return s;
 }