/*
inputcommands.hh -- part of LilyPond
- (c) 1996 Han-Wen Nienhuys
+ (c) 1996,97 Han-Wen Nienhuys
*/
#ifndef INPUTCOMMANDS_HH
/****************/
Moment when();
- void parse(Staff_commands_at*);
+ void parse(Staff_commands_at*);
void print() const;
Moment barleft();
void add(Input_command*);
/****************/
void find_moment(Moment);
- void add(Input_command c);
+ void add(Input_command c,Assoc<String,Moment> &marks_assoc_r);
void do_skip(int bars, Moment wholes);
Input_commands();
#include "command.hh"
#include "stcol.hh"
#include "staff.hh"
+#include "assoc.hh"
void
Commands_at::print() const
mtor << "}\n";
#endif
}
+
Moment
Commands_at::when()
{
return tdescription_.when;
}
+
Commands_at::Commands_at(Moment dt, Commands_at* prev)
: tdescription_(dt, (prev)? &prev->tdescription_ : 0)
{
- if (prev&& !tdescription_.whole_in_measure) {
+ if (prev && !tdescription_.whole_in_measure) {
bottom().add(get_newmeasure_command());
}
}
int o = i->args[2];
tdescription_.set_meter(l,o);
bottom().add(get_grouping_command( get_default_grouping(l)));
-
}
}
while (1) {
if (! ok() ) {
*this = list().bottom();
- Moment dt = (w - when()) <? ptr()->barleft();
+
+ Moment dt = (w - when());
+ if ( !ptr()->tdescription_.cadenza_b_ )
+ dt = dt <? ptr()->barleft();
Commands_at * c = new Commands_at(dt, *this);
assert(c->when() <= w);
/****************/
+
Input_commands::Input_commands(Input_commands const&src)
: ptr(src.ptr)
{
void
-Input_commands::add(Input_command c)
-{
- if (c.args[0] == "PARTIAL") {
+Input_commands::add(Input_command c, Assoc<String,Moment> &marks_assoc_r)
+{
+ String s(c.args[0]);
+ if (s == "CADENZA") {
+ ptr->tdescription_.set_cadenza(c.args[1]);
+ } if (s == "PARTIAL") {
ptr->setpartial(c.args[1]);
- } else if (c.args[0] == "GROUPING") {
+ } else if (s == "GROUPING") {
Input_command *ic = new Input_command(c);
ic->args.insert(ptr->tdescription_.one_beat, 1);
ptr->add(ic);
- } else if (c.args[0] == "METER") {
+ } else if (s == "METER") {
int beats_per_meas = c.args[1];
int one_beat = c.args[2];
Input_command *ch = get_meterchange_command(beats_per_meas, one_beat);
ptr->add(ch);
- } else if (c.args[0] == "SKIP") {
+ } else if (s == "SKIP") {
int bars = c.args[1] ;
Moment wholes= c.args[2];
do_skip(bars, wholes);
- } else if (c.args[0] == "RESET") {
+ } else if (s == "RESET") {
ptr= top();
+ } else if (s=="GOTO") {
+ ptr = top();
+ String m(c.args[1]);
+ if (!marks_assoc_r.elt_query(m))
+ error("Unknown marker: `" +m + "\'");
+
+ ptr.find_moment(marks_assoc_r[m]);
} else {
Input_command *ic = new Input_command(c);
ptr->add(ic);
if (!i->when()) { /* all pieces should start with a breakable. */
com_l->set_breakable();
- #if 0
- Command c;//(0.0);
- c.code = INTERPRET;
- c.args.add("BAR");
- c.args.add("empty");
- com_l->add(c);
- #endif
}
i->parse(com_l);