-Command*get_clef_interpret_command(String w);
-Command *get_bar_command(Real);
-Command* get_meterchange_command( int,int);
+/*
+ getcommand.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef GETCOMMAND_HH
+#define GETCOMMAND_HH
+#include "proto.hh"
+
+
Command* get_meter_command( Real,int,int);
-Command* get_skip_command( int,Real);
-Command* get_key_interpret_command(svec<String>);
-Command *get_reset_command();
-Command*get_partial_command(Real u);
+
+
+
+#endif // GETCOMMAND_HH
#include "plist.hh"
#include "real.hh"
-struct Input_cursor : public PCursor<Command*>
+
+struct Input_cursor : public PCursor<Input_command*>
{
/// current measure info
Real whole_per_measure;
int bars;
- Input_cursor(PCursor<Command*>);
+ Input_cursor(PCursor<Input_command*>);
/// hmm. not safe. Should rethink cursor.
void operator++(int);
/** warning: no optor -- () defined.. */
void reset();
Real when()const;
- void add(Command*);
+ void add(Input_command*);
void setpartial(Real);
- void addbot(Command*);
+ void addbot(Input_command*);
void sync();
void print()const;
void last_command_here();
};
/// the list of commands in Score
-struct Input_commands : public IPointerList<Command*> {
+struct Input_commands : public IPointerList<Input_command*> {
Input_cursor ptr;
/****************/
Input_commands();
Input_commands(Input_commands const&);
- void add(Command*);
+ void add(Input_command);
void reset();
void print()const;
Staff_commands *parse() const;
void
-interpret_meter(Command *c, int &beats_per_meas, int& one_beat,
+interpret_meter(Input_command *c, int &beats_per_meas, int& one_beat,
Real& whole_per_measure);
#endif // INPUTCOMMANDS_HH
--- /dev/null
+#ifndef ISCORE_HH
+#define ISCORE_HH
+#include "vray.hh"
+#include "proto.hh"
+#include "plist.hh"
+
+
+/// the total music def of one movement
+struct Input_score {
+ /// paper_, staffs_ and commands_ form the problem definition.
+ Paperdef *paper_;
+ IPointerList<Input_staff*> staffs_;
+ IPointerList<Input_command*> commands_;
+
+ /****************************************************************/
+ Input_score();
+ Input_score(Input_score&);
+ void add(svec<Input_command*> &s);
+ void add(Input_staff*);
+ ~Input_score();
+ /// construction
+ void set(Paperdef*);
+ void print() const;
+ Score*parse();
+};
+/**
+
+ */
+#endif
--- /dev/null
+#include "debug.hh"
+#include "inputcommand.hh"
+#include "inputscore.hh"
+#include "inputstaff.hh"
+#include "score.hh"
+#include "paper.hh"
+
+void
+Input_score::add(svec<Input_command*> &s)
+{
+ commands_.bottom().add(get_reset_command());
+ for (int i=0; i < s.sz(); i++)
+ commands_.bottom().add(s[i]);
+}
+
+void
+Input_score::add(Input_staff*s)
+{
+ staffs_.bottom().add(s);
+}
+
+void
+Input_score::set(Paperdef*p)
+{
+ delete paper_;
+ paper_ = p;
+}
+
+Score*
+Input_score::parse()
+{
+ Paperdef* p=new Paperdef(*paper_);
+ Score *s = new Score(p);
+
+ for (PCursor<Input_staff*> i(staffs_); i.ok(); i++) {
+ Staff* staf=i->parse(commands_);
+ s->add(staf);
+ }
+ return s;
+}
+
+Input_score::~Input_score()
+{
+ // should fix paper/symtabs to allow this deletion.
+// delete paper_;
+}
+
+Input_score::Input_score()
+{
+ paper_=new Paperdef;
+}
+
+void
+Input_score::print()const
+{
+ mtor << "Input_score {\n";
+ for (PCursor<Input_staff*> i(staffs_); i.ok(); i++) {
+ i->print();
+ }
+ mtor << "}\n";
+}
--- /dev/null
+#include "getcommand.hh"
+#include "debug.hh"
+#include "inputmusic.hh"
+#include "inputstaff.hh"
+#include "inputcommands.hh"
+#include "inputcommand.hh"
+#include "staffcommands.hh"
+#include "melodicstaff.hh"
+#include "rhythmstaff.hh"
+#include "staff.hh"
+
+void
+Input_staff::add(svec<Input_command*> &s)
+{
+ commands_.bottom().add(get_reset_command());
+ for (int i=0; i < s.sz(); i++)
+ commands_.bottom().add(s[i]);
+ s.set_size(0);
+}
+
+Input_staff::Input_staff(String s)
+{
+ type= s;
+}
+
+void
+Input_staff::add(Horizontal_music*m)
+{
+ music_.bottom().add(m);
+}
+
+Staff*
+Input_staff::parse(PointerList<Input_command*> score_wide)
+{
+ Staff *p=0;
+
+ if (type == "melodic")
+ p = new Melodic_staff;
+ else if (type == "rhythmic")
+ p = new Rhythmic_staff;
+
+ for (PCursor<Horizontal_music*> i(music_); i.ok(); i++) {
+ Voice_list vl = i->convert();
+ p->add(vl);
+ }
+
+ Input_commands commands;
+ for (PCursor<Input_command*> i(score_wide); i.ok(); i++)
+ commands.add(**i);
+ for (PCursor<Input_command*> i(commands_); i.ok(); i++)
+ commands.add(**i);
+
+ p->staff_commands_ = commands.parse();
+
+ return p;
+}
+
+Input_staff::Input_staff(Input_staff&s)
+{
+ for (PCursor<Input_command*> i(s.commands_); i.ok(); i++)
+ commands_.bottom().add(new Input_command(**i));
+ for (PCursor<Horizontal_music*> i(s.music_); i.ok(); i++)
+ add(i);
+
+ type = s.type;
+}
+
+void
+Input_staff::print() const
+{
+#ifndef NPRINT
+ mtor << "Input_staff {\n";
+ for (PCursor<Input_command*> i(commands_); i.ok(); i++)
+ i->print();
+ for (PCursor<Horizontal_music*> i(music_); i.ok(); i++)
+ i->print();
+ mtor << "}\n";
+#endif
+}
#include "command.hh"
+#include "inputscore.hh"
+#include "inputstaff.hh"
+#include "inputmusic.hh"
+#include "inputcommand.hh"
#include "molecule.hh"
#include "plist.cc"