]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.22
authorfred <fred>
Sun, 24 Mar 2002 19:27:40 +0000 (19:27 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:27:40 +0000 (19:27 +0000)
51 files changed:
hdr/break.hh
hdr/clef.hh
hdr/command.hh
hdr/grouping.hh
hdr/inputscore.hh
hdr/inputstaff.hh
hdr/key.hh
hdr/keyitem.hh
hdr/leastsquares.hh
hdr/linespace.hh
hdr/localkeyitem.hh
hdr/meter.hh
hdr/pscore.hh
hdr/qlpsolve.hh
hdr/sccol.hh
hdr/score.hh
hdr/scoreline.hh
hdr/slur.hh
hdr/staffcommands.hh
hdr/staffelem.hh
hdr/staffline.hh
hdr/stcol.hh
hdr/stem.hh
src/beam.cc
src/boxes.cc
src/break.cc
src/calcideal.cc
src/command.cc
src/grouping.cc
src/inputcommands.cc
src/inputscore.cc
src/inputstaff.cc
src/key.cc
src/keyitem.cc
src/leastsquares.cc
src/linespace.cc
src/localkeyitem.cc
src/molecule.cc
src/pscore.cc
src/qlp.cc
src/qlpsolve.cc
src/sccol.cc
src/scoreline.cc
src/scores.cc
src/simpleprint.cc
src/slur.cc
src/staffelem.cc
src/stem.cc
src/symbol.cc
src/tex.cc
src/wordwrap.cc

index 4c0f6b33b678bfb09559ed0eff0baf84bb175a06..4475e7d1730e699c9e8a67eeaaae85c7407295fc 100644 (file)
@@ -6,18 +6,18 @@
 
 #ifndef BREAK_HH
 #define BREAK_HH
-#include "vray.hh"
+#include "varray.hh"
 #include "proto.hh"
-typedef svec<PCol*>  Line_of_cols;
+typedef Array<PCol*>  Line_of_cols;
 
 struct Col_configuration {
     Line_of_cols cols;
-    svec<Real> config;
+    Array<Real> config;
     Real energy;
 
     /****************/
     void OK()const;
-    void setsol(svec<Real>);
+    void setsol(Array<Real>);
     Col_configuration() ;
     void add( PCol*c);
     void print() const;
@@ -33,21 +33,21 @@ struct Break_algorithm {
     /// check if the spacing/breaking problem is well-stated
     void problem_OK()const;
     /// search all pcols which are breakable.
-    svec<PCol *> find_breaks() const;
+    Array<PCol *> find_breaks() const;
 
      /// helper: solve for the columns in #curline#.
-    svec<Real> solve_line(Line_of_cols) const;
+    Array<Real> solve_line(Line_of_cols) const;
 
     
     /// does curline fit on the paper?    
     bool feasible(Line_of_cols)const;
     
-    virtual svec<Col_configuration> solve()=0;
+    virtual Array<Col_configuration> solve()=0;
 };
 
 /// wordwrap type algorithm: move to next line if current is optimal.
 struct Word_wrap : Break_algorithm {
-    virtual svec<Col_configuration> solve();
+    virtual Array<Col_configuration> solve();
     Word_wrap(PScore&);
 };
 #endif // BREAK_HH
index 243ea6ebdd8f9e1a8a9fe37b1ac53115a71f717c..3b61ca3bc76f739e5fc92752b32ec0e01b2842c2 100644 (file)
@@ -7,14 +7,14 @@
 #ifndef CLEF_HH
 #define CLEF_HH
 #include "scalar.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 struct Clef {
     int c0_pos;
     String clef_type;
 
     Clef();
-    void read(svec<Scalar> args);    
+    void read(Array<Scalar> args);    
 };
 #endif // CLEF_HH
 
index 43d016bbeeaeb6c73fd64922db455cf1ef54b203..d4dda9411c4735844e9e6ad6bd7ddd92ddffda17 100644 (file)
@@ -2,7 +2,7 @@
 #define COMMAND_HH
 
 #include "glob.hh"
-#include "vray.hh"
+#include "varray.hh"
 #include "scalar.hh"
 
 enum Commandcode {
@@ -17,7 +17,7 @@ struct Command {
     Commandcode code;
 
     /// analogous to argv[]
-    svec<Scalar> args;
+    Array<Scalar> args;
 
     ///
     int priority;
index 9541123b9ee2174c3fb874fd822dc12b6cc70573..6e13f3217e54bfa29938e47d0e273fa96359dc60 100644 (file)
@@ -9,19 +9,19 @@
 
 #include "moment.hh"
 #include "interval.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 typedef Interval_t<Moment> MInterval;
 
 /// data structure which represents rhythmic units 
 struct Rhythmic_grouping {    
     
-    svec<Rhythmic_grouping*> children;
+    Array<Rhythmic_grouping*> children;
     MInterval *interval_;
     
     /****************/
 
-    svec<MInterval> intervals();
+    Array<MInterval> intervals();
     MInterval interval()const;
     Moment length() const;
     void intersect(MInterval);
@@ -30,19 +30,19 @@ struct Rhythmic_grouping {
     Rhythmic_grouping(Rhythmic_grouping const&);
     Rhythmic_grouping(MInterval, int n=1);
     Rhythmic_grouping();
-    Rhythmic_grouping(svec<Rhythmic_grouping*>);
+    Rhythmic_grouping(Array<Rhythmic_grouping*>);
     ~Rhythmic_grouping();
 
     void add_child(Moment start, Moment len);
 
     void split(Rhythmic_grouping r);
-    void split(svec<MInterval>);
+    void split(Array<MInterval>);
     void split(int n);
 
     void print() const;
     void OK() const;
 
-    svec<int> generate_beams(svec<int>, int&);
+    Array<int> generate_beams(Array<int>, int&);
 
 private:
     void init();
index a34e6d957944d9fcb8c97ae55d6236dc2644392d..39e6a367fdce4f23f0db53067b17ca7b7e8cc74b 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef ISCORE_HH
 #define ISCORE_HH
-#include "vray.hh"
+#include "varray.hh"
 #include "proto.hh"
 #include "plist.hh"
 
@@ -14,8 +14,8 @@ struct Input_score {
     
     /****************************************************************/
     Input_score();
-    Input_score(Input_score&);
-    void add(svec<Input_command*> &s);
+    Input_score(Input_score const&);
+    void add(Array<Input_command*> &s);
     void add(Input_staff*);
     ~Input_score();
     /// construction
index e2caea7dc2b0e5ec56e6a82bbb4a87662f66e713..6fac2046434e417069f64f352c352a44ffc698b6 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "string.hh"
 #include "plist.hh"
-#include "vray.hh"
+#include "varray.hh"
 #include "proto.hh"
 
 struct Input_staff {
@@ -22,10 +22,9 @@ struct Input_staff {
     void add(Input_music*m);
     Input_staff(Input_staff&);
     Input_staff(String);
-    void add(svec<Input_command*> &s);
-    Staff* parse(PointerList<Input_command*>);
+    void add(Array<Input_command*> &s);
+    Staff* parse(PointerList<Input_command*>, Score*);
     void print() const;
 };
 
 
index f0141d688f58c3238c43a89e65d636228ef48ad5..791c0861cf880e69d030b540f382bca48ecde5ab 100644 (file)
@@ -7,17 +7,17 @@
 #ifndef KEY_HH
 #define KEY_HH
 
-#include "vray.hh"
+#include "varray.hh"
 #include "scalar.hh"
 
 class Key {
-    svec<int> accidentals;
+    Array<int> accidentals;
 
     /****************/
 
 public:
-    svec<int> read(svec<Scalar> );
-    svec<int> oldkey_undo(svec<Scalar>);
+    Array<int> read(Array<Scalar> );
+    Array<int> oldkey_undo(Array<Scalar>);
 
     Key();
     void set(int i, int acc);
@@ -31,7 +31,7 @@ struct Local_key
     Local_key();
 
 private:
-    svec<Key> octaves;
+    Array<Key> octaves;
 };
 
 #endif // KEY_HH
index ffd0abeb9da7a4060743f906b44b0d041858d16e..43ce9ca0a7fa7bf56c3cf20b40329233fdd08b7d 100644 (file)
@@ -8,12 +8,12 @@
 #define KEYITEM_HH
 
 #include "item.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 /// 
 struct Keyitem : Item {
-    svec<int> pitch;
-    svec<int> acc;
+    Array<int> pitch;
+    Array<int> acc;
     int c_position;
 
     
@@ -21,7 +21,7 @@ struct Keyitem : Item {
     
     Keyitem(int cposition);
     void add(int pitch, int acc);
-    void read(svec<int> k);
+    void read(Array<int> k);
 
     void preprocess();
 
index 105efd0aa714ed3d3869450edb2a0a2687b796d7..e7368e398bfacbaedbb12e17eab66677c6dd3955 100644 (file)
@@ -6,11 +6,11 @@
 
 #ifndef LEASTSQUARE_HH
 #define LEASTSQUARE_HH
-#include "vray.hh"
+#include "varray.hh"
 #include "offset.hh"
 
 struct Least_squares {
-    svec<Offset> input;
+    Array<Offset> input;
     void minimise(Real &coef, Real &offset);
 };
 
index 75f4b9fb742733d3322d8c880ab88ff434387ad7..50f13bd35cfd6deaacd5bbf209077a8cb0621fc5 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "glob.hh"
 #include "plist.hh"
-#include "vray.hh"
+#include "varray.hh"
 #include "vector.hh"
 #include "interval.hh"
 
@@ -29,8 +29,8 @@ struct Colinfo {
 
 /// spacing for one line.
 class Spacing_problem {
-    svec<const Idealspacing*> ideals;
-    svec<Colinfo> cols;
+    Array<const Idealspacing*> ideals;
+    Array<Colinfo> cols;
 
     /// the index of #c# in #cols#
     int col_id(const PCol *c) const;
@@ -51,7 +51,7 @@ class Spacing_problem {
 
 public:
     /// solve the spacing problem
-    svec<Real> solve() const;
+    Array<Real> solve() const;
     /**
     return the column positions, and the energy (last element)
     */
index 05a468b973a625a1782588c6e72b5249bc152bbd..6276977b776f1ccab8427d6a7bd60ebeee70b8e8 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef LOCALKEYITEM_HH
 #define LOCALKEYITEM_HH
 #include "item.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 struct Local_acc {
     int name , acc, octave;
@@ -15,8 +15,8 @@ struct Local_acc {
 };
 
 struct Local_key_item : Item {
-    svec<Local_acc> accs;
-    svec<Notehead*> group;
+    Array<Local_acc> accs;
+    Array<Notehead*> group;
     int c0_position;           // move into walker
 
     /****************/
index 33838c15258e3131ea1caae3722e626ca1ed996a..ca364cf59c47f535b5491c10d0760180c770b61b 100644 (file)
@@ -7,13 +7,13 @@
 #ifndef METER_HH
 #define METER_HH
 #include "item.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 struct Meter: Item {
-    svec<Scalar> args;
+    Array<Scalar> args;
     /****************/
     
-    Meter(svec<Scalar> args) ;
+    Meter(Array<Scalar> args) ;
     Molecule*brew_molecule() const;
 };
 #endif // METER_HH
index 8ad259412e3aa07636eac076d2d4aebd23564a8e..f79624735356498e7969a3c2b8c2996a33d8ba1f 100644 (file)
@@ -4,13 +4,13 @@
 #define PSCORE_HH
 
 #include "break.hh"
-#include "vray.hh"
+#include "varray.hh"
 #include "pcol.hh"
 #include "pstaff.hh"
 
 /// all stuff which goes onto paper
 struct PScore {
-    Paperdef *paper_;          // indirection.
+    Paperdef *paper_l_;
     
     /// the columns, ordered left to right
     IPointerList<PCol *> cols;
@@ -34,63 +34,62 @@ struct PScore {
     IPointerList<Spanner*> broken_spans;
 
     /****************/
-
-    void add_broken(Spanner*);
-    
-    svec<Item*> select_items(PStaff*, PCol*);
-
-    /// before calc_breaking
-    void preprocess();
-    
-    void calc_breaking();
-    /**
-      calculate where the lines are to be broken.
-
-      POST
-    
-      lines contain the broken lines.
-     */
-
-    /// after calc_breaking
-    void postprocess();
+    /* CONSTRUCTION */
     
+    PScore(Paperdef*);
     /// add a line to the broken stuff. Positions given in #config#
-    void set_breaking(svec< Col_configuration> );
+    void set_breaking(Array<Col_configuration>);
 
     void add(PStaff *);
     
     /// add item
     void typeset_item(Item *,  PCol *,PStaff*,int=1);
 
-    /// add an Spanner
+    /// add a Spanner
     void typeset_spanner(Spanner*, PStaff*);
  
     ///    add to bottom of pcols
     void add(PCol*);
-    /**
+    void add_broken(Spanner*);
+
+    /* INSPECTION */
+    Array<Item*> select_items(PStaff*, PCol*);
+
+    /// return argument as a cursor.
+    PCursor<PCol *> find_col(const PCol *)const;
+
+    /* MAIN ROUTINES */
+    void process();
 
-    */
+    /// last deed of this struct
     void output(Tex_stream &ts);
 
-    Idealspacing* get_spacing(PCol *, PCol *);
-    /*
-    get the spacing between c1 and c2, create one if necessary.
-    */
+    /* UTILITY ROUTINES */
 
-    /// return argument as a cursor.
-    PCursor<PCol *> find_col(PCol *)const;
+    /// get the spacing between c1 and c2, create one if necessary.
+    Idealspacing* get_spacing(PCol *c1, PCol *c2);
 
-    /// delete unused columns
-    void clean_cols();
+    /// connect c1 and c2
+    void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
 
-    /// invarinants
+    /// connect c1 and c2 and any children of c1 and c2
+    void connect(PCol* c1, PCol *c2, Real distance_f,Real  strength_f= 1.0);
+    
+    /* STANDARD ROUTINES */
     void OK()const;
-
-    PScore(Paperdef*);
     void print() const;
+private:
+    /// before calc_breaking
+    void preprocess();
+
+    /// calculate where the lines are to be broken, and use results
+    void calc_breaking();
 
-        /// which is first (left, higher)
-    int compare_pcols( PCol*, PCol*)const;
+    /// after calc_breaking
+    void postprocess();
+    
+    /// delete unused columns
+    void clean_cols();
 };
 /** notes, signs, symbols in a score can be grouped in two ways:
     horizontally (staffwise), and vertically (columns). #PScore#
index 4d29bcc4a0cf6c566e2888cdae75f2f08d8c9ec3..b9789bfc4aac1f042b06b24b993210f7ad3e8271 100644 (file)
@@ -7,8 +7,8 @@ class Active_constraints {
     
 
     Matrix A,H;
-    svec<int> active;
-    svec<int> inactive;                // actually this is a set, not an array.
+    Array<int> active;
+    Array<int> inactive;               // actually this is a set, not an array.
     const Ineq_constrained_qp *opt;
 
 public:
@@ -71,7 +71,7 @@ public:
     int constraint_id() const { return ac->inactive[j]; }
     Vector vec() const { return ac->vec(constraint_id()); }
     Real rhs() const { return ac->rhs(constraint_id()); }
-    bool ok() const { return j < ac->inactive.sz(); }
+    bool ok() const { return j < ac->inactive.size(); }
 };
 /**
     loop through the inactive constraints.
index 8c1d82b3aede30e62d7dd7a39e4a46f833a5b6aa..615376309c77f256ee6792814d983dd5ffd0239d 100644 (file)
@@ -7,25 +7,23 @@
 #ifndef SCCOL_HH
 #define SCCOL_HH
 #include "proto.hh"
-#include "vray.hh"
+#include "varray.hh"
 #include "moment.hh"
 
 
 struct Score_column {
 
     /// indirection to column
-    PCol * pcol_;
+    PCol * pcol_l_;
 
     /// length of notes/rests in this column
-    svec<Moment> durations;
+    Array<Moment> durations;
     
-    Moment when;
-
     /// 
-    bool musical;
+    bool musical_;
     
     /****************/
-    
+    Moment when() {  return when_; }
     Score_column(Moment when);       
     static int compare(Score_column & c1, Score_column &c2);
     void add_duration(Moment );
@@ -33,6 +31,9 @@ struct Score_column {
     void set_breakable();
     bool used();
     void print() const;
+
+private:
+    Moment when_;
 };
 /**
 
index 5363b475cb44d7c7a3114139bc82d32f044de8d8..f58367c30ecfad4b5ff229590ec7c4f440cc0a75 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef SCORE_HH
 #define SCORE_HH
-#include "vray.hh"
+#include "varray.hh"
 #include "proto.hh"
 #include "plist.hh"
 #include "moment.hh"
@@ -8,12 +8,12 @@
 /// the total music def of one movement
 struct Score {
     /// paper_, staffs_ and commands_ form the problem definition.
-    Paperdef *paper_;
+    Paperdef *paper_p_;
     IPointerList<Staff*> staffs_;
     
     /// "runtime" fields for setting up spacing    
     IPointerList<Score_column*> cols_;
-    PScore *pscore_;
+    PScore *pscore_p_;
 
     /****************************************************************/
 
@@ -22,22 +22,32 @@ struct Score {
     ~Score();    
     void add(Staff*);        
 
-
-
-    void OK() const;
-    PCursor<Score_column *> find_col(Moment,bool);
+    /// do everything except outputting to file
     void process();
+    
+    /// output to file
     void output(String fn);
-    PCursor<Score_column*> create_cols(Moment);
+
+    // standard
+    void OK() const;
     void print() const;
+
+    // utils:
+    PCursor<Score_column*> create_cols(Moment);
+    PCursor<Score_column *> find_col(Moment,bool);
+    /// when does the last *musical* element finish?
     Moment last() const;
     
 private:
-    void do_pcols();    
+    Score(Score const&){}
+    void do_cols();
+    /**
+      make the pcol_l_ fields of each Score_column point to the correct PCol,
+      remove any unnecessary Score_column's
+     */
+
+    /// remove unused cols
     void clean_cols();
-    void distribute_commands();
-    void do_connect(PCol *c1, PCol *c2, Real d,Real);
-    void connect(PCol* c1, PCol *c2, Real d,Real = 1.0);
     
     /// add #Idealspacings# to #pscore_#
     void calc_idealspacing();
index 5734a7b4b458b4c396f242c661eac7f708686103..233496932a9926f27e78df3506681b3cfc038eaf 100644 (file)
@@ -8,7 +8,7 @@
 #define SCORELINE_HH
 #include "plist.hh"
 #include "proto.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 /// the columns of a score that form one line.
 struct
@@ -17,11 +17,11 @@ Line_of_score {
 
     // need to store height of each staff.
     IPointerList<Line_of_staff*> staffs;
-    PScore * pscore_;  // needed to generate staffs
+    PScore * pscore_l_;        // needed to generate staffs
 
     /****************/
     void process() ;
-    Line_of_score(svec<PCol *> sv,  PScore *);
+    Line_of_score(Array<PCol *> sv,  PScore *);
 
     String TeXstring() const;
 
index cf8c2261ab4e327fa4945a1f2773a9be2d9ae484..9a3333f0630dd1da79a677a715bc8cfeb1769156 100644 (file)
@@ -9,11 +9,11 @@
 
 #include "directionalspanner.hh"
 #include "fproto.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 struct Slur : Directional_spanner {
 
-    svec<Notehead*> encompass;
+    Array<Notehead*> encompass;
     //int dir;
 
     bool open_left,open_right;                 
index 633b73285cfb9e739d466a8940fb88b6ccc7e312..e0e27be4be8ce75eebee3500e8b3f29e4e189b65 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "proto.hh"
 #include "command.hh"
-#include "vray.hh"
+#include "varray.hh"
 #include "plist.hh"
 #include "timedescription.hh"
 
@@ -28,20 +28,5 @@ struct Staff_commands_at : public IPointerList<Command*> {
     void add(Command c);
 };
 
-/// the list of commands in Score
-struct Staff_commands : public IPointerList<Staff_commands_at*>
-{
-    Staff_commands_at*find(Moment);
-    void add(Staff_commands_at*);
-    void clean(Moment last);
-    void OK() const;
-    void print() const;
-    Moment last() const;
-};
-/** the list of commands in Score. Put in a separate class, since it
-  otherwise clutters the methods of Score.
-
-  */
-
 #endif
 
index a12addbfac9caf378efafe65134580e2087269af..bd10f216a858b3ddcc39fbae5a757993978dc034 100644 (file)
@@ -6,7 +6,7 @@
 
 #ifndef STAFFELEM_HH
 #define STAFFELEM_HH
-#include "vray.hh"
+#include "varray.hh"
 #include "proto.hh"
 #include "offset.hh"
 #include "molecule.hh"
@@ -20,13 +20,13 @@ struct Staff_elem {
        OUTPUT,                 // molecule has been output
     } status;
     bool calc_children;
-    svec<Staff_elem*> dependencies;
+    Array<Staff_elem*> dependencies;
     
-    /// indirection to the pstaff it is in
-    PStaff *pstaff_;
+    ///  the pstaff it is in
+    PStaff *pstaff_l_;
 
     /****************/
-    
+    Staff_elem(Staff_elem const&);
     String TeXstring () const ;
     virtual void print() const;
     virtual Interval width() const;
index 12d30c376430a74429a83de88391c315c6b7cd85..663c9584b25bbc931fa522b606509a84e6d84ccc 100644 (file)
@@ -9,15 +9,15 @@
 
 #include "real.hh"
 #include "plist.hh"
-#include "vray.hh"
+#include "varray.hh"
 #include "glob.hh"
 #include "pstaff.hh"
 
 /// one broken line of staff.
 struct Line_of_staff {
 
-    Line_of_score  * line_of_score_;
-    PStaff *pstaff_;
+    Line_of_score  * line_of_score_l_;
+    PStaff *pstaff_l_;
 
     /****************/
     
index 9e7501edc752f3eb4f22946a16bb355e0cdf7fc6..2bdd3b8bb9f6ed113b144cfd627eb8186a2d55da 100644 (file)
@@ -7,19 +7,19 @@
 #ifndef STCOL_HH
 #define STCOL_HH
 #include "proto.hh"
-#include "vray.hh"
+#include "varray.hh"
 #include "moment.hh"
 
 /// store simultaneous requests
 struct Staff_column {
-    /// indirection
-    Score_column *score_column;
+
+    Score_column *score_column_l_;
 
     /// fields to collect data vertically.
-    svec<Voice_element *> v_elts;
+    Array<Voice_element *> v_elts;
 
     /// idem
-    Staff_commands_at *s_commands;
+    Staff_commands_at *staff_commands_p_;
 
     Time_description *tdescription_;
     
@@ -29,7 +29,7 @@ struct Staff_column {
     bool mus() const;
     Moment when() const;
     void add(Voice_element*ve);
-
+    void OK() const;
     /****************************************************************
       VIRTUAL
     ****************************************************************/
@@ -37,6 +37,8 @@ struct Staff_column {
     virtual void process_requests()=0;
 
     virtual ~Staff_column();
+private:
+    Staff_column(Staff_column const&){}
 };
 
 
index ad2856b0f208d3fbf0b188de3f2e566cf20dadde..b7d7e05e29517daf7532308061b3e29e838ed2e5 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef STEM_HH
 #define STEM_HH
 #include "item.hh"
-#include "vray.hh"
+#include "varray.hh"
 #include "moment.hh"
 
 /// the rule attached to the ball
@@ -46,7 +46,7 @@ struct Stem : public Item {
 
     Real stem_xoffset;
     
-    svec<Notehead*> heads;
+    Array<Notehead*> heads;
 
     /****************/
     Stem(int center, Moment duration);
index 5edf3ce7eba7af27c9a50a37a9d90cc2c7b53d2d..1016320deae1339c35785637aff3a4e3ebde1fc9 100644 (file)
@@ -50,7 +50,6 @@ Beam::center()const
 
 Beam::Beam()
 {
-    group = 0;
     slope = 0;
     left_pos = 0.0;
     dir =0;
@@ -85,7 +84,7 @@ Beam::set_default_dir()
 void
 Beam::solve_slope()
 {
-    svec<Stem_info> sinfo;
+    Array<Stem_info> sinfo;
     for (iter_top(stems,i); i.ok(); i++) {
        i->set_default_extents();
        Stem_info info(i);
@@ -93,14 +92,14 @@ Beam::solve_slope()
     }
     Real leftx = sinfo[0].x;
     Least_squares l;
-    for (int i=0; i < sinfo.sz(); i++) {
+    for (int i=0; i < sinfo.size(); i++) {
        sinfo[i].x -= leftx;
        l.input.add(Offset(sinfo[i].x, sinfo[i].idealy));
     }
 
     l.minimise(slope, left_pos);
     Real dy = 0.0;
-    for (int i=0; i < sinfo.sz(); i++) {
+    for (int i=0; i < sinfo.size(); i++) {
        Real y = sinfo[i].x * slope + left_pos;
        Real my = sinfo[i].miny;
 
@@ -113,7 +112,7 @@ Beam::solve_slope()
 
                                // URG
     Real sl = slope*paper()->internote();
-    paper()->lookup_->beam(sl, convert_dimen(20,"pt"));
+    paper()->lookup_p_->beam(sl, convert_dimen(20,"pt"));
     slope = sl /paper()->internote();
 }
 
@@ -141,28 +140,28 @@ Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur)
 {
     def.OK();
     cur.OK();
-    assert(cur.children.sz() == stems.size());
+    assert(cur.children.size() == stems.size());
     
     cur.split(def);
-    group = new Rhythmic_grouping(cur);
-    svec<int> b;
+
+    Array<int> b;
     {
        iter_top(stems,s);
-       svec<int> flags;
+       Array<int> flags;
        for (; s.ok(); s++) {
            int f = intlog2(abs(s->flag))-2;
            assert(f>0);
            flags.add(f);
        }
        int fi =0;
-       b= group->generate_beams(flags, fi);
+       b= cur.generate_beams(flags, fi);
        b.insert(0,0);
        b.add(0);
-       assert(stems.size() == b.sz()/2);
+       assert(stems.size() == b.size()/2);
     }
 
     iter_top(stems,s);
-    for (int i=0; i < b.sz() && s.ok(); i+=2, s++) {
+    for (int i=0; i < b.size() && s.ok(); i+=2, s++) {
        s->beams_left = b[i];
        s->beams_right = b[i+1];
     }
@@ -179,8 +178,8 @@ Beam::do_break_at( PCol *, PCol *) const
 void
 Beam::do_pre_processing()
 {
-    left  = (*stems.top())   ->pcol_;
-    right = (*stems.bottom())->pcol_;    
+    left  = (*stems.top())   ->pcol_l_;
+    right = (*stems.bottom())->pcol_l_;    
     assert(stems.size()>1);
     if (!dir)
        set_default_dir();
@@ -207,7 +206,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
     Real dy=paper()->internote()*2;
     Real stemdx = paper()->rule_thickness();
     Real sl = slope*paper()->internote();
-    paper()->lookup_->beam(sl, convert_dimen(20,"pt"));
+    paper()->lookup_p_->beam(sl, convert_dimen(20,"pt"));
 
     Molecule leftbeams;
     Molecule rightbeams;
@@ -217,7 +216,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
        int lhalfs= lhalfs = here->beams_left - prev->beams_right ;
        int lwholebeams= here->beams_left <? prev->beams_right ;
        Real w = (here->hpos() - prev->hpos())/4;
-       Atom a =  paper()->lookup_->beam(sl, w);
+       Atom a =  paper()->lookup_p_->beam(sl, w);
        a.translate(Offset (-w, -w * sl));
        for (int j = 0; j  < lhalfs; j++) {
            Atom b(a);
@@ -231,7 +230,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
        int rwholebeams = here->beams_right <? next->beams_left; 
 
        Real w = next->hpos() - here->hpos();
-       Atom a = paper()->lookup_->beam(sl, w + stemdx);
+       Atom a = paper()->lookup_p_->beam(sl, w + stemdx);
        
        int j = 0;
        for (; j  < rwholebeams; j++) {
@@ -240,7 +239,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
            rightbeams.add( b ); 
        }
        w /= 4;
-       a = paper()->lookup_->beam(sl, w);
+       a = paper()->lookup_p_->beam(sl, w);
        
        for (; j  < rwholebeams + rhalfs; j++) {
            Atom b(a);
@@ -257,7 +256,6 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
 Molecule*
 Beam::brew_molecule() const return out;
 {
-    assert(left->line == right->line);
     Real inter=paper()->internote();
     out = new Molecule;
     Real x0 = stems.top()->hpos();
@@ -288,5 +286,5 @@ Beam::print()const
 
 Beam::~Beam()
 {
-    delete group;
+
 }
index d6564663a1e63710df939c2ffbfb60a0eed5c601..f83f7659e929eca8fe24a4771caf09c9d2020c7a 100644 (file)
@@ -1,6 +1,6 @@
 #include "boxes.hh"
 #include "const.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 
 Box::Box()
index e27abd9b849099eb2a0257add77bbd07c7b811b7..2a0586edff2b0e0775029ba4dcf5074b787c1b04 100644 (file)
 /*
   return all breakable columns
  */
-svec<PCol *>
+Array<PCol *>
 Break_algorithm::find_breaks() const
 {
-    svec<PCol *> retval;
+    Array<PCol *> retval;
     for (iter_top(pscore_.cols,c); c.ok(); c++)
        if (c->breakable())
-
-
            retval.add(c);
 
     return retval;
 }
 
 // construct an appropriate Spacing_problem and solve it. 
-svec<Real>
+Array<Real>
 Break_algorithm::solve_line(Line_of_cols curline) const
 {
    Spacing_problem sp;
 
    sp.add_column(curline[0], true, 0.0);
-   for (int i=1; i< curline.sz()-1; i++)
+   for (int i=1; i< curline.size()-1; i++)
        sp.add_column(curline[i]);
    sp.add_column(curline.last(), true, linelength);
 
@@ -41,21 +39,21 @@ Break_algorithm::solve_line(Line_of_cols curline) const
    for (iter_top(pscore_.suz,i); i.ok(); i++) {
        sp.add_ideal(i);
    }
-   svec<Real> the_sol=sp.solve();
+   Array<Real> the_sol=sp.solve();
    return the_sol;
 }
 
 Break_algorithm::Break_algorithm(PScore&s)
     :pscore_(s)
 {
-    linelength = s.paper_->linewidth;
+    linelength = s.paper_l_->linewidth;
 }
 
 bool
 Break_algorithm::feasible(Line_of_cols curline) const
 {
     Real l =0;
-    for (int i=0; i < curline.sz(); i++)
+    for (int i=0; i < curline.size(); i++)
        l +=curline[i]->width().length();
     return l < linelength;    
 }
@@ -88,7 +86,7 @@ Col_configuration::add( PCol*c)
 }
 
 void
-Col_configuration::setsol(svec<Real> sol)
+Col_configuration::setsol(Array<Real> sol)
 {
     config = sol;
     energy = config.last();
@@ -100,11 +98,13 @@ Col_configuration::print() const
 {
 #ifndef NPRINT
     mtor << "energy : " << energy << '\n';
-    mtor << "line of " << config.sz() << " cols\n";
+    mtor << "line of " << config.size() << " cols\n";
 #endif
 }
 void
 Col_configuration::OK()const
 {
-    assert(config.sz() == cols.sz());
+#ifndef NDEBUG
+    assert(config.size() == cols.size());
+#endif
 }
index 77cef180ef47bf4a83eb7e326d4e00f6eee7f879..b6d34115081e2ca5c5f063dde5ebfe24aa0420b8 100644 (file)
@@ -9,32 +9,12 @@
 #include "dimen.hh"
 
 
-void
-Score::do_connect(PCol *c1, PCol *c2, Real d, Real h)
-{
-    if (!c1 || !c2 )
-       return;
-    Idealspacing*sp=pscore_->get_spacing(c1,c2);
-       
-    if (!sp->hooke){
-       sp->hooke = h;
-       sp->space =d;
-    }
-}
-
-void
-Score::connect(PCol* c1, PCol *c2, Real d, Real h)
-{
-    do_connect(c1,c2,d,h);
-    do_connect(c1->postbreak, c2,d,h);
-    do_connect(c1, c2->prebreak,d,h);
-    do_connect(c1->postbreak, c2->prebreak,d,h);
-}
+/*
+  this needs A LOT of rethinking.
 
-/* this needs A LOT of rethinking.
+  generate springs between columns.
 
-    generate springs between columns.
-    */
+  */
 void
 Score::calc_idealspacing()
 {
@@ -43,21 +23,20 @@ Score::calc_idealspacing()
     for (; i.ok(); i++) {
        assert(i->used());
        PCursor<Score_column*> j(i+1);
-       if (i->musical) {
+       if (i->musical_) {
            assert(j.ok());
-           for (int n=0; n < i->durations.sz(); n++) {
+           for (int n=0; n < i->durations.size(); n++) {
                Moment d = i->durations[n];
-               Real dist = paper_->duration_to_dist(d);
-               while (j->when < d + i->when)
+               Real dist = paper_p_->duration_to_dist(d);
+               while (j->when() < d + i->when())
                    j++;
-               
-               assert( j->when== d+i->when);
+               assert( j->when()== d+i->when());
 
-               connect(i->pcol_, j->pcol_, dist);
-               if (!j->musical && (j+1).ok() 
-                   && (j+1)->when == j->when) {
+               pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist);
+               if (!j->musical_ && (j+1).ok() 
+                   && (j+1)->when() == j->when()) {
                    j++;
-                   connect(i->pcol_, j->pcol_,  dist);
+                   pscore_p_->connect(i->pcol_l_, j->pcol_l_,  dist);
                }
            }
        } else if (j.ok()) {
@@ -66,14 +45,13 @@ Score::calc_idealspacing()
              the last col is breakable, and therefore in use
              */
            
-           Moment d = j->when - i->when;
-           Real dist = (d) ? paper_->duration_to_dist(d) :
+           Moment d = j->when() - i->when();
+           Real dist = (d) ? paper_p_->duration_to_dist(d) :
                convert_dimen(2,"pt"); // todo
            
-           connect(i->pcol_, j->pcol_, dist, (d) ? 1.0:1.0);
+           pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist, (d) ? 1.0:1.0);
        }
-           // !j.ok() might hold if we're at the last col.
-       
+       // !j.ok() might hold if we're at the last col.
     }
 }
 
index 98be691cd30a259db5ead74c515f1125ecb8b5c4..7ddebc6f820210661aa0573532379603df54ee43 100644 (file)
@@ -21,9 +21,9 @@ Command::print() const
     mtor << "Command " << "code " << code << " prio " << priority;
     if ( isbreak())
        mtor << "(break separator)";
-    if (args.sz()) {
+    if (args.size()) {
        mtor<< " args: ";
-       for (int i = 0; i<args.sz(); i++)
+       for (int i = 0; i<args.size(); i++)
            mtor << "`"<<args[i] <<"',";
     }
     mtor << "\n";
index c7d38dbdae5b0a12e6eb44c9191a0340787a5147..4b8efaee6cdb8b74eeda27701ef5e387e6114aed 100644 (file)
@@ -12,14 +12,16 @@ Rhythmic_grouping::init()
 void
 Rhythmic_grouping::OK()const
 {
-    assert(bool(children.sz()) != bool(interval_));
+#ifndef NDEBUG
+    assert(bool(children.size()) != bool(interval_));
 
-    for (int i= 0; i < children.sz(); i++) {
+    for (int i= 0; i < children.size(); i++) {
        children[i]->OK();
        if (i>0)
            assert(children[i-1]->interval().right ==
                   children[i]->interval().left);
     }
+#endif
 }
 
 Moment
@@ -48,7 +50,7 @@ Rhythmic_grouping::split(Rhythmic_grouping r)
     r.intersect(interval());
     split(r.intervals());
     
-    for (int i= 0; i < children.sz(); i++) {
+    for (int i= 0; i < children.size(); i++) {
        if (!children[i]->interval_) {
            Rhythmic_grouping here(r);  
            children[i]->split(here);
@@ -57,17 +59,17 @@ Rhythmic_grouping::split(Rhythmic_grouping r)
 }
 
 
-svec<MInterval>
+Array<MInterval>
 Rhythmic_grouping::intervals()
 {
-    svec<MInterval> r;
-    if (interval_ || children.sz() == 1) {
+    Array<MInterval> r;
+    if (interval_ || children.size() == 1) {
        MInterval i(interval());
        MInterval r1(i), r2(i);
        r1.right = r2.left = i.center();
        r.add(r1); r.add(r2);
     } else {
-       for (int i=0; i < children.sz(); i++)
+       for (int i=0; i < children.size(); i++)
            r.add(children[i]->interval());
     }
     return r;
@@ -80,7 +82,7 @@ Rhythmic_grouping::intersect(MInterval t)
        return;
     }
     
-    for (int i=0; i < children.sz(); i++) {
+    for (int i=0; i < children.size(); i++) {
        MInterval inter = intersection(t, children[i]->interval());
        if (inter.empty() || inter.length() <= 0) {
            delete children[i];
@@ -89,7 +91,7 @@ Rhythmic_grouping::intersect(MInterval t)
            children[i]->intersect(t);
        }
     }
-    for (int i=0; i < children.sz(); ) {
+    for (int i=0; i < children.size(); ) {
        if (!children[i])
            children.del(i);
        else
@@ -99,14 +101,14 @@ Rhythmic_grouping::intersect(MInterval t)
 }
 
 void
-Rhythmic_grouping::split(svec<MInterval> splitpoints)
+Rhythmic_grouping::split(Array<MInterval> splitpoints)
 {
     //check on splitpoints..
     int j = 0, i=0, starti = 0, startj = 0;
     
-    svec<Rhythmic_grouping*> ch;
+    Array<Rhythmic_grouping*> ch;
     while (1) {
-       if  ( i >= children.sz() || j >= splitpoints.sz())
+       if  ( i >= children.size() || j >= splitpoints.size())
            break;
        
        assert( 
@@ -152,7 +154,7 @@ Rhythmic_grouping::Rhythmic_grouping(MInterval t, int n)
 }
 
 
-Rhythmic_grouping::Rhythmic_grouping(svec<Rhythmic_grouping*> r)
+Rhythmic_grouping::Rhythmic_grouping(Array<Rhythmic_grouping*> r)
     :children(r)
 {
     interval_ =0;
@@ -168,7 +170,7 @@ void
 Rhythmic_grouping::copy(Rhythmic_grouping const&s)
 {
     interval_ =  (s.interval_)? new MInterval(*s.interval_) : 0;
-    for (int i=0; i < s.children.sz(); i++)
+    for (int i=0; i < s.children.size(); i++)
        children.add(new Rhythmic_grouping(*s.children[i]));
 }
 
@@ -189,7 +191,7 @@ void
 Rhythmic_grouping::junk()
 {
     delete interval_;
-    for (int i=0; i < children.sz(); i++)
+    for (int i=0; i < children.size(); i++)
        delete children[i];
     init();
 }
@@ -201,7 +203,7 @@ Rhythmic_grouping::print()const
     mtor << "{ \n";
     if (interval_)
        mtor<<" Interval "<< interval_->str();
-    for (int i=0; i < children.sz(); i++) {
+    for (int i=0; i < children.size(); i++) {
        children[i]->print();
     }
     mtor << "}\n";
@@ -212,14 +214,14 @@ void
 Rhythmic_grouping::add_child(Moment start, Moment len)
 {
     Moment stop = start+len;
-    for (int i=0; i < children.sz(); i ++) {
+    for (int i=0; i < children.size(); i ++) {
        MInterval j=children[i]->interval();
        if (j.left == start && j.right==stop) {
            return;
        }
     }
     
-    if (children.sz())
+    if (children.size())
        assert ( children.last()->interval().right== start);
 
     children.add(new Rhythmic_grouping(MInterval(start, stop)));
@@ -231,23 +233,23 @@ Rhythmic_grouping::Rhythmic_grouping()
 }
 
 int
-min_elt(svec<int> v)
+min_elt(Array<int> v)
 {
     int i = 1000;              // ugh
-    for (int j = 0 ; j <  v.sz(); j++)
+    for (int j = 0 ; j <  v.size(); j++)
        i = i <? v[j];
     return i;
 }
 
-svec<int>
-Rhythmic_grouping::generate_beams(svec<int> flags, int &flagidx)
+Array<int>
+Rhythmic_grouping::generate_beams(Array<int> flags, int &flagidx)
 {
     
     assert (!interval_) ;
     
-    svec< svec<int> > children_beams;
-    for (int i=0; i < children.sz(); i++) {
-       svec<int> child_beams;
+    Array< Array<int> > children_beams;
+    for (int i=0; i < children.size(); i++) {
+       Array<int> child_beams;
        if (children[i]->interval_) {
            int f = flags[flagidx++];
            child_beams.add(f);
@@ -257,18 +259,18 @@ Rhythmic_grouping::generate_beams(svec<int> flags, int &flagidx)
        }
        children_beams.add(child_beams);
     }
-    svec<int> beams;
+    Array<int> beams;
     int lastm, m, nextm;
-    for (int i=0; i  < children_beams.sz(); i++) {
+    for (int i=0; i  < children_beams.size(); i++) {
        bool add_left =  (i >0);
-       bool add_right = (i  < children_beams.sz() -1);
+       bool add_right = (i  < children_beams.size() -1);
 
        if (!i)
            m =  min_elt(children_beams[i]);
        if (add_right)
            nextm = min_elt(children_beams[i+1]);
        
-       if (children_beams[i].sz() == 1) {
+       if (children_beams[i].size() == 1) {
            if (add_right)
                beams.add(m);
            if (add_left)
@@ -283,7 +285,7 @@ Rhythmic_grouping::generate_beams(svec<int> flags, int &flagidx)
        lastm = m;
        m = nextm;      
     }
-    assert(!(beams.sz()%2));
+    assert(!(beams.size()%2));
     return beams;
 }
 
index 64e8fa9598ef7e6a9fe950d12de4d90a77b66d4a..90d6eeffa64831cf2499dbfa554a1711d912e9a5 100644 (file)
@@ -4,6 +4,8 @@
 #include "staffcommands.hh"
 #include "getcommand.hh"
 #include "command.hh"
+#include "stcol.hh"
+#include "staff.hh"
 
 void
 Commands_at::print() const
@@ -25,7 +27,7 @@ Commands_at::Commands_at(Moment dt, Commands_at* prev)
     : tdescription_(dt, (prev)? &prev->tdescription_ : 0)
 {
     if (prev&& !tdescription_.whole_in_measure) {
-       bottom().add(get_bar_command());
+       bottom().add(get_newmeasure_command());
     }
 }
 
@@ -70,7 +72,7 @@ Commands_at::parse(Staff_commands_at*s)
 {
     s->tdescription_ = tdescription_;
     for (iter_top(*this,cc); cc.ok(); cc++) {
-       if (cc->args.sz() &&  cc->args[0] !="") {
+       if (cc->args.size() &&  cc->args[0] !="") {
            Command c = **cc;
            s->add(c);
            
@@ -169,30 +171,31 @@ Input_commands::add(Input_command c)
     
 }
 
-Staff_commands*
-Input_commands::parse() const
+void
+Input_commands::parse(Staff * staff_l) const
 {
     print();
-    Staff_commands*nc = new Staff_commands;
-
     for (iter_top(*this,i); i.ok(); i++) {
 
-       Staff_commands_at* s= nc->find(i->when());
-       if (!s){
-           s = new Staff_commands_at(i->tdescription_);
-           nc->add(s);
-       }
+       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();
+           #if 0
            Command c;//(0.0);
            c.code = INTERPRET;
            c.args.add("BAR");
            c.args.add("empty");
-           s->add(c);
+           com_l->add(c);
+           #endif
        }
 
-       i->parse(s);
+       i->parse(com_l);
     }
-    return nc;
 }
 
 
index 8bbe7e266e3bccf21a496c9d16de40d5367fd853..cdc348c725fd3f5f9d78a5509293f06285290bd6 100644 (file)
@@ -6,10 +6,10 @@
 #include "paper.hh"
 
 void
-Input_score::add(svec<Input_command*> &s)
+Input_score::add(Array<Input_command*> &s)
 {
     commands_.bottom().add(get_reset_command());
-    for (int i=0; i < s.sz(); i++)
+    for (int i=0; i < s.size(); i++)
        commands_.bottom().add(s[i]);
 }
 
@@ -29,19 +29,20 @@ Input_score::set(Paperdef*p)
 Score*
 Input_score::parse()
 {
-    Paperdef* p=new Paperdef(*paper_);
-    Score *s = new Score(p);
+    Paperdef* paper_p=new Paperdef(*paper_);
+    Score *s_p = new Score(paper_p);
     
     for (iter_top(staffs_,i); i.ok(); i++) {
-       Staff* staf=i->parse(commands_);
-       s->add(staf);
+       Staff* staf_p=i->parse(commands_, s_p);
+       s_p->add(staf_p);
     }
-    return s;
+    return s_p;
 }
 
 Input_score::~Input_score()
 {
-    // should fix paper/symtabs to allow this deletion.
+    // TODO!
+//should fix paper/symtabs to allow this deletion.
 //    delete paper_;
 }
 
index 97622a9dab808840dddf81196bedf73e536a19b1..1786f3e29359be6e4401c522e461b9fe2f3589f6 100644 (file)
 #include "staff.hh"
 
 void
-Input_staff::add(svec<Input_command*> &s)
+Input_staff::add(Array<Input_command*> &s)
 {
     commands_.bottom().add(get_reset_command());
-    for (int i=0; i < s.sz(); i++)
+    for (int i=0; i < s.size(); i++)
        commands_.bottom().add(s[i]);
     s.set_size(0);
 }
@@ -30,7 +30,7 @@ Input_staff::add(Input_music*m)
 }
 
 Staff*
-Input_staff::parse(PointerList<Input_command*> score_wide)
+Input_staff::parse(PointerList<Input_command*> score_wide, Score*score_l)
 {
     Staff *p=0;
     
@@ -38,7 +38,7 @@ Input_staff::parse(PointerList<Input_command*> score_wide)
        p = new Melodic_staff;
     else if (type == "rhythmic")
        p = new Rhythmic_staff;
-
+    p->score_l_ = score_l;
     for (iter_top(music_,i); i.ok(); i++) {
        Voice_list vl = i->convert();
        p->add(vl);
@@ -50,7 +50,7 @@ Input_staff::parse(PointerList<Input_command*> score_wide)
     for (iter_top(commands_,i); i.ok(); i++) 
        commands.add(**i);
 
-    p->staff_commands_ = commands.parse();
+    commands.parse(p);
 
     return p;
 }
@@ -60,7 +60,7 @@ Input_staff::Input_staff(Input_staff&s)
     for (iter_top(s.commands_,i); i.ok(); i++)
        commands_.bottom().add(new Input_command(**i));
     for (iter_top(s.music_,i); i.ok(); i++)
-       add(i);
+       add(i->clone());
 
     type = s.type;
 }
index dac8c266ec2240c641e325e9b813b07d261c3575..cd7f400737c4a56464ed4d599ca1c016e3e23cbe 100644 (file)
@@ -36,14 +36,14 @@ Local_key::reset(Key k)
        octaves[i] = k;
 }
 
-svec<int>
-Key::read(svec<Scalar> s)
+Array<int>
+Key::read(Array<Scalar> s)
 {
-    svec<int> newkey;
+    Array<int> newkey;
     for (int j = 0; j < 7; j++)
        accidentals[j] = 0;
    
-    for (int i=0; i < s.sz(); ) {
+    for (int i=0; i < s.size(); ) {
        int large = s[i++];
        int small = s[i++];
        accidentals[large]=small;
@@ -54,21 +54,21 @@ Key::read(svec<Scalar> s)
     return newkey;
 }
 
-svec<int>
-Key::oldkey_undo(svec<Scalar>s)
+Array<int>
+Key::oldkey_undo(Array<Scalar>s)
 {
-    svec<int> oldkey;
-    svec<int> newkey;
+    Array<int> oldkey;
+    Array<int> newkey;
     newkey.set_size(7);
-    for (int i=0; i < newkey.sz(); i++)
+    for (int i=0; i < newkey.size(); i++)
        newkey[i] = 0;
        
-    for (int i=0; i < s.sz(); ) {
+    for (int i=0; i < s.size(); ) {
        int large = s[i++];
        int small = s[i++];
        newkey[large] = small;
     }
-    for (int i=0; i < newkey.sz(); i++)
+    for (int i=0; i < newkey.size(); i++)
        if (accidentals[i] && accidentals[i] != newkey[i]) {
            oldkey.add(i);
            oldkey.add(0);
index 3499149352cde1c6f14235781244981276a7e66f..29b1f25e5c9fc91ad59e3622280ec6c85299bb3e 100644 (file)
@@ -12,9 +12,9 @@ Keyitem::Keyitem(int c)
 }
 
 void
-Keyitem::read(svec<int> s)
+Keyitem::read(Array<int> s)
 {
-    for (int i = 0 ; i< s.sz(); ) {
+    for (int i = 0 ; i< s.size(); ) {
        int note = s[i++];
        int acc = s[i++];
            
@@ -36,14 +36,14 @@ Keyitem::brew_molecule()const
     Molecule*output = new Molecule;
     Real inter = paper()->interline()/2;
     
-    for (int i =0; i < pitch.sz(); i++) {
-       Symbol s= paper()->lookup_->accidental(acc[i]);
+    for (int i =0; i < pitch.size(); i++) {
+       Symbol s= paper()->lookup_p_->accidental(acc[i]);
        Atom a(s);
        a.translate(Offset(0,(c_position + pitch[i]) * inter));
        Molecule m(a);
        output->add_right(m);   
     }
-    Molecule m(paper()->lookup_->fill(Box(
+    Molecule m(paper()->lookup_p_->fill(Box(
        Interval(0, paper()->note_width()),
        Interval(0,0))));
     output->add_right(m);
index 1e1c91cee36f650db9d56467ac523fc9dafb072a..adbc09821936e93a768636f36443db2d789ecc09 100644 (file)
@@ -8,7 +8,7 @@ Least_squares::minimise(Real &coef, Real &offset)
     Real sqx =0.0;
     Real sxy = 0.0;
 
-    for (int i=0; i < input.sz();i++) {
+    for (int i=0; i < input.size();i++) {
        Real x=input[i].x;
        Real y = input[i].y;
        sx += x;
@@ -16,7 +16,7 @@ Least_squares::minimise(Real &coef, Real &offset)
        sqx += sqr(x);
        sxy += x*y;
     }
-    int N = input.sz();
+    int N = input.size();
     
 
     coef = (N * sxy - sx*sy )/(N*sqx - sqr(sx));
index f35f64e2fabfe0a2bb7c7c7c86147a9bdc4c69ee..920d3ba7abb7344f8fef66aaa3545e2b3ee91ac7 100644 (file)
@@ -12,7 +12,7 @@ const Real COLFUDGE=1e-3;
 bool
 Spacing_problem::contains(const PCol *w)
 {
-    for (int i=0; i< cols.sz(); i++)
+    for (int i=0; i< cols.size(); i++)
        if (cols[i].pcol_ == w)
            return true;
     return false;
@@ -21,7 +21,7 @@ Spacing_problem::contains(const PCol *w)
 int 
 Spacing_problem::col_id(const PCol *w)const
 {
-    for (int i=0; i< cols.sz(); i++)
+    for (int i=0; i< cols.size(); i++)
        if (cols[i].pcol_ == w)
            return i;
     assert(false);
@@ -32,20 +32,20 @@ void
 Spacing_problem::OK() const
 {
 #ifndef NDEBUG
-    Union_find connected(cols.sz());
-    svec<int> fixed;
-    for (int i=0; i < ideals.sz(); i++) {
+    Union_find connected(cols.size());
+    Array<int> fixed;
+    for (int i=0; i < ideals.size(); i++) {
        assert(ideals[i]->hooke > 0);
        int l = col_id(ideals[i]->left);
        int r = col_id(ideals[i]->right);
        connected.connect(l,r);         
     }
-    for (int i = 0; i < cols.sz(); i++)
+    for (int i = 0; i < cols.size(); i++)
        if (cols[i].fixed())
            fixed.add(i);
-    for (int i = 0; i < cols.sz(); i++) {
+    for (int i = 0; i < cols.size(); i++) {
        bool c=false;
-       for (int j =0; j<fixed.sz(); j++)
+       for (int j =0; j<fixed.size(); j++)
            c |=  connected.equiv(j,i);
        assert(c);
     }
@@ -101,7 +101,7 @@ Spacing_problem::check_feasible() const
 Vector
 Spacing_problem::try_initial_solution() const
 {
-    int dim=cols.sz();
+    int dim=cols.size();
     Vector initsol(dim);
     for (int i=0; i < dim; i++) {
        if (cols[i].fixed()) {
@@ -135,7 +135,7 @@ Spacing_problem::make_matrices(Matrix &quad, Vector &lin, Real &c) const
     quad.fill(0);
     lin.fill(0);
     c = 0;
-    for (int j=0; j < ideals.sz(); j++){
+    for (int j=0; j < ideals.size(); j++){
        Idealspacing const*i=ideals[j];
        int l = col_id(i->left);
        int r = col_id(i->right);
@@ -156,7 +156,7 @@ Spacing_problem::make_matrices(Matrix &quad, Vector &lin, Real &c) const
 void
 Spacing_problem::make_constraints(Mixed_qp& lp) const
 {    
-    int dim=cols.sz();
+    int dim=cols.size();
     for (int j=0; j < dim; j++) {
        Colinfo *c=&(cols[j]);
        if (c->fixed()) {
@@ -173,7 +173,7 @@ Spacing_problem::make_constraints(Mixed_qp& lp) const
     }
 }
 
-svec<Real>
+Array<Real>
 Spacing_problem::solve() const
 {
     print();
@@ -181,7 +181,7 @@ Spacing_problem::solve() const
     assert(check_feasible());
 
     /* optimalisatiefunctie */        
-    Mixed_qp lp(cols.sz());
+    Mixed_qp lp(cols.size());
     make_matrices(lp.quad,lp.lin, lp.const_term);
     make_constraints(lp);    
     Vector start=find_initial_solution();    
@@ -191,7 +191,7 @@ Spacing_problem::solve() const
     }
        
 
-    svec<Real> posns(sol);
+    Array<Real> posns(sol);
     posns.add(lp.eval(sol));
     return posns;
 }
@@ -234,11 +234,11 @@ void
 Spacing_problem::print() const
 {
 #ifndef NPRINT
-    for (int i=0; i < cols.sz(); i++) {
+    for (int i=0; i < cols.size(); i++) {
        mtor << "col " << i<<' ';
        cols[i].print();
     }
-    for (int i=0; i < ideals.sz(); i++) {
+    for (int i=0; i < ideals.size(); i++) {
        print_ideal(ideals[i]);
     }
 #endif
index 42bb268df01db8976ef97142470985cdfdd871b7..d23b26277f64884f95f94e16abb556be24effb3b 100644 (file)
@@ -33,7 +33,7 @@ Local_key_item::brew_molecule()const
     Molecule*    output = new Molecule;
     Molecule*octmol = 0;
     int lastoct = -100;
-    for  (int i = 0; i <  accs.sz(); i++) {
+    for  (int i = 0; i <  accs.size(); i++) {
        if (accs[i].octave != lastoct) {
            if (octmol){
                Real dy =lastoct*7*paper()->interline()/2;
@@ -44,7 +44,7 @@ Local_key_item::brew_molecule()const
            octmol= new Molecule;
        }
        lastoct = accs[i].octave;
-       Symbol s =paper()->lookup_->accidental(accs[i].acc);   
+       Symbol s =paper()->lookup_p_->accidental(accs[i].acc);   
        Atom a(s);
        Real dy = (accs[i].name + c0_position) * paper()->interline()/2;
        a.translate(Offset(0,dy));
index 6b9db4cac3147a1020788589e1180214518430dc..682204880d11d95291426140c9037c7c9fd53737 100644 (file)
@@ -1,4 +1,4 @@
-#include "vray.hh"
+#include "varray.hh"
 #include "interval.hh"
 #include "dimen.hh"
 #include "string.hh"
@@ -32,7 +32,7 @@ Atom::TeXstring() const
 {
     // whugh.. Hard coded...
     String s("\\placebox{%}{%}{%}");
-    svec<String> a;
+    Array<String> a;
     a.add(print_dimen(off.y));
     a.add(print_dimen(off.x));
     a.add(sym.tex);
index bd9154647d76ea7a80f83db68bc3e2be206d97d3..696c54283848d27dc957d386d4f5db91b28d634f 100644 (file)
@@ -42,22 +42,45 @@ PScore::clean_cols()
 void
 PScore::add(PStaff *s)
 {
-    assert(s->pscore_ == this);
+    assert(s->pscore_l_ == this);
     staffs.bottom().add(s);
 }
 
+
+void
+PScore::do_connect(PCol *c1, PCol *c2, Real d, Real h)
+{
+    if (!c1 || !c2 )
+       return;
+    Idealspacing*s_l=get_spacing(c1,c2);
+       
+    if (!s_l->hooke){
+       s_l->hooke = h;
+       s_l->space =d;
+    }
+}
+
+void
+PScore::connect(PCol* c1, PCol *c2, Real d, Real h)
+{
+    do_connect(c1,c2,d,h);
+    do_connect(c1->postbreak_p_, c2,d,h);
+    do_connect(c1, c2->prebreak_p_,d,h);
+    do_connect(c1->postbreak_p_, c2->prebreak_p_,d,h);
+}
+
 void
 PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
 {
     assert(c && i && s);
 //    assert(!breakstat != 4 || c->breakable() );
     if (breakstat == 0) {
-       typeset_item(i, c->prebreak, s);
+       typeset_item(i, c->prebreak_p_, s);
        return;
     }
 
     if (breakstat == 2) {
-       typeset_item(i, c->postbreak, s);
+       typeset_item(i, c->postbreak_p_, s);
        return;
     }
 
@@ -73,7 +96,7 @@ PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
 void
 PScore::typeset_spanner(Spanner*span_p, PStaff*ps)
 {
-    span_p->pstaff_ = ps;
+    span_p->pstaff_l_ = ps;
     spanners.bottom().add(span_p);
     ps->spans.bottom().add(span_p);
 
@@ -82,29 +105,20 @@ PScore::typeset_spanner(Spanner*span_p, PStaff*ps)
 }
 
 
-int
-PScore::compare_pcols(PCol*a,  PCol*b)const
-{
-    PCursor<PCol*> ac(find_col(a));
-    PCursor<PCol*> bc(find_col(b));
-    assert(ac.ok() && bc.ok());
-    return ac - bc;
-}
-
 void
 PScore::add(PCol *p)
 {
-    p->pscore_ = this;
+    p->pscore_l_ = this;
     if (p->breakable()){
-       p->prebreak->pscore_ = this;
-       p->postbreak->pscore_ = this;
+       p->prebreak_p_->pscore_l_ = this;
+       p->postbreak_p_->pscore_l_ = this;
     }
     cols.bottom().add(p);
 }
 
 PScore::PScore( Paperdef*p)
 {
-    paper_ = p;
+    paper_l_ = p;
 }
 
 void
@@ -112,7 +126,7 @@ PScore::output(Tex_stream &ts)
 {
     int l=1;
 
-    ts << "\n "<<  paper_->lookup_->texsetting << "%(Tex id)\n";
+    ts << "\n "<<  paper_l_->lookup_p_->texsetting << "%(Tex id)\n";
     for (iter_top(lines,lic); lic.ok(); lic++) {
        ts << "% line of score no. " << l++ <<"\n";
        ts << lic->TeXstring();
@@ -122,13 +136,13 @@ PScore::output(Tex_stream &ts)
 }
 
 
-svec<Item*>
-PScore::select_items(PStaff*ps , PCol*pc)
+Array<Item*>
+PScore::select_items(PStaff*ps, PCol*pc)
 {
-    svec<Item*> ret;
+    Array<Item*> ret;
     assert(ps && pc);
     for (iter_top(pc->its,i); i.ok(); i++){
-       if (i->pstaff_ == ps)
+       if (i->pstaff_l_ == ps)
            ret.add((Item*)(const Item*)i);
     }
     return ret;
@@ -150,7 +164,7 @@ PScore::print() const
 {    
 #ifndef NPRINT
     mtor << "PScore { ";
-    paper_->print();
+    paper_l_->print();
     mtor << "\ncolumns: ";
     for (iter_top(cols,cc); cc.ok(); cc++)
        cc->print();
@@ -196,34 +210,34 @@ PScore::postprocess()
 }
 
 PCursor<PCol *>
-PScore::find_col(PCol *c)const
+PScore::find_col(const PCol *c)const
 {
-    PCol*what = (PCol*)c;
-    if (what->daddy )
-       what = what -> daddy;
+    const PCol*what = c;
+    if (what->daddy_l_ )
+       what = what->daddy_l_;
     
-    return cols.find(what);
+    return cols.find((PCol*)what);
 }
 
 void
 PScore::add_broken(Spanner*s)
 {
-    assert(s->left->line == s->right->line);
+    assert(s->left->line_l_ == s->right->line_l_);
     broken_spans.bottom().add(s);
     s->left->starters.bottom().add (s);
     s->right->stoppers.bottom().add (s);
 }
 
 void
-PScore::set_breaking(svec<Col_configuration> breaking)
+PScore::set_breaking(Array<Col_configuration> breaking)
 {
-    for (int j=0; j < breaking.sz(); j++) {
-       svec<PCol*> &curline(breaking[j].cols);
-       svec<Real> &config(breaking[j].config);
+    for (int j=0; j < breaking.size(); j++) {
+       Array<PCol*> &curline(breaking[j].cols);
+       Array<Real> &config(breaking[j].config);
        
-       Line_of_score *p = new Line_of_score(curline,this);
-       lines.bottom().add(p);          
-       for (int i=0; i < curline.sz(); i++){
+       Line_of_score *s_p = new Line_of_score(curline,this);
+       lines.bottom().add(s_p);        
+       for (int i=0; i < curline.size(); i++){
            curline[i]->hpos = config[i];
        }
     }
@@ -235,3 +249,15 @@ PScore::calc_breaking()
     Word_wrap w(*this);
     set_breaking(w.solve());
 }
+
+void
+PScore::process()
+{
+    clean_cols();
+    *mlog << "Preprocessing ... ";
+    preprocess();
+    *mlog << "Calculating ... ";
+    calc_breaking();
+    *mlog << "Postprocessing ... ";
+    postprocess();
+}
index 460bd864231b27646bbab9d76cb29ef1ae857f92..5aa8e9f45e7592f21fb9ab8c0a252886e4e9700e 100644 (file)
@@ -34,7 +34,7 @@ void
 Ineq_constrained_qp::OK() const
 {
 #ifndef NDEBUG    
-    assert(cons.sz() == consrhs.sz());
+    assert(cons.size() == consrhs.size());
     Matrix Qdif= quad - quad.transposed();
     assert(Qdif.norm()/quad.norm() < EPS);
 #endif    
@@ -52,12 +52,12 @@ Mixed_qp::solve(Vector start) const
     print();
     Ineq_constrained_qp pure(*this);
     
-    for  (int i= eq_cons.sz()-1; i>=0; i--) {
+    for  (int i= eq_cons.size()-1; i>=0; i--) {
        pure.eliminate_var(eq_cons[i], eq_consrhs[i]);
        start.del(eq_cons[i]);
     }
     Vector sol = pure.solve(start);
-    for (int i= 0; i < eq_cons.sz(); i++) {
+    for (int i= 0; i < eq_cons.size(); i++) {
        sol.insert( eq_consrhs[i],eq_cons[i]);
     }
     return sol;
@@ -80,7 +80,7 @@ Ineq_constrained_qp::eliminate_var(int idx, Real value)
     row.del(idx);
     lin +=row ;
 
-   for (int i=0; i < cons.sz(); i++) {
+   for (int i=0; i < cons.size(); i++) {
       consrhs[i] -= cons[i](idx) *value;
       cons[i].del(idx);
    }
@@ -91,8 +91,8 @@ Ineq_constrained_qp::eliminate_var(int idx, Real value)
 void
 Ineq_constrained_qp::assert_solution(Vector sol) const
 {
-    svec<int> binding;
-    for (int i=0; i < cons.sz(); i++) {
+    Array<int> binding;
+    for (int i=0; i < cons.size(); i++) {
        Real R=cons[i] * sol- consrhs[i];
        assert(R> -EPS);
        if (R < EPS)
@@ -109,7 +109,7 @@ Ineq_constrained_qp::print() const
     mtor << "Quad " << quad;
     mtor << "lin " << lin <<"\n"
        << "const " << const_term<<"\n";
-    for (int i=0; i < cons.sz(); i++) {
+    for (int i=0; i < cons.size(); i++) {
        mtor << "constraint["<<i<<"]: " << cons[i] << " >= " << consrhs[i];
        mtor << "\n";
     }
@@ -137,7 +137,7 @@ Mixed_qp::OK() const
 {
 #ifndef NDEBUG
     Ineq_constrained_qp::OK();
-    assert(eq_consrhs.sz() == eq_cons.sz());
+    assert(eq_consrhs.size() == eq_cons.size());
 #endif    
 }
 
@@ -146,7 +146,7 @@ Mixed_qp::print() const
 {
 #ifndef NPRINT
     Ineq_constrained_qp::print();
-    for (int i=0; i < eq_cons.sz(); i++) {
+    for (int i=0; i < eq_cons.size(); i++) {
        mtor << "eq cons "<<i<<": x["<<eq_cons[i]<<"] == " << eq_consrhs[i]<<"\n";
     }
 #endif
index 88b703bbbbad7965b56c9dfb6d7eee5e90d703f7..8482bfd8752616df03c35f855569e6de5a623620 100644 (file)
@@ -9,12 +9,12 @@ String
 Active_constraints::status() const
 {
     String s("Active|Inactive [");
-    for (int i=0; i< active.sz(); i++) {
+    for (int i=0; i< active.size(); i++) {
        s += String(active[i]) + " ";
     }
 
     s+="| ";
-    for (int i=0; i< inactive.sz(); i++) {
+    for (int i=0; i< inactive.size(); i++) {
        s += String(inactive[i]) + " ";
     }
     s+="]";
@@ -23,26 +23,29 @@ Active_constraints::status() const
 }
 
 void
-Active_constraints::OK() {
+Active_constraints::OK()
+{
+    #ifndef NDEBUG
     H.OK();
     A.OK();
-    assert(active.sz() +inactive.sz() == opt->cons.sz());
+    assert(active.size() +inactive.size() == opt->cons.size());
     assert(H.dim() == opt->dim());
-    assert(active.sz() == A.rows());
-    svec<int> allcons;
+    assert(active.size() == A.rows());
+    Array<int> allcons;
 
-    for (int i=0; i < opt->cons.sz(); i++)
+    for (int i=0; i < opt->cons.size(); i++)
        allcons.add(0);
-    for (int i=0; i < active.sz(); i++) {
+    for (int i=0; i < active.size(); i++) {
        int j = active[i];
        allcons[j]++;
     }
-    for (int i=0; i < inactive.sz(); i++) {
+    for (int i=0; i < inactive.size(); i++) {
        int j = inactive[i];
        allcons[j]++;
     }
-    for (int i=0; i < allcons.sz(); i++)
+    for (int i=0; i < allcons.size(); i++)
        assert(allcons[i] == 1);
+#endif
 }
 
 Vector
@@ -60,7 +63,7 @@ Active_constraints::add(int k)
     int cidx=inactive[k];
     active.add(cidx);
 
-    inactive.swap(k,inactive.sz()-1);
+    inactive.swap(k,inactive.size()-1);
     inactive.pop();
 
     Vector a( opt->cons[cidx] );
@@ -92,7 +95,7 @@ Active_constraints::add(int k)
 void
 Active_constraints::drop(int k)
 {
-    int q=active.sz()-1;
+    int q=active.size()-1;
 
         // drop indices
     inactive.add(active[k]);
@@ -124,7 +127,7 @@ Active_constraints::Active_constraints(Ineq_constrained_qp const *op)
            H(op->dim()),
            opt(op)
 {
-    for (int i=0; i < op->cons.sz(); i++)
+    for (int i=0; i < op->cons.size(); i++)
        inactive.add(i);
     Choleski_decomposition chol(op->quad);
     H=chol.inverse();
index ec8784a9bdf4bdf1dda20800336bc2c65136c806..bbd0dba1aeda4e56d77c8596591d7d34c106ec7a 100644 (file)
@@ -5,35 +5,37 @@
 int
 Score_column::compare(Score_column & c1, Score_column &c2)
 {
-       return sign(c1.when - c2.when);
+       return sign(c1.when_ - c2.when_);
 }
 
 void
-Score_column::set_breakable() {
-    pcol_->set_breakable();
+Score_column::set_breakable()
+{
+    pcol_l_->set_breakable();
 }
+
 Score_column::Score_column(Moment w)
 {
-    when = w;
-    pcol_ = new PCol(0);
-    musical = false;
+    when_ = w;
+    pcol_l_ = new PCol(0);
+    musical_ = false;
 }
 
 bool
 Score_column::used() {
-    return pcol_->used();
+    return pcol_l_->used();
 }
 
 void
 Score_column::print() const
 {
 #ifndef NPRINT
-    mtor << "Score_column { mus "<< musical <<" at " <<  when<<'\n';
+    mtor << "Score_column { mus "<< musical_ <<" at " <<  when_<<'\n';
     mtor << "durations: [";
-    for (int i=0; i < durations.sz(); i++)
+    for (int i=0; i < durations.size(); i++)
        mtor << durations[i] << " ";
     mtor << "]\n";
-    pcol_->print();
+    pcol_l_->print();
     mtor << "}\n";
 #endif
 }
@@ -52,7 +54,7 @@ Score_column::preprocess()
 void
 Score_column::add_duration(Moment d)
 {
-    for (int i = 0; i< durations.sz(); i++) {
+    for (int i = 0; i< durations.size(); i++) {
        if (d == durations[i])
            return ;
     }
index 39c13c48b8d054c116083bf86db4cfd30cc7c4c3..ed28c5b543a9cf85705fb3a9d98b0b15aff6aadb 100644 (file)
@@ -22,17 +22,17 @@ Line_of_score::TeXstring() const
 }
 
 
-Line_of_score::Line_of_score(svec<PCol *> sv,
+Line_of_score::Line_of_score(Array<PCol *> sv,
                             PScore *ps)
 {
-    pscore_ = ps;
-    for (int i=0; i< sv.sz(); i++) {
+    pscore_l_ = ps;
+    for (int i=0; i< sv.size(); i++) {
        PCol *p=(PCol *) sv[i];
        cols.bottom().add(p);
-       p->line=this;
+       p->line_l_=this;
     }
 
-    for (iter_top(pscore_->staffs,sc); sc.ok(); sc++)
+    for (iter_top(pscore_l_->staffs,sc); sc.ok(); sc++)
        staffs.bottom().add(new Line_of_staff(this, sc));    
 }
 /* construct a line with the named columns. Make the line field
index 1d0679c534268c540518fa7cfb03080da5a7f42f..1b7b6558de72fbb02545f336fd0df2b5252448b4 100644 (file)
@@ -3,7 +3,7 @@
 #include "score.hh"
 #include "string.hh"
 
-static svec<Input_score*> sv;
+static Array<Input_score*> score_array_global;
 
 static String outfn="lelie.uit";
 
@@ -11,21 +11,21 @@ static String outfn="lelie.uit";
 void
 do_scores()
 {
-    for (int i=0; i < sv.sz(); i++) {
-       Score * s = sv[i]->parse();     
-       delete sv[i];
-       
-       s->process();
-       s->output(outfn);
-       delete s;
+    for (int i=0; i < score_array_global.size(); i++) {
+       Score * s_p = score_array_global[i]->parse();   
+       delete score_array_global[i];
+       s_p->print ();
+       s_p->process();
+       s_p->output(outfn);
+       delete s_p;
     }
-    sv.set_size(0);
+    score_array_global.set_size(0);
 }
 
 void
 add_score(Input_score * s)
 {
-    sv.add(s);
+    score_array_global.add(s);
 }
 
 
index b3f2ac40c0bc719787d42593975e52086f0a37d5..de3d6ec921ac0db212b597d92236defbad58bcd8 100644 (file)
@@ -13,7 +13,7 @@ Item *
 Simple_staff::get_TYPESET_item(Command *com)
 {
     Item *s=0;
-    svec<Scalar> arg( com->args);
+    Array<Scalar> arg( com->args);
     String type =arg[0];
     arg.del(0);
     if (type ==  "BAR" ) {
@@ -32,12 +32,12 @@ Simple_staff::get_TYPESET_item(Command *com)
 
 
 Interval
-itemlist_width(const svec<Item*> &its)
+itemlist_width(const Array<Item*> &its)
 {
     Interval iv ;
     iv.set_empty();
      
-    for (int j =0; j < its.sz(); j++){
+    for (int j =0; j < its.size(); j++){
        iv.unite (its[j]->width());
 
     }
@@ -49,18 +49,18 @@ Simple_column::typeset_item(Item *i, int breakst)
 {
     assert(i);
     
-    staff_->pscore_->typeset_item(i, score_column->pcol_,
+    staff_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
                                  staff_->theline,breakst);
     
     if (breakst == BREAK_PRE - BREAK_PRE) {
        
-        svec<Item*> to_move(
-           staff_->pscore_->select_items(staff_->theline,
-                                         score_column->pcol_->prebreak));
+        Array<Item*> to_move(
+           staff_->pscore_l_->select_items(staff_->theline,
+                                         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.sz(); j++) {
+       for (int j=0; j < to_move.size(); j++) {
            to_move[j]->translate(Offset(-column_wid.right, 0));
        }
     }
@@ -70,13 +70,13 @@ void
 Simple_column::typeset_item_directional(Item *i, int dir, int breakst)
 {
     assert(i);
-    PCol * c=score_column->pcol_;
+    PCol * c=score_column_l_->pcol_l_;
     if (breakst == 0)
-       c = c->prebreak;
+       c = c->prebreak_p_;
     else if (breakst == 2)
-       c = c->postbreak;
+       c = c->postbreak_p_;
     
-    svec<Item*> to_move(staff_->pscore_->select_items(staff_->theline,
+    Array<Item*> to_move(staff_->pscore_l_->select_items(staff_->theline,
                                                      c));    
     typeset_item(i, breakst);
 
@@ -89,8 +89,8 @@ Simple_column::typeset_item_directional(Item *i, int dir, int breakst)
 void
 Simple_staff::set_output(PScore* ps )
 {
-    pscore_ = ps;
-    pscore_->add(theline);
+    pscore_l_ = ps;
+    pscore_l_->add(theline);
 }
 
 
index 15a94cf8c30e2dc513da0372d894b7ddda156b04..e5dbf385ac739e8bf3e268f7c7ce4f7c9db6867d 100644 (file)
@@ -38,12 +38,12 @@ void
 Slur::set_default_dir()
 {
     int sumpos=0;
-    for (int i=0; i < encompass.sz(); i ++) {
+    for (int i=0; i < encompass.size(); i ++) {
        sumpos += encompass[i]->position;
     }
 
     /* should consult stems */
-    Real meanpos = sumpos/Real(encompass.sz());
+    Real meanpos = sumpos/Real(encompass.size());
     if (meanpos < 5)           // todo
        dir = -1;
     else
@@ -59,19 +59,19 @@ Slur::print()const
 void
 Slur::do_pre_processing()
 {
-    right  = encompass.last()->pcol_;
-    left = encompass[0]->pcol_;    
+    right  = encompass.last()->pcol_l_;
+    left = encompass[0]->pcol_l_;    
 }
 
 Spanner*
 Slur::do_break_at(PCol*l, PCol*r) const
 {
-    assert(l->line == r->line);
+    assert(l->line_l_ == r->line_l_);
     Slur*ret = new Slur(*this);
 
     ret->encompass.set_size(0);
-    for (int i =0; i < encompass.sz(); i++) {
-       if (encompass[i]->pcol_->line==l->line)
+    for (int i =0; i < encompass.size(); i++) {
+       if (encompass[i]->pcol_l_->line_l_==l->line_l_)
            ret->encompass.add(encompass[i]);
     }
     if (right != r)
@@ -93,32 +93,41 @@ Molecule*
 Slur::brew_molecule() const
 {
     Molecule*output = new Molecule;
-    assert(left->line == right->line);
+
     int minp=1000, maxp=-1000; // todo    
-    for (int i=0; i<encompass.sz(); i++) {
+    for (int i=0; i<encompass.size(); i++) {
        minp = encompass[i]->position <? minp;
        maxp = encompass[i]->position >? maxp;
     }
-    assert(encompass.sz()>0);  // todo
+    assert(encompass.size()>0);        // todo
     
     Notehead *lnote_p =encompass[0];
     Notehead *rnote_p =encompass.last();
-    int pos1 = lnote_p->position;
-    int pos2 = rnote_p->position;
-
-    int dy =  pos2-pos1;
+    int lpos_i = lnote_p->position;
+    int rpos_i = rnote_p->position;
+    Offset  left_off(lnote_p->x_dir, lpos_i + 2*dir);
+    Offset right_off(lnote_p->x_dir, rpos_i + 2*dir);
+    if (!lnote_p->extremal)
+       left_off += Offset(0.5, -dir);
+    if (!rnote_p->extremal)
+       right_off+= Offset(-0.5, -dir);
+    
+    int dy = right_off.y - left_off.y;
+    
     Real nw_f = paper()->note_width();
+    Real nh_f = paper()->internote();
     Real w = width().length();
-    w+= (-lnote_p->x_dir + rnote_p->x_dir)* nw_f ;
+    
+    w+= (right_off.x - left_off.x) * nw_f ;
     Real round_w = w;          // slur lookup rounds the slurwidth .
     
-    Symbol sl = paper()->lookup_->slur(dy , round_w, dir);
+    Symbol sl = paper()->lookup_p_->slur(dy , round_w, dir);
 
     Real error = w-round_w;
     
     Atom a(sl);
-    a.translate(Offset((lnote_p->x_dir + 0.5 )*nw_f + error/2,
-                      (pos2+2*dir) * paper()->internote()));
+    a.translate(Offset((left_off.x + 0.5 )*nw_f + error/2,
+                      left_off.y * nh_f));
     output->add(a);
     return output;
 }
index bf76a9eb704304d24e5a16a1e1deff477100e667..d942732e7c264bc8c96c0513656e9630065125b7 100644 (file)
@@ -7,12 +7,23 @@
 String
 Staff_elem::TeXstring() const
 {
-    assert(output && !calc_children);
+    assert(!calc_children);
     Molecule m(*output);
     m.translate(offset_);      // ugh?
     return m.TeXstring();
 }
 
+Staff_elem::Staff_elem(Staff_elem const&s)
+    :    dependencies(s.dependencies)
+{
+    status = s.status;
+    assert(!s.output);
+    output = 0;
+    pstaff_l_ = s.pstaff_l_;
+    calc_children = false;
+    offset_ = Offset(0,0);
+}
+
 Staff_elem::~Staff_elem()
 {
    delete output;
@@ -60,7 +71,7 @@ Staff_elem::print()const
 Staff_elem::Staff_elem()
 {
     calc_children = false;
-    pstaff_=0;
+    pstaff_l_=0;
     offset_ = Offset(0,0);
     output = 0;
     status = ORPHAN;
@@ -70,8 +81,8 @@ Staff_elem::Staff_elem()
 Paperdef*
 Staff_elem::paper()  const
 {
-    assert(pstaff_);
-    return pstaff_->pscore_->paper_;
+    assert(pstaff_l_);
+    return pstaff_l_->pscore_l_->paper_l_;
 }
 
 void
@@ -89,7 +100,7 @@ Staff_elem::pre_processing()
 {
     if (status >= PRECALCED )
        return;
-    for (int i=0; i < dependencies.sz(); i++)
+    for (int i=0; i < dependencies.size(); i++)
        if (dependencies[i])
            dependencies[i]->pre_processing();
     if (!calc_children)
@@ -101,7 +112,7 @@ Staff_elem::post_processing()
 {
     if (status > POSTCALCED)
        return;
-    for (int i=0; i < dependencies.sz(); i++)
+    for (int i=0; i < dependencies.size(); i++)
        if (dependencies[i])
            dependencies[i]->post_processing();
     if (!calc_children)
@@ -114,7 +125,7 @@ Staff_elem::molecule_processing()
 {
     if (status >= OUTPUT)
        return;
-    for (int i=0; i < dependencies.sz(); i++)
+    for (int i=0; i < dependencies.size(); i++)
        if (dependencies[i])
            dependencies[i]->molecule_processing();
     if (!calc_children)
index df250aa8d37d1e43cdb554009b7c44609d3b28a2..66b1aadb33501a338959a77a7386da1e1924bf44 100644 (file)
@@ -116,9 +116,11 @@ void
 Stem::set_noteheads()
 {
     heads.sort(Notehead::compare);
+    heads[0]->extremal = -1;
+    heads.last()->extremal = 1;
     int parity=1;
     int lastpos = heads[0]->position;
-    for (int i=1; i < heads.sz(); i ++) {
+    for (int i=1; i < heads.size(); i ++) {
        int dy =abs(lastpos- heads[i]->position);
        
        if (dy <= 1) {
@@ -146,7 +148,7 @@ Stem::width()const
     if (!print_flag || abs(flag) <= 4)
        return Interval(0,0);   // TODO!
     Paperdef*p= paper();
-    Interval r(p->lookup_->flag(flag).dim.x);
+    Interval r(p->lookup_p_->flag(flag).dim.x);
     r+= stem_xoffset;
     return r;
 }
@@ -154,20 +156,19 @@ Stem::width()const
 Molecule*
 Stem::brew_molecule()const return out;
 {
-    assert(pstaff_);
     assert(bot!=top);
  
     
     Paperdef *p =paper();
 
     Real dy = p->internote();
-    Symbol ss =p->lookup_->stem(bot*dy,top*dy);
+    Symbol ss =p->lookup_p_->stem(bot*dy,top*dy);
 
     
     out = new Molecule(Atom(ss));
 
     if (print_flag&&abs(flag) > 4){
-       Symbol fl = p->lookup_->flag(flag);
+       Symbol fl = p->lookup_p_->flag(flag);
        Molecule m(fl);
        if (flag < -4){         
            out->add_bottom(m);
@@ -183,7 +184,7 @@ Stem::brew_molecule()const return out;
 Real
 Stem::hpos()const
 {
-    return pcol_->hpos + stem_xoffset;
+    return pcol_l_->hpos + stem_xoffset;
 }
 
 
index d9ffea7afbb565ae1d13bafd8d0dfebeb0bb1bed..01b235679b7016b5cd18932629b5135c6000ec97 100644 (file)
@@ -1,5 +1,5 @@
 #include "symbol.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 
 Symbol::Symbol()
index 372536c20aa31916d1e4cd9824dfbb29a06040d9..9a10c993ea023da5ff030dfd3dd93d6882e84cc3 100644 (file)
@@ -2,7 +2,7 @@
 #include "tex.hh"
 #include "symbol.hh"
 #include "const.hh"
-#include "vray.hh"
+#include "varray.hh"
 
 String
 vstrut(Real h)
@@ -22,20 +22,20 @@ substitute_arg(String& r, String arg)
 
 
 String
-substitute_args(String source, svec<String> args)    
+substitute_args(String source, Array<String> args)    
 {
     String retval (source);
-    for (int i = 0 ; i < args.sz(); i++)
+    for (int i = 0 ; i < args.size(); i++)
         substitute_arg(retval, args[i]);
     while (retval.pos('%'))
         substitute_arg(retval, "");
     return retval;
 }
 String
-substitute_args(String source, svec<Scalar> args)    
+substitute_args(String source, Array<Scalar> args)    
 {
-    svec<String> sv;
-    for (int i = 0 ; i < args.sz(); i++)
+    Array<String> sv;
+    for (int i = 0 ; i < args.size(); i++)
        sv.add(args[i]);
     
     return substitute_args(source, sv);
index ec6ac16395ef159d23a5167914abd9f15e061c91..d0bfd5b74fd907c336105e179b1bc2fe32840fc6 100644 (file)
@@ -9,25 +9,25 @@
    
     */
 
-svec<Col_configuration>
+Array<Col_configuration>
 Word_wrap::solve()
 {
     problem_OK();
     iter_top(pscore_.cols,curcol);
-    svec<Col_configuration> breaking;
-    svec<PCol *> breakpoints(find_breaks());
-    assert(breakpoints.sz()>=2);
-    for (int i=0 ; i < breakpoints.sz() -1; ) {
+    Array<Col_configuration> breaking;
+    Array<PCol *> breakpoints(find_breaks());
+    assert(breakpoints.size()>=2);
+    for (int i=0 ; i < breakpoints.size() -1; ) {
        Col_configuration minimum;
        Col_configuration current;
 
         // do  another line
-       PCol *post = breakpoints[i]->postbreak;
+       PCol *post = breakpoints[i]->postbreak_p_;
        current.add( post);
        curcol++;               // skip the breakable.
        i++;
 
-       while (i < breakpoints.sz()) {
+       while (i < breakpoints.size()) {
 
            // add another measure.
            while (breakpoints[i] != curcol.ptr()){
@@ -35,9 +35,9 @@ Word_wrap::solve()
                current.add(curcol);
                curcol++;
            }
-           current.add(breakpoints[i]->prebreak );
+           current.add(breakpoints[i]->prebreak_p_ );
            if (!feasible(current.cols)) {
-               if (!minimum.cols.sz())
+               if (!minimum.cols.size())
                    error("sorry, this measure is too long");
                break;
            }