]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.28 release/0.0.28
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 6 Feb 1997 01:51:23 +0000 (02:51 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 6 Feb 1997 01:51:23 +0000 (02:51 +0100)
57 files changed:
.dstreamrc
Documentation/lilygut.pod
NEWS
Sources.make
TODO
Variables.make
configure
deps/Makefile
deps/dummy.dep [new file with mode: 0644]
flower/Variables.make
flower/matdebug.cc
flower/vector.cc
flower/vector.hh
genheader
hdr/break.hh
hdr/colhpos.hh [new file with mode: 0644]
hdr/inputscore.hh
hdr/inputstaff.hh
hdr/leastsquares.hh
hdr/linespace.hh
hdr/main.hh
hdr/proto.hh
hdr/pscore.hh
hdr/request.hh
hdr/score.hh
hdr/sourcefile.hh
hdr/staffelem.hh
input/Makefile
input/scsii-menuetto.ly [new file with mode: 0644]
input/wohltemperirt.ly
src/beam.cc
src/break.cc
src/calcideal.cc
src/colhpos.cc [new file with mode: 0644]
src/complexwalker.cc
src/inputscore.cc
src/inputstaff.cc
src/leastsquares.cc
src/lexerinit.cc
src/localkeyitem.cc
src/lookup.cc
src/main.cc
src/parser.y
src/pcol.cc
src/pscore.cc
src/request.cc
src/score.cc
src/script.cc
src/slur.cc
src/sourcefile.cc
src/spanner.cc
src/staffelem.cc
src/stem.cc
src/textspanner.cc
src/timedescription.cc
src/warn.cc
src/wordwrap.cc

index 5ca2fa850cd1aac38ca3dae767ed93c67456c1d6..088fbcc81a976d2d14b6b4d7b8a683b6dc8666c3 100644 (file)
@@ -2,11 +2,11 @@
 
 My_flex_lexer          1
 yyFlexLexer            1
-PCol                   0
-Score_column           0
+PCol                   1
+Score_column           1
 Ineq_constrained_qp    1
-Spacing_problem        0
-Colinfo                        0
+Spacing_problem        1
+Colinfo                        1
 Mixed_qp               1
 PScore                 1
 Idealspacing           1
@@ -22,20 +22,29 @@ Lexer                       1
 parse_duration         1
 parse_pitchmod         1
 Col_configuration      1
-Request                        0
-Note_req               0
-Rhythmic_req           0
+Request                        1
+Note_req               1
+Rhythmic_req           1
 Rest_req               1
 delete_identifiers     1
 Command                        1
 Staff_commands         1
 Stem                   1
-Staff                  0
+Staff                  1
 Score                  1
-Voice                  0
-Voice_element          0
+Voice                  1
+Voice_element          1
 Input_cursor           1
-Commands_at            0
-Input_command          0
-Time_description       0
+Commands_at            1
+Input_command          1
+Time_description       1
 Melodic_req            1
+Stem_req               1
+Group_change_req       1
+Script_req             1
+Colinfo                        1
+Word_wrap              1
+Text_req               1
+Script_def             1
+Text_def               1
+Paperdef               1
index eae32d2e01354722be4435d8a628749c7b38dbd7..5633ee211a9e22723ba5e55c0995358ac5d3425e 100644 (file)
@@ -117,6 +117,75 @@ support.
 
 =back
 
+=head1 Request_register
+
+In the previous section the idea of Request has been explained, but
+this only solves one half of the problem. The other half is
+deciding which requests should be honored, which should merged with
+other requests, and which should be ignored. Consider this (pseudo)input
+
+       { % chord
+               \music { [c() c] }
+               \music { [e() e] }
+       }
+
+Both the c and e are part of a chord (they are in the same
+Voice_group), so they should share the beams, and the two [ ] pairs
+should be merged. The slurs OTOH are specific for each voice, so they
+should not be shared.
+
+The judge in this "allocation" problem is Staff (actually, it's child
+C<Complex_staff>). It uses the C<Request_register> to do most of the
+work class.  For each request C<Complex_staff> queries so-called
+C<Request_register>s if they want to accept a request eg, the
+C<Notehead_register> will accept C<Note_req>s, and turn down
+C<Slur_req>s. If C<Complex_staff> cannot find a register wants the
+request, it is junked (with a warning message).
+
+After all requests have been either assigned, or junked, the Register
+will process the requests (which usually means creating an C<Item> or
+C<Spanner>). If a C<Request_register> creates something, it tells
+C<Complex_staff>. If all requests have been processed, then each
+Register is notified of any created Staff_element.
+
+=head2 example:
+
+       c4
+
+produces:
+
+       note_request (duration 1/4)
+       stem_request (duration 1/4)
+
+note_request will be taken by a C<Notehead_register>, stem_request
+will be taken by a C<Stem_beam_register>. C<Notehead_register> creates
+a C<Notehead>, C<Stem_beam_register> creates a C<Stem>. Both announce
+this to the Staff. Staff will tell C<Stem_beam_register> about the
+C<Notehead>, which will add the C<Notehead> to the C<Stem> it just
+created.
+
+To decide on merging, C<Complex_staff> has grouped several
+registers. There are a few groups:
+
+=item *
+Staff wide, contains
+       Local_key_register
+
+=item *
+Voice group, contains
+       Stem_beam_register
+       Script_register
+       Text_register
+
+=item *
+Voice, contains
+       Slur_register
+       Notehead_register
+
+
+=item 1
+
+
 =head1 COMMANDS
 
 
diff --git a/NEWS b/NEWS
index 3362d4ffa6d112cadb22f41982ddbc6188bd7043..4592ee36f952ea45e8ba3e561363ca780418c988 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+pl 28
+
+Internal
+       - idealspacing slightly better for multivoice.
+Doc
+       - Request_register
+Bugfix
+       - Script.cc : float exception
+       - Request::Request(Request) copying of definition pointer
+       - cleaned dependencies for broken spanners
+       - stupid typo in Staff_elem::post_processing()
+       - init of hpos in PCol::PCol
+       - Word_wrap::solve() bug 
+
 pl 27
        - preliminary WIN32 support (JN)
 Features
index 56e9623b54090e9ba03ff99f8f1fa2647a6ce8e4..c40a11e55fbd6528bc3d5ef9557bcd6737999119 100644 (file)
@@ -2,7 +2,7 @@
 # sourcefiles to be shipped. Also for dependencies
 
 hdr=   bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\
-       command.hh complexwalker.hh complexstaff.hh\
+       colhpos.hh command.hh complexwalker.hh complexstaff.hh\
        const.hh debug.hh dimen.hh directionalspanner.hh\
        getcommand.hh glob.hh  grouping.hh idealspacing.hh\
        identifier.hh identparent.hh inputcommand.hh inputcommands.hh\
@@ -24,7 +24,7 @@ hdr=   bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\
        voicegroup.hh
 
 mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\
-       clefitem.cc command.cc complexstaff.cc complexwalker.cc \
+       clefitem.cc colhpos.cc command.cc complexstaff.cc complexwalker.cc \
         complexprint.cc debug.cc dimen.cc\
        directionalspanner.cc\
        getcommands.cc grouping.cc groupregs.cc idealspacing.cc identifier.cc\
diff --git a/TODO b/TODO
index 0385d4ae0c87d38fa98ff64164475adcab37a483..ad7d69049e31e74bd22ed0ed1e31f8c42b40af4f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -28,8 +28,6 @@ SMALLISH PROJECTS
 
        * make spanner for staffsym
        
-       * Lyric_req: Text_req, Rhythmic_req
-       
        * Lookup::tex_glissando, Lookup::tex_bracket,
        Lookup::tex_cresc, Lookup::tex_decresc (use texbeam.cc as an
        example.)
@@ -64,7 +62,6 @@ DOC
 
        * beam generation.
 
-       * Request_register
 
        * all errors
 
index 39719441bf7e758ad8d2c57f3e494e081ce36c97..f0a26c0c3d659bcb3517c7bdad91543b21ca5222 100644 (file)
@@ -40,7 +40,7 @@ endif
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=27
+PATCHLEVEL=28
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
 CXXVER=`$(CXX) --version`
 
index 000f31cdc139a4cb995f7323a8e996e6ecc987e6..e07c529a01f55c9a3d7409946ac64d3c740a09a0 100755 (executable)
--- a/configure
+++ b/configure
@@ -3,7 +3,7 @@
 PREFIX=${PREFIX:-.}
 echo using PREFIX=$PREFIX
 
-NEEDFLOWERVER=1.0.2
+NEEDFLOWERVER=1.0.24
 flowertar=flower-$NEEDFLOWERVER
 here=`pwd`
 cd ..
index 4a3104af2ff9f9f7fb8fab2ab23edc269d84234e..79265b1c0f9615f77883bda077f21bdfc22ed4a8 100644 (file)
@@ -1,9 +1,12 @@
-DISTFILES=Makefile
+DISTFILES=Makefile dummy.dep
 
-default:
 
 
-dist:
+dummy.dep:
+       touch dummy.dep
+
+
+dist: $(DISTFILES)
        ln $(DISTFILES) $(DDIR)/$(SUBDIR)
 
 clean:
diff --git a/deps/dummy.dep b/deps/dummy.dep
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
index 67d1863f279767b9665c8c999ff254830e5faa46..ea51570ce7daf04bdefeafa043568f28efd3c1a3 100644 (file)
@@ -1,6 +1,6 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=23
+PATCHLEVEL=24
 PACKAGENAME=flower
 
 #PROFILEFLAG=-pg
index 1c3df9dda143ec206ae70163e8f337663d9ed966..7aec81909f6aec5f6bca08e65bdbc2a9916b6a9f 100644 (file)
@@ -35,7 +35,7 @@ Matrix::print() const
 Vector::operator String() const
 {
     String s("vector [");
-#ifndef NDEBUG
+#ifndef NPRINT
     for (int i=0; i < dim(); i++) {
        s += String(dat[i], "%6f") + ' ';
     }
index bb3008ee5e902cd7318c028fc0bd8a2919d43879..5cc76bfd7b274e4f1046bde102d04ea6ca73938e 100644 (file)
@@ -1,7 +1,11 @@
 #include "vector.hh"
-
+Vector::Vector(Array<Real> d)
+       : dat(d)
+{
+}
 Vector::Vector(const Vector&n)
-          :dat(n.dat)
+    dat(n.dat)
 {
 }    
 
index 2fdf41482a68e52f4477e2a495c4c08ac57d1424..c039d5ce89276d024cf6d187b5b4e3122a633f76 100644 (file)
@@ -16,6 +16,7 @@ public:
     void OK() const { dat.OK();}
     int dim() const { return dat.size(); }
     Vector() { }
+    Vector(Array<Real> d );
     Vector(const Vector&n);
     Vector(int n) {
        dat.set_size(n);
index 203ed196ea5bd093997dfd78c94f114357b0a905..6e5b278ab3eba06ca195c20d6a9bd0b590eab2f7 100755 (executable)
--- a/genheader
+++ b/genheader
@@ -8,10 +8,15 @@ cat << HERE
   (c) 1997 $USERNAME <$MAILADRESS>
 */
 
+HERE
+
+if [ $1 != `basename .hh` ]
+then
+cat <<EOF
 #ifndef $def
 #define $def
 
 
 #endif // $def
-
-HERE
+EOF
+fi
index 2f471fd4fd1d2d5b656d4170212aca3916d5dca3..9ecb484e5b156d253db8aee2f87f3bfa03118015 100644 (file)
@@ -8,20 +8,7 @@
 #define BREAK_HH
 #include "varray.hh"
 #include "proto.hh"
-typedef Array<PCol*>  Line_of_cols;
-
-struct Col_configuration {
-    Line_of_cols cols;
-    Array<Real> config;
-    Real energy;
-
-    /****************/
-    void OK()const;
-    void setsol(Array<Real>);
-    Col_configuration() ;
-    void add( PCol*c);
-    void print() const;
-};
+#include "colhpos.hh"
 
 struct Break_algorithm {
     PScore &pscore_;
@@ -30,24 +17,25 @@ struct Break_algorithm {
     /****************/
 
     Break_algorithm(PScore&);
+
     /// check if the spacing/breaking problem is well-stated
     void problem_OK()const;
+
     /// search all pcols which are breakable.
-    Array<PCol *> find_breaks() const;
+    Line_of_cols find_breaks() const;
 
      /// helper: solve for the columns in #curline#.
-    Array<Real> solve_line(Line_of_cols) const;
+    Col_hpositions solve_line(Line_of_cols) const;
 
-    
     /// does curline fit on the paper?    
     bool feasible(Line_of_cols)const;
     
-    virtual Array<Col_configuration> solve()=0;
+    virtual Array<Col_hpositions> solve()=0;
 };
 
 /// wordwrap type algorithm: move to next line if current is optimal.
 struct Word_wrap : Break_algorithm {
-    virtual Array<Col_configuration> solve();
+    virtual Array<Col_hpositions> solve();
     Word_wrap(PScore&);
 };
 #endif // BREAK_HH
diff --git a/hdr/colhpos.hh b/hdr/colhpos.hh
new file mode 100644 (file)
index 0000000..d066574
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+  colhpos.hh -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef COLHPOS_HH
+#define COLHPOS_HH
+#include "varray.hh"
+#include "proto.hh"
+
+typedef Array<PCol*>  Line_of_cols;
+
+struct Col_hpositions {
+    Line_of_cols cols;
+    Array<Real> config;
+    Real energy;
+
+    /****************/
+    void OK()const;
+
+    Col_hpositions();
+    void add( PCol*c);
+    void print() const;
+};
+
+
+#endif // COLHPOS_HH
+
index 1555456778716758a7655728abd8d3334d2ce0d8..94ff0458147ad44e01ee56c0a942172dc2105fa6 100644 (file)
@@ -9,7 +9,7 @@
 /// the total music def of one movement
 struct Input_score {
     /// defined where?    
-    String define_spot_str_;
+    const char* defined_ch_c_l_;
     int errorlevel_i_;
     
     /// paper_, staffs_ and commands_ form the problem definition.
index 01062de99cf76535ce94238142b6573786033413..647ffaf8a5829676af83dd0aaa9362a617bef14c 100644 (file)
@@ -15,7 +15,7 @@
 struct Input_staff {
     
     /// defined where?    
-    String define_spot_str_;
+    const char * defined_ch_c_l_;
     String type;
     IPointerList<Input_command*> commands_;
     IPointerList<Input_music*> music_;
index 4d3931ee945888cdc0c3ca74e32a2d27657eda47..b9a9241d0d8081aeef9e0a65755733f3986ba547 100644 (file)
@@ -12,6 +12,7 @@
 struct Least_squares {
     Array<Offset> input;
     void minimise(Real &coef, Real &offset);
+    void OK() const;
 };
 
 
index 50f13bd35cfd6deaacd5bbf209077a8cb0621fc5..e23d334ca6345fc101d9ef46690363953bdc06fb 100644 (file)
@@ -40,6 +40,7 @@ class Spacing_problem {
 
     /// check if problem is too tight
     bool check_feasible() const;
+
     /// does #this# contain the column #w#? 
     bool contains(const PCol *w);
 
index 1102833face510097b2b24ba2d195c0193adc171..e19b0aff12fb8154783d822c3621c21dcaec49cf 100644 (file)
@@ -10,6 +10,6 @@ void set_default_output(String s);
 Input_score* current_iscore_l();
 String find_file(String);
 const char *get_version();
-extern Source* source_l;
+extern Source* source_global_l;
 
 #endif
index 4987a705477a4525174a0ad21ed56435f35fcf9f..1ef4d8d9f24adc48afd4d4e4dac9d3fab8b7985a 100644 (file)
@@ -23,7 +23,7 @@ struct CNote_info;
 struct Chord;
 struct Clef;
 struct Clef_item;
-struct Col_configuration;
+struct Col_hpositions;
 struct Colinfo;
 struct Command;
 struct Commands_at ;
@@ -90,8 +90,10 @@ struct Slur;
 struct Slur_req;
 class Source;
 class Source_file;
+struct Spacing_req ;
 struct Span_req;
 struct Spanner;
+struct Blank_req;
 struct Staff;
 struct Staff_column;
 struct Staff_command_req;
index f79624735356498e7969a3c2b8c2996a33d8ba1f..3b47c65e44580bcfc820606f08f8a7a0c1b37aea 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef PSCORE_HH
 #define PSCORE_HH
 
-#include "break.hh"
+#include "colhpos.hh"
 #include "varray.hh"
 #include "pcol.hh"
 #include "pstaff.hh"
@@ -38,7 +38,7 @@ struct PScore {
     
     PScore(Paperdef*);
     /// add a line to the broken stuff. Positions given in #config#
-    void set_breaking(Array<Col_configuration>);
+    void set_breaking(Array<Col_hpositions>);
 
     void add(PStaff *);
     
index 9a01ade3fbab72254b70b4bf67eb0e46037669bb..203fc9ab059adaf472edef0dcacb64b076daa462 100644 (file)
@@ -22,7 +22,9 @@ struct Request {
     
     virtual Moment duration() const { return 0; }
 
-    /*  accessors for children */
+    /*  accessors for children
+       maybe checkout RTTI
+     */
     virtual Barcheck_req *barcheck() { return 0; }
     virtual Note_req *note() {return 0;}
     virtual Script_req *script() {return 0;}
@@ -40,6 +42,8 @@ struct Request {
     virtual Terminate_voice_req *terminate() {return 0;}
     virtual Group_change_req * groupchange() { return 0;}
     virtual Group_feature_req * groupfeature() { return 0; }
+    virtual Spacing_req * spacing() { return 0; }
+    virtual Blank_req * blank() { return 0; }
 protected:
     virtual void do_print()const ;
 };
@@ -87,6 +91,18 @@ struct Rhythmic_req : virtual Request {
     REQUESTMETHODS(Rhythmic_req, rhythmic);
 };
 
+struct Spacing_req :virtual Request {
+    Moment next;
+    Real distance;
+    Real strength;
+    /****************/
+    REQUESTMETHODS(Spacing_req, spacing);
+};
+
+struct Blank_req : Spacing_req, Rhythmic_req {
+    REQUESTMETHODS(Spacing_req, spacing);
+    
+};
 
 ///Put a text above or below (?) this staff.
 struct Text_req : virtual Request {
@@ -309,11 +325,6 @@ struct Grace_notes {
     
 };
 
-struct Spacing_req {
-    Moment next;
-    Real distance;
-};
-
 struct Glissando_req : Span_req {
     
 };
index 61868a471932c1567408814df0bd8060a15c4e55..64e282861454d06dc711ede99aa67d699bc0c16a 100644 (file)
@@ -16,7 +16,7 @@ struct Score {
     IPointerList<Score_column*> cols_;
     PScore *pscore_p_;
 
-    String define_spot_str_;
+    const char *defined_ch_c_l_;
     int errorlevel_i_;
     
     Assoc<String, Moment> markers_assoc_;
index 5e97f31a22098fec0a1ffc3e0d219a73f5e865f5..1e1e2a86922e00c3faa30111fd1a3f06ee1a3940 100644 (file)
@@ -21,6 +21,7 @@ public:
     bool in_b( char const* pos_ch_c_l );
     int line_i( char const* pos_ch_c_l );
     String name_str();
+    String file_line_no_str(const char *ch_c_l );
 
 private:
     void close();
index c7751b6ecc9a7652fffa948c15add5c05abf521d..ba3df695bfe4a99655842c35846c3593e4c8c403 100644 (file)
@@ -15,12 +15,12 @@ struct Staff_elem {
     enum Status {
        ORPHAN,                 // not yet added to pstaff
        VIRGIN,                 // added to pstaff
+       PRECALCING,
        PRECALCED,              // calcs before spacing done
+       POSTCALCING,
        POSTCALCED,             // after spacing calcs done
        OUTPUT,                 // molecule has been output
     } status;
-    bool calc_children;
-    Array<Staff_elem*> dependencies;
     
     ///  the pstaff it is in
     PStaff *pstaff_l_;
@@ -43,6 +43,8 @@ struct Staff_elem {
     virtual const char *name() const;          // to find out derived classes.
     virtual Spanner* spanner()  { return 0; }
     virtual Item * item() { return 0; }
+    void add_depedency(Staff_elem* );    
+    void substitute_dependency(Staff_elem* old, Staff_elem * newdep);
 protected:
     
     /// do printing of derived info.
@@ -57,6 +59,8 @@ protected:
     /// do calculations after determining horizontal spacing
     virtual void do_post_processing();
 
+    Array<Staff_elem*> dependants;
+
 private:
     /// member: the symbols
     Molecule *output;          // should scrap, and use temp var?
@@ -67,6 +71,7 @@ private:
       This is  needed, because #output# may still be
       NULL.
       */
+    Array<Staff_elem*> dependencies;
 };
 /** Both Spanner and Item are Staff_elem's. Most Staff_elem's depend
   on other Staff_elem's, eg, Beam needs to know and set direction of
index 61c04f111a4f0d698782a827c7c86dc135232bf6..182b105fb00d8177a56802424ffdfb6b963f0008 100644 (file)
@@ -4,7 +4,8 @@ DISTFILES=Makefile  kortjakje.ly pavane.ly  maartje.ly\
        cadenza.ly scales.ly standchen.ly twinkle.ly\
        wohltemperirt.ly error.ly\
        martien.ly mlalt.ly mlvio1.ly mlvio2.ly mlcello.ly\
-       standchen.tex pavane.tex  scsii-menuetto.tex martien.tex
+       standchen.tex pavane.tex scsii-menuetto.tex scsii-menuetto.ly\
+       martien.tex
 
 
 dist:
diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly
new file mode 100644 (file)
index 0000000..8401484
--- /dev/null
@@ -0,0 +1,153 @@
+% scsii-menuetto.ly
+%
+% Solo Cello Suites
+% J. S. Bach
+%
+% Suite II part v
+% Menuetto I
+%
+% Copyright (c) 1995,1996,1997 Jan Nieuwenhuizen <jan@digicash.com>
+% 
+% The purpose of this file is to demonstrate features of LilyPond.
+% (there is an accompanying LaTeX file, scsii-menuetto.tex)
+%
+
+% \lefttitle{Menuetto}
+% \tempo{Moderato}
+% \metron{4=120}
+%
+% \meter{3/4}
+% \key\F               % key is F ( f-major )
+% \clef\alto           % use alto clef
+% \duration8           % default duration is 'eight note
+%
+% \verb{\nobarnumbers} % issue MusiXTeX command
+% \barnumbering0
+% \slope{30}           % Fool MusiXTeX into 30 / 10 steeper beam
+% \stemlength3         % shorter stemlength
+%              % because piece is set very tightly
+%%1            % double comments are included in .tex file
+ii_menuetto = music {
+       $
+       \octave{}
+       \duration{8}
+       { a2 f2 d2_"\f" } bes4-.  |
+%%2
+       { [ bes^"1" e c_"2"_"4" }
+%      (^ )
+       a bes-. g-. ] a4-.^"4" |
+%%3
+%      { d4 `bes4-.\stemup } stemup: 2 voices?
+       { d4 `bes4-. } g4-. [ f-. e-. ] |
+%%4
+%      { f `a } (^ e ) d cis-. `b-. `a-. ]
+%      [ f ( e ) d cis-. `b-. `a-. ]
+       { [ f `a } e d cis-. `b-. `a-. ]
+%%5
+       { a2 f2 d2 } bes4-. | %   @bes4-. |
+%%6
+%      {  bes( e  }  ) a
+       { [ bes e } a bes-. g-. ]
+       'c4-. | % ='c4-. |
+%%7
+       { a4-. f4}
+%      { 'd4-.-\upbow f4 `bes4\stemdown }
+       { 'd4-.-\upbow f4 `bes4 }
+%      { 'e4-.-\downbow g4 `g4\stemdown } |
+       { 'e4-.-\downbow g4 `g4 } |
+%%8
+%      { 'cis2.-\upbow e2. `a2.\stemdown } :||:
+       { 'cis2.-\upbow e2. `a2. } | % :||:
+%%9
+%      \clef "violin"
+%      { 'e2 a2_f\stemdown }
+       { 'e2 a2_"\f" }
+       [ 'd( 'e16 )'f16 ] |
+%%10
+%      [ { 'e( g } ) 'd 'cis_{ }_{ }_2 'e
+       { [ 'e g } 'd 'cis_"2" 'e a( )g ] |
+%%11
+%      { a4\stemup( f2\stemdown } ) 'd4\stemup
+%      { 'cis4\stemup-. e4\stemdown }
+       { \music { a4 'd4 'cis4-. } \music { f2 e4 } } |
+%%12
+%      { 'g^4 d\stemdown } (^  'f 'e ) 'f 'd^3(^ ) ='c ] |
+       { [ 'g^"4" d } 'f 'e 'f 'd^"3"( ) 'c ] |
+% %13
+%      { bes2\stemup g4\stemdown } ( )  f4
+%      { 'c4\stemup e4\stemdown }
+%      { bes2 g4 } f4 { 'c4 e4 } | % \clef "alto" |
+       { \music { bes2 'c4 } \music { g4 f4 e4 } } |
+%%%14
+%%     [ { a( f } ) g a f ] { 'd4-\upbow e4 `bes4\stemdown } |
+       { [ a f } g a f ] { 'd4-\upbow e4 `bes4 } |
+%%%15
+%%     { 'c4-\downbow f4 `a4\stemdown } [ bes( )a g a ] |
+%      { 'c4-\downbow f4 `a4 } [ bes( )a g a ] |
+%%%16
+       [ f( e )f a-. g-. bes-. ] |
+%% \tighten            % use one line less
+%% \newline            % start new line
+%%     |
+%%%17
+%%     { a2^0^\tr fis2_3 } bes4 |
+       { a2^"0" fis2_"3" } bes4 |
+%%%18
+%%     [ { 'c( es } ) bes 'c a ] fis4^\tr |
+       { [ 'c es } bes 'c a ] fis4 |
+%%%19
+%%     { 'd4-\downbow g4 `bes4\stemdown } { 'c4-\upbow g4 c4\stemdown } [ { bes d } a ] |
+       { 'd4-\downbow g4 `bes4 } { 'c4-\upbow g4 c4 } { [ bes d } a ] |
+%%%20
+%%     [ { 'c( d `g } bes a ) bes g ( ) bes ] |
+       { [ 'c d `g } bes a bes g( )bes ] |
+%%%21
+%%     { 'd4\stemup g2\stemdown } (^ ) 'cis4\stemup { 'd4\stemup =f4\stemdown } |
+%      { 'd4 g2 } 'cis4 { 'd4 f4 } |
+       { \music { 'd4 'cis4 'd4 } \music { g2 f4 } } |
+%%%22
+%%     [ { g(  cis } )f g e ] { f4 d4 } |
+       { [ g cis } f g e ] { f4 d4 } |
+%%%23
+%%     [ `g g ] { e4.\stemup^\tr `a4.\stemdown } d\stemup-\upbow |
+       [ `g g ] { e4. `a4. } d-\upbow |
+%%%24
+%%     { d2.^{fine}  `a2. `d2.\stemup_{ }_{ }_{3 mins.}}       s4 :||
+%%     { \textstyle "italic" d2.^"fine" `a2. \textstyle "roman" `d2._"3 mins."} | % :||
+       { d2.^"fine" `a2. `d2._"3 mins."} | % :||
+%% \tighten            % use one line less
+       $
+}
+
+score {
+       staff { 
+               melodic
+               music { ii_menuetto }
+               commands {
+                       key $bes$
+                       clef "alto"     
+                       skip 8:0
+                       clef "violin"
+                       skip 5:0
+                       clef "alto"
+                       skip 12:0
+               }
+       }
+       commands {
+               meter 3*4
+               skip 8:0
+               bar ":|:"
+%              clef "violin"
+               skip 5:0
+%              \clef "alto" 
+               skip 12:0
+               bar ":||"
+       }
+       paper {
+               symboltables { table_sixteen }
+               width 195mm
+%              unitspace 12mm % this should do, really
+               unitspace 8mm  % to get lily to use only three lines
+               output "scsii-menuetto.out"
+       }
+}
index aac76544586bfb792fa1f8a6501c4540d4783a4e..3163a7bf3c3caa3fabf68116a72064b7d05fabb0 100644 (file)
@@ -55,6 +55,7 @@ score {
                        key $bes es as$
                }
        }
+       staff { basstaf }
        commands { 
                meter 4*4
                skip 8:0
index 52080a39ab4091da451fdbb6483fd02d4f215677..02e3d3d94fd1f74d73962ec25d9418f5c547873f 100644 (file)
@@ -34,7 +34,7 @@ Stem_info::Stem_info(const Stem*s)
     idealy  = max(dir*s->top, dir*s->bot);
     miny = max(dir*s->minnote, dir*s-> maxnote);
     assert(miny <= idealy);
-    no_beams = s->flag;
+
 }
 
 /****************/
@@ -43,10 +43,6 @@ Offset
 Beam::center()const
 {
     assert(status >= POSTCALCED);
-    if (calc_children){                // URGGGG!!!
-       Beam*me_p = (Beam*)this;
-       me_p->do_post_processing();
-    }
 
     Real w=(paper()->note_width() + width().length())/2.0;
     return Offset(w, (left_pos + w* slope)*paper()->interline());
@@ -64,7 +60,7 @@ void
 Beam::add(Stem*s)
 {
     stems.bottom().add(s);
-    s->dependencies.push(this);
+    s->add_depedency(this);
     s->print_flag = false;
 }
 
@@ -177,7 +173,9 @@ Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur)
 Spanner *
 Beam::do_break_at( PCol *, PCol *) const
 {
-    return new Beam(*this);
+    Beam *beam_p= new Beam(*this);
+    
+    return beam_p;
 }
 
 void
index f3832cf0f608fb3848d1c2a1ad0e66cc27307103..a138049471a88a95bbf2e59b995caa0f8a2d8142 100644 (file)
@@ -1,6 +1,5 @@
 /*
-    do calculations for breaking problem
-    
+    do calculations for breaking problem    
     */
 #include "break.hh"
 #include "paper.hh"
 /*
   return all breakable columns
  */
-Array<PCol *>
+Line_of_cols
 Break_algorithm::find_breaks() const
 {
-    Array<PCol *> retval;
+    Line_of_cols retval;
     for (iter_top(pscore_.cols,c); c.ok(); c++)
        if (c->breakable())
            retval.push(c);
-
+    assert(retval.last() == pscore_.cols.bottom().ptr());
     return retval;
 }
 
 // construct an appropriate Spacing_problem and solve it. 
-Array<Real>
+Col_hpositions
 Break_algorithm::solve_line(Line_of_cols curline) const
 {
    Spacing_problem sp;
@@ -40,7 +39,13 @@ Break_algorithm::solve_line(Line_of_cols curline) const
        sp.add_ideal(i);
    }
    Array<Real> the_sol=sp.solve();
-   return the_sol;
+   Col_hpositions col_hpos;
+   col_hpos.cols = curline;
+   col_hpos.energy = the_sol.last();
+   the_sol.pop();
+   col_hpos.config = the_sol;
+   col_hpos.OK();
+   return col_hpos;
 }
 
 Break_algorithm::Break_algorithm(PScore&s)
@@ -71,40 +76,3 @@ Break_algorithm::problem_OK() const
     assert(end->breakable());
 #endif
 }
-
-/****************/
-
-Col_configuration::Col_configuration()
-{
-    energy = INFTY;
-}
-
-void
-Col_configuration::add( PCol*c)
-{
-    cols.push(c);
-}
-
-void
-Col_configuration::setsol(Array<Real> sol)
-{
-    config = sol;
-    energy = config.last();
-    config.pop();
-}
-
-void
-Col_configuration::print() const
-{
-#ifndef NPRINT
-    mtor << "energy : " << energy << '\n';
-    mtor << "line of " << config.size() << " cols\n";
-#endif
-}
-void
-Col_configuration::OK()const
-{
-#ifndef NDEBUG
-    assert(config.size() == cols.size());
-#endif
-}
index b6d34115081e2ca5c5f063dde5ebfe24aa0420b8..7fcf65d762afa9f6dbbd8d791639e038b151a17c 100644 (file)
@@ -31,13 +31,15 @@ Score::calc_idealspacing()
                while (j->when() < d + i->when())
                    j++;
                assert( j->when()== d+i->when());
-
+               
                pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist);
+#if 0          
                if (!j->musical_ && (j+1).ok() 
-                   && (j+1)->when() == j->when()) {
+                   && ) {
                    j++;
                    pscore_p_->connect(i->pcol_l_, j->pcol_l_,  dist);
                }
+#endif 
            }
        } else if (j.ok()) {
            
diff --git a/src/colhpos.cc b/src/colhpos.cc
new file mode 100644 (file)
index 0000000..530e4d4
--- /dev/null
@@ -0,0 +1,35 @@
+#include "colhpos.hh"
+#include "real.hh"
+#include "debug.hh"
+#include "const.hh"
+#include "vector.hh"
+
+Col_hpositions::Col_hpositions()
+{
+    energy = INFTY;
+}
+
+void
+Col_hpositions::add( PCol*c)
+{
+    cols.push(c);
+}
+
+void
+Col_hpositions::print() const
+{
+#ifndef NPRINT
+    mtor << "energy : " << energy << '\n';
+    mtor << "line of " << config.size() << " cols\n";
+    Vector v(config);
+    mtor << v;
+#endif
+}
+
+void
+Col_hpositions::OK()const
+{
+#ifndef NDEBUG
+    assert(config.size() == cols.size());
+#endif
+}
index f1a73e0200b02be6ffaca5faf376907aae2fa179..87e3729a072da364c3550acca35f5884320d42f8 100644 (file)
@@ -205,7 +205,8 @@ Complex_walker::try_request(Request*req)
     } 
 
     if (!b)
-       WARN<< "junking request: " <<req->name() <<"\n";
+       warning("junking request: "  + String(req->name()),
+               req->defined_ch_c_l_m);
 }
 
 void
index a5d4a31007679d9ee94906bb1656c7a78c0ccf86..ef684047c4e06e210d9474288fa2b02b9afc5e8d 100644 (file)
@@ -36,7 +36,7 @@ Input_score::parse()
 {
     Paperdef* paper_p=new Paperdef(*paper_);
     Score *s_p = new Score(paper_p);
-    s_p->define_spot_str_ = define_spot_str_;
+    s_p->defined_ch_c_l_= defined_ch_c_l_;
     s_p->errorlevel_i_ = errorlevel_i_;
     Array<Staff*> parsed_staffs;
     for (iter_top(staffs_,i); i.ok(); i++) {
@@ -60,6 +60,7 @@ Input_score::~Input_score()
 
 Input_score::Input_score()
 {
+    defined_ch_c_l_=0;
     paper_= 0;
     errorlevel_i_ = 0;
 }
index 6cbed389569050bb0a56fda358be1f0ac0ade584..8a56643f5c8aeffc7f86c198e48a1e5fb57102c4 100644 (file)
@@ -23,6 +23,7 @@ Input_staff::add(Array<Input_command*> &s)
 Input_staff::Input_staff(String s)
 {
     type= s;
+    defined_ch_c_l_ = 0;
 }
 
 void
@@ -48,7 +49,7 @@ Input_staff::parse(Score*score_l)
        error("Unknown staff-type `" + type +"\'");
     
     p->score_l_ = score_l;
-    p->define_spot_str_ = define_spot_str_;
+    p->define_spot_str_ = "";  // todo
     
     for (iter_top(music_,i); i.ok(); i++) {
        Voice_list vl = i->convert();
@@ -67,11 +68,12 @@ Input_staff::parse(Score*score_l)
 
 Input_staff::Input_staff(Input_staff const&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->clone());
-    define_spot_str_ = s.define_spot_str_;
+    defined_ch_c_l_ = s.defined_ch_c_l_;
     type = s.type;
 }
 
index adbc09821936e93a768636f36443db2d789ecc09..cf9ec478e494b50923f067bd624f0bc7c73e56ae 100644 (file)
@@ -1,8 +1,18 @@
 #include "leastsquares.hh"
+void
+Least_squares::OK() const
+{
+    assert( input.size() > 1 );
+    Real dx = 0.0;
+    for (int i=1; i < input.size(); i++)
+       dx += abs (input[i-1].x - input[i].x);
 
+    assert(dx);
+}
 void
 Least_squares::minimise(Real &coef, Real &offset)
 {
+    OK();
     Real sx = 0.0;
     Real sy = 0.0;
     Real sqx =0.0;
index 508c61e30d993ace379110598d5e9bb1aedf8bb6..92b52ad8b2020e6b8f0d3481f48234cd0f16d651 100644 (file)
@@ -38,7 +38,7 @@ Input_file::Input_file(String s)
     }
     else {
        Source_file* sourcefile_p = new Source_file( pf );
-       source_l->add( sourcefile_p );
+       source_global_l->add( sourcefile_p );
        sourcefile_l_ = sourcefile_p;
        is = sourcefile_l_->istream_l();
     }
index 383f875d42b8e3657427541253d1948c446334d6..c61f1b91afa3a3366aa63748bac5f83adef7c4f6 100644 (file)
@@ -15,7 +15,7 @@ void
 Local_key_item::add(Item*head_l)
 {
     group.push(head_l);
-    dependencies.push(head_l);
+    add_depedency(head_l);
 }
 void
 Local_key_item::add(Melodic_req*m_l)
index fe22149d12c5435b9f722a7780ceb49f38b29a9a..77cf12554cf984c6e429beeb2123d5b363c3e20c 100644 (file)
@@ -103,7 +103,7 @@ Symbol
 Lookup::dots(int j)
 {
     if (j>3)
-       error("max 3 dots");
+       error("max 3 dots");    // todo
     return (*symtables_)("dots")->lookup(j);
 }
 
index 7e20c89a70d5d41f10dfbd2fc0bff519c4fcec85..e100ec2884f21156d8b6b85eff4591142fdd65de 100644 (file)
@@ -12,7 +12,7 @@
 #include "source.hh"
 
 Source source;
-Source* source_l = &source;
+Source* source_global_l = &source;
 
 extern void parse_file(String,String);
 
index 8d6ac75f0c2cdbe32816f3b0896e6fbc0cda5db0..3f01afb423c8ca44d8e2d0cb5ab0178ac1af039a 100644 (file)
@@ -19,7 +19,7 @@
 #endif
 
 Array<Request*> pre_reqs, post_reqs;
-sstack<String> define_spots;
+sstack<const char *> define_spots;
 Paperdef*default_paper();
 char const* defined_ch_c_l;
 char const* req_defined_ch_c_l;
@@ -195,10 +195,10 @@ notename_tab_body:                                {
        SCORE
 */
 score_block: SCORE 
-               { define_spots.push(lexer->spot()); }
+               { define_spots.push(lexer->here_ch_c_l()); }
        '{' score_body '}'      {
                $$ = $4;
-               $$->define_spot_str_ = define_spots.pop();
+               $$->defined_ch_c_l_ = define_spots.pop();
                if (!$$->paper_)
                        $$->paper_ = default_paper();
 
@@ -333,10 +333,10 @@ paper_body:
        STAFFs
 */
 staff_block:
-       STAFF   { define_spots.push(lexer->spot()); }
+       STAFF   { define_spots.push(lexer->here_ch_c_l()); }
 /*cont*/       '{' staff_body '}'      {
                $$ = $4; 
-               $$->define_spot_str_ = define_spots.pop();
+               $$-> defined_ch_c_l_ = define_spots.pop();
        }
        ;
 
index 4c9ef91afcb4de8169b0fd46c750b2e9569154c5..54e177f4860c30ee438f68303814be75e8c2f57d 100644 (file)
@@ -97,7 +97,7 @@ PCol::PCol(PCol *parent)
     prebreak_p_=0;
     postbreak_p_=0;
     line_l_=0;
+    hpos = -1.0;
     pscore_l_ = 0;
 }
 
index 83f71f440cb4f434871691d519cb0396cf6231e7..89a58be790d59e0adce89aefbd1ffe8f26d9e226 100644 (file)
@@ -9,7 +9,7 @@
 #include "pscore.hh"
 #include "tstream.hh"
 #include "item.hh"
-
+#include "break.hh"
 
 Idealspacing*
 PScore::get_spacing(PCol*l, PCol*r)
@@ -229,7 +229,7 @@ PScore::add_broken(Spanner*s)
 }
 
 void
-PScore::set_breaking(Array<Col_configuration> breaking)
+PScore::set_breaking(Array<Col_hpositions> breaking)
 {
     for (int j=0; j < breaking.size(); j++) {
        Array<PCol*> &curline(breaking[j].cols);
index 3be4f8260eaf959f9274fee7296ec0b738149834..0a5c8dc3d842fdd9661cddf86e8e53f5226d648e 100644 (file)
@@ -60,10 +60,27 @@ Request::Request()
     elt_l_ = 0;
     defined_ch_c_l_m = 0;
 }
-Request::Request(Request const&)
+Request::Request(Request const&src)
 {
     elt_l_ = 0;
-    defined_ch_c_l_m = 0;
+    defined_ch_c_l_m = src.defined_ch_c_l_m;
+}
+/****************/
+Spacing_req::Spacing_req()
+{
+    next = 0;
+    distance = 0;
+    strength = 0;
+}
+void
+Spacing_req::do_print()const
+{
+    mtor << "next " << next << "dist " << distance << "strength\n";
+}
+void
+Blank_req::do_print()const
+{
+    Spacing_req::do_print();
 }
 /****************/
 Melodic_req::Melodic_req()
index feb7db93e727438e65c1a1b176001a5efe5cd350..f784f30efae50bb074b93bf087fb79befacdf64c 100644 (file)
@@ -5,7 +5,9 @@
 #include "staff.hh"
 #include "debug.hh"
 #include "paper.hh"
-
+#include "main.hh"
+#include "source.hh"
+#include "sourcefile.hh"
 
 void
 Score::process()
@@ -14,7 +16,7 @@ Score::process()
     
     assert (paper_p_);
     if (last() == Moment(0)) {
-       error("Need to have music in a score.");
+       warning("Need to have music in a score.", defined_ch_c_l_);
     }
     // distribute commands to disciples
     pscore_p_ = new PScore(paper_p_);
@@ -161,6 +163,7 @@ Score::Score(Paperdef*p)
     pscore_p_=0;
     paper_p_ = p;              // ?? safe?
     errorlevel_i_ = 0;
+    defined_ch_c_l_ = 0;
 }
 
 Score::~Score()
@@ -185,7 +188,10 @@ Score::output(String s)
     *mlog << "output to " << paper_p_->outfile << "...\n";
     
     Tex_stream the_output(paper_p_->outfile);
-    the_output << "% outputting Score, defined at: " << define_spot_str_ << "\n";
+    
+    the_output << "% outputting Score, defined at: " <<
+       source_global_l->
+       sourcefile_l (defined_ch_c_l_)->file_line_no_str(defined_ch_c_l_) << "\n";
     pscore_p_->output(the_output);
 }
 
index f9155ea0c41e88fe9e1299278227ec6d00d86f05..4b1ae191d04008c06a32d21b63dbde9ea3b88695 100644 (file)
@@ -11,14 +11,14 @@ void
 Script::set_stem(Stem*st_l)
 {
     stem_l_ = st_l;
-    dependencies.push(st_l);
+    add_depedency(st_l);
 }
 
 void
 Script::set_support(Item*i)
 {
     support.push(i);
-    dependencies.push(i);
+    add_depedency(i);
 }
 
 Script::Script(Script_req* rq, int staflen)
@@ -68,7 +68,7 @@ Script::set_default_pos()
        Interval v= support_height();
        y = v[dir]  -dy[-dir] + 2*dir*inter_f;
     } else {
-       Real y  = (d > 0) ? staffsize + 2: -2; // ug
+       y  = (d > 0) ? staffsize + 2: -2; // ug
        y *=inter_f;
        Interval v= support_height();
 
@@ -78,6 +78,7 @@ Script::set_default_pos()
            y = y <? v.min();
        }
     }
+    
     if (stem_l_) {
        Interval v= stem_l_->height();
 
index 2cdddfec47b9071fb5b2a05bcb0c962d20ba71ad..bd1f4c3d1d8941f1c213f03811c298a4456c16e5 100644 (file)
@@ -1,3 +1,8 @@
+/*
+
+  TODO:
+  think about crossing stems.
+ */
 #include "slur.hh"
 #include "scalar.hh"
 #include "lookup.hh"
@@ -31,7 +36,7 @@ void
 Slur::add(Notehead*n)
 {
     encompass.push(n);
-    dependencies.push(n);
+    add_depedency(n);
 }
 
 void
index 4792483056400d12b05f9c5534e4c20f6eb35a58..f279fae129e55ef2d0c96635bb153c21d88fdfcc 100644 (file)
@@ -174,3 +174,9 @@ Source_file::unmap()
        size_off_m = 0;
     }
 }
+String
+Source_file::file_line_no_str(const char *cch_c_l )
+{
+    return name_str() + ": "
+       + String( line_i( cch_c_l ) );
+}
index ce3cb4916250fb1c4bf5865686a96f80385cd76b..ad5b2e2552126351f48dc0fad6fa2672f84eeecb 100644 (file)
@@ -8,17 +8,16 @@ Spanner::do_print()const
 {
     mtor << " (unknown) ";
 }
+
 Spanner*
 Spanner::broken_at(PCol*c1, PCol *c2)const
 {
-    Spanner *me_p = (Spanner*)this;
     Spanner *span_p = do_break_at(c1,c2);
 
-    me_p->calc_children = true;
-    me_p->dependencies.push(span_p);
-
-    span_p->calc_children = false; // should handle in ctor
-
+    for (int i=0; i < dependants.size(); i++) {
+       dependants[i]->substitute_dependency((Staff_elem*)this, span_p); 
+    }
+    
     span_p->left = c1;
     span_p->right = c2;
     
index 0ef190020378e26a362c0083c7ca4482c13676fc..341b54e32b01ac8fce50e4e5ae026ac122df88c9 100644 (file)
@@ -8,20 +8,19 @@
 String
 Staff_elem::TeXstring() const
 {
-    assert(!calc_children);
     Molecule m(*output);
     m.translate(offset_);      // ugh?
     return m.TeXstring();
 }
 
 Staff_elem::Staff_elem(Staff_elem const&s)
-    :    dependencies(s.dependencies)
+    : dependants(s.dependants),
+      dependencies(s.dependencies)
 {
     status = s.status;
     assert(!s.output);
     output = 0;
     pstaff_l_ = s.pstaff_l_;
-    calc_children = false;
     offset_ = Offset(0,0);
 }
 
@@ -29,6 +28,7 @@ Staff_elem::~Staff_elem()
 {
    delete output;
 }
+
 void
 Staff_elem::translate(Offset O)
 {
@@ -87,7 +87,6 @@ NAME_METHOD(Staff_elem);
 
 Staff_elem::Staff_elem()
 {
-    calc_children = false;
     pstaff_l_=0;
     offset_ = Offset(0,0);
     output = 0;
@@ -107,9 +106,8 @@ Staff_elem::add_processing()
 {
     if (status >= VIRGIN)
        return;
-
-    do_add_processing();
     status = VIRGIN;
+    do_add_processing();
 }
 
 void
@@ -117,23 +115,29 @@ Staff_elem::pre_processing()
 {
     if (status >= PRECALCED )
        return;
+    assert(status != PRECALCING); // cyclic dependency
+    status = PRECALCING;
+
     for (int i=0; i < dependencies.size(); i++)
        if (dependencies[i])
            dependencies[i]->pre_processing();
-    if (!calc_children)
-       do_pre_processing();
+
+    
+    do_pre_processing();
     status = PRECALCED;
 }
 void
 Staff_elem::post_processing()
 {
-    if (status > POSTCALCED)
+    if (status >= POSTCALCED)
        return;
+    assert(status != POSTCALCING);// cyclic dependency
+    status=POSTCALCING;        
+
     for (int i=0; i < dependencies.size(); i++)
        if (dependencies[i])
            dependencies[i]->post_processing();
-    if (!calc_children)
-       do_post_processing();
+    do_post_processing();
     status=POSTCALCED;
 }
 
@@ -142,12 +146,12 @@ Staff_elem::molecule_processing()
 {
     if (status >= OUTPUT)
        return;
+    status = OUTPUT;           // do it only once.
     for (int i=0; i < dependencies.size(); i++)
        if (dependencies[i])
            dependencies[i]->molecule_processing();
-    if (!calc_children)
-       output= brew_molecule_p();
-    status = OUTPUT;    
+
+    output= brew_molecule_p();
 }
 
 void
@@ -164,3 +168,30 @@ void
 Staff_elem::do_add_processing()
 {
 }
+
+void
+Staff_elem::substitute_dependency(Staff_elem * old, Staff_elem * newdep)
+{
+    bool hebbes_b=false;
+    for (int i=0; i < dependencies.size(); i++) {
+       if (dependencies[i] == old){
+           dependencies[i] = newdep;
+           hebbes_b = true;
+       } else if (dependencies[i] == newdep) {
+           hebbes_b = true;
+       }
+    }
+    if (!hebbes_b)
+       dependencies.push(newdep);
+}
+
+void
+Staff_elem::add_depedency(Staff_elem * p)
+{
+    for (int i=0; i < dependencies.size(); i ++)
+       if (dependencies[i] == p)
+           return;
+    
+    dependencies.push(p);
+    p->dependants.push(p);
+}
index 2e0d55474ee1c765c97a30826345370309e7ff6c..fc5f9accb4be67c5c93c9ac10f2e39763f873b67 100644 (file)
@@ -60,7 +60,7 @@ Stem::add(Notehead *n)
     if ( p> maxnote)
        maxnote = p;
     heads.push(n);
-    n->dependencies.push(this);
+    n->add_depedency(this);
 }
 
 
@@ -72,11 +72,13 @@ Stem::get_default_dir()
     Real mean = (minnote+maxnote)/2;
     return (mean > staff_center) ? -1: 1;
 }
+
 void
 Stem::set_default_dir()
 {
     dir = get_default_dir();
 }
+
 void
 Stem::set_default_stemlen()
 {
index d4de8fb824465722b5c672a71952a54926ccfa57..021b81fbbbb52ac9a2aebbcf770d79971e833cba 100644 (file)
@@ -10,8 +10,9 @@ void
 Text_spanner::set_support(Directional_spanner*d)
 {
     support = d;
-    dependencies.push(d);
-}    
+    add_depedency(d);
+}
+
 Text_spanner::Text_spanner()
 {
     support = 0;
index cabaeb00cfb093c6a9a07e89c693d5f67f6a267d..1a66b44a44e426b9356c8ea30cbc7a8649783e89 100644 (file)
@@ -1,5 +1,6 @@
 #include "timedescription.hh"
 #include "debug.hh"
+
 String
 Time_description::str()const
 {
@@ -57,7 +58,7 @@ Time_description::Time_description(Moment dt, Time_description const *prev)
     } else {                           // default 4/4
        whole_per_measure = 1;
        whole_in_measure =0;
-       one_beat = 0.25;
+       one_beat = Moment(1,4);
        when = 0.0;
        bars = 0;
        cadenza_b_ = false;
index 8328f64fb7fd7f8f86e8883ceeaf572f66092ba3..f8688d72277131451a89557960c69159b3093f17 100644 (file)
@@ -48,10 +48,9 @@ void
 message( String message_str, char const* context_ch_c_l )
 {
     String str = "lilypond: ";
-    Source_file* sourcefile_l = source_l->sourcefile_l( context_ch_c_l );
+    Source_file* sourcefile_l = source_global_l->sourcefile_l( context_ch_c_l );
     if ( sourcefile_l ) {
-       str += sourcefile_l->name_str() + ": ";
-       str += String( sourcefile_l->line_i( context_ch_c_l ) ) + ": ";
+       str += sourcefile_l->file_line_no_str(context_ch_c_l);
     }
     str += message_str;
     if ( sourcefile_l ) {
index e390500d82ee80eb6a795b9faa745740d34bcbb0..cc114e9e5249852a69b6dd04466bfaffa50fa62b 100644 (file)
@@ -9,56 +9,62 @@
    
     */
 
-Array<Col_configuration>
+Array<Col_hpositions>
 Word_wrap::solve()
 {
     problem_OK();
     iter_top(pscore_.cols,curcol);
-    Array<Col_configuration> breaking;
-    Array<PCol *> breakpoints(find_breaks());
+    Array<Col_hpositions> breaking;
+    Line_of_cols breakpoints(find_breaks());
     assert(breakpoints.size()>=2);
-    for (int i=0 ; i < breakpoints.size() -1; ) {
-       Col_configuration minimum;
-       Col_configuration current;
+
+    int break_idx_i=0;                 
+    while ( break_idx_i < breakpoints.size() -1) {
+       Col_hpositions minimum;
+       Col_hpositions current;
 
         // do  another line
-       PCol *post = breakpoints[i]->postbreak_p_;
+       PCol *post = breakpoints[break_idx_i]->postbreak_p_;
        current.add( post);
        curcol++;               // skip the breakable.
-       i++;
+       break_idx_i++;
 
-       while (i < breakpoints.size()) {
+       while (break_idx_i < breakpoints.size()) {
 
            // add another measure.
-           while (breakpoints[i] != curcol.ptr()){
-               
+           while (breakpoints[break_idx_i] != curcol.ptr()){
                current.add(curcol);
                curcol++;
            }
-           current.add(breakpoints[i]->prebreak_p_ );
+           current.add(breakpoints[break_idx_i]->prebreak_p_ );
+
+           // try to solve
            if (!feasible(current.cols)) {
                if (!minimum.cols.size())
                    error("sorry, this measure is too long");
-               break;
+               current.energy = INFTY; // make sure we go back
+           } else {
+               current = solve_line(current.cols);
+               current.print();
            }
-           current.setsol(solve_line(current.cols));
-           current.print();
-           
+
+           // update minimum, or backup.
            if (current.energy < minimum.energy) {              
                minimum = current;         
            } else {            // we're one col too far.
-               i--;
-               while (curcol.ptr() != breakpoints[i])
+               break_idx_i--;
+               while (curcol.ptr() != breakpoints[break_idx_i])
                    curcol --;
-               
-               break;
+               break;          // do the next line.
            }
-       
-           current.cols.last()=breakpoints[i];
+
+
+           // add nobreak version of breakable column
+           current.cols.last()=breakpoints[break_idx_i];
            curcol ++;
-           i++;
+           break_idx_i++;
        }
-       mtor << "Adding cols~, next breakpoint " << i << '\n';
+       mtor << "Adding cols~, next breakpoint " << break_idx_i << '\n';
        breaking.push(minimum);
     }