+++ /dev/null
-qlp.o: qlp.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh const.hh \
- ../flower/real.hh qlp.hh ../flower/matrix.hh ../flower/vsmat.hh \
- ../flower/vector.hh ../flower/choleski.hh
-qlpsolve.o: qlpsolve.cc qlpsolve.hh qlp.hh ../flower/matrix.hh \
- ../flower/vsmat.hh ../flower/vray.hh ../flower/real.hh \
- ../flower/vector.hh const.hh debug.hh ../flower/dstream.hh \
- ../flower/string.hh ../flower/stringutil.hh ../flower/assoc.hh \
- ../flower/choleski.hh
-break.o: break.cc linespace.hh glob.hh ../flower/real.hh proto.hh \
- const.hh ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl \
- ../flower/vray.hh cols.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- item.hh tex.hh ../flower/compare.hh ../flower/matrix.hh \
- ../flower/vsmat.hh ../flower/vector.hh debug.hh ../flower/dstream.hh \
- ../flower/assoc.hh line.hh pstaff.hh pscore.hh
-linespace.o: linespace.cc linespace.hh glob.hh ../flower/real.hh \
- proto.hh const.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl ../flower/vray.hh cols.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
- ../flower/stringutil.hh item.hh tex.hh ../flower/compare.hh \
- ../flower/matrix.hh ../flower/vsmat.hh ../flower/vector.hh debug.hh \
- ../flower/dstream.hh ../flower/assoc.hh qlp.hh ../flower/unionfind.hh
-molecule.o: molecule.cc glob.hh ../flower/real.hh proto.hh const.hh \
- ../flower/string.hh ../flower/stringutil.hh molecule.hh \
- ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh ../flower/vray.hh item.hh \
- tex.hh symbol.hh
-line.o: line.cc line.hh ../flower/real.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
- proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh symbol.hh cols.hh ../flower/compare.hh pscore.hh
-pscore.o: pscore.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh line.hh \
- ../flower/real.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl glob.hh proto.hh const.hh pstaff.hh item.hh \
- boxes.hh ../flower/textdb.hh ../flower/textstr.hh tex.hh pscore.hh \
- cols.hh ../flower/compare.hh tstream.hh
-tex.o: tex.cc tex.hh ../flower/string.hh ../flower/stringutil.hh \
- boxes.hh ../flower/textdb.hh ../flower/textstr.hh ../flower/vray.hh \
- ../flower/real.hh symbol.hh const.hh
-item.o: item.cc line.hh ../flower/real.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
- proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh symbol.hh cols.hh ../flower/compare.hh
-cols.o: cols.cc cols.hh glob.hh ../flower/real.hh proto.hh const.hh \
- boxes.hh ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/vray.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl item.hh tex.hh \
- ../flower/compare.hh pstaff.hh
-staff.o: staff.cc staff.hh score.hh ../flower/vray.hh cols.hh glob.hh \
- ../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl item.hh \
- tex.hh ../flower/compare.hh mtime.hh command.hh voice.hh request.hh \
- debug.hh ../flower/dstream.hh ../flower/assoc.hh pscore.hh pstaff.hh
-rhythmstaf.o: rhythmstaf.cc request.hh glob.hh ../flower/real.hh \
- proto.hh const.hh ../flower/string.hh ../flower/stringutil.hh \
- mtime.hh debug.hh ../flower/dstream.hh ../flower/assoc.hh \
- ../flower/vray.hh linestaff.hh pstaff.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl item.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh tex.hh staff.hh score.hh \
- cols.hh ../flower/compare.hh command.hh voice.hh pscore.hh \
- molecule.hh rhythmstaf.hh symbol.hh
-score.o: score.cc tstream.hh ../flower/string.hh \
- ../flower/stringutil.hh score.hh ../flower/vray.hh cols.hh glob.hh \
- ../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
- command.hh pscore.hh pstaff.hh staff.hh voice.hh request.hh misc.hh \
- debug.hh ../flower/dstream.hh ../flower/assoc.hh
-note.o: note.cc ../flower/string.hh ../flower/stringutil.hh \
- ../flower/real.hh debug.hh ../flower/dstream.hh ../flower/assoc.hh \
- ../flower/vray.hh request.hh glob.hh proto.hh const.hh mtime.hh \
- voice.hh ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl notename.hh
-main.o: main.cc ../flower/lgetopt.hh misc.hh mtime.hh \
- ../flower/real.hh ../flower/string.hh ../flower/stringutil.hh main.hh \
- proto.hh
-misc.o: misc.cc misc.hh mtime.hh ../flower/real.hh glob.hh proto.hh \
- const.hh
-symbol.o: symbol.cc symbol.hh ../flower/string.hh \
- ../flower/stringutil.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/vray.hh ../flower/real.hh
-request.o: request.cc request.hh glob.hh ../flower/real.hh proto.hh \
- const.hh ../flower/string.hh ../flower/stringutil.hh mtime.hh
-notename.o: notename.cc glob.hh ../flower/real.hh proto.hh const.hh \
- ../flower/string.hh ../flower/stringutil.hh
-voice.o: voice.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh voice.hh \
- mtime.hh ../flower/real.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl request.hh glob.hh proto.hh const.hh
-keyword.o: keyword.cc glob.hh ../flower/real.hh proto.hh const.hh \
- lexer.hh
-linestaff.o: linestaff.cc linestaff.hh pstaff.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl item.hh glob.hh \
- ../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/vray.hh tex.hh symbol.hh
-table.o: table.cc glob.hh ../flower/real.hh proto.hh const.hh debug.hh \
- ../flower/dstream.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/assoc.hh ../flower/vray.hh keyword.hh parser.hh
-command.o: command.cc ../flower/string.hh ../flower/stringutil.hh \
- command.hh glob.hh ../flower/real.hh proto.hh const.hh mtime.hh \
- ../flower/vray.hh
-warn.o: warn.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh
-debug.o: debug.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh \
- ../flower/vector.hh ../flower/real.hh
-symtable.o: symtable.cc misc.hh mtime.hh ../flower/real.hh debug.hh \
- ../flower/dstream.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/assoc.hh ../flower/vray.hh symbol.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh symtable.hh const.hh
-boxes.o: boxes.cc boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
- ../flower/string.hh ../flower/stringutil.hh ../flower/vray.hh \
- ../flower/real.hh const.hh
-pstaff.o: pstaff.cc pstaff.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh glob.hh ../flower/real.hh proto.hh \
- const.hh boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
- ../flower/string.hh ../flower/stringutil.hh ../flower/vray.hh tex.hh
-tstream.o: tstream.cc tex.hh ../flower/string.hh \
- ../flower/stringutil.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/vray.hh ../flower/real.hh misc.hh \
- mtime.hh tstream.hh debug.hh ../flower/dstream.hh ../flower/assoc.hh
-version.o: version.cc version.hh
-calcideal.o: calcideal.cc tstream.hh ../flower/string.hh \
- ../flower/stringutil.hh score.hh ../flower/vray.hh cols.hh glob.hh \
- ../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
- command.hh pscore.hh pstaff.hh staff.hh voice.hh request.hh misc.hh \
- debug.hh ../flower/dstream.hh ../flower/assoc.hh
-scores.o: scores.cc main.hh proto.hh ../flower/real.hh score.hh \
- ../flower/vray.hh cols.hh glob.hh const.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
- command.hh
-identifier.o: identifier.cc keyword.hh lexer.hh proto.hh \
- ../flower/real.hh parser.hh
-template1.o: template1.cc line.hh ../flower/real.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
- proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh cols.hh ../flower/compare.hh request.hh mtime.hh command.hh \
- ../flower/list.cc ../flower/cursor.cc
-template2.o: template2.cc line.hh ../flower/real.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
- proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh symbol.hh voice.hh mtime.hh request.hh staff.hh score.hh \
- cols.hh ../flower/compare.hh command.hh ../flower/list.cc \
- ../flower/cursor.cc
-template3.o: template3.cc request.hh glob.hh ../flower/real.hh \
- proto.hh const.hh ../flower/string.hh ../flower/stringutil.hh \
- mtime.hh command.hh ../flower/vray.hh molecule.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh item.hh tex.hh ../flower/list.cc \
- ../flower/cursor.cc
-parser.o: parser.cc lexer.hh proto.hh ../flower/real.hh staff.hh \
- score.hh ../flower/vray.hh cols.hh glob.hh const.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
- command.hh voice.hh request.hh main.hh keyword.hh debug.hh \
- ../flower/dstream.hh ../flower/assoc.hh parseconstruct.hh
-lexer.o: lexer.cc glob.hh ../flower/real.hh proto.hh const.hh \
- ../flower/string.hh ../flower/stringutil.hh lexer.hh keyword.hh \
- ../flower/vray.hh parser.hh debug.hh ../flower/dstream.hh \
- ../flower/assoc.hh
--- /dev/null
+#include "scommands.hh"
+#include "debug.hh"
+
+/*
+ maybe it's time for a "narrowing" cursor?
+ */
+PCursor<Command*>
+Score_commands::first(Real w)
+{
+ PCursor<Command*> pc(*this);
+ while (pc.ok() && pc->when < w)
+ pc++;
+
+ return pc;
+}
+
+PCursor<Command*>
+Score_commands::last_insertion(Real w)
+{
+ PCursor<Command*> pc(*this);
+ while (pc.ok() && pc->when <= w)
+ pc++;
+ return pc;
+}
+
+void
+Score_commands::add_seq(svec<Command> com)
+{
+ if (!com.sz())
+ return;
+ Real when = com[0].when;
+
+ PCursor<Command*> pc(last_insertion(when));
+ for (int i = 0; i < com.sz(); i++) {
+ Command *c = new Command(com[i]);
+ assert(com[i].when == when);
+ if (!pc.ok())
+ pc.add(c);
+ else
+ pc.insert(c);
+ }
+}
+
+void
+Score_commands::set_breakable(Real when)
+{
+ bool found_typeset(false);
+ PCursor<Command*> cc = first(when);
+ for (; cc.ok() && cc->when == when; cc++) {
+ if (cc->isbreak())
+ return;
+ if (cc->code == TYPESET)
+ found_typeset=true;
+ }
+
+ assert(!found_typeset);
+
+ svec<Command> seq;
+ Command k(when);
+ k.code = BREAK_PRE;
+ seq.add(k);
+ k.code = BREAK_MIDDLE;
+ seq.add(k);
+ k.code = BREAK_POST;
+ seq.add(k);
+ k.code = BREAK_END;
+ seq.add(k);
+
+ add_seq(seq);
+}
+bool
+Score_commands::is_breakable(Real w)
+{
+ PCursor<Command*> cc = first(w);
+ for (; cc.ok() && cc->when == w; cc++) {
+ if (cc->isbreak())
+ return true;
+ }
+ return false;
+}
+void
+Score_commands::add_command_to_break(Command pre, Command mid,Command post)
+{
+ Real w = pre.when;
+
+ Command k(w);
+
+ PCursor<Command*> c ( first(w));
+ while (!c->isbreak())
+ c++;
+ c.add(new Command(pre));
+
+ while (!c->isbreak())
+ c++;
+ c.add(new Command(mid));
+
+ while (!c->isbreak())
+ c++;
+ c.add(new Command(post));
+}
+
+void
+Score_commands::add(Command c)
+{
+ bool encapsulate =false;
+
+ Command pre(c.when);
+ Command mid(c.when);
+ Command post(c.when);
+
+
+ if (c.code == TYPESET) {
+ if (c.args[0] == "BAR") {
+ set_breakable(c.when);
+ encapsulate = true;
+ mid = c;
+ pre = c;
+ }
+ if (c.args[0] == "METER" && is_breakable(c.when)) {
+ encapsulate = true;
+ mid = c;
+ pre = c;
+ post =c;
+ }
+ }
+
+ if (encapsulate)
+ add_command_to_break(pre, mid, post);
+ else {
+ svec<Command> seq;
+ seq.add(c);
+ add_seq(seq);
+ }
+}
+
+/*
+ first and last column should be breakable.
+ Remove any command past the last musical column.
+ */
+void
+Score_commands::clean(Real l)
+{
+ assert(l>0);
+ if (!is_breakable(0.0)) {
+ Command c(0.0);
+ c.code = TYPESET;
+ c.args.add("BAR");
+ c.args.add("empty");
+ add(c);
+ }
+
+ PCursor<Command*> bot(bottom());
+
+ while (bot.ok() && bot->when > l) {
+
+ mtor <<"removing "<< bot->code <<" at " << bot->when<<'\n';
+ bot.del();
+ bot = bottom();
+ }
+
+ if (!is_breakable(l)) {
+ Command c(l);
+ c.code = TYPESET;
+ c.args.add("BAR");
+ c.args.add("||");
+ add(c);
+ }
+ OK();
+}
+
+void
+Score_commands::OK() const
+{
+ for (PCursor<Command*> cc(*this); cc.ok() && (cc+1).ok(); cc++) {
+ assert(cc->when <= (cc+1)->when);
+ }
+}
+
+void
+Score_commands::print() const
+{
+ for (PCursor<Command*> cc(*this); cc.ok() ; cc++) {
+ cc->print();
+ }
+}