+++ /dev/null
-/*
- clef.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef CLEF_HH
-#define CLEF_HH
-#include "scalar.hh"
-#include "varray.hh"
-
-/// where is c-0 in the staff?
-class Clef {
-
-public:
- int c0_position_i_;
- String clef_type_str_;
-
- Clef();
- void set_type(String);
-};
-#endif // CLEF_HH
-
+++ /dev/null
-#ifndef COMMAND_HH
-#define COMMAND_HH
-
-#include "glob.hh"
-#include "varray.hh"
-#include "scalar.hh"
-
-/// what kind of command?
-enum Commandcode {
- NOP,
- INTERPRET,
- TYPESET,
- BREAK_PRE,BREAK_MIDDLE, BREAK_POST, BREAK_END
-};
-
-/// set a nonrythmical symbol
-
-/**
- A nonrhythmical "thing" in a staff is called a "command".
- Commands have these properties:
-
- \begin{itemize}
- \item They are \bf{not} rhythmical, i.e. they do not have a duration
- \item They have a staff-wide impact, i.e. a command cannot be targeted at
- only one voice in the staff: two voices sharing a staff can't have
- different clefs
- \item Commands are ordered, that is, when from musical point of view the
- commands happen simultaneously, the order in which Staff receives the
- commands can still make a difference in the output
- \item Some commands are actually score wide, so Score has to issue these
- commands to the Staff, eg. BREAK commands
- \end{itemize}
-
- At this moment we have three classes of commands:
- \begin{description}
- INTERPRET commands are not grouped.
- \item[TYPESET] These commands instruct the Staff to
- typeset symbols on the output, eg meter/clef/key changes
- \item[INTERPRET] These commands do not produce output, instead,
- they change the interpretation of other commands or requests.
- example: shift output vertically, set the key.
- \item[BREAK_XXX] These commands group TYPESET commands in
- prebreak and postbreak commands. See Documentation/breaking
-
- Staff can insert additional commands in a sequence of BREAK_XXX
- commands, eg. key change commands
-
- \end{description}
-
- These commands are generated by Score, since they have to be the
- same for the whole score.
-
-
- \begin{description}
- \item[BREAK_PRE]
- \item[BREAK_MIDDLE]
- \item[BREAK_POST]
- \item[BREAK_END]
- \item[TYPESET] METER,BAR
- \end{description}
-
-
- Commands can be freely copied, they do not have virtual methods.
-
- */
-
-struct Command {
- Commandcode code;
-
- /// analogous to argv[]
- Array<Scalar> args;
-
-
- /** in what order relative to other TYPESET commands (eg, bar
- should precede meter). Highest priority first. */
- int priority;
-
- /* *************** */
-
- Command();
- bool isbreak()const;
- void print() const;
-};
-
-#endif
+++ /dev/null
-/*
- getcommand.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef GETCOMMAND_HH
-#define GETCOMMAND_HH
-#include "proto.hh"
-
-
-Command* get_meter_command(int,int);
-Command get_defaultbar_command();
-
-void split_bar_command(Command &pre_com, Command &no_break_com, Command &post_com,String s);
-
-
-#endif // GETCOMMAND_HH
+++ /dev/null
-/*
- inputcommand.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef INPUTCOMMAND_HH
-#define INPUTCOMMAND_HH
-#include "proto.hh"
-#include "scalar.hh"
-#include "varray.hh"
-#include "moment.hh"
-/// command without time assoced
-struct Input_command {
- /// analogous to argv[]
- Array<Scalar> args;
- void print()const;
- Input_command();
-
- operator Command();
-};
-Input_command*get_cadenza_toggle(int i);
-Input_command *get_meterchange_command( int,int);
-Input_command *get_key_interpret_command(Array<int >);
-Input_command *get_clef_interpret_command(String w);
-Input_command *get_reset_command();
-Input_command *get_partial_command(Moment u);
-Input_command *get_skip_command(int,Moment);
-Input_command *get_grouping_command(Array<int>);
-Input_command *get_bar_command(String);
-Input_command *get_newmeasure_command();
-Input_command *get_goto_command(String);
-Array<int> get_default_grouping(int count, int onenote);
-#endif // INPUTCOMMAND_HH
-
+++ /dev/null
-/*
- inputcommands.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef INPUTCOMMANDS_HH
-#define INPUTCOMMANDS_HH
-
-#include "proto.hh"
-#include "plist.hh"
-#include "real.hh"
-#include "timedescription.hh"
-
-struct Commands_at : public IPointerList<Input_command*> {
- Time_description tdescription_;
-
- /* *************** */
-
- Moment when();
- void parse(Staff_commands_at*);
- void print() const;
- Moment barleft();
- void add(Input_command*);
- void setpartial(Moment);
- Commands_at(const Commands_at&);
- Commands_at(Moment, Commands_at*prev);
-};
-
-struct Input_cursor : public PCursor<Commands_at*>
-{
- /* *************** */
- Input_cursor(PCursor<Commands_at*>);
- Moment when()const;
- void find_moment(Moment w);
- void prev() { operator --(0); }
- void next() { operator ++(0); }
-};
-
-/// the list of commands in Score
-struct Input_commands : public IPointerList<Commands_at*> {
- Input_cursor ptr;
-
- /* *************** */
-
- void find_moment(Moment);
- void add(Input_command c,Assoc<String,Moment> &marks_assoc_r);
- void do_skip(int bars, Moment wholes);
-
- Input_commands();
- Input_commands(Input_commands const&);
-
- void reset();
- void print()const;
- void parse(Staff *) const;
-};
-
-#endif // INPUTCOMMANDS_HH
-
+++ /dev/null
-/*
- lilypond, (c) 1996,97 Han-Wen Nienhuys
-*/
-#ifndef SCORECOMMANDS_HH
-#define SCORECOMMANDS_HH
-
-#include "proto.hh"
-#include "command.hh"
-#include "varray.hh"
-#include "plist.hh"
-#include "timedescription.hh"
-
-
-struct Staff_commands_at : public IPointerList<Command*> {
- Time_description tdescription_;
-
- /* *************** */
-
- bool is_breakable();
- Moment when();
- Staff_commands_at(Time_description);
- 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);
-};
-
-#endif
-
+++ /dev/null
-/*
- clef.cc -- implement Clef
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>,
- Mats Bengtsson <matsb@s3.kth.se>
-*/
-
-#include "clef.hh"
-#include "debug.hh"
-
-Clef::Clef()
-{
- set_type("violin");
-}
-
-void
-Clef::set_type(String type_str)
-{
- clef_type_str_ = type_str;
- if (clef_type_str_ == "violin") {
- c0_position_i_= -2;
- } else if (clef_type_str_ == "alto") {
- c0_position_i_= 4;
- } else if (clef_type_str_ == "tenor") {
- c0_position_i_= 6;
- } else if (clef_type_str_ == "bass") {
- c0_position_i_= 10;
- } else
- error("unknown clef type `"+clef_type_str_+"\'");
-}
+++ /dev/null
-#include "string.hh"
-#include "debug.hh"
-#include "command.hh"
-
-bool
-Command::isbreak()const
-{
- return (code >= BREAK_PRE && code <= BREAK_END);
-}
-
-Command::Command()
-{
- code = NOP;
- priority=0;
-}
-
-void
-Command::print() const
-{
-#ifndef NPRINT
- mtor << "Command " << "code " << code << " prio " << priority;
- if ( isbreak())
- mtor << "(break separator)";
- if (args.size()) {
- mtor<< " args: ";
- for (int i = 0; i<args.size(); i++)
- mtor << "`"<<args[i] <<"',";
- }
- mtor << "\n";
-#endif
-}
+++ /dev/null
-#include "keyitem.hh"
-
-#include "request.hh"
-#include "pscore.hh"
-#include "paperdef.hh"
-#include "complexstaff.hh"
-#include "sccol.hh"
-#include "debug.hh"
-
-#include "clefitem.hh"
-#include "bar.hh"
-#include "meter.hh"
-const NO_LINES = 5;
-
-Item *
-Complex_staff::get_TYPESET_item(Command *com)
-{
- Item *s=0;
- Array<Scalar> arg( com->args);
- String type =arg[0];
- arg.del(0);
- if (com->args[0] == "KEY") {
- return new Keyitem(NO_LINES); // urgh. depends on clef.
- } else if (type == "BAR" ) {
- s = new Bar(com->args[1]);
- } else if (type == "METER") {
- s = new Meter(arg);
- } else if (type == "CLEF" || type == "CURRENTCLEF") {
- Clef_item * c = new Clef_item;
- s = c;
- c->change = (type == "CLEF");
- }else{
- WARN << "ignoring TYPESET command for " << type << '\n';
- }
- return s;
-}
-
-
-
-Interval
-itemlist_width(const Array<Item*> &its)
-{
- Interval iv ;
- iv.set_empty();
-
- for (int j =0; j < its.size(); j++){
- iv.unite (its[j]->width());
-
- }
- return iv;
-}
-
-void
-Complex_column::typeset_item(Item *i, int breakst)
-{
- assert(i);
-
- staff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
- staff_l_->pstaff_l_,breakst);
-
- if (breakst == BREAK_PRE - BREAK_PRE) {
-
- Array<Item*> to_move(
- staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_,
- score_column_l_->pcol_l_->prebreak_p_));
- Interval column_wid = itemlist_width(to_move);
- assert(!column_wid.empty());
-
- for (int j=0; j < to_move.size(); j++) {
- to_move[j]->translate(Offset(-column_wid.right, 0));
- }
- }
-}
-/*
- UGGGG
- */
-void
-Complex_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH!
-{
- assert(i);
- PCol * c=score_column_l_->pcol_l_;
- if (breakst == 0)
- c = c->prebreak_p_;
- else if (breakst == 2)
- c = c->postbreak_p_;
-
- Array<Item*> to_move(staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_,
- c));
- typeset_item(i, breakst);
-
- Interval column_wid = itemlist_width(to_move);
- if (column_wid.empty())
- column_wid = Interval(0,0);
- i->translate(Offset(column_wid[dir] - i->width()[-dir], 0));
-}
-
-void
-Complex_staff::set_output(PScore* pscore_l )
-{
- pstaff_l_ = new PStaff(pscore_l); // pstaff_l_ is added to pscore later.
- pscore_l_ = pscore_l;
- pscore_l_->add(pstaff_l_);
-}
-
-
+++ /dev/null
-#include "string.hh"
-#include "inputcommand.hh"
-#include "parseconstruct.hh"
-#include "command.hh"
-
-Command*
-get_key_typeset_command(Array<Scalar>which)
-{
- Command*c = new Command;
- c->code = TYPESET;
- c->args = which;
- String k("KEY");
- c->args.insert(k,0 );
- c->priority = 70;
- return c;
-}
-
-Command *
-get_meter_command(int n, int m)
-{
- Command*c = new Command;
-
- c->code = TYPESET;
- c->args.push( "METER");
- c->args.push( n );
- c->args.push( m );
- c->priority = 40;
- return c;
-}
-
-Command
-get_defaultbar_command()
-{
- Command c;
- c.code = TYPESET;
- c.args.push("BAR");
- c.args.push("default");
- return c;
-}
-
-void
-split_bar_command(Command &pre_com, Command &no_break_com, Command &post_com,
- String s)
-{
- Command c;
- c.code = TYPESET;
- c.priority = (s=="default") ? 100: 110;
- c.args.push("BAR");
- if(s=="default")
- s = "|";
-
- if (s == ":|:") {
- no_break_com=post_com=pre_com = c;
-
- pre_com.args.push( ":|");
- no_break_com.args.push( s);
- post_com.args.push( "|:");
- }else if (s=="|:") {
- c.args.push(s);
- no_break_com=post_com=c;
- } else {
- c.args.push(s);
- pre_com= no_break_com= c;
- }
-}
+++ /dev/null
-#include "inputcommand.hh"
-#include "debug.hh"
-#include "command.hh"
-
-Input_command::Input_command()
-{
-}
-
-
-Input_command::operator Command()
-{
- Command c;
- if (!args.size())
- return c;
-
- c.code = INTERPRET;
- String s = args[0];
-
- int p=0;
- if (s == "KEY")
- p = 200;
- else if (s=="CLEF")
- p = 190;
- else if (s == "METER")
- p = 180;
- else if (s == "BAR")
- p = 170;
- else if (s == "GROUPING")
- p = 160;
-
- c.priority = p;
- c.args = args;
-
- return c;
-}
-
-
-Input_command*
-get_partial_command(Moment u)
-{
- Input_command*c = new Input_command;
- 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.push("GROUPING");
- for (int i=0; i < a.size(); i ++)
- c->args.push(a[i]);
-
- return c;
-}
-
-Input_command*
-get_key_interpret_command(Array<int >a )
-{
- Input_command*c = new Input_command;
- c->args.push("KEY");
- for (int i=0; i < a.size(); i ++) {
- c->args.push(a[i]);
- }
- return c;
-}
-
-Input_command*
-get_reset_command()
-{
- Input_command*c = new Input_command;
- c->args.push("RESET");
- return c;
-}
-
-Input_command *
-get_meterchange_command(int n, int m)
-{
- Input_command*c = new Input_command;
-
- c->args.push( "METER");
- c->args.push( n );
- c->args.push( m );
-
- return c;
-}
-
-Input_command *
-get_newmeasure_command()
-{
- Input_command*c = new Input_command;
- c->args.push( "NEWMEASURE");
- return c;
-}
-
-Input_command *
-get_skip_command(int n, Moment m)
-{
- Input_command*c = new Input_command;
-
- c->args.push( "SKIP");
- c->args.push( n );
- c->args.push( m );
-
- return c;
-}
-
-
-void
-Input_command::print()const
-{
-#ifndef NPRINT
- mtor << "{ ";
- if (args.size()) {
- mtor<< " args: ";
- 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.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;
-}
-
-Array<int>
-get_default_grouping(int count, int one_beat_note)
-{
- Array<int> s;
- if (!(count % 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.push(2);
- s.push(one_beat_note);
- }
-
- }else {
- s.push(2);
- s.push(one_beat_note);
- s.concat(get_default_grouping(count-2, one_beat_note));
- }
- return s;
-}
+++ /dev/null
-#include "inputcommands.hh"
-#include "inputcommand.hh"
-#include "debug.hh"
-#include "staffcommands.hh"
-#include "getcommand.hh"
-#include "command.hh"
-#include "stcol.hh"
-#include "staff.hh"
-#include "assoc.hh"
-#include "lexer.hh"
-
-void
-Commands_at::print() const
-{
-#ifndef NPRINT
- mtor << "Commands_at {";
- tdescription_.print();
- for (iter_top(*this,cc); cc.ok(); cc++)
- cc->print();
- 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) {
- bottom().add(get_newmeasure_command());
- }
-}
-
-void
-Commands_at::add(Input_command *i)
-{
- bottom().add(i);
-
- // should check for other meterchanges here.
- if (i->args[0] == "METER") {
- int l = i->args[1];
- int o = i->args[2];
- tdescription_.set_meter(l,o);
- bottom().add(get_grouping_command( get_default_grouping(l,o)));
- }
-}
-
-Commands_at::Commands_at(Commands_at const&src) :
- tdescription_(src.tdescription_)
-{
- IPointerList<Input_command*> &me(*this);
- const IPointerList<Input_command*> &that(src);
-
- PL_copy(me, that);
-}
-
-void
-Commands_at::setpartial(Moment p)
-{
- tdescription_.setpartial(p);
-}
-
-Moment
-Commands_at::barleft()
-{
- return tdescription_.barleft();
-}
-
-void
-Commands_at::parse(Staff_commands_at*s)
-{
- s->tdescription_ = tdescription_;
- for (iter_top(*this,cc); cc.ok(); cc++) {
- if (cc->args.size() && cc->args[0] !="") {
- Command c = **cc;
- s->add(c);
-
- }
- }
-}
-/* *************** */
-
-void
-Input_cursor::find_moment(Moment w)
-{
- Moment last = when();
- while (1) {
- if (! ok() ) {
- *this = list().bottom();
-
- 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);
- add(c);
- } else if (when() == w ) {
- return ;
- } else if (when() > w )
- break;
-
-
- last = when();
- next();
- }
-
- prev();
- Moment dt = (w - when());
- Commands_at * c = new Commands_at(dt, *this);
- add(c);
- next();
-}
-
-
-
-/* *************** */
-void
-Input_commands::find_moment(Moment m)
-{
- ptr.find_moment(m);
-}
-
-Input_commands::Input_commands(Input_commands const&src)
- : ptr(src.ptr)
-{
- IPointerList<Commands_at*> &me(*this);
- const IPointerList<Commands_at*> &that(src);
-
- PL_copy(me, that);
-}
-
-Input_commands::Input_commands()
- : ptr (bottom())
-{
- Commands_at * p = new Commands_at(0,0);
- bottom().add(p);
- ptr = bottom();
-}
-
-void
-Input_commands::do_skip(int bars, Moment wholes)
-{
- while (bars > 0) {
- Moment b = ptr->barleft();
- ptr.find_moment(ptr->when() + b);
- bars --;
- }
- if (wholes) {
- ptr.find_moment(ptr->when() + wholes);
- }
-}
-
-
-void
-Input_commands::add(Input_command c, Assoc<String,Moment> &marks_assoc_r)
-{
- String s(c.args[0]);
- if (s == "CADENZA") {
- ptr->tdescription_.set_cadenza((int)c.args[1]);
- } if (s == "PARTIAL") {
- ptr->setpartial(c.args[1]);
- } else if (s == "GROUPING") {
- Input_command *ic = new Input_command(c);
- ic->args.insert(ptr->tdescription_.one_beat, 1);
- ptr->add(ic);
- } 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 (s == "SKIP") {
- int bars = c.args[1] ;
- Moment wholes= c.args[2];
- do_skip(bars, wholes);
- } else if (s == "RESET") {
- ptr= top();
- } else if (s=="GOTO") {
- ptr = top();
- String m(c.args[1]);
- if (!marks_assoc_r.elt_query(m)) {
- warning( "Unknown marker: `" +m + "\'", 0 );
- return;
- }
-
- ptr.find_moment(marks_assoc_r[m]);
- } else {
- Input_command *ic = new Input_command(c);
- ptr->add(ic);
- }
-
-}
-
-void
-Input_commands::parse(Staff * staff_l) const
-{
- print();
- for (iter_top(*this,i); i.ok(); i++) {
-
- Staff_column* col_l = staff_l->get_col(i->when(), false);
- if (!col_l->staff_commands_p_)
- col_l->staff_commands_p_ = new Staff_commands_at(i->tdescription_);
-
- Staff_commands_at * com_l = col_l->staff_commands_p_;
-
- if (!i->when()) { /* all pieces should start with a breakable. */
- com_l->set_breakable();
- }
-
- i->parse(com_l);
- }
-}
-
-
-void
-Input_commands::print() const
-{
-#ifndef NPRINT
- for (iter_top(*this,cc); cc.ok() ; cc++) {
- cc->print();
- }
-#endif
-}
-/* *************** */
-
-Moment
-Input_cursor::when()const
-{
- return (*this)->when();
-}
-Input_cursor::Input_cursor(PCursor<Commands_at *>c)
- : PCursor<Commands_at*>(c)
-{
-}
+++ /dev/null
-#include "staffcommands.hh"
-#include "debug.hh"
-#include "parseconstruct.hh"
-#include "getcommand.hh"
-
-Moment
-Staff_commands_at::when()
-{
- return tdescription_.when;
-}
-
-void
-Staff_commands_at::print() const
-{
-#ifndef NPRINT
- iter_top(*this,i);
- mtor << "Commands at: " ;
- tdescription_.print();
-
- for (; i.ok(); i++)
- i->print();
-#endif
-}
-void
-Staff_commands_at::OK()const
-{
-#ifndef NDEBUG
- iter_top(*this,i);
- for (; i.ok() && (i+1).ok(); i++)
- if (!i->isbreak() && !(i+1)->isbreak())
- assert(i->priority >= (i+1)->priority);
-#endif
-}
-
-Staff_commands_at::Staff_commands_at(Time_description m)
- :tdescription_(m)
-{
-
-}
-
-bool
-Staff_commands_at::is_breakable()
-{
- iter_top(*this,i);
- for (; i.ok(); i++) {
- if (i->isbreak())
- return true;
- }
- return false;
-}
-
-void
-Staff_commands_at::set_breakable()
-{
- if (is_breakable()) return;
-
- Command k;
- k.code = BREAK_PRE;
- bottom().add(new Command(k));
- k.code = BREAK_MIDDLE;
- bottom().add(new Command(k));
- k.code = BREAK_POST;
- bottom().add(new Command(k));
- k.code = BREAK_END;
- bottom().add(new Command(k));
-}
-
-void
-Staff_commands_at::insert_between(Command victim, PCursor<Command*> firstc,
- PCursor<Command*> last)
-{
- PCursor<Command*> c(firstc+1);
-// assert(firstc < last&&last.ok());
- assert(firstc->code < last->code && last.ok());
-
-// while (c < last) {
- while (c->code < last->code ) {
- if (c->priority <= victim.priority) {
- c.insert(new Command(victim));
- return;
- }
- c++;
- }
- last.insert(new Command(victim));
-}
-
-void
-Staff_commands_at::add_command_to_break(Command pre, Command mid,Command post)
-{
- assert(is_breakable());
- iter_top(*this,c), f(c), l(c);
-
- while (!c->isbreak())
- c++;
- f = c++;
- while (!c->isbreak())
- c++;
- l = c++;
-
- insert_between(pre, f, l);
- f = l;
- while (!c->isbreak())
- c++;
- l = c++;
- insert_between(mid, f, l);
- f = l;
- while (!c->isbreak())
- c++;
- l = c++;
- assert(l.ok() && l->code == BREAK_END);
-
- insert_between(post, f, l);
-}
-
-
-/*
- should move this stuff into inputlanguage.
- */
-void
-Staff_commands_at::add(Command c)
-{
- bool encapsulate =false;
- Command pre;
- Command mid;
- Command post;
-
- if (c.code == INTERPRET)
- { // UGH
- Command typeset; // kut met peren
- typeset.code = TYPESET;
- typeset.args = c.args;
- if (c.args[0] == "NEWMEASURE") {
- add(get_defaultbar_command());
- } else if (c.args[0] == "BAR") {
- add(typeset);
- c.code= NOP; // no INTERPRET (BAR) commands
- } else if (c.args[0] == "KEY") {
- typeset.priority = 70;
- add(typeset);
- } else if (c.args[0] == "CLEF") {
- typeset.priority = 90;
- add(typeset);
- } else if (c.args[0] == "METER") {
- typeset.priority = 40;
- add(typeset);
- return;
- }
- }
-
- // kut en peer
- if (c.code == TYPESET) {
- encapsulate = is_breakable();
- if (c.args[0] == "BAR") {
- set_breakable();
- encapsulate = true;
- split_bar_command(pre,mid,post, c.args[1]);
-
- { /* every line a currentkey. */
- Command kc;
- kc.code =TYPESET;
- kc.args.push( "CURRENTKEY");
- kc.priority = 60;
- add(kc);
- }
- { /* every line a currentclef. */
- Command kc;
- kc.code =TYPESET;
- kc.args.push( "CURRENTCLEF");
- kc.priority = 80;
- add(kc);
- }
- }
- if (is_breakable()) {
- if (c.args[0] == "METER") {
- mid = c;
- pre = c;
- post =c;
- }else if( c.args[0] == "KEY") {
-
- mid = c;
- pre = c;
- post = c;
- }else if (c.args[0] == "CURRENTKEY" ){
- post = c;
-
- }else
- if (c.args[0] == "CURRENTCLEF" ){
- post = c;
-
- }else if (c.args[0] == "CLEF") {
-
- post = c;
- pre = c;
- mid = c;
- }
- }
- }
-
- if (encapsulate)
- add_command_to_break(pre, mid, post);
- else {
- if (c.priority>0)
- top().insert(new Command(c));
- else
- bottom().add(new Command(c));
- }
-}
-