]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.5 release/0.0.5
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 5 Nov 1996 16:55:42 +0000 (17:55 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 5 Nov 1996 16:55:42 +0000 (17:55 +0100)
61 files changed:
.dstreamrc
Makefile
README
Sources.make
TODO
boxes.cc
boxes.hh
break.cc
calcideal.cc
command.cc
command.hh
debug.cc
debug.hh
flower/Makefile
flower/Sources.make
flower/TODO
flower/assoc.hh
flower/associter.hh [new file with mode: 0644]
flower/dstream.cc
flower/dstream.hh
flower/plist.hh
flower/plist.inl
getcommands.cc [new file with mode: 0644]
item.cc
item.hh
lexer.l
lilyponddefs.tex
lookupsyms.cc
maartje.ly
make_patch
misc.cc
misc.hh
molecule.cc
molecule.hh
mtime.hh [deleted file]
parseconstruct.hh
parser.y
pcol.cc
pcol.hh
proto.hh
pscore.cc
pscore.hh
request.hh
rhythmstaf.cc
rhythmstaf.hh
sccol.cc
sccol.hh
scommands.cc
scommands.hh
score.cc
score.hh
scores.cc
staff.cc
staff.hh
stcol.cc
stcol.hh
suzan.ly
symbol.ini
table.cc
voice.cc
voice.hh

index b5fa669d14f81cb13fb8316adee185e206c6187d..fccd8d5c370abbf57e3f130634b0a7cf463cf8bc 100644 (file)
@@ -13,4 +13,6 @@ Parser                        1
 Lexer                  1
 parse_duration         1
 parse_pitch            1
-
+Col_configuration      1
+Command                        1
+Score_commands         1
\ No newline at end of file
index 2f5b450761166df3b803966a344e52a1397a63f6..c1636f40128720cc272ea64c39b79db2e8fb07a2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 MAJVER=0
 MINVER=0
-PATCHLEVEL=4
+PATCHLEVEL=5
 
 # 
 #
@@ -28,8 +28,10 @@ DFILES=$(hdr) $(mycc) $(othersrc) $(OFILES) $(IFILES) $(SCRIPTS) $(DOC)
 #compiling
 LOADLIBES=-L$(FLOWERDIR) -lflower
 FLOWERDIR=../flower
-#DEFINES=-DNDEBUG -DNPRINT -O2
-CXXFLAGS=$(DEFINES) -I$(FLOWERDIR) -pipe -Wall -W  -pedantic -g
+#DEFINES=-DNDEBUG -DNPRINT -O2                         # speedy
+DEFINES=-g                                     # lots of debugging info
+
+CXXFLAGS=$(DEFINES) -I$(FLOWERDIR) -pipe -Wall -W  -pedantic 
 FLEX=flex
 BISON=bison
 exe=$(PACKAGENAME)
diff --git a/README b/README
index 412248b1440045ede6d73b5ee3f3488f8b63e5d8..0ad234c7ff2b2c8ae4d661ed2d371033b96d0d1a 100644 (file)
--- a/README
+++ b/README
@@ -6,4 +6,6 @@ patches to me,
 
   hanwen@stack.urc.tue.nl
 
+If you actually want to use this, you'd better use the "speed"
+compilation flags in the Makefile
 
index 02eac2a6c0c0d528ec838cc250281331d5d3483d..6c420edad718bdd1b0875d7e49c6e2932b7550f2 100644 (file)
@@ -3,7 +3,7 @@ hdr=    qlp.hh       \
        pcol.hh   proto.hh pstaff.hh  line.hh\
        const.hh glob.hh molecule.hh  boxes.hh pscore.hh item.hh tex.hh\
        request.hh voice.hh command.hh staff.hh  linestaff.hh \
-       tstream.hh  mtime.hh rhythmstaf.hh\
+       tstream.hh   rhythmstaf.hh\
        parseconstruct.hh  debug.hh globvars.hh keyword.hh\
        misc.hh score.hh notename.hh lexer.hh symtable.hh\
        symbol.hh main.hh dimen.hh paper.hh lookupsyms.hh\
@@ -19,5 +19,5 @@ mycc=   qlp.cc qlpsolve.cc \
        pstaff.cc  tstream.cc version.cc\
        calcideal.cc scores.cc identifier.cc \
        dimen.cc paper.cc lookupsyms.cc scommands.cc\
-       sccol.cc stcol.cc\
+       sccol.cc stcol.cc getcommands.cc\
        template1.cc template2.cc template3.cc
diff --git a/TODO b/TODO
index 3f91b6bbd877687aeded9df8f5b01c15e68d38bc..cce684e09c926ab7e985ab354dfac7adcc3d46ff 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,7 +1,4 @@
-bug in BAR.
-dot spacing
-typeset direction.
-beam
-stem
+melodie staff.
+beam + stem
 
 
index 74475b453053f168518107b7e3f22c4defc35fc0..ebfc08abfe02c7861e90e4bea5b40567339752e2 100644 (file)
--- a/boxes.cc
+++ b/boxes.cc
@@ -2,11 +2,14 @@
 #include "const.hh"
 
 void
-Interval:: set_empty() {
-       min = INFTY;
-       max = -INFTY;
+Interval::set_empty() {
+    min = INFTY;
+    max = -INFTY;
+}
+Real
+Interval::length() const {
+    return max-min;
 }
-
 Box::Box(svec<Real> s)
 {
     assert(s.sz() == 4);
@@ -22,6 +25,7 @@ Box::Box()
 
 Box::Box(Interval ix, Interval iy)
 {
-    x=ix;
+    x = ix;
     y = iy;
 }
+
index c9ff3e62efa952b215c98acdee2af1a8af9f10da..5d0be85452fdaf7a0ca9a7fbadecd05876f9cdb6 100644 (file)
--- a/boxes.hh
+++ b/boxes.hh
@@ -49,7 +49,7 @@ struct Interval {
        if (h.max>max)
            max = h.max;
     }
-    
+    Real length() const;
     void set_empty() ;
     bool empty() { return min > max; }
     Interval() {
index e705c546cfe4cd0227baac0a0a42b86bbe38f7ce..b8dc1827bc79b4af4e50bb828ec29f59bccac0c0 100644 (file)
--- a/break.cc
+++ b/break.cc
@@ -13,7 +13,7 @@ svec<Real>
 PScore::solve_line(svec<const PCol *> curline) const
 {
    Spacing_problem sp;
-   mtor << "line of " << curline.sz() << " cols\n";
+
    sp.add_column(curline[0], true, 0.0);
    for (int i=1; i< curline.sz()-1; i++)
        sp.add_column(curline[i]);
@@ -36,8 +36,8 @@ PScore::problem_OK() const
     PCursor<PCol *> start(cols);
     PCursor<PCol *> end (((PScore*)this)->cols.bottom());
     
-    assert(start->breakable);    
-    assert(end->breakable);
+    assert(start->breakable());    
+    assert(end->breakable());
 }
 
 struct Col_configuration {
@@ -54,10 +54,16 @@ struct Col_configuration {
        energy = config.last();
        config.pop();
     }
+    void print() const {
+#ifndef NPRINT
+       mtor << "energy : " << energy << '\n';
+       mtor << "line of " << config.sz() << " cols\n";
+#endif
+    }
 };
 
 /// wordwrap type algorithm
-/* el stupido. This should be optimised:
+/* el stupido. This should be done more accurately:
 
    It would be nice to have a Dynamic Programming type of algorithm
    similar to TeX's
@@ -77,8 +83,9 @@ PScore::calc_breaking()
        Col_configuration minimum;
        Col_configuration current;
 
-        // do  another line 
-       current.add(breakpoints[i]->postbreak );
+        // do  another line
+       PCol *post = breakpoints[i]->postbreak;
+       current.add( post);
        curcol++;               // skip the breakable.
        i++;
 
@@ -92,11 +99,15 @@ PScore::calc_breaking()
            }
            current.add(breakpoints[i]->prebreak );
            current.setsol(solve_line(current.line));
-           mtor << "energy : " << current.energy << '\n';
+           current.print();
            
            if (current.energy < minimum.energy) {
                minimum = current;
-           } else {
+           } else {            // we're one col too far.
+               i--;
+               while (curcol != breakpoints[i])
+                   curcol --;
+               
                break;
            }
        
index bddd4f28970f7b76ac0deb5b8c8eebc2b0fba4c3..1dc0e1d3859e79f73d02e35bf6b8aad1e2f37465 100644 (file)
@@ -26,13 +26,13 @@ Score::connect_nonmus(PCol* c1, PCol *c2, Real d)
        do_connect(c1,c2,d);
 
        // alert! this is broken!
-       if (c1->breakable) {
+       if (c1->breakable()) {
            do_connect(c1->postbreak, c2,d);
        }
-       if (c2->breakable) {
+       if (c2->breakable()) {
            do_connect(c1, c2->prebreak,d);
        }
-       if (c1->breakable &&c2->breakable) {
+       if (c1->breakable() &&c2->breakable()) {
            do_connect(c1->postbreak, c2->prebreak,d);      
        }       
     }
@@ -49,8 +49,8 @@ Score::calc_idealspacing()
     for (; sc.ok(); sc++) {
        if (sc->musical)
            for (int i=0; i < sc->durations.sz(); i++) {
-               Mtime d = sc->durations[i];
-               Real dist = duration_to_idealspace(d, paper->whole_width);
+               Real d = sc->durations[i];
+               Real dist = duration_to_idealspace(d, paper_->whole_width);
                PCol * c2 = find_col(sc->when + d,true)->pcol;
                connect_nonmus(sc->pcol, c2, dist);
                c2 = find_col(sc->when + d,false)->pcol;
index 6375c7e6d3101fe915d9baf93ff3b068ebef8403..23edf1ec36c649ecd7322a893f6e8ea23c9e7b10 100644 (file)
@@ -5,39 +5,14 @@
 bool
 Command::isbreak()const
 {
-    return (code >= BREAK_PRE&&code <= BREAK_END);
+    return (code >= BREAK_PRE && code <= BREAK_END);
 }
 
-Command*
-get_bar_command(Real w)
-{
-    Command*c = new Command;
-    c->when = w;
-    c->code = TYPESET;
-    c->args.add( "BAR");
-    c->args.add( "|");
-    return c;
-}
-
-Command *
-get_meter_command(Real w, int n, int m)
-{
-    Command*c = new Command;
-    
-    c->when = w;
-    c->code = TYPESET;
-    c->args.add( "METER");
-    c->args.add( n );
-    c->args.add( m );
-    return c;
-}
-
-
-
 Command::Command()
 {
     code = NOP;
     when = -1;
+    priority=0;
 }
 
 
@@ -46,12 +21,19 @@ Command::Command(Real w)
 {
     code = NOP;
     when = w;
+    priority=0;
 }
+
 void
 Command::print() const
 {
-    mtor << "command code: " << code << " args: ";
-    for (int i = 0; i<args.sz(); i++)
-       mtor << args[i];
+#ifndef NPRINT
+    mtor << "command at " << when << ", code " << code << " prio " << priority;
+    if (args.sz()) {
+       mtor<< " args: ";
+       for (int i = 0; i<args.sz(); i++)
+           mtor << "`"<<args[i] <<"',";
+    }
     mtor << "\n";
+#endif
 }
index 6b835e964bd8e307c5583aa6c9a85bd7ff9ec1a4..3e90067075cd4c45701dc028e5efbfe863307e2f 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef COMMAND_HH
 #define COMMAND_HH
 #include "glob.hh"
-#include "mtime.hh"
+
 #include "vray.hh"
 #include "string.hh"
 
@@ -15,9 +15,13 @@ enum Commandcode {
 struct Command {
     Commandcode code;
 
-    Mtime when;
+    Real when;
     /// analogous to argv[]
     svec<String> args;
+    int priority;
+    
+    /****************/
+    
     Command();
     Command(Real w);
     bool isbreak()const;
index 874937573e346bda16f067d0139aea65ee0b2a84..34859a3c9f70c93242c47e6a4b1589198f816229 100644 (file)
--- a/debug.cc
+++ b/debug.cc
@@ -1,9 +1,10 @@
+#include <fstream.h>
 #include "debug.hh"
 #include "dstream.hh"
 #include "vector.hh"
 
 Dstream monitor(&cout,".dstreamrc");
-
+ostream * nulldev = new ofstream("/dev/null");
 void
 debug_init()
 {
index ca805df011aca50d80279d6d138f9a0fec355989..200585608b7868697c75b25cb31fb2d5a8f5cd66 100644 (file)
--- a/debug.hh
+++ b/debug.hh
@@ -9,10 +9,14 @@
 #define WARN warnout << "warning: "<<__FUNCTION__ << "(): "
 extern ostream &warnout ;
 extern ostream *mlog;  
+extern ostream *nulldev;  
 extern Dstream monitor; // monitor
 
+#ifdef NPRINT
+#define mtor *nulldev
+#else
 #define mtor monitor.identify_as(__PRETTY_FUNCTION__)
-
+#endif
 void error(String s);
 void warning(String s);
 
index 4533783563a6dd66dd0c29f1ba48569af61ef70c..5b40b40629817682a943e50b257f51e3f6648d72 100644 (file)
@@ -1,6 +1,6 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=4
+PATCHLEVEL=5
 
 PACKAGENAME=flower
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
index fd5dcf414610946561df2d31cc895c13fbdbf14e..e8b2250ad199c7f4a3e8d97fab79957e8e3af58c 100644 (file)
@@ -9,4 +9,5 @@ hh=cursor.hh pcursor.hh lgetopt.hh link.hh list.hh dstream.hh \
        string.hh stringutil.hh vray.hh textdb.hh textstr.hh  assoc.hh\
        findcurs.hh unionfind.hh compare.hh handle.hh matrix.hh\
        smat.hh vsmat.hh  vector.hh  real.hh choleski.hh\
-       tsmat.hh tvsmat.hh plist.hh\
+       tsmat.hh tvsmat.hh plist.hh associter.hh\
+
index 6f0f451cce25e336a9ec0a07bdaf26a069df866d..bcb4e27042caf2994c8f8fc91b2a70b34b45927c 100644 (file)
@@ -1,3 +1,4 @@
+       * PointerList<T>:List<T> -> PointerList<T>:List<T*>
 
        * efficient copy cons for List
 
index 84a54c9a72bb4a61fc86e3da89adff02130973a3..24099856688d920bf7b1f776bc922215e6ee4426 100644 (file)
@@ -2,6 +2,7 @@
 #define ASSOC_HH
 
 #include "vray.hh"
+#include <assert.h>
 
 template<class K,class V>
 struct Assoc_ent_ {
@@ -72,4 +73,5 @@ public:
 };
 /** mindblowingly stupid Associative array implementation
  */
+
 #endif
diff --git a/flower/associter.hh b/flower/associter.hh
new file mode 100644 (file)
index 0000000..6103f22
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+  associter.hh -- part of flowerlib
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef ASSOCITER_HH
+#define ASSOCITER_HH
+
+#include "assoc.hh"
+
+/// an iterator for the #Assoc# class
+template<class K, class V>
+struct Assoc_iter {
+    int i;
+    Assoc<K,V> &assoc_;
+    
+    Assoc_iter(Assoc<K,V> &a) :
+       assoc_(a)
+    {  
+       i= next(0);
+    }
+    int next(int j) {
+       while (j < assoc_.arr.sz() && assoc_.arr[j].free)
+           j++;
+       return j;
+    }
+    bool ok() const {
+       return i < assoc_.arr.sz();
+    }
+    void OK()const {
+       assert(!ok() || !assoc_.arr[i].free);
+    }
+    void operator++(int) { i++; i = next(i); }
+    K key() { return assoc_.arr[i].key; }
+    V &val() { return assoc_.arr[i].val; }    
+};
+/*
+  Iterator
+ */
+
+#endif
index d8cff690414128eb2154c815c736634b520fbfa8..8540e734cffd29c1ee144b7162d72dc4af405111 100644 (file)
@@ -1,5 +1,5 @@
 #include <fstream.h>
-
+#include "assoc.hh"
 #include "dstream.hh"
 #include "string.hh"
 #include "textdb.hh"
@@ -36,14 +36,14 @@ Dstream::identify_as(String name)
     String cl(strip_member(mem));
     String idx = cl;
     
-    if (silent.elt_query(mem))
+    if (silent->elt_query(mem))
        idx  = mem;
-    else if (silent.elt_query(cl))
+    else if (silent->elt_query(cl))
        idx = cl;
     else {
-       silent[idx] = false;
+       (*silent)[idx] = false;
     }
-    local_silence = silent[idx];
+    local_silence = (*silent)[idx];
     if (classname != idx && !local_silence) {
        classname=idx;
        *os << "[" << classname << ":]";
@@ -54,9 +54,9 @@ Dstream::identify_as(String name)
 bool
 Dstream::silence(String s)
 {
-    if (!silent.elt_query(s))
+    if (!silent->elt_query(s))
        return false;
-    return silent[s];
+    return (*silent)[s];
 }
 ///
 Dstream &
@@ -99,6 +99,7 @@ Dstream::operator<<(String s)
 Dstream::Dstream(ostream *r, const char * cfg_nm )
 {
     os = r;
+    silent = new Assoc<String,bool>;
     if (!os)
        return;
     indentlvl = 0;
@@ -109,15 +110,18 @@ Dstream::Dstream(ostream *r, const char * cfg_nm )
        if (!ifs)
            return;
     }
-    //    cerr << "(" << fn;
+
     Text_db cfg(fn);
     while (! cfg.eof()){            
         Text_record  r(  cfg++);
         assert(r.sz() == 2);
-        silent[r[0]] = r[1].to_bool();
+        (*silent)[r[0]] = r[1].to_bool();
     }
-    //  cerr <<")";
-}
 
+}
 
 
+Dstream::~Dstream()
+{
+    delete silent;
+}
index 72d0897201a5210fc63aec7700b9c22161add756..aae52a7838c5fda5b03fdb079b844465a162d9c0 100644 (file)
@@ -4,10 +4,12 @@
 #define DSTREAM_HH
 
 #include "string.hh"
-#include "assoc.hh"
 
 const char eol= '\n';
 
+template<class K,class V>
+struct Assoc;
+
 /// debug stream
 class Dstream
 {
@@ -16,7 +18,7 @@ class Dstream
     bool local_silence;
     String classname;
 
-    Assoc<String, bool> silent;
+    Assoc<String, bool> *silent;
 public:
 
     bool silence(String);
index 3660968a47e8b1620fdb065b893bab5764c4d4bf..8fa126b52777fa5fdbe3880cd7785ad0e6249ec3 100644 (file)
@@ -44,7 +44,7 @@ class PointerList : public List<T>
 
 
 template<class T>
-void PL_copy(PointerList<T> &dst,PointerList<T> const&src);
+void PL_copy(PointerList<T*> &dst,PointerList<T*> const&src);
 
 #define PL_instantiate(a) L_instantiate(a *); template class PointerList<a*>
 
index fb18c872413b6cfbd4691716fa37463c16bc5457..b8cd8d602099a39268c89db40b3636091d618a55 100644 (file)
@@ -25,18 +25,17 @@ template<class T>
 inline void
 PointerList_print( PointerList<T> const & l  ) 
 {
-    List<T>& promises_to_be_const = (List<T>&) l;
-    for ( Cursor<T> c( promises_to_be_const ); c.ok(); c++ )
-        (*c)->print();  
+    for (PCursor<T> c(l ); c.ok(); c++ )
+        c->print();  
 }
 
 template<class T>
 inline void
-PL_copy(PointerList<T> &to,PointerList<T> const&src)
+PL_copy(PointerList<T*> &to,PointerList<T*> const&src)
 {
-    for (PCursor<T> pc(src); pc.ok(); pc++) {
-       T q = pc;
-       T p=new typeof(*q) (*q) ; // argh, how do i do this in ANSI-C++
+    for (PCursor<T*> pc(src); pc.ok(); pc++) {
+       T *q = pc;
+       T *p=new T(*q) ; // argh, how do i do this in ANSI-C++
        to.bottom().add(p);
     }
 }
diff --git a/getcommands.cc b/getcommands.cc
new file mode 100644 (file)
index 0000000..1f9362c
--- /dev/null
@@ -0,0 +1,58 @@
+#include "string.hh"
+#include "parseconstruct.hh"
+#include "command.hh"
+
+Command*
+get_bar_command(Real w)
+{
+    Command*c = new Command;
+    c->when = w;
+    c->code = TYPESET;
+    c->args.add( "BAR");
+    c->args.add( "|");
+    c->priority = 100;
+    return c;
+}
+
+Command *
+get_meter_command(Real w, int n, int m)
+{
+    Command*c = new Command;
+    
+    c->when = w;
+    c->code = TYPESET;
+    c->args.add( "METER");
+    c->args.add( n );
+    c->args.add( m );
+    c->priority = 50;          // less than bar
+    return c;
+}
+
+Command *
+get_meterchange_command(int n, int m)
+{
+    Command*c = new Command;
+
+    c->code = INTERPRET;
+    c->args.add( "METER");
+    c->args.add( n );
+    c->args.add( m );
+    c->priority = 0;           // more than bar
+    return c;
+}
+
+
+Command *
+get_skip_command(int n, Real m)
+{
+    Command*c = new Command;
+    
+    c->code = INTERPRET;
+    c->args.add( "SKIP");
+    c->args.add( n );
+    c->args.add( m );
+    c->priority = 0;           // more than bar
+    return c;
+}
+
+
diff --git a/item.cc b/item.cc
index 453200627b0e5694a8dc3d3c59912c52829f1158..96ec8a890a4c7ed742d2c6b23bb50c612f992975 100644 (file)
--- a/item.cc
+++ b/item.cc
@@ -54,3 +54,8 @@ Item::Item()
     output = 0;
     pstaff_ = 0;
 }
+void
+Item::print() const
+{
+    output->print();
+}
diff --git a/item.hh b/item.hh
index 6a3a9880d77418767c83f0e2ceef2ea3c6d52ea4..484822533bceddf0f1e4f3fd4b177276e11a71f5 100644 (file)
--- a/item.hh
+++ b/item.hh
@@ -40,6 +40,7 @@ struct Item {
     */
     String TeXstring () const ;
     Item();
+    void print()const;
 };
 /** An item must be part of a Column
 */
diff --git a/lexer.l b/lexer.l
index 03853ca579f93777a68c5a55cdc2931331f0c224..46a30cf7526d3619145902c1d4eaf233c10cc4f6 100644 (file)
--- a/lexer.l
+++ b/lexer.l
@@ -113,9 +113,15 @@ REAL               [0-9]+(\.[0-9]*)?
        mtor << "parens\n";
        return YYText()[0];
 }
+[:]            {
+       char c = YYText()[0];
+       mtor << "misc char" <<c<<"\n";
+       return c;
+}
 [ \t\n]+       {
        
 }
+
 %.*            {
        //ignore
 }
index 242a17d5f433c42473b4d09c0fdc946c24f4699a..9b18faf8802d55a8133e906938cf0ba641bb7088 100644 (file)
@@ -26,6 +26,9 @@
 \mdef\singledot{'00}
 \mdef\doubledot{'01}
 \mdef\tripledot{'02}
+
+
+
 \def\maatstreep{\vrule height8pt depth8pt }
 \def\finishbar{\vrule height8pt width 1pt depth8pt}
 \parindent0pt
@@ -42,7 +45,7 @@
 
 \newcount\n
 \def\linestafsym#1#2{\hbox to 0pt{\vbox to 0pt{\n=0%
-       \loop\ifnum\n<#1\advance\n by1
+       \loop\ifnum\n<#1\advance\n by1%
        \ifnum\n>1\vskip2pt\fi \hrule width#2\repeat\vss}\hss}}
 
 \def\vcenter#1{\vbox to 0pt{\vss #1\vss}}
@@ -50,4 +53,8 @@
 \def\cquartrest{\vcenter\quartrest}
 \def\ceighthrest{\vcenter\eighthrest}
 \def\csixteenthrest{\vcenter\sixteenthrest}
-\def\cthirtysecondrest{\vcenter\thirtysecondrest}
\ No newline at end of file
+\def\cthirtysecondrest{\vcenter\thirtysecondrest}
+
+\def\lsingledot{\kern-6pt\singledot}
+\def\ldoubledot{\kern-6pt\doubledot}
+\def\ltripledot{\kern-6pt\tripledot}
\ No newline at end of file
index 66cbd6db084623fd5647d087d513c422a5b5155c..14b3ab11e3c4fe0a53443f40f7a27b962861ffcb 100644 (file)
@@ -68,8 +68,8 @@ struct Meter_sym:Parametric_symbol {
 
     Symbol eval(svec<String> a) const{
        Symbol s;
-       s.dim.x = Interval(0, convert_dimen(10,"pt"));
-       s.dim.y = Interval(0, convert_dimen(10,"pt") ); 
+       s.dim.x = Interval( convert_dimen(-5,"pt"), convert_dimen(10,"pt"));
+       s.dim.y = Interval(0, convert_dimen(10,"pt") ); // todo
        String src = the_sym_tables("param")->lookup("meter").tex;
        s.tex = substitute_args(src,a);
        return s;
index 49665efd4dfb14252906b6d1b40f6a1aaed98503..508389a12ed03ca7d79f6814f683f8a79201614a 100644 (file)
@@ -2,7 +2,9 @@
 
 
 score {
-%      output "maartje.uit"
+       paper {
+               unitspace 3 cm
+       }
        rhythmstaff {
                voice { $ c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
        }
@@ -11,12 +13,11 @@ score {
                r2 r4 r1
        $ }
        }
-       
-       bar 2  bar 3
-       bar 4.5 bar 5 bar 5.5
-       bar 6 bar 7 bar 8
-
-       meter 2 4 4 % after bars.
-
+       commands {
+               meter 4 4
+               skip 3:0
+               meter 2 4
+               skip 8:0
+       }
 }
 
index 08f4936b563092fec113563b236e8aa23631cfc7..c2a1e50f8a44027f0132b9c36f6f5544ea911ed0 100755 (executable)
@@ -28,4 +28,4 @@ fi
 #(cd $nm$old; touch depend; make clean)
 #(cd $nm$new; touch depend; make clean)
 (cd $nm$new; diff -P -c  ../$nm$old . > ../patch-$new)
-rm -rf $nm$old
+rm -rf $nm$old $nm$new
diff --git a/misc.cc b/misc.cc
index 2be0f81dd67c9530007177553bd5723542aaf5dd..3a8658f4a02057a113ce44166b6e6abb0d48f056 100644 (file)
--- a/misc.cc
+++ b/misc.cc
@@ -1,6 +1,6 @@
 #include "misc.hh"
 #include "glob.hh"
-#include "mtime.hh"
+
 #include <math.h>
 
 int intlog2(int d) {
@@ -26,7 +26,7 @@ const double WHOLE_SPACE = 5.0; // should be settable from input
 
   
 Real
-duration_to_idealspace(Mtime d, Real w)
+duration_to_idealspace(Real d, Real w)
 {
     // see  Roelofs, p. 57
     return w * pow(ENGRAVERS_SPACE, log2(d));
diff --git a/misc.hh b/misc.hh
index a22304267f6075a197df16657007ea1d7adc641e..03211132422c00eddc55230c7c4db1c51b9f3933 100644 (file)
--- a/misc.hh
+++ b/misc.hh
@@ -1,7 +1,7 @@
 #ifndef MISC_HH
 #define MISC_HH
-#include "mtime.hh"
+#include "real.hh"
 int intlog2(int d);
-Real duration_to_idealspace(Mtime d,Real w);
+Real duration_to_idealspace(Real d,Real w);
 
 #endif
index 7b8a752423e002148d726345d24031991f254b47..5ab384f87d639d710d59c1bca89b412e7e8aaf10 100644 (file)
@@ -3,6 +3,13 @@
 #include "string.hh"
 #include "molecule.hh"
 #include "symbol.hh"
+#include "debug.hh"
+
+void
+Atom::print() const
+{
+    mtor << "texstring: " <<sym.tex<<"\n";    
+}
 
 Box
 Atom::extent() const
@@ -29,7 +36,6 @@ Atom::TeXstring() const
     return s;
 }
 
-/****************************************************************/
 
 String
 Molecule::TeXstring() const
@@ -111,3 +117,10 @@ Molecule::Molecule(const Molecule&s)
 {
     add(s);
 }
+
+void
+Molecule::print() const
+{
+    for (PCursor<Atom*> c(ats); c.ok(); c++)
+       c->print();
+}
index 60a7a05f44ed8664a6458a0f1eaf6131af575b0b..05ec64e3e09b13843ee2b837db373dba80c31b86 100644 (file)
@@ -18,6 +18,7 @@ struct Atom {
     Box extent() const;
     Atom(Symbol s);
 
+  void print() const;
 
     String TeXstring() const;
 };
@@ -42,6 +43,7 @@ struct Molecule {
     String TeXstring() const;
 
     Molecule(const Molecule&s);
+    void print() const;
 private:
     void operator=(const Molecule&);
 };
diff --git a/mtime.hh b/mtime.hh
deleted file mode 100644 (file)
index ef01d23..0000000
--- a/mtime.hh
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef MTIME_HH
-#define MTIME_HH
-
-#include "real.hh"
-
-typedef Real Mtime;
-
-#endif
index fa9f62757da9c0cb6509f12e9889ed713f6d8cdf..d2f2c1ac4ae67480fc4a78f4f0c4be044f3fe9ab 100644 (file)
@@ -5,4 +5,8 @@ Staff * get_new_rhythmstaff();
 Voice_element * get_note_element(String,String);
 Voice_element* get_rest_element(String,String);
 Command *  get_bar_command(Real);
-Command* get_meter_command(Real, int,int);
+
+Command* get_meterchange_command( int,int);
+Command* get_meter_command( Real,int,int);
+Command* get_skip_command( int,Real);
+
index d60face970f2830abbe8980091da4c7dadc7593a..ebc4c54f8b340dfc0f6e03a3fbf44950579c6daf 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -7,6 +7,7 @@
 #include "score.hh"
 #include "main.hh"
 #include "keyword.hh"
+#include "scommands.hh"
 #include "debug.hh"
 #include "parseconstruct.hh"
 #include "dimen.hh"
@@ -22,7 +23,7 @@
     Real real;
     Command *command;
     Identifier *id;    
-
+    Score_commands *scommands;
     Voice *voice;    
     Voice_element *el; 
     Staff *staff;    
@@ -34,7 +35,7 @@
 }
 
 %token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT
-%token CM IN PT MM PAPER WIDTH METER
+%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS
 
 %type <consstr> unit
 %token <id> IDENTIFIER
@@ -50,7 +51,7 @@
 %type <score> score_block score_body
 %type <staff> staff_block  rhythmstaff_block rhythmstaff_body
 %type <i> int
-
+%type <scommands> score_commands_block score_commands_body
 
 %%
 
@@ -66,9 +67,16 @@ score_block: SCORE '{' score_body '}'        { $$ = $3; }
 
 score_body:            { $$ = new Score; } 
        | score_body staff_block        { $$->add($2); }
-       | score_body score_command      { $$->add($2); }
-       | score_body paper_block        { delete $$->paper;
-               $$->paper = $2;
+       | score_body score_commands_block       { $$->set($2); }
+       | score_body paper_block                { $$->set($2);  }
+       ;
+score_commands_block:
+       COMMANDS '{' score_commands_body '}' { $$ =$3;}
+       ;
+
+score_commands_body:                   { $$ = new Score_commands; }
+       | score_commands_body score_command             {
+               $$->parser_add($2);
        }
        ;
 
@@ -82,6 +90,7 @@ paper_body:
        | paper_body OUTPUT STRING      { $$->outfile = *$3;
                delete $3;
        }
+       | paper_body UNITSPACE dim      { $$->whole_width = $3; }
        ;
 
 dim:
@@ -142,13 +151,17 @@ voice_elt:
        ;
 
 score_command:
-       BAR REAL                        {
-               $$ = get_bar_command($2);
+       SKIP int ':' REAL               {
+               $$ = get_skip_command($2, $4);
        }
-       | METER REAL int int            {
-               $$ = get_meter_command($2, $3, $4);
+       | METER  int int                {
+               $$ = get_meterchange_command($2, $3);
        }
+/*     | PARTIALMEASURE REAL           {
+               $$ = get_partial_command($2);
+       }*/
        ;
+       
 
 int:
        REAL                    {
diff --git a/pcol.cc b/pcol.cc
index 44c82a938ddf67ff316bbb82c0663638c2a4c32c..1ae06519ac55c90f4ae61c2904788e130651699a 100644 (file)
--- a/pcol.cc
+++ b/pcol.cc
@@ -5,10 +5,10 @@
 void
 Idealspacing::print() const
 {
-    #ifndef NPRINT
+#ifndef NPRINT
     mtor << "idealspacing {" ;
     mtor << "distance "<<space<< " strength " << hooke << "}\n";
-    #endif
+#endif
 }
 
 Idealspacing::Idealspacing(const PCol * l,const PCol * r)
@@ -18,6 +18,7 @@ Idealspacing::Idealspacing(const PCol * l,const PCol * r)
     left = l;
     right = r;
 }
+
 void
 Idealspacing::OK() const
 {
@@ -46,7 +47,11 @@ PCol::print() const
     #ifndef NPRINT
     mtor << "PCol {";
     mtor << "# symbols: " << its.size() ;
-    mtor << "breakable: " << breakable<<"\n";
+    if (breakable()){
+       mtor << "pre,post: ";
+       prebreak->print();
+       postbreak->print();
+    }
     mtor << "extent: " << width().min << ", " << width().max << "\n";
     mtor << "}\n";
     #endif 
@@ -63,7 +68,9 @@ void
 PCol::OK () const
 {
     if (prebreak || postbreak ) {
-       assert(breakable);
+       assert(prebreak&&postbreak);
+       assert(prebreak->daddy == this);
+       assert(postbreak->daddy == this);
     }
     
 }
@@ -71,29 +78,33 @@ PCol::OK () const
 void
 PCol::set_breakable()
 {
-    if (breakable)
+    if (breakable())
        return;
 
     prebreak = new PCol(this);
     postbreak = new PCol(this);
-    breakable = true;
     used = true;
 }
 
+bool
+PCol::breakable() const
+{
+    return prebreak||postbreak;
+}
+
 PCol::PCol(PCol *parent) {
     daddy = parent;
     prebreak=0;
     postbreak=0;
-    breakable=false;
     line=0;
     used  = false;
 }
 
 PCol::~PCol()
 {
-    if (prebreak)
-       delete prebreak;        // no recursion!
-    if (postbreak)
+
+       delete prebreak;        
+
        delete postbreak;       
 }
 
diff --git a/pcol.hh b/pcol.hh
index d11a23ca9c796d6aeff0141158370ad441b90e85..203482b10e1b1d12ead779cbc5fa2278f8abf1a8 100644 (file)
--- a/pcol.hh
+++ b/pcol.hh
@@ -12,7 +12,7 @@ struct PCol {
     List<const Spanner*> stoppers, starters;
     
     /// Can this be broken? true eg. for bars. 
-    bool breakable;
+    bool breakable()const;
 
     /// does this column have items, does it have spacings attached?
     bool used;
index 394f3be14b4cf840d90b9dcf0dca5e0819c1a0c7..ba93e7a52671d4e8e7248b1b0faeb414be9e5e3a 100644 (file)
--- a/proto.hh
+++ b/proto.hh
@@ -1,6 +1,13 @@
+/*
+  proto.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef PROTO_HH
+#define PROTO_HH
 #include "real.hh"
 
-class Parametric_symbol;
 class Line_of_score;
 class Line_of_staff;
 class PCol;
@@ -74,3 +81,10 @@ struct Identifier;
 struct Keyword;
 class Mixed_qp;
 class Paperdef;
+class Score_commands;
+class Parametric_symbol;
+
+
+
+#endif // PROTO_HH
+
index 44a87c0dd4d4416ca4912e06f6283b00a2093f16..773554375c8e2d280f1337c07575352531a58d68 100644 (file)
--- a/pscore.cc
+++ b/pscore.cc
@@ -1,5 +1,6 @@
 // utility functions for PScore
 #include "debug.hh"
+#include "molecule.hh"
 #include "dimen.hh"
 #include "line.hh"
 #include "pscore.hh"
@@ -11,7 +12,6 @@ PScore::clean_cols()
     for (PCursor<PCol *> c(cols); c.ok(); )
        if (!c->used) {
            c.del();
-           mtor << "removing pcol\n";
        } else
            c++;
 }
@@ -27,15 +27,28 @@ void
 PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
 {
     assert(c && i && s);
-    if (breakstat == 1 ) {
-       typeset_item(i, c->prebreak, s, 0);
-    } if (breakstat == 3) 
-       typeset_item(i, c->prebreak, s, 0 );
-    else{
-       its.bottom().add(i);
-       s->add(i);
-       c->add(i);
+//    assert(!breakstat != 4 || c->breakable() );
+    if (breakstat == 0) {
+       typeset_item(i, c->prebreak, s);
+       return;
     }
+
+    if (breakstat == 2) {
+       typeset_item(i, c->postbreak, s);
+       return;
+    }
+    if (c->daddy && c == c->daddy->prebreak) { // makeshift.
+       Interval iv (i->width());
+       if (!iv.empty()) {
+           svec<Item*> col_its (select_items(s, c));
+           for (int j =0; j < col_its.sz(); j++)
+               col_its[j]->output->translate(Offset(-iv.length(),0));
+           i->output->translate (Offset(-iv.max, 0));
+       }
+    }
+    its.bottom().add(i);
+    s->add(i);
+    c->add(i);
 }
 
 void
@@ -70,7 +83,7 @@ PScore::find_breaks() const
 {
     svec<const PCol *> retval;
     for (PCursor<PCol *> c(cols); c.ok(); c++)
-       if (c->breakable)
+       if (c->breakable())
            retval.add(c);
            
     return retval;
@@ -84,7 +97,7 @@ PScore::add(PCol *p)
 
 PScore::PScore()
 {
-    linewidth = convert_dimen(15,"cm");
+    linewidth = convert_dimen(15,"cm");        // default
 }
 
 void
@@ -115,18 +128,18 @@ PScore::select_items(PStaff*ps , PCol*pc)
 void
 PScore::OK()const
 {
+#ifdef NDEBUG
     for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
        cc->OK();
     for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
        ic->OK();
-    
+#endif
 }
 void
 PScore::print() const
-{
-    
-     #ifndef NPRINT
-   mtor << "PScore { width "<<print_dimen(linewidth);
+{    
+#ifndef NPRINT
+    mtor << "PScore { width "<<print_dimen(linewidth);
     mtor << "\ncolumns: ";
     for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
        cc->print();
@@ -135,6 +148,6 @@ PScore::print() const
     for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
        ic->print();
     mtor << "}\n";
-   #endif 
+#endif 
 }
 
index 5ae4c37951649695cca690a9f1e99339500f56d3..b22582e3f6fb8bb7f27ceee9eb7cc9d356552329 100644 (file)
--- a/pscore.hh
+++ b/pscore.hh
@@ -55,7 +55,7 @@ struct PScore {
 
     void add(PStaff *);
     /// add item
-    void typeset_item(Item *,  PCol *,PStaff*,int);
+    void typeset_item(Item *,  PCol *,PStaff*,int=1);
     ///    add to bottom of pcols
     void add(PCol*);
     /**
index 79846e7e6947fdd1414e6e8d6d62d48a546deb92..f2dc5f7144f2c6eb3473f965ba9f78815a4df2e2 100644 (file)
@@ -4,7 +4,7 @@
 
 #include "glob.hh"
 #include "string.hh"
-#include "mtime.hh"
+
 struct Request {
     Voice_element*elt;
 #if 0
@@ -172,7 +172,7 @@ struct Slur_req : Span_req {
 
 /// helper in the hierarchy
 struct Dynamic {
-    Mtime subtime;
+    Real subtime;
 };
 /** Each dynamic is bound to one note ( a crescendo spanning multiple
     notes is thought to be made of two "dynamics": a start and a stop).
index d2a85d62cee60f9ceb7d0fe5b0b0554ddd129dfc..0b9e90e229edcbd740b3e5041f41c593ddda0936 100644 (file)
@@ -17,11 +17,13 @@ Rhythmic_column::Rhythmic_column(Score_column*s, Rhythmic_staff *rs)
     staff_ = rs;
 }
 
-
+Rhythmic_staff::Rhythmic_staff()
+{
+    theline = new Linestaff(1);
+}
 void
 Rhythmic_staff::set_output(PScore* ps )
 {
-    theline = new Linestaff(1);
     pscore_ = ps;
     pscore_->add(theline);
 }
@@ -30,7 +32,7 @@ Rhythmic_staff::set_output(PScore* ps )
 void
 Rhythmic_column::process_commands( )
 {
-    int breakstat = BREAK_END;
+    int breakstat = BREAK_END - BREAK_PRE;
     for (int i = 0 ; i < s_commands.sz(); i++) {
        Command *com = s_commands[i];
        switch (com->code){
@@ -41,7 +43,7 @@ Rhythmic_column::process_commands( )
        case BREAK_POST:
        case BREAK_END:
            score_column->set_breakable();
-           breakstat = com->code;
+           breakstat = com->code- BREAK_PRE;
            break;
            
        case TYPESET:
@@ -77,7 +79,6 @@ Rhythmic_column::process_requests()
                the_note = rq;
            }
            break;
-               
        }
 }
 
@@ -136,7 +137,7 @@ Rhythmic_column::typeset_req(Request *rq)
        m->add_right(dm);
     }
     i->output=m;
-    staff_->pscore_->typeset_item(i, score_column->pcol, staff_->theline,0 );
+    staff_->pscore_->typeset_item(i, score_column->pcol, staff_->theline );
 }
 
 void
index 8e362146e33d96ee5bf76c0840a7fe0a07f25962..69b61ec4877914133efd83c93c1e24c0851bfcf0 100644 (file)
@@ -32,11 +32,14 @@ struct Rhythmic_column : Staff_column {
 struct Rhythmic_staff : Staff {
     /// indirection to the PStaff.
     PStaff *theline;
+
+    /****************/
     void set_output(PScore *);
     void process_commands( PCursor<Command*> &where);
 
     void grant_requests();
     Staff_column * create_col(Score_column*);
+    Rhythmic_staff();
 };
 
 
index 28955332d5482d326dd78725e2bb2226048c4c42..1dfc8f21764c9c898fef527a15071410e42caa3e 100644 (file)
--- a/sccol.cc
+++ b/sccol.cc
@@ -1,7 +1,7 @@
 #include "sccol.hh"
 #include "debug.hh"
 
-Score_column::Score_column(Mtime w)
+Score_column::Score_column(Real w)
 {
     when = w;
     pcol = new PCol(0);
index 9c22c277a1b6e2ed489d62f494fde368ee8d7d83..21a341d17f7ee810a7c7dbae17179ce144c69f2d 100644 (file)
--- a/sccol.hh
+++ b/sccol.hh
@@ -7,19 +7,18 @@
 #ifndef SCCOL_HH
 #define SCCOL_HH
 #include "pcol.hh"
-#include "mtime.hh"
 
 
 struct Score_column {
     PCol * pcol;
-    svec<Mtime> durations;
-    Mtime when;
+    svec<Real> durations;
+    Real when;
 
     /// 
     bool musical;
     
 
-    Score_column(Mtime when);
+    Score_column(Real when);
 
     static int compare(Score_column & c1, Score_column &c2) {
        return sgn(c1.when - c2.when);
index 82fe9a169100ddaba1d6674818a32fbbc640c0fa..8f86ff6fad47e5e5fb3b620b8ebf382796794495 100644 (file)
@@ -1,5 +1,6 @@
 #include "scommands.hh"
 #include "debug.hh"
+#include "parseconstruct.hh"
 
 /*
   maybe it's time for a "narrowing" cursor?
@@ -78,45 +79,74 @@ Score_commands::is_breakable(Real w)
     }
     return false;
 }
+
+void
+Score_commands::insert_between(Command victim, PCursor<Command*> firstc,
+                              PCursor<Command*> last)
+{
+    assert(last->when==firstc->when);
+    PCursor<Command*> c(firstc+1);
+    while (c != last) {        // hmm what if !last.ok()?
+       if (victim.priority > c->priority) {
+           c.insert(new Command(victim));
+           return;
+       }
+       c++;
+    }
+    last.insert(new Command(victim));    
+    
+}
 void
 Score_commands::add_command_to_break(Command pre, Command mid,Command post)
 {
     Real w = pre.when;
-    
-    Command k(w);
-    
-    PCursor<Command*> c ( first(w));
+    PCursor<Command*> c ( first(w)), f(c), l(c);
+
     while (!c->isbreak())
        c++;
-    c.add(new Command(pre));
-
+    f = c++;
     while (!c->isbreak())
        c++;
-    c.add(new Command(mid));
-
+    l = c++;
+    
+    insert_between(pre, f, l);
+    f = l;
     while (!c->isbreak())
        c++;
-    c.add(new Command(post));
+    l = c++;    
+    insert_between(mid, f, l);
+    f = l;
+    while (!c->isbreak())
+       c++;
+    l = c++;    
+    insert_between(post, f, l);
+    assert(l.ok() && l->when ==w && l->code == BREAK_END);
 }
 
 void
-Score_commands::add(Command c)
+Score_commands::parser_add(Command *c)
 {
-    bool encapsulate =false;
+    bottom().add(c);
+}
 
-    Command pre(c.when);
-    Command mid(c.when);
-    Command post(c.when);
+void
+Score_commands::process_add(Command c)
+{
+    bool encapsulate =false;
+    Real w = c.when;
+    Command pre(w);
+    Command mid(w);
+    Command post(w);
 
 
     if (c.code == TYPESET) {
        if (c.args[0] == "BAR") {
-           set_breakable(c.when);
+           set_breakable(w);
            encapsulate  = true;
            mid = c;
            pre = c;
        }
-       if (c.args[0] == "METER" && is_breakable(c.when)) {
+       if (c.args[0] == "METER" && is_breakable(w)) {
            encapsulate = true;
            mid = c;
            pre = c;
@@ -146,14 +176,14 @@ Score_commands::clean(Real l)
        c.code = TYPESET;
        c.args.add("BAR");
        c.args.add("empty");
-       add(c);
+       process_add(c);
     }
     
     PCursor<Command*> bot(bottom());
 
     while (bot.ok() && bot->when > l) {
-
-       mtor <<"removing "<< bot->code <<" at " << bot->when<<'\n';
+       mtor <<"removing ";
+       bot->print();
        bot.del();
        bot = bottom();
     }
@@ -163,7 +193,7 @@ Score_commands::clean(Real l)
        c.code = TYPESET;
        c.args.add("BAR");
        c.args.add("||");
-       add(c);
+       process_add(c);
     }
     OK();
 }
@@ -173,6 +203,8 @@ Score_commands::OK() const
 {
     for (PCursor<Command*> cc(*this); cc.ok() && (cc+1).ok(); cc++) {
        assert(cc->when <= (cc+1)->when);
+       if (cc->when == (cc+1)->when && !cc->isbreak() && !(cc+1)->isbreak())
+           assert(cc->priority >= (cc+1)->priority);
     }
 }
 
@@ -183,3 +215,47 @@ Score_commands::print() const
        cc->print();
     }
 }
+
+Score_commands*
+Score_commands::parse(Real l) const
+{
+    Score_commands*nc = new Score_commands;
+    int beats_per_meas=4;
+    Real measlen = 1.0; // 4/4 by default
+    
+    Real inbar=0.0;
+    int barcount=0;
+    Real wholes=0.0;
+    Real stoppos=0.0;
+
+    {
+       Command c(0.0);
+       c.code = TYPESET;
+       c.args.add("BAR");
+       c.args.add("empty");
+       nc->process_add(c);
+    }
+    for (PCursor<Command*> cc(*this); cc.ok() && cc->when <= l; cc++) {
+       assert (cc->code==INTERPRET);
+       if (cc->args[0] == "METER") {
+           beats_per_meas=cc->args[1].value();
+           int one_beat =cc->args[2].value ();
+           measlen = beats_per_meas/Real(one_beat);
+           nc->process_add(*get_meter_command(wholes,beats_per_meas, one_beat));
+       }
+       if (cc->args[0] == "SKIP") {
+           stoppos = wholes + cc->args[1].value() * measlen + cc->args[2].fvalue();
+           wholes += (measlen-inbar); // skip at least 1 measure
+           barcount++;
+           while (wholes <= stoppos) {
+               nc->process_add(*get_bar_command(wholes)); // liek
+               wholes += measlen;
+               barcount ++;            
+           }
+           wholes = stoppos;
+           //something
+       }
+    }
+    
+    return nc;
+}
index 15c844ca65aa776f47ecd81d9310769202912100..ee3b4591ab1e03407fc116c87fb22458da8e7cc8 100644 (file)
@@ -9,8 +9,10 @@
 #include "vray.hh"
 #include "list.hh"
 
-struct Score_commands : public      PointerList<Command*> {
-    void add(Command);
+struct Score_commands : public PointerList<Command*> {
+    void process_add(Command);
+    Score_commands*parse(Real last)const;
+    void parser_add(Command*);
     void add_seq(svec<Command>);
     void clean(Real last);
     void set_breakable(Real when);
@@ -20,6 +22,9 @@ struct Score_commands : public      PointerList<Command*> {
     void add_command_to_break(Command pre, Command mid,Command post);
     void OK() const;
     void print() const;
+    Real last() const;
+    void insert_between(Command victim, PCursor<Command*> firstc,
+                       PCursor<Command*> last);
 };
 /** the list of commands in Score. Put in a separate class, since it
   otherwise clutters the methods of Score.  */
index 0f8bbf70de0b6b763add44afceac9c8e1d20e1d7..3c95fd179002bfd593583d0d3dcd908572beedc1 100644 (file)
--- a/score.cc
+++ b/score.cc
@@ -1,3 +1,4 @@
+#include "scommands.hh"
 #include "tstream.hh"
 #include "score.hh"
 #include "sccol.hh"
@@ -6,15 +7,21 @@
 #include "debug.hh"
 #include "paper.hh"
 
+void
+Score::set(Paperdef*p)
+{
+    delete paper_;
+    paper_ = p;
+}
 void
 Score::output(String s)
 {
     OK();
-    if (paper->outfile=="")
-       paper->outfile = s;
+    if (paper_->outfile=="")
+       paper_->outfile = s;
     
-    *mlog << "output to " << paper->outfile << "...\n";
-    Tex_stream the_output(paper->outfile);    
+    *mlog << "output to " << paper_->outfile << "...\n";
+    Tex_stream the_output(paper_->outfile);    
     pscore_->output(the_output);
 }
 
@@ -22,10 +29,13 @@ Score::output(String s)
 void
 Score::process()
 {
-    if (!paper)
-       paper = new Paperdef;
-
-    commands_.clean(last());
+    set(commands_->parse(last()));
+    commands_->print();
+    
+    if (!paper_)
+       paper_ = new Paperdef;
+    
+    commands_->clean(last());
     
     /// distribute commands to disciples
     distribute_commands();
@@ -72,7 +82,7 @@ Score::clean_cols()
     */
 // todo
 PCursor<Score_column*>
-Score::create_cols(Mtime w)
+Score::create_cols(Real w)
 {
     Score_column* c1 = new Score_column(w);
     Score_column* c2 = new Score_column(w);
@@ -102,7 +112,7 @@ Score::create_cols(Mtime w)
 }
 
 Score_column*
-Score::find_col(Mtime w,bool mus)
+Score::find_col(Real w,bool mus)
 {
     PCursor<Score_column*> scc(cols_);
     for (; scc.ok(); scc++) {
@@ -121,7 +131,7 @@ void
 Score::distribute_commands(void)
 {
     for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
-       sc->add_commands(commands_);
+       sc->add_commands(*commands_);
     }
 }
 void
@@ -140,10 +150,10 @@ Score::do_pcols()
        pscore_->add(sc->pcol);
     }
 }
-Mtime
+Real
 Score::last() const
 {    
-    Mtime l = 0;
+    Real l = 0;
     for (PCursor<Staff*> stc(staffs_); stc.ok(); stc++) {
        l = MAX(l, stc->last());
     }
@@ -163,7 +173,7 @@ Score::OK() const
     for (PCursor<Score_column*> cc(cols_); cc.ok() && (cc+1).ok(); cc++) {
        assert(cc->when <= (cc+1)->when);
     }
-    commands_.OK();
+    commands_->OK();
 #endif    
 }
 
@@ -179,7 +189,7 @@ Score::print() const
     for (PCursor<Score_column*> sc(cols_); sc.ok(); sc++) {
        sc->print();
     }
-    commands_.print();
+    commands_->print();
     mtor << "}\n";
 #endif
 }
@@ -187,10 +197,20 @@ Score::print() const
 Score::Score()
 {
     pscore_=0;
-    paper = 0;
+    paper_ = 0;
+    commands_ = new Score_commands;
 }
+
+Score::~Score()
+{
+    delete pscore_;
+    delete commands_;
+    delete paper_;
+}
+
 void
-Score::add(Command*c)
+Score::set(Score_commands*c)
 {
-    commands_.add(*c);
+    delete commands_;
+    commands_ = c;
 }
index c6af97c7a10d77fb395fe086961ca9f2fd07292e..e58f87f0581ff3db8f6103692c6564332c19df45 100644 (file)
--- a/score.hh
+++ b/score.hh
@@ -1,16 +1,16 @@
 #ifndef SCORE_HH
 #define SCORE_HH
-
 #include "vray.hh"
-#include "mtime.hh"
-#include "scommands.hh"
+#include "proto.hh"
+#include "list.hh"
+
 
 /// the total music def of one movement
 struct Score {
-    Paperdef *paper;
-    /// staffs_ and commands_ form the problem definition.
+    /// paper_, staffs_ and commands_ form the problem definition.
+    Paperdef *paper_;
     PointerList<Staff *> staffs_;
-    Score_commands commands_;
+    Score_commands *commands_;
     
     /// "runtime" fields for setting up spacing    
     PointerList<Score_column*> cols_;
@@ -18,27 +18,25 @@ struct Score {
 
     /****************************************************************/
 
-    Score();    
-    void process();
-
     /// construction
     void add_staff(Staff *st);
+    void set(Paperdef*);
+    Score();
+    ~Score();    
+    void add(Staff*);        
+    void set(Score_commands*);
 
-    void OK() const;
-    Score_column *find_col(Mtime,bool);
-    void do_pcols();
 
-    void add(Staff*);
+    void OK() const;
+    Score_column *find_col(Real,bool);
+    void process();
     void output(String fn);
-    PCursor<Score_column*> create_cols(Mtime);
+    PCursor<Score_column*> create_cols(Real);
     void print() const;
-
-    Mtime last() const;
-    
-    void add(Command*);
+    Real last() const;
     
 private:
-    
+    void do_pcols();    
     void clean_cols();
     void distribute_commands();
     void do_connect(PCol *c1, PCol *c2, Real d);
index cb06b0074ff8f637d7e984b8198f113742dd12ff..46685d605053be9908837a359c8f158d54b50c00 100644 (file)
--- a/scores.cc
+++ b/scores.cc
@@ -1,5 +1,6 @@
 #include "main.hh"
 #include "score.hh"
+#include "string.hh"
 
 static svec<Score*> sv;
 
@@ -11,6 +12,8 @@ do_scores()
     for (int i=0; i < sv.sz(); i++) {  
        sv[i]->process();
        sv[i]->output(outfn);
+       delete sv[i];
+       sv[i] =0;
     }
 }
 
index 0827c953f015cc38bec5910e35c2abf0ef22beca..7dd2666dc9ff02167982979b81158457d0096484 100644 (file)
--- a/staff.cc
+++ b/staff.cc
@@ -17,7 +17,7 @@ Staff::clean_cols()
 }
 
 Staff_column *
-Staff::get_col(Mtime w, bool mus)
+Staff::get_col(Real w, bool mus)
 {
     Score_column* sc = score_->find_col(w,mus);
     assert(sc->when == w);
@@ -65,7 +65,7 @@ Staff::setup_staffcols()
     
     for (PCursor<Voice*> vc(voices); vc.ok(); vc++) {
 
-       Mtime now = vc->start;
+       Real now = vc->start;
        for (PCursor<Voice_element *> ve(vc->elts); ve.ok(); ve++) {
 
            Staff_column *sc=get_col(now,true);
@@ -130,9 +130,9 @@ Staff::OK() const
 }
 
 
-Mtime
+Real
 Staff::last() const {
-    Mtime l = 0.0;
+    Real l = 0.0;
     for (PCursor<Voice*> vc(voices); vc.ok(); vc++) {
        l = MAX(l, vc->last());
     }
@@ -154,3 +154,9 @@ Staff::print() const
     #endif
 }
 
+Staff::Staff()
+{
+    score_ =0;
+    pscore_=0;
+    
+}
index cca8c35266412d745ca8397dc92c174bcbfdf507..3d39c6e78bdb89dc047436a264398bb1d888f121 100644 (file)
--- a/staff.hh
+++ b/staff.hh
@@ -19,6 +19,8 @@ struct Staff {
     Score *score_;
     PScore *pscore_;
 
+    /****************************************************************/
+    
     void add_voice(Voice *v);
     void add_staff_column(Staff_column *sp);
 
@@ -28,18 +30,13 @@ struct Staff {
     /**
     This routines calls virtual functions from Staff, to delegate the
     interpretation of requests to a derived class of Staff */
-
-    
-    /****************************************************************
-      VIRTUALS
-    ****************************************************************/
-    
     void setup_staffcols();
 
-    virtual void set_output(PScore * destination)=0;
-    virtual void grant_requests()=0;
-    
-    Staff_column * get_col(Mtime,bool);
+    void OK() const;
+    void print() const;
+    Real last() const;
+    void clean_cols() ;
+    Staff_column * get_col(Real,bool);
 
     void add_commands(PointerList<Command* >const & sv);
     /**
@@ -48,12 +45,21 @@ struct Staff {
     PRE
     sv is time-ordered.
     */
+
+    Staff();
+    /**
+      Should construct with Score as arg, but this isn't known during parsing.      
+      */
+    /****************************************************************
+      VIRTUALS
+    ****************************************************************/
+    
+    virtual void set_output(PScore * destination)=0;
+    virtual void grant_requests()=0;    
     virtual Staff_column * create_col(Score_column * )=0;
+    virtual ~Staff() { }
 
-    void OK() const;
-    void print() const;
-    Mtime last() const;
-    void clean_cols() ;
-    virtual ~Staff() { } 
 };
 #endif
+
+
index e9a80c8e3622fb0a1815c68c5909355dcf1f60de..799daed31641fa4aa23e078a8edc7f4429b29821 100644 (file)
--- a/stcol.cc
+++ b/stcol.cc
@@ -8,7 +8,7 @@ Staff_column::mus() const
     return score_column->musical;
 }
 
-Mtime
+Real
 Staff_column::when() const
 {
     return score_column->when;
@@ -17,7 +17,7 @@ Staff_column::when() const
 void
 Staff_column::add(Voice_element*ve)
 {
-    Mtime d= ve->duration;
+    Real d= ve->duration;
     if (d){
        score_column->durations.add(d);
     }
index 2b23934c53851f7344cf8da181dbe2a28fa88916..060d585fdedf8198d26abf03b011e58eb55ab713 100644 (file)
--- a/stcol.hh
+++ b/stcol.hh
@@ -17,7 +17,7 @@ struct Staff_column {
     svec<Command *> s_commands;
     
     Staff_column(Score_column*s); 
-    bool mus() const ;
+    bool mus() const;
     Real when() const;
     void add(Voice_element*ve);
     /****************************************************************
index 08c4ddf64355ee4070e484ecccb92242037b42df..59eb0c74890377b5d6c880c38d99ed24410701d1 100644 (file)
--- a/suzan.ly
+++ b/suzan.ly
@@ -2,6 +2,7 @@
 
 score{
        rhythmstaff {
-               voice { $c2 c2 c2 c2$ }
+               voice { $ c2 c2  c4. c8 c4 c4 c4 c4 c4 c4 c2 c2$  }
        }
+       commands { meter 2 4 skip 2:0 meter 4 4 skip 2:0}
 }
index 459deb1f670df5fed0982d2f741746d4335d398f..26c0a31bffdd62ac27ca82884620bb326f3b4c31 100644 (file)
@@ -36,7 +36,7 @@ table param
 end
 
 table dots
-       1       \singledot              0pt     4pt     -1pt    1pt
-       2       \doubledot              0pt     8pt     -1pt    1pt
-       3       \tripledot              0pt     12pt    -1pt    1pt
+       1       \lsingledot             0pt     8pt     -1pt    1pt
+       2       \ldoubledot             0pt     12pt    -1pt    1pt
+       3       \ltripledot             0pt     16pt    -1pt    1pt
 end
index 72b5ccfd55eea9980a6362af23a4e1b2bbe2eaf5..da2af9575ed504101855bbbc5aa5fe792dbdf9cd 100644 (file)
--- a/table.cc
+++ b/table.cc
@@ -17,6 +17,9 @@ static Keyword_ent  the_key_tab[]={
     "paper", PAPER,
     "width", WIDTH,
     "meter", METER,
+    "unitspace", UNITSPACE,
+    "skip", SKIP,
+    "commands", COMMANDS,
     0,0
 } ;
 
index 907f229481dfab5e88c0add8af1858c8a3fa30eb..ae9342b487e1bbe48b5db86345dc19b536ea9a51 100644 (file)
--- a/voice.cc
+++ b/voice.cc
@@ -51,10 +51,10 @@ Voice_element::print() const
 #endif
 }
 
-Mtime
+Real
 Voice::last() const
 {
-    Mtime l =start;
+    Real l =start;
     for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
        l  += vec->duration;
     return l;
index 35537525ece1630ddc731472840a4bd8a5d7a941..b580972b233366fd7a479dd3e4688892c0de8853 100644 (file)
--- a/voice.hh
+++ b/voice.hh
@@ -1,18 +1,18 @@
 #ifndef VOICE_HH
 #define VOICE_HH
 
-#include "mtime.hh"
+
 #include "list.hh"
 #include "request.hh"
 
 /// class for  horizontal stuff.
 struct Voice {
     PointerList<Voice_element *> elts;
-    Mtime start;
+    Real start;
 
     /****************/
-    Mtime when(const Voice_element*)const;
-    Mtime last() const;
+    Real when(const Voice_element*)const;
+    Real last() const;
     Voice();
     void add(Voice_element*);
     void print() const;
@@ -30,7 +30,7 @@ struct Voicegroup {
 
 /// 
 struct Voice_element {
-    Mtime duration;
+    Real duration;
     const Voicegroup *group;
     const Voice *voice;
     PointerList<Request*> reqs;