]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/inputcommand.cc
release: 0.0.31
[lilypond.git] / src / inputcommand.cc
index 9cedc52c2ab5c42d5d235999f533d85bab375d1b..aab0ea4a8b8a69ec599ce3da8a52c16611806abb 100644 (file)
@@ -39,18 +39,36 @@ 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_goto_command(String s)
+{
+    Input_command*c = new Input_command;
+    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.add("GROUPING");    
+    c->args.push("GROUPING");    
     for (int i=0; i < a.size(); i ++)
-       c->args.add(a[i]);
+       c->args.push(a[i]);
 
     return c;
 }
@@ -59,9 +77,9 @@ Input_command*
 get_key_interpret_command(Array<int >a ) 
 {
     Input_command*c = new Input_command;
-    c->args.add("KEY");
+    c->args.push("KEY");
     for (int i=0; i < a.size(); i ++) {
-       c->args.add(a[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,9 +97,9 @@ 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;
 }
@@ -90,9 +108,7 @@ Input_command *
 get_newmeasure_command()
 {
     Input_command*c = new Input_command;
-
-    c->args.add( "NEWMEASURE");
-
+    c->args.push( "NEWMEASURE");
     return c;
 }
 
@@ -101,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;
 }
@@ -112,6 +128,7 @@ get_skip_command(int n, Moment m)
 void
 Input_command::print()const
 {
+#ifndef NPRINT
     mtor << "{ ";
     if (args.size()) {
        mtor<< " args: ";
@@ -119,14 +136,15 @@ Input_command::print()const
            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;
 }
 
@@ -134,24 +152,30 @@ Input_command*
 get_bar_command(String w)
 {
     Input_command*c = new Input_command;
-    c->args.add("BAR");
-    c->args.add(w);
+    c->args.push("BAR");
+    c->args.push(w);
     return c;
 }
 
 Array<int>
-get_default_grouping(int count)
+get_default_grouping(int count, int one_beat_note)
 {
     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;
 }