]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.4 release/0.0.4
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 1 Nov 1996 16:48:30 +0000 (17:48 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 1 Nov 1996 16:48:30 +0000 (17:48 +0100)
92 files changed:
.dstreamrc
Makefile
README [new file with mode: 0644]
Sources.make
TODO [new file with mode: 0644]
boxes.cc
break.cc
calcideal.cc
cols.cc [deleted file]
cols.hh [deleted file]
command.cc
command.hh
const.hh
debug.hh
depend [deleted file]
dimen.cc [new file with mode: 0644]
dimen.hh [new file with mode: 0644]
dimen.tex
flower/Makefile
flower/Sources.make
flower/TODO
flower/cursor.hh
flower/cursor.inl
flower/dataf.cc
flower/list.cc
flower/list.hh
flower/list.inl
flower/matdebug.cc
flower/pcursor.hh
flower/plist.cc [new file with mode: 0644]
flower/stringutil.hh
genheader [new file with mode: 0755]
item.cc
item.hh
lexer.l
lilyponddefs.tex
line.cc
linespace.cc
linespace.hh
linestaff.cc
linestaff.hh
lookupsyms.cc [new file with mode: 0644]
lookupsyms.hh [new file with mode: 0644]
maartje.ly
main.cc
main.hh
make_patch
misc.cc
misc.hh
molecule.cc
molecule.hh
mtime.hh
note.cc
paper.cc [new file with mode: 0644]
paper.hh [new file with mode: 0644]
parseconstruct.hh
parser.y
pcol.cc [new file with mode: 0644]
pcol.hh [new file with mode: 0644]
proto.hh
pscore.cc
pscore.hh
pstaff.hh
qlp.hh
request.cc
request.hh
rhythmstaf.cc
rhythmstaf.hh
sccol.cc [new file with mode: 0644]
sccol.hh [new file with mode: 0644]
scommands.cc [new file with mode: 0644]
scommands.hh [new file with mode: 0644]
score.cc
score.hh
staff.cc
staff.hh
stcol.cc [new file with mode: 0644]
stcol.hh [new file with mode: 0644]
suzan.ly
symbol.cc
symbol.hh
symbol.ini
symtable.cc
symtable.hh
table.cc
template1.cc
template2.cc
template3.cc
tex.cc
tex.hh
tstream.cc
voice.cc

index ec6e96fabc685956b257e15c5664d6565ea38fe7..b5fa669d14f81cb13fb8316adee185e206c6187d 100644 (file)
@@ -12,4 +12,5 @@ PScore                        1
 Parser                 1
 Lexer                  1
 parse_duration         1
-parse_pitch            1
\ No newline at end of file
+parse_pitch            1
+
index 38b71b9bbbf2869630b1c69b975b8819b65f86b7..2f5b450761166df3b803966a344e52a1397a63f6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 MAJVER=0
 MINVER=0
-PATCHLEVEL=3
+PATCHLEVEL=4
 
 # 
 #
@@ -19,17 +19,19 @@ VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
 PACKAGENAME=lilypond
 DNAME=$(PACKAGENAME)-$(VERSION)
 othersrc=lexer.l parser.y
-SCRIPTS=make_version make_patch
+SCRIPTS=make_version make_patch genheader
 IFILES=dimen.tex symbol.ini suzan.ly maartje.ly  lilyponddefs.tex test.tex .dstreamrc
-OFILES=Makefile Sources.make depend 
-DFILES=$(hdr) $(mycc) $(othersrc) $(OFILES) $(IFILES) $(SCRIPTS) COPYING
+OFILES=Makefile Sources.make 
+DOC=COPYING README TODO
+DFILES=$(hdr) $(mycc) $(othersrc) $(OFILES) $(IFILES) $(SCRIPTS) $(DOC)
 
 #compiling
 LOADLIBES=-L$(FLOWERDIR) -lflower
 FLOWERDIR=../flower
-#DEFINES=-DNDEBUG
-CXXFLAGS=$(DEFINES) -I$(FLOWERDIR) -pipe -Wall -g
-
+#DEFINES=-DNDEBUG -DNPRINT -O2
+CXXFLAGS=$(DEFINES) -I$(FLOWERDIR) -pipe -Wall -W  -pedantic -g
+FLEX=flex
+BISON=bison
 exe=$(PACKAGENAME)
 
 ##################################################################
@@ -62,7 +64,7 @@ depend: Sources.make  .GENERATE
 include depend
 
 parser.cc: parser.y
-       bison -d $<
+       $(BISON) -d $<
        mv parser.tab.h parser.hh
        mv parser.tab.c parser.cc
 
@@ -74,7 +76,7 @@ version.hh: Makefile make_version
        make_version $(MAJVER) $(MINVER) $(PATCHLEVEL)  > $@
 
 lexer.cc: lexer.l
-       flex -+ -t $< > $@
+       $(FLEX) -+ -t $< > $@
 
 DDIR=$(DNAME)
 dist:
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..412248b
--- /dev/null
+++ b/README
@@ -0,0 +1,9 @@
+
+
+This is a beta version of LilyPond (a music typesetter). This release is
+preliminary, please do not distribute. Please send your helpful comments and
+patches to me, 
+
+  hanwen@stack.urc.tue.nl
+
+
index 54ff23ac29206264e2800a71a63cd98b0f301815..02eac2a6c0c0d528ec838cc250281331d5d3483d 100644 (file)
@@ -1,22 +1,23 @@
 hdr=    qlp.hh       \
        linespace.hh   qlpsolve.hh\
-       cols.hh   proto.hh pstaff.hh  line.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  mtime.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
+       symbol.hh main.hh dimen.hh paper.hh lookupsyms.hh\
+       sccol.hh stcol.hh scommands.hh
 
-mycc=  qlp.cc qlpsolve.cc \
-        break.cc linespace.cc molecule.cc line.cc\
-       pscore.cc tex.cc item.cc cols.cc staff.cc rhythmstaf.cc\
+mycc=   qlp.cc qlpsolve.cc \
+       break.cc linespace.cc molecule.cc line.cc\
+       pscore.cc tex.cc item.cc pcol.cc staff.cc rhythmstaf.cc\
        score.cc note.cc  main.cc misc.cc \
        symbol.cc request.cc notename.cc  voice.cc\
        keyword.cc linestaff.cc table.cc command.cc\
        warn.cc debug.cc symtable.cc boxes.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\
        template1.cc template2.cc template3.cc
-
-
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..3f91b6b
--- /dev/null
+++ b/TODO
@@ -0,0 +1,7 @@
+bug in BAR.
+dot spacing
+typeset direction.
+beam
+stem
+
+
index e55af6c6f5ac9ad02ea725ac03bfbe42c4d956d2..74475b453053f168518107b7e3f22c4defc35fc0 100644 (file)
--- a/boxes.cc
+++ b/boxes.cc
@@ -19,6 +19,7 @@ Box::Box(svec<Real> s)
 Box::Box()
 {        
 }
+
 Box::Box(Interval ix, Interval iy)
 {
     x=ix;
index 9eb55cc9f78f6f269c6141213731803753b21454..e705c546cfe4cd0227baac0a0a42b86bbe38f7ce 100644 (file)
--- a/break.cc
+++ b/break.cc
@@ -29,12 +29,12 @@ PScore::solve_line(svec<const PCol *> curline) const
 
 
 void
-PScore::problem_OK() 
+PScore::problem_OK() const
 {
     if (!cols.size())
        error("PScore::problem_OK(): Score does not have any columns");
     PCursor<PCol *> start(cols);
-    PCursor<PCol *> end (cols.bottom());
+    PCursor<PCol *> end (((PScore*)this)->cols.bottom());
     
     assert(start->breakable);    
     assert(end->breakable);
@@ -67,6 +67,7 @@ struct Col_configuration {
 void
 PScore::calc_breaking()
 {
+    OK();
     problem_OK();
     PCursor<PCol *> curcol(cols);
            
index b1410aefc013e9974f28b622c750e2d74c885098..bddd4f28970f7b76ac0deb5b8c8eebc2b0fba4c3 100644 (file)
@@ -2,7 +2,9 @@
 #include "score.hh"
 #include "pscore.hh"
 #include "staff.hh"
+#include "paper.hh"
 #include "misc.hh"
+#include "sccol.hh"
 #include "debug.hh"
 
 
@@ -48,7 +50,7 @@ Score::calc_idealspacing()
        if (sc->musical)
            for (int i=0; i < sc->durations.sz(); i++) {
                Mtime d = sc->durations[i];
-               Real dist = duration_to_idealspace(d);
+               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;
diff --git a/cols.cc b/cols.cc
deleted file mode 100644 (file)
index 0de683c..0000000
--- a/cols.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-#include "cols.hh"
-#include "pstaff.hh"
-
-Idealspacing::Idealspacing(const PCol * l,const PCol * r)
-{
-    space = 0.0;
-    hooke = 0.0;
-    left = l;
-    right = r;
-}
-void
-Idealspacing::OK() const
-{
-#ifndef NDEBUG
-    assert(hooke >= 0 && left  && right);
-#endif    
-}
-
-Interval
-PCol::width() const
-{
-    Interval w;
-
-    for (PCursor<const Item *> ic(its); ic.ok(); ic++)
-       w.unite(ic->width());
-    if (w.empty())
-       w.unite(Interval(0,0));
-    return w;
-}
-/****************************************************************/
-
-int
-PCol::compare(const PCol &c1, const PCol &c2)
-{
-    assert(false);
-    return 0 ;
-}
-
-void
-PCol::OK () const
-{
-    if (prebreak || postbreak ) {
-       assert(breakable);
-    }
-}
-
-void
-PCol::set_breakable()
-{
-    if (breakable)
-       return;
-
-    prebreak = new PCol(this);
-    postbreak = new PCol(this);
-    breakable = true;
-    used = true;
-}
-
-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 postbreak;       
-}
-
-void
-PCol::add(const Item *i)
-{
-    its.bottom().add(i);
-    used = true;
-}
-
diff --git a/cols.hh b/cols.hh
deleted file mode 100644 (file)
index e51e2d5..0000000
--- a/cols.hh
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef COLS_HH
-#define COLS_HH
-
-#include "glob.hh"
-#include "boxes.hh"
-#include "list.hh"
-#include "item.hh"
-
-/// stuff grouped vertically.
-struct PCol {
-    List<const Item*> its;
-    List<const Spanner*> stoppers, starters;
-    
-    /// Can this be broken? true eg. for bars. 
-    bool breakable;
-
-    /// does this column have items, does it have spacings attached?
-    bool used;
-
-    /// prebreak is put before end of line.
-    PCol *prebreak;
-    /**
-    if broken here, then (*this) column is discarded, and prebreak
-    is put at end of line, owned by Col
-    */
-
-    /// postbreak at beginning of the new line
-    PCol *postbreak;
-    /**  \See{prebreak}
-    */
-    PCol *daddy;
-    /*
-    if this column is pre or postbreak, then this field points to the parent.
-    */
-    /// if lines are broken then this column is in #line#
-    const Line_of_score *line;
-
-    /// if lines are broken then this column x-coord #hpos#
-    Real hpos;
-
-
-    /****************************************************************/
-
-    void add(const Item*i);
-
-    Interval width() const;
-    ~PCol();
-    PCol(PCol * parent);
-    /// initialize the prebreak and postbreak fields
-    setup_breaks();
-    
-    /// which col comes first?
-    static int compare(const PCol &c1, const PCol &c2);
-    /**
-    signed compare on columns.
-
-    return < 0 if c1 < c2.
-    */
-
-    void OK() const;
-    void set_breakable();
-
-};
-/**
-    This is a class to address items vertically. It contains the data for:
-    \begin{itemize}
-    \item
-    unbroken score
-    \item
-    broken score
-    \item
-    the linespacing problem
-    \end{itemize}
-  */
-
-#include "compare.hh"
-instantiate_compare(const PCol &, PCol::compare);
-     
-
-/// ideal spacing between two columns
-struct Idealspacing {
-
-    /// the ideal distance
-    Real space;
-
-    /// Hooke's constant: how strong are the "springs" attached to columns
-    Real hooke;
-
-    /// the two columns
-    const PCol *left, *right;
-
-    void OK() const ;
-    Idealspacing(const PCol *left,const PCol *right);
-};
-
-#endif
index ebf993d239e1a7eeba8a087f93633a25707d9097..6375c7e6d3101fe915d9baf93ff3b068ebef8403 100644 (file)
@@ -1,7 +1,12 @@
-
 #include "string.hh"
+#include "debug.hh"
 #include "command.hh"
 
+bool
+Command::isbreak()const
+{
+    return (code >= BREAK_PRE&&code <= BREAK_END);
+}
 
 Command*
 get_bar_command(Real w)
@@ -13,3 +18,40 @@ get_bar_command(Real w)
     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;
+}
+
+
+
+Command::Command(Real w)
+{
+    code = NOP;
+    when = w;
+}
+void
+Command::print() const
+{
+    mtor << "command code: " << code << " args: ";
+    for (int i = 0; i<args.sz(); i++)
+       mtor << args[i];
+    mtor << "\n";
+}
index 353bf5d4bbb7cc4f3c26cbad8b53ad16aa52e66f..6b835e964bd8e307c5583aa6c9a85bd7ff9ec1a4 100644 (file)
@@ -3,11 +3,13 @@
 #include "glob.hh"
 #include "mtime.hh"
 #include "vray.hh"
+#include "string.hh"
+
 enum Commandcode {
        NOP,
        INTERPRET,
        TYPESET,
-       BREAK_PRE,BREAK_MIDDLE, BREAK_POST, BREAK_END
+       BREAK_PRE,BREAK_MIDDLE, BREAK_POST, BREAK_END
 };
 /// set a nonrythmical symbol
 struct Command {
@@ -16,6 +18,10 @@ struct Command {
     Mtime when;
     /// analogous to argv[]
     svec<String> args;
+    Command();
+    Command(Real w);
+    bool isbreak()const;
+    void print() const;
 };
 
 /**
index 38e464c382a53978c136a5c4a583554eb932923c..dce593b4a06401edb837b783c9be86c3f4814981 100644 (file)
--- a/const.hh
+++ b/const.hh
@@ -6,10 +6,6 @@
 #include <math.h>
 #include "real.hh"
 
-const Real CM_TO_PT=72/2.54;
-const Real VERT_TO_PT=CM_TO_PT;        // tex output
-const Real HOR_TO_PT=CM_TO_PT; // tex output
-
 const Real EPS=1e-7;           // qlpsolve.hh
 const int MAXITER=100;         // qlpsolve.hh
 const Real INFTY=HUGE;
index ae75b77fa142dd32d6cd6c6e2e3a732a229e0f80..ca805df011aca50d80279d6d138f9a0fec355989 100644 (file)
--- a/debug.hh
+++ b/debug.hh
@@ -16,12 +16,4 @@ extern Dstream monitor; // monitor
 void error(String s);
 void warning(String s);
 
-extern int debug_flags;
-
-void
-set_debug(String s);
-const int DEBUGPARSER = 0x01;
-const int DEBUGTOKEN = 0x02;
-const int DEBUGITEMS = 0x04;
-
 #endif
diff --git a/depend b/depend
deleted file mode 100644 (file)
index 3c3bccb..0000000
--- a/depend
+++ /dev/null
@@ -1,192 +0,0 @@
-qlp.o: qlp.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh const.hh \
- ../flower/real.hh qlp.hh ../flower/matrix.hh ../flower/vsmat.hh \
- ../flower/vector.hh ../flower/choleski.hh
-qlpsolve.o: qlpsolve.cc qlpsolve.hh qlp.hh ../flower/matrix.hh \
- ../flower/vsmat.hh ../flower/vray.hh ../flower/real.hh \
- ../flower/vector.hh const.hh debug.hh ../flower/dstream.hh \
- ../flower/string.hh ../flower/stringutil.hh ../flower/assoc.hh \
- ../flower/choleski.hh
-break.o: break.cc linespace.hh glob.hh ../flower/real.hh proto.hh \
- const.hh ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl \
- ../flower/vray.hh cols.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- item.hh tex.hh ../flower/compare.hh ../flower/matrix.hh \
- ../flower/vsmat.hh ../flower/vector.hh debug.hh ../flower/dstream.hh \
- ../flower/assoc.hh line.hh pstaff.hh pscore.hh
-linespace.o: linespace.cc linespace.hh glob.hh ../flower/real.hh \
- proto.hh const.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl ../flower/vray.hh cols.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
- ../flower/stringutil.hh item.hh tex.hh ../flower/compare.hh \
- ../flower/matrix.hh ../flower/vsmat.hh ../flower/vector.hh debug.hh \
- ../flower/dstream.hh ../flower/assoc.hh qlp.hh ../flower/unionfind.hh
-molecule.o: molecule.cc glob.hh ../flower/real.hh proto.hh const.hh \
- ../flower/string.hh ../flower/stringutil.hh molecule.hh \
- ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh ../flower/vray.hh item.hh \
- tex.hh symbol.hh
-line.o: line.cc line.hh ../flower/real.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
- proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh symbol.hh cols.hh ../flower/compare.hh pscore.hh
-pscore.o: pscore.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh line.hh \
- ../flower/real.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl glob.hh proto.hh const.hh pstaff.hh item.hh \
- boxes.hh ../flower/textdb.hh ../flower/textstr.hh tex.hh pscore.hh \
- cols.hh ../flower/compare.hh tstream.hh
-tex.o: tex.cc tex.hh ../flower/string.hh ../flower/stringutil.hh \
- boxes.hh ../flower/textdb.hh ../flower/textstr.hh ../flower/vray.hh \
- ../flower/real.hh symbol.hh const.hh
-item.o: item.cc line.hh ../flower/real.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
- proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh symbol.hh cols.hh ../flower/compare.hh
-cols.o: cols.cc cols.hh glob.hh ../flower/real.hh proto.hh const.hh \
- boxes.hh ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/vray.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl item.hh tex.hh \
- ../flower/compare.hh pstaff.hh
-staff.o: staff.cc staff.hh score.hh ../flower/vray.hh cols.hh glob.hh \
- ../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl item.hh \
- tex.hh ../flower/compare.hh mtime.hh command.hh voice.hh request.hh \
- debug.hh ../flower/dstream.hh ../flower/assoc.hh pscore.hh pstaff.hh
-rhythmstaf.o: rhythmstaf.cc request.hh glob.hh ../flower/real.hh \
- proto.hh const.hh ../flower/string.hh ../flower/stringutil.hh \
- mtime.hh debug.hh ../flower/dstream.hh ../flower/assoc.hh \
- ../flower/vray.hh linestaff.hh pstaff.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl item.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh tex.hh staff.hh score.hh \
- cols.hh ../flower/compare.hh command.hh voice.hh pscore.hh \
- molecule.hh rhythmstaf.hh symbol.hh
-score.o: score.cc tstream.hh ../flower/string.hh \
- ../flower/stringutil.hh score.hh ../flower/vray.hh cols.hh glob.hh \
- ../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
- command.hh pscore.hh pstaff.hh staff.hh voice.hh request.hh misc.hh \
- debug.hh ../flower/dstream.hh ../flower/assoc.hh
-note.o: note.cc ../flower/string.hh ../flower/stringutil.hh \
- ../flower/real.hh debug.hh ../flower/dstream.hh ../flower/assoc.hh \
- ../flower/vray.hh request.hh glob.hh proto.hh const.hh mtime.hh \
- voice.hh ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl notename.hh
-main.o: main.cc ../flower/lgetopt.hh misc.hh mtime.hh \
- ../flower/real.hh ../flower/string.hh ../flower/stringutil.hh main.hh \
- proto.hh
-misc.o: misc.cc misc.hh mtime.hh ../flower/real.hh glob.hh proto.hh \
- const.hh
-symbol.o: symbol.cc symbol.hh ../flower/string.hh \
- ../flower/stringutil.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/vray.hh ../flower/real.hh
-request.o: request.cc request.hh glob.hh ../flower/real.hh proto.hh \
- const.hh ../flower/string.hh ../flower/stringutil.hh mtime.hh
-notename.o: notename.cc glob.hh ../flower/real.hh proto.hh const.hh \
- ../flower/string.hh ../flower/stringutil.hh
-voice.o: voice.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh voice.hh \
- mtime.hh ../flower/real.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl request.hh glob.hh proto.hh const.hh
-keyword.o: keyword.cc glob.hh ../flower/real.hh proto.hh const.hh \
- lexer.hh
-linestaff.o: linestaff.cc linestaff.hh pstaff.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl item.hh glob.hh \
- ../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/vray.hh tex.hh symbol.hh
-table.o: table.cc glob.hh ../flower/real.hh proto.hh const.hh debug.hh \
- ../flower/dstream.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/assoc.hh ../flower/vray.hh keyword.hh parser.hh
-command.o: command.cc ../flower/string.hh ../flower/stringutil.hh \
- command.hh glob.hh ../flower/real.hh proto.hh const.hh mtime.hh \
- ../flower/vray.hh
-warn.o: warn.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh
-debug.o: debug.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh \
- ../flower/vector.hh ../flower/real.hh
-symtable.o: symtable.cc misc.hh mtime.hh ../flower/real.hh debug.hh \
- ../flower/dstream.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/assoc.hh ../flower/vray.hh symbol.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh symtable.hh const.hh
-boxes.o: boxes.cc boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
- ../flower/string.hh ../flower/stringutil.hh ../flower/vray.hh \
- ../flower/real.hh const.hh
-pstaff.o: pstaff.cc pstaff.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh glob.hh ../flower/real.hh proto.hh \
- const.hh boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
- ../flower/string.hh ../flower/stringutil.hh ../flower/vray.hh tex.hh
-tstream.o: tstream.cc tex.hh ../flower/string.hh \
- ../flower/stringutil.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/vray.hh ../flower/real.hh misc.hh \
- mtime.hh tstream.hh debug.hh ../flower/dstream.hh ../flower/assoc.hh
-version.o: version.cc version.hh
-calcideal.o: calcideal.cc tstream.hh ../flower/string.hh \
- ../flower/stringutil.hh score.hh ../flower/vray.hh cols.hh glob.hh \
- ../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
- command.hh pscore.hh pstaff.hh staff.hh voice.hh request.hh misc.hh \
- debug.hh ../flower/dstream.hh ../flower/assoc.hh
-scores.o: scores.cc main.hh proto.hh ../flower/real.hh score.hh \
- ../flower/vray.hh cols.hh glob.hh const.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
- command.hh
-identifier.o: identifier.cc keyword.hh lexer.hh proto.hh \
- ../flower/real.hh parser.hh
-template1.o: template1.cc line.hh ../flower/real.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
- proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh cols.hh ../flower/compare.hh request.hh mtime.hh command.hh \
- ../flower/list.cc ../flower/cursor.cc
-template2.o: template2.cc line.hh ../flower/real.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
- proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh symbol.hh voice.hh mtime.hh request.hh staff.hh score.hh \
- cols.hh ../flower/compare.hh command.hh ../flower/list.cc \
- ../flower/cursor.cc
-template3.o: template3.cc request.hh glob.hh ../flower/real.hh \
- proto.hh const.hh ../flower/string.hh ../flower/stringutil.hh \
- mtime.hh command.hh ../flower/vray.hh molecule.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh item.hh tex.hh ../flower/list.cc \
- ../flower/cursor.cc
-parser.o: parser.cc lexer.hh proto.hh ../flower/real.hh staff.hh \
- score.hh ../flower/vray.hh cols.hh glob.hh const.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
- command.hh voice.hh request.hh main.hh keyword.hh debug.hh \
- ../flower/dstream.hh ../flower/assoc.hh parseconstruct.hh
-lexer.o: lexer.cc glob.hh ../flower/real.hh proto.hh const.hh \
- ../flower/string.hh ../flower/stringutil.hh lexer.hh keyword.hh \
- ../flower/vray.hh parser.hh debug.hh ../flower/dstream.hh \
- ../flower/assoc.hh
diff --git a/dimen.cc b/dimen.cc
new file mode 100644 (file)
index 0000000..eb53756
--- /dev/null
+++ b/dimen.cc
@@ -0,0 +1,40 @@
+#include <ctype.h>
+#include "dimen.hh"
+#include "debug.hh"
+#include "string.hh"
+
+Real
+parse_dimen(String dim)
+{
+    int i=dim.len()-1;
+    const char *s = dim;
+    while  (i > 0 && (isspace(s[i]) || isalpha(s[i])) ){
+       i--;
+    }
+    String unit(s + i+1);
+    return convert_dimen(dim.fvalue(), unit); 
+}
+
+const Real CM_TO_PT=72/2.54;
+
+Real
+convert_dimen(Real quant, String unit)
+{
+    if (unit == "cm")
+       return quant * CM_TO_PT;
+    if (unit == "pt")
+       return quant;
+    if (unit == "mm")
+       return quant*CM_TO_PT/10;
+    if (unit == "in")
+       return quant * 72;
+    error ("unknown length unit: `" + unit+"'");
+}
+
+String
+print_dimen(Real r)
+{
+    String s(r);
+    s += "pt ";
+    return s;
+}
diff --git a/dimen.hh b/dimen.hh
new file mode 100644 (file)
index 0000000..4ee17ea
--- /dev/null
+++ b/dimen.hh
@@ -0,0 +1,12 @@
+#ifndef DIMEN_HH
+#define DIMEN_HH
+
+#include "real.hh"
+#include "string.hh"
+
+Real parse_dimen(String);
+Real convert_dimen(Real, String);
+String print_dimen(Real);
+
+#endif
+
index 0be3eca9a86dc3bb298190204676be05fb2d009c..7665eb33798de689dd336ea3b992bc08e9bc41b4 100644 (file)
--- a/dimen.tex
+++ b/dimen.tex
        \hbox to 50pt{\qquad\twhrul\mb{#1}\hss}\setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0}
 
 \newcount\n
-\def\charn{\n=0
+\def\charn{\n=-1
        \loop\ifnum\n<255\advance\n by1
        \doitem{\number\n}\endgraf\repeat}
 
 
        \charn
 
-
-
-
-
-
 \bye
\ No newline at end of file
index aff8ac8f14f8b72be0014aac1f6cdfde46dd4f1d..4533783563a6dd66dd0c29f1ba48569af61ef70c 100644 (file)
@@ -1,6 +1,6 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=3
+PATCHLEVEL=4
 
 PACKAGENAME=flower
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
index 6521100b3bb5ba72883175fdeaa7a77bfc716bfd..fd5dcf414610946561df2d31cc895c13fbdbf14e 100644 (file)
@@ -1,12 +1,12 @@
 
 cc=lgetopt.cc   string.cc dataf.cc textdb.cc unionfind.cc  \
        smat.cc matrix.cc choleski.cc vector.cc dstream.cc\
-       matdebug.cc
+       matdebug.cc 
 
-templatecc=cursor.cc list.cc tsmat.cc 
-inl=findcurs.inl link.inl list.inl
-hh=cursor.hh pcursor.hh cursor.inl lgetopt.hh link.hh list.hh dstream.hh \
+templatecc=cursor.cc list.cc tsmat.cc plist.cc
+inl=findcurs.inl link.inl list.inl plist.inl cursor.inl 
+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
+       tsmat.hh tvsmat.hh plist.hh\
index 8d6e50591d20e791b3902b725a8306b7dd2e3188..6f0f451cce25e336a9ec0a07bdaf26a069df866d 100644 (file)
@@ -1,4 +1,6 @@
 
+       * efficient copy cons for List
+
        * change String::pos
 
                s[s.pos('%')] == '%'
index cff93c68ce4edfdde8af8b192acf99a8b4ffe4e9..1c61b1a76cd8fa6880fdc813e2abdc164dd9b172 100644 (file)
@@ -11,7 +11,10 @@ template<class T>
 class Cursor 
 {
  public:
-    Cursor( List<T>& list, Link<T>* pointer = 0 );
+    Cursor( const List<T>& list, Link<T>* pointer = 0 );
+    /** this isn't true, actually, #list# surely isn't const, but I get
+      tired of the warning messages.  */
+    
     Cursor( const Cursor<T>& cursor );
     
     /// return current T
@@ -100,17 +103,8 @@ private:
 
 
 /*
-  comparations.
+  comparisons.
   */
-
-
-
-
-
-
-
-
-
 #include "compare.hh"
 
 template<class T>
index a4e03492b536bb6b8e7a5dbbf334800762de1489..bdc242590f7488382820f566df1047be1942f26f 100644 (file)
@@ -6,12 +6,11 @@
 
 template<class T>
 inline
-Cursor<T>::Cursor( List<T>& list, Link<T>* pointer ) : 
-    list_( list )
+Cursor<T>::Cursor( const List<T>& list, Link<T>* pointer ) : 
+    list_((List<T>&) list )
 {
     if ( list.size() )
         pointer_ = pointer ? pointer : list.top_;
-    //list.top().pointer_; // ARGH! recursion.
     else
         pointer_ = pointer;
 }
index e53c716d8bd35a17c3598c285c7aaad1d125fa47..d050e278c54850b8b3db273eec0548ff8a5c04d0 100644 (file)
@@ -110,16 +110,14 @@ String Data_file::get_line()
 void
 Data_file::gobble_leading_white() 
 {
-    char c;
-    
     // eat blank lines.
-    while (!eof()) 
-       {
-       c = data_get();             
-       if (!isspace(c))
+    while (!eof()) {
+       char c = data_get();                
+       if (!isspace(c)) {
+           data_unget(c);
            break;
        }
-    data_unget(c);
+    }
 }
 
 
index 782b3da86eb77b3276f395d8777e714a1ab1defe..741e4ee97c87b48830c3d703ae66c69ad80b1d0a 100644 (file)
@@ -3,6 +3,15 @@
 
 #include "list.hh"
 
+template<class T>
+List<T>::List(List const&src)
+{
+    set_empty();
+    // probably el stupido
+    for (Cursor<T> c(src); c.ok(); c++)
+       bottom().add(c);
+}
+
 template<class T>
 void
 List<T>::OK() const
@@ -29,7 +38,7 @@ template<class T>
 Cursor<T>
 List<T>::top()
 {
-
+#if 0 
     // ?? waarvoor is deze if ? 
     if ( top_ )                        // equivalent: if ( size_ )
        {
@@ -42,7 +51,9 @@ List<T>::top()
            t = top_->previous();
            }
        }
-                               // list empty: Cursor not ok()
+#endif
+    
+// list empty: Cursor not ok()
     return Cursor<T>( *this, top_ );
 }
 
@@ -70,20 +81,4 @@ List<T>::bottom()
 }
 
 
-// not inlined since it assumes knowledge of destructor.
-template<class T>
-inline void
-PointerList<T>::remove( Cursor<T> me )
-{
-    if ( me.ok() )
-       {
-
-       delete *me;
-        List<T>::remove( me ); 
-       }
-}
-
-
-
-
 #endif
index a45252b8c3fb9d6020e479168cd1c69ed4beecfe..6edf4aebc4c25ba4b72b356e86f43bb19a11af27 100644 (file)
@@ -11,10 +11,12 @@ template<class T> class Link;
 template<class T>
 class List
 {
- public:
-     /// construct empty list                
-    List(); 
+    List(List const&src);
 
+ public:
+    /// construct empty list                
+    List();
+    
     /// construct list from first item.  
     List( const T& thing );
     
@@ -28,6 +30,11 @@ class List
  protected:
     friend class Cursor<T>;
     friend class Link<T>;
+    /// make *this empty
+    void set_empty();
+    /**
+      WARNING: contents lost, and not deleted.
+      */
     
     /// add after after_me
     void add( const T& thing, Cursor<T> after_me );
@@ -67,32 +74,13 @@ class List
 */
 
 
-/// Use for list of pointers, e.g. PointerList<AbstractType*>.
-template<class T>
-class PointerList : public List<T>
-{
- public:
-    PointerList();
-    PointerList( const T& thing );
-
-    ///
-    virtual ~PointerList();
-    /**
-      This function deletes deletes the allocated pointers of all links. 
-      #\Ref{~List}# is used to delete the links themselves.
-      */ 
-
- protected:
-    virtual void remove( Cursor<T> me );
-};
-
 #include "list.inl"
 #include "cursor.hh"
 
 // instantiate a template:  explicit instantiation.
 #define L_instantiate(a)  template class List<a>; template class Cursor<a>; \
   template class Link<a>
-#define PL_instantiate(a) L_instantiate(a *); template class PointerList<a*>
+
 
 #endif // __LIST_HH //
     
index 8396156b6a1546e19561cc14e24928dbe1b3a437..8bdcf158772df21f6764b6fa507742870c022ca8 100644 (file)
@@ -4,6 +4,13 @@
 template<class T>
 inline
 List<T>::List()
+{
+    set_empty();
+}
+
+template<class T>
+inline void
+List<T>::set_empty()
 {
     top_ = bottom_ = 0;
     size_ = 0;
@@ -13,8 +20,7 @@ template<class T>
 inline
 List<T>::List( const T& thing )
 {
-    top_ = bottom_ = 0;
-    size_ = 0;
+    set_empty();
     add( thing, Cursor<T>( *this, bottom_ ) );
 }
 
@@ -113,40 +119,6 @@ List<T>::size() const
     return size_;
 }
 
-template<class T>
-inline
-PointerList<T>::PointerList() :
-    List<T>()
-{
-}
-
-template<class T>
-inline
-PointerList<T>::PointerList( const T& thing ) :
-    List<T>( thing )
-{
-}
-
-template<class T>
-inline
-PointerList<T>::~PointerList()
-{
-    Cursor<T> next(*this);
-    for ( Cursor<T> c( *this ); c.ok(); c = next ) {
-       next = c;
-       next++;
-       remove( c );            // PointerList::remove deletes the  real data
-    }
-}
-
-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();  
-}
 
 
 #endif
index 5a313123866540ddb3cfcb1dc75bae9bcb4e5e22..1c3df9dda143ec206ae70163e8f337663d9ed966 100644 (file)
@@ -34,10 +34,9 @@ Matrix::print() const
 
 Vector::operator String() const
 {
-    int i=0;
     String s("vector [");
 #ifndef NDEBUG
-    for (; i < dim(); i++) {
+    for (int i=0; i < dim(); i++) {
        s += String(dat[i], "%6f") + ' ';
     }
 #endif
index 8b0b179b4fc8035a642e101356c00e195be553f1..eb0e8f15f951339c26555cb0467c77dd6e607814 100644 (file)
@@ -1,4 +1,13 @@
 
+/*
+  pcursor.hh -- part of flowerlib
+
+  (c) 1996 Han-Wen Nienhuys&Jan Nieuwenhuizen
+*/
+
+#ifndef PCURSOR_HH
+#define PCURSOR_HH
+
 
 /// cursor which feels like a pointer
 template<class T>
@@ -13,14 +22,15 @@ struct PCursor : public Cursor<T> {
     PCursor<T> operator +( int no) const {
        return PCursor<T> (Cursor<T>::operator+(no));
     }
-    PCursor(List<T> & l) : Cursor<T> (l) {}
+    PCursor(const List<T> & l) : Cursor<T> (l) {}
 
     PCursor( const Cursor<T>& cursor ) : Cursor<T>(cursor) { }
     T operator ->() { return  *(*this); }
 
 };
 /**
HWN: I'd like an operator->(), so here it is.
I like  operator->(), so here it is.
 
  Cursor to go with pointer list.
  */
+#endif
diff --git a/flower/plist.cc b/flower/plist.cc
new file mode 100644 (file)
index 0000000..bbb0e74
--- /dev/null
@@ -0,0 +1,16 @@
+#include "plist.hh"
+
+// not inlined since it assumes knowledge of destructor.
+template<class T>
+void
+PointerList<T>::remove( Cursor<T> me )
+{
+    if ( me.ok() ) {
+       delete *me;
+        List<T>::remove( me ); 
+    }
+}
+
+
+
+
index fe0b8e307bc3bdd0b5672b5b1c3be245d0e61b03..d7f70816173dddbf4715bad6bc7bba70d0ab262c 100644 (file)
@@ -6,11 +6,12 @@
 #define NDEBUG BLONDE
 #endif
 
+const INITIALMAX=8;
 class String_handle;
 /// Internal String struct
 class StringData {
     // GNU malloc: storage overhead is 8 bytes anyway.
-    const int INITIALMAX =8;   // how to do this in ANSI C++ ?
+
 
 friend class String_handle;
     int maxlen;        // maxlen is arraysize-1
@@ -156,6 +157,7 @@ friend class String_handle;
    the data itself. Handles simple tasks (resizing, resetting)
    */
 
+
 /****************************************************************/
 /// ref. counting for strings
 class String_handle {
diff --git a/genheader b/genheader
new file mode 100755 (executable)
index 0000000..739df26
--- /dev/null
+++ b/genheader
@@ -0,0 +1,16 @@
+#!/bin/sh
+def=`echo $1 | sed s/\\\./_/ | tr a-z A-Z`
+cat << HERE
+/*
+  $1 -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef $def
+#define $def
+
+
+#endif // $def
+
+HERE
diff --git a/item.cc b/item.cc
index 72f447be94cb47eecca35b7070e568b563543781..453200627b0e5694a8dc3d3c59912c52829f1158 100644 (file)
--- a/item.cc
+++ b/item.cc
@@ -1,13 +1,14 @@
 #include "line.hh"
 #include "symbol.hh"
-#include "cols.hh"
+#include "molecule.hh"
+#include "pcol.hh"
 
 String
 Spanner::TeXstring() const
 {
     assert(right->line);
     Real w = left->hpos - right->hpos;
-    return (*strets)(w);
+    return strets->eval(w).tex;
 }
 
 Spanner *
diff --git a/item.hh b/item.hh
index 28b6b5604c6ddbdac05dd46d8fbf3ed4c8d1fdd4..6a3a9880d77418767c83f0e2ceef2ea3c6d52ea4 100644 (file)
--- a/item.hh
+++ b/item.hh
@@ -9,7 +9,7 @@
 /// a symbol which is attached between two columns.
 struct Spanner {
     const PCol *left, *right;
-    Stretchable_symbol *strets;
+    Parametric_symbol *strets;
     PStaff * pstaff_;
     ///      clone a piece of  this spanner.
     Spanner *broken_at(const PCol *c1, const PCol *c2) const; 
@@ -33,7 +33,7 @@ struct Item {
     virtual Interval width() const;    
     virtual Interval height() const;
     const PCol * col;
-    Output *output;
+    Molecule *output;
     
     PStaff *pstaff_;
     /** needed for knowing at which staff to output this item
diff --git a/lexer.l b/lexer.l
index a0da226a995ebd6ac9bf594a435ec280597812ad..03853ca579f93777a68c5a55cdc2931331f0c224 100644 (file)
--- a/lexer.l
+++ b/lexer.l
@@ -193,4 +193,4 @@ yyerror(char *s)
        return NOTENAME;
 }
 
-#endif
\ No newline at end of file
+#endif
index 46da68d7fbe5d629983d68f9ee0ae0cea4dae136..242a17d5f433c42473b4d09c0fdc946c24f4699a 100644 (file)
@@ -1,5 +1,3 @@
-
-
 \def\musixtwentydefs{
        \font\musicfnt=musix20
 
@@ -8,13 +6,9 @@
        %\balkskip4pt
 }
 \def\interstaffline{
-%      \vskip 20pt%
-}
-\def\interscoreline{
-       \par\vskip 10pt\par
-       \hrule height 2pt width2cm
-       \vskip 10pt
+       \vskip 20pt%
 }
+
 \musixtwentydefs
 \def\mdef#1#2{\def#1{{\musicfnt\char#2}}}
 \mdef\quartball{'007}
 \mdef\singledot{'00}
 \mdef\doubledot{'01}
 \mdef\tripledot{'02}
-\def\maatstreep{\vrule height10pt }
-\def\finishbar{\vrule height10pt width 1pt}
+\def\maatstreep{\vrule height8pt depth8pt }
+\def\finishbar{\vrule height8pt width 1pt depth8pt}
 \parindent0pt
 
+\def\generalmeter#1#2{\vbox to 0pt{\vss\rm\hbox{#1}\hbox{#2}\vss}}
+
+\mdef\mussepline{155}
+\def\lineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
+\def\interscoreline{
+       \par\vskip 10pt\par
+       \hskip -5pt\lineseparator% \hbox to 1cm{\kern -5mm\hrulefill}
+       \vskip 10pt
+}
+
+\newcount\n
+\def\linestafsym#1#2{\hbox to 0pt{\vbox to 0pt{\n=0%
+       \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}}
 
 \def\cquartrest{\vcenter\quartrest}
-
+\def\ceighthrest{\vcenter\eighthrest}
+\def\csixteenthrest{\vcenter\sixteenthrest}
+\def\cthirtysecondrest{\vcenter\thirtysecondrest}
\ No newline at end of file
diff --git a/line.cc b/line.cc
index d0a5d794bbf90ab7f5878b1cf3bcd9a07d6e8912..ebe9595d3b78b1a94e534d9559cff414c56b3557 100644 (file)
--- a/line.cc
+++ b/line.cc
@@ -1,21 +1,23 @@
 #include "line.hh"
+#include "dimen.hh"
 #include "symbol.hh"
-#include "cols.hh"
+#include "pcol.hh"
 #include "pscore.hh"
 
 String
 Line_of_staff::TeXstring() const
 {
     String s("%line_of_staff\n\\vbox to ");
-    s += String(maxheight() * VERT_TO_PT) +"pt{";
+    s += print_dimen(maxheight() ) +"{";
 
     //make some room
-    s += vstrut(base* VERT_TO_PT);
+    s += vstrut(base);
 
     // the staff itself: eg lines, accolades
     s += "\\hbox{";
     {
-       s+=(*pstaff_->stafsym)(scor->score->linewidth);
+       Symbol sym = pstaff_->get_stafsym(scor->score->linewidth);
+       s+=sym.tex;
        PCursor<const PCol *> cc(scor->cols);
        Real lastpos=cc->hpos;
 
@@ -25,7 +27,7 @@ Line_of_staff::TeXstring() const
            lastpos = cc->hpos;
 
            // moveover
-           s +=String( "\\kern ") + HOR_TO_PT*delta + "pt ";
+           s +=String( "\\kern ") + print_dimen(delta);
 
            // now output the items.
 
@@ -102,7 +104,10 @@ Real
 Line_of_staff::maxheight() const
 {
     Interval y;
-    y = pstaff_->stafsym->height(scor->score->linewidth);
+    {
+       Symbol s = pstaff_->stafsym->eval(scor->score->linewidth);
+       y = s.dim.y;
+    }
     PCursor<const PCol *> cc(scor->cols);
     
     // all items in the current line & staff.
index 402bd4074ebe16afb1d75f6ee5945366b2fc4804..17c16ef4efbabc3aa6a118c6cb98aefe2c6f23b7 100644 (file)
@@ -143,7 +143,7 @@ Spacing_problem::make_matrices(Matrix &quad, Vector &lin, Real &c) const
 
 // put the constraints into the LP problem
 void
-Spacing_problem::make_constraints(Optimisation_problem& lp) const
+Spacing_problem::make_constraints(Mixed_qp& lp) const
 {    
     int dim=cols.sz();
     for (int j=0; j < dim; j++) {
@@ -172,7 +172,7 @@ Spacing_problem::solve() const
 
     
     /* optimalisatiefunctie */        
-    Optimisation_problem lp(cols.sz());
+    Mixed_qp lp(cols.sz());
     make_matrices(lp.quad,lp.lin, lp.const_term);
     make_constraints(lp);    
     Vector start=find_initial_solution();    
@@ -196,6 +196,7 @@ Spacing_problem::add_column(const PCol *col, bool fixed, Real fixpos)
     Colinfo c;
     c.fixed=fixed;
     c.fixpos=fixpos;
+    assert(col);
     c.col=col;
     cols.add(c);
 }
@@ -219,15 +220,14 @@ Spacing_problem::print_ideal(const Idealspacing*id)const
     int l = col_id(id->left);
     int r = col_id(id->right);
 
-    mtor << "idealspacing { between " << l <<","<<r<<'\n';
-    mtor << "distance "<<id->space<< " strength " << id->hooke << "}\n";
+    mtor << "between " << l <<","<<r<<":" ;
 #endif
 }
 
 void
 Spacing_problem::print() const
 {
-    #ifndef NPRINT
+#ifndef NPRINT
     for (int i=0; i < cols.sz(); i++) {
        mtor << "col " << i<<' ';
        cols[i].print();
@@ -235,7 +235,7 @@ Spacing_problem::print() const
     for (int i=0; i < ideals.sz(); i++) {
        print_ideal(ideals[i]);
     }
-    #endif
+#endif
     
 }
 
@@ -246,9 +246,14 @@ Colinfo::print() const
     mtor << "column { ";
     if (fixed)
        mtor << "fixed at " << fixpos<<", ";
+    assert(col);
     mtor << "[" << minleft() << ", " << minright() << "]";
     mtor <<"}\n";
 #endif
 }
 
-
+Colinfo::Colinfo()
+{
+    fixed=false;
+    col=0;
+}
index 5a3c4edeb88303aec5b17f51592aed9d54f5bee8..e5b23ca7f0504a829424cd54c1a47187695de3a3 100644 (file)
@@ -4,7 +4,7 @@
 #include "glob.hh"
 #include "list.hh"
 #include "vray.hh"
-#include "cols.hh"
+#include "pcol.hh"
 #include "matrix.hh"
 
 /// helper struct for #Spacing_problem#
@@ -12,10 +12,7 @@ struct Colinfo {
     const PCol *col;
     bool fixed;
     Real fixpos;
-    Colinfo() {
-       fixed=false;
-       col=0;
-    }
+    Colinfo();
     void print() const;
     Real minright()const { return col->width().max; }
     Real minleft()const { return -col->width().min; }
@@ -42,7 +39,7 @@ class Spacing_problem {
     void make_matrices(Matrix &quad, Vector &lin,Real&) const;
 
     /// generate the LP constraints
-    void make_constraints(Optimisation_problem& lp) const;
+    void make_constraints(Mixed_qp& lp) const;
 
 public:
     /// solve the spacing problem
index f2dd43b2b5a167e00e04dda434febf1b2143e3b4..dd9227b155eeaebd9c0e00fbf4452d82c52a2061 100644 (file)
@@ -1,11 +1,17 @@
 #include "linestaff.hh"
 #include "symbol.hh"
-
-
+#include "lookupsyms.hh"
+#include "dimen.hh"
 
 Linestaff::Linestaff(int l)
 {
     nolines = l;
-    stafsym = Stretchable_symbol::get_linestaff(l); 
+    stafsym = Lookup::linestaff(l); 
 }
 
+Symbol
+Linestaff::get_stafsym(Real width)const
+{  
+   String w(print_dimen(width));
+   return stafsym->eval(w);
+}
index 7ca34f5739aa59d7a3358d92f80d620b06f31e4a..33e9d39f4e0d2409205ebc592fc1a119d4015375 100644 (file)
@@ -1,8 +1,10 @@
 #include "pstaff.hh"
 
 struct Linestaff : PStaff {
-    int nolines;
     
+    int nolines;
+
+    Symbol get_stafsym(Real width)const;
     Linestaff(int);
     
 };
diff --git a/lookupsyms.cc b/lookupsyms.cc
new file mode 100644 (file)
index 0000000..66cbd6d
--- /dev/null
@@ -0,0 +1,91 @@
+#include "lookupsyms.hh"
+#include "debug.hh"
+#include "symtable.hh"
+#include "dimen.hh"
+#include "tex.hh"
+
+Symtables the_sym_tables("symbol.ini");
+
+Symbol
+Lookup::ball(int j)
+{
+    if (j > 4) j = 4;
+    Symtable * st = the_sym_tables("balls");
+    return st->lookup(String(j));
+}
+
+Symbol
+Lookup::rest(int j)
+{
+    return the_sym_tables("rests")->lookup(String(j));
+}
+
+
+ Symbol
+Lookup::bar(String s)
+{
+    return the_sym_tables("bars")->lookup(s);
+}
+ Symbol
+Lookup::dots(int j)
+{
+    if (j>3)
+       error("max 3 dots");
+    return the_sym_tables("dots")->lookup(j);
+}
+
+/****************************************************************/
+// bare bones.
+
+struct Linestaf_symbol : Parametric_symbol {
+    int lines;
+    Linestaf_symbol(int n) { lines = n;}
+    Symbol eval(svec<String>)const;
+};
+
+
+Symbol
+Linestaf_symbol::eval(svec<String> w)const
+{
+    Real wid = w[0].fvalue();
+
+    Symbol s;
+    s.dim.x = Interval(0,wid);
+    s.dim.y = Interval(0, lines*convert_dimen(5,"pt"));
+    svec<String> a;
+    a.add(lines);
+    a.add(w[0]);
+    s.tex = the_sym_tables("param")->lookup("linestaf").tex;
+    s.tex = substitute_args(s.tex, a);
+    return s;
+}
+
+/****************************************************************
+ */
+
+
+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") ); 
+       String src = the_sym_tables("param")->lookup("meter").tex;
+       s.tex = substitute_args(src,a);
+       return s;
+    }
+};
+/****************************************************************/
+
+Parametric_symbol *
+Lookup::meter(String )
+{
+    return new Meter_sym;
+}
+
+Parametric_symbol *
+Lookup::linestaff(int n)
+{
+    return new Linestaf_symbol(n);
+}
+
diff --git a/lookupsyms.hh b/lookupsyms.hh
new file mode 100644 (file)
index 0000000..d4e0866
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+  lilypond, (c) 1996 Han-Wen Nienhuys
+*/
+#ifndef LOOKUPSYMS_HH
+#define LOOKUPSYMS_HH
+
+#include "symbol.hh"
+
+struct Lookup {
+    static Parametric_symbol *linestaff(int n);
+    static Parametric_symbol *meter(String);
+    static Symbol ball(int);
+    static Symbol rest(int);
+    static Symbol bar(String);
+    static Symbol dots(int);
+};
+
+#endif
index a0711079af4f432c36c3571f77cf9816b4f013e7..49665efd4dfb14252906b6d1b40f6a1aaed98503 100644 (file)
@@ -7,13 +7,16 @@ score {
                voice { $ c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
        }
        rhythmstaff {
-               voice { $ c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4
+               voice { $ c2.. r8 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4
                r2 r4 r1
        $ }
        }
-bar 0.5
+       
        bar 2  bar 3
        bar 4.5 bar 5 bar 5.5
        bar 6 bar 7 bar 8
+
+       meter 2 4 4 % after bars.
+
 }
 
diff --git a/main.cc b/main.cc
index 21453315654c0119aa24e9faa1d6e94dd2831fe4..5e518752cff85a9a3834201437da72afa98cbd19 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -17,25 +17,24 @@ long_option_init theopts[] = {
 void notice()
 {
     cout <<
-       "LilyPond, a music typesetter.
-Copyright (C) 1996 by
-  Han-Wen Nienhuys <hanwen@stack.urc.tue.nl>
-
-
-    This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-    This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-    You should have received a copy (refer to the file COPYING) of the
-GNU General Public License along with this program; if not, write to
-the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
-USA.
-"
+       "LilyPond, a music typesetter.\n"
+       "Copyright (C) 1996 by\n"
+       "  Han-Wen Nienhuys <hanwen@stack.urc.tue.nl>\n"
+       "\n"
+       "\n"
+       "    This program is free software; you can redistribute it and/or\n"
+       "modify it under the terms of the GNU General Public License version 2\n"
+       "as published by the Free Software Foundation.\n"
+       "\n"
+       "    This program is distributed in the hope that it will be useful,\n"
+       "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+       "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
+       "General Public License for more details.\n"
+       "\n"
+       "    You should have received a copy (refer to the file COPYING) of the\n"
+       "GNU General Public License along with this program; if not, write to\n"
+       "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n"
+       "USA.\n";
 }
 
 int
diff --git a/main.hh b/main.hh
index 264ac3aa78b32ac71123807cb4391b99a8f41a5e..58928f51421fe72af6211faabf5d07e2cf68ab98 100644 (file)
--- a/main.hh
+++ b/main.hh
@@ -1,8 +1,11 @@
 #ifndef MAIN_HH
 #define MAIN_HH
 #include "proto.hh"
+
 void debug_init();
 void do_scores();
 void add_score(Score * s);
 void set_default_output(String s);
+const char *get_version();
+
 #endif
index 80548815dfad4acb8e73bc5b4f359b661f54723d..08f4936b563092fec113563b236e8aa23631cfc7 100755 (executable)
@@ -25,7 +25,7 @@ then
    tar zfxv $nm$old.tar.gz
 fi
 
-(cd $nm$old; make clean)
-(cd $nm$new; make clean)
+#(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
diff --git a/misc.cc b/misc.cc
index effab35896fee3a3cfbb8a0a006e2d958ec847b4..2be0f81dd67c9530007177553bd5723542aaf5dd 100644 (file)
--- a/misc.cc
+++ b/misc.cc
@@ -26,10 +26,10 @@ const double WHOLE_SPACE = 5.0; // should be settable from input
 
   
 Real
-duration_to_idealspace(Mtime d)
+duration_to_idealspace(Mtime d, Real w)
 {
     // see  Roelofs, p. 57
-    return WHOLE_SPACE * pow(ENGRAVERS_SPACE, log2(d));
+    return w * pow(ENGRAVERS_SPACE, log2(d));
 }
 
 
diff --git a/misc.hh b/misc.hh
index fb8889f55193300f66ce85d32273ebad2bdd3591..a22304267f6075a197df16657007ea1d7adc641e 100644 (file)
--- a/misc.hh
+++ b/misc.hh
@@ -1,8 +1,7 @@
 #ifndef MISC_HH
 #define MISC_HH
 #include "mtime.hh"
-int intlog2(int d);    
-Real duration_to_idealspace(Mtime d);
-class String;
-const char *get_version();
+int intlog2(int d);
+Real duration_to_idealspace(Mtime d,Real w);
+
 #endif
index e1c4ac5f8d4065079c8aef9ee308c533db438cf8..7b8a752423e002148d726345d24031991f254b47 100644 (file)
@@ -1,4 +1,5 @@
 #include "glob.hh"
+#include "dimen.hh"
 #include "string.hh"
 #include "molecule.hh"
 #include "symbol.hh"
@@ -6,24 +7,25 @@
 Box
 Atom::extent() const
 {
-    Box b( sym->dim);
+    Box b( sym.dim);
     b.translate(off);
     return b;
 }
 
-Atom::Atom(const Symbol * s)
+Atom::Atom(Symbol s)
 {
     sym=s;
 }
 
+
 String
 Atom::TeXstring() const
 {
     // whugh.. Hard coded...
     String s("\\raise");
-    s+= String(off.y * VERT_TO_PT)+"pt\\hbox to 0pt{\\kern ";
-    s+= String(off.x * HOR_TO_PT) + "pt";
-    s+= sym->tex + "\\hss}";
+    s+= print_dimen(off.y) +"\\hbox to 0pt{\\kern ";
+    s+= print_dimen(off.x);
+    s+= sym.tex + "\\hss}";
     return s;
 }
 
@@ -33,8 +35,8 @@ String
 Molecule::TeXstring() const
 {
     String s;
-    for(Cursor<Atom> c(ats); c.ok(); c++)
-       s+=(*c).TeXstring();
+    for(PCursor<Atom*> c(ats); c.ok(); c++)
+       s+=c->TeXstring();
     return s;
 }
 
@@ -42,24 +44,23 @@ Box
 Molecule::extent() const
 {
     Box b;
-    for(Cursor<Atom> c(ats); c.ok(); c++)
-       b.unite((*c).extent());
+    for(PCursor<Atom*> c(ats); c.ok(); c++)
+       b.unite(c->extent());
     return b;
 }
 
 void
 Molecule::translate(Offset o)
 {
-    for(Cursor<Atom> c(ats); c.ok(); c++)
-       (*c).translate(o);
+    for (PCursor<Atom*> c(ats); c.ok(); c++)
+       c->translate(o);
 }
 
 void
 Molecule::add(const Molecule &m)
 {
-    for (Cursor<Atom> c(m.ats); c.ok(); c++) {
-       Atom a(c);
-       ats.bottom().add(a);    
+    for (PCursor<Atom*> c(m.ats); c.ok(); c++) {
+       add(**c);
     }
 }
 
@@ -78,7 +79,7 @@ Molecule::add_left(const Molecule &m)
     Real xof=extent().x.min - m.extent().x.max;
     Molecule toadd(m);
     toadd.translate(Offset(xof, 0.0));
-        add(toadd);
+    add(toadd);
 }
 
 
@@ -88,7 +89,7 @@ Molecule::add_top(const Molecule &m)
     Real yof=extent().y.max - m.extent().y.min;
     Molecule toadd(m);
     toadd.translate(Offset(0,yof));
-        add(toadd);
+    add(toadd);
 }
 
 void
@@ -100,3 +101,13 @@ Molecule::add_bot(const Molecule &m)
     add(toadd);
 }
 
+void
+Molecule::operator = (const Molecule&)
+{
+    assert(false);
+}
+
+Molecule::Molecule(const Molecule&s)
+{
+    add(s);
+}
index 6709b7375074b89124e5e39e2de2a2ac71e3d438..60a7a05f44ed8664a6458a0f1eaf6131af575b0b 100644 (file)
@@ -4,11 +4,11 @@
 #include "list.hh"
 #include "boxes.hh"
 #include "item.hh"
-
+#include "symbol.hh"
 /// a symbol which can be translated, and freely copied
 struct Atom {
     Offset off;
-    const Symbol * sym;
+    Symbol sym;
 
     void translate(Offset o) {
        off += o;
@@ -16,28 +16,34 @@ struct Atom {
     
     /// how big is #this#?
     Box extent() const;
-    Atom(const Symbol*s);
+    Atom(Symbol s);
+
+
     String TeXstring() const;
 };
 
 /// a group of #Atom#s
-struct Molecule : Output {
-    List<Atom> ats;
+struct Molecule {
+    PointerList<Atom*> ats;
 
     Molecule() { }
-    Molecule(Atom a) { ats.bottom().add(a); }
-    //    Molecule(Molecule const&src);
+    Molecule(Atom a) { add(a) ; }
+
     void add_right(const Molecule &m);
     void add_left(const Molecule &m);
     void add_top(const Molecule &m);
     void add_bot(const Molecule &m);
     void add(Molecule const &m);
     void translate(Offset);
-
+    void add(Atom a) { ats.bottom().add(new Atom(a)); }
     /// how big is #this#? 
     Box extent() const;
 
     String TeXstring() const;
+
+    Molecule(const Molecule&s);
+private:
+    void operator=(const Molecule&);
 };
 /** a group of individually translated symbols. You can add molecules
     to the top, to the right, etc.  */
index f42c87b82dfd6cde52b98306262ded2d346f4b19..ef01d2314bf1f9f15df0d9f5272d33435eee4e96 100644 (file)
--- a/mtime.hh
+++ b/mtime.hh
@@ -5,4 +5,4 @@
 
 typedef Real Mtime;
 
-#endif MTIME_HH
+#endif
diff --git a/note.cc b/note.cc
index c51e3c33af8fa767164c51a388d1c31372d9e684..2307729a3cf4ed7935c35fd8c8066d6a366f7697 100644 (file)
--- a/note.cc
+++ b/note.cc
@@ -111,7 +111,7 @@ get_note_element(String pitch, String durstr)
 }
 
 Voice_element *
-get_rest_element(String type, String durstr)
+get_rest_element(String, String durstr)
 {    
     Voice_element*v = new Voice_element;
     int i=0;
diff --git a/paper.cc b/paper.cc
new file mode 100644 (file)
index 0000000..5afee7d
--- /dev/null
+++ b/paper.cc
@@ -0,0 +1,8 @@
+#include "paper.hh"
+#include "dimen.hh"
+
+Paperdef::Paperdef()
+{
+    width = convert_dimen(15,"cm");            // in cm for now
+    whole_width= convert_dimen(5,"cm");
+}
diff --git a/paper.hh b/paper.hh
new file mode 100644 (file)
index 0000000..b48391a
--- /dev/null
+++ b/paper.hh
@@ -0,0 +1,13 @@
+
+
+#include "real.hh"
+#include "string.hh"
+struct Paperdef {
+    Paperdef();
+    String outfile;
+    Real width;
+    /// how much space does a whole note take (ideally?)
+    Real whole_width;
+    // maybe add pointsize?
+    // symbol init?
+};
index 820499cb36ffd2ffe25fde050166669c28c53f66..fa9f62757da9c0cb6509f12e9889ed713f6d8cdf 100644 (file)
@@ -5,3 +5,4 @@ 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);
index cb0853b3409b32d0a06b7c20751f902afa0c9383..d60face970f2830abbe8980091da4c7dadc7593a 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -2,20 +2,23 @@
 #include <iostream.h>
 
 #include "lexer.hh"
+#include "paper.hh"
 #include "staff.hh"
 #include "score.hh"
 #include "main.hh"
 #include "keyword.hh"
 #include "debug.hh"
 #include "parseconstruct.hh"
-#define YYDEBUG 1
+#include "dimen.hh"
 
+#ifndef NDEBUG
+#define YYDEBUG 1
+#endif
 
 %}
 
 
-%union {
-     int i;    
+%union {    
     Real real;
     Command *command;
     Identifier *id;    
     Voice_element *el; 
     Staff *staff;    
     String *string;
-    Score *score;    
+    Score *score;
+    const char *consstr;
+    Paperdef *paper;
+    int i;
 }
 
 %token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT
+%token CM IN PT MM PAPER WIDTH METER
 
-
+%type <consstr> unit
 %token <id> IDENTIFIER
 %token <string> PITCH DURATION RESTNAME
 %token <real> REAL
 %token <string> STRING
 
+%type <paper> paper_block paper_body
+%type <real> dim
 %type <voice> voice_block voice_body voice_elts voice_elts_dollar
 %type <el> voice_elt
 %type <command> score_command
 %type <score> score_block score_body
 %type <staff> staff_block  rhythmstaff_block rhythmstaff_body
+%type <i> int
+
 
 %%
 
@@ -56,11 +67,35 @@ score_block: SCORE '{' score_body '}'       { $$ = $3; }
 score_body:            { $$ = new Score; } 
        | score_body staff_block        { $$->add($2); }
        | score_body score_command      { $$->add($2); }
-       | score_body OUTPUT STRING      { $$->outfile = *$3;
+       | score_body paper_block        { delete $$->paper;
+               $$->paper = $2;
+       }
+       ;
+
+paper_block:
+       PAPER '{' paper_body '}'        { $$ = $3; }
+       ;
+
+paper_body:
+       /* empty */                     { $$ = new Paperdef; }
+       | paper_body WIDTH dim          { $$->width = $3;}
+       | paper_body OUTPUT STRING      { $$->outfile = *$3;
                delete $3;
        }
        ;
 
+dim:
+       REAL unit       { $$ = convert_dimen($1,$2); }
+       ;
+
+
+unit:  CM              { $$ = "cm"; }
+       |IN             { $$ = "in"; }
+       |MM             { $$ = "mm"; }
+       |PT             { $$ = "pt"; }
+       ;
+       
+
 staff_block:
        rhythmstaff_block
        ;
@@ -110,6 +145,18 @@ score_command:
        BAR REAL                        {
                $$ = get_bar_command($2);
        }
+       | METER REAL int int            {
+               $$ = get_meter_command($2, $3, $4);
+       }
+       ;
+
+int:
+       REAL                    {
+               $$ = int($1);
+               if (ABS($1-Real(int($$))) > 1e-8)
+                       yyerror("expecting integer number");
+               
+       }
        ;
 
 %%
@@ -118,7 +165,9 @@ void
 parse_file(String s)
 {
    *mlog << "Parsing ... ";
+#ifdef YYDEBUG
    yydebug = !monitor.silence("Parser");
+#endif
    new_input(s);
    yyparse();
 }
diff --git a/pcol.cc b/pcol.cc
new file mode 100644 (file)
index 0000000..44c82a9
--- /dev/null
+++ b/pcol.cc
@@ -0,0 +1,106 @@
+#include "pcol.hh"
+#include "pstaff.hh"
+#include "debug.hh"
+
+void
+Idealspacing::print() const
+{
+    #ifndef NPRINT
+    mtor << "idealspacing {" ;
+    mtor << "distance "<<space<< " strength " << hooke << "}\n";
+    #endif
+}
+
+Idealspacing::Idealspacing(const PCol * l,const PCol * r)
+{
+    space = 0.0;
+    hooke = 0.0;
+    left = l;
+    right = r;
+}
+void
+Idealspacing::OK() const
+{
+#ifndef NDEBUG
+    assert(hooke >= 0 && left  && right);
+#endif    
+}
+
+/****************************************************************/
+
+Interval
+PCol::width() const
+{
+    Interval w;
+
+    for (PCursor<const Item *> ic(its); ic.ok(); ic++)
+       w.unite(ic->width());
+    if (w.empty())
+       w.unite(Interval(0,0));
+    return w;
+}
+
+void
+PCol::print() const
+{
+    #ifndef NPRINT
+    mtor << "PCol {";
+    mtor << "# symbols: " << its.size() ;
+    mtor << "breakable: " << breakable<<"\n";
+    mtor << "extent: " << width().min << ", " << width().max << "\n";
+    mtor << "}\n";
+    #endif 
+}
+
+int
+PCol::compare(const PCol &, const PCol &)
+{
+    assert(false);
+    return 0 ;
+}
+
+void
+PCol::OK () const
+{
+    if (prebreak || postbreak ) {
+       assert(breakable);
+    }
+    
+}
+
+void
+PCol::set_breakable()
+{
+    if (breakable)
+       return;
+
+    prebreak = new PCol(this);
+    postbreak = new PCol(this);
+    breakable = true;
+    used = true;
+}
+
+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 postbreak;       
+}
+
+void
+PCol::add(const Item *i)
+{
+    its.bottom().add(i);
+    used = true;
+}
+
diff --git a/pcol.hh b/pcol.hh
new file mode 100644 (file)
index 0000000..d11a23c
--- /dev/null
+++ b/pcol.hh
@@ -0,0 +1,95 @@
+#ifndef COLS_HH
+#define COLS_HH
+
+#include "glob.hh"
+#include "boxes.hh"
+#include "list.hh"
+#include "item.hh"
+
+/// stuff grouped vertically.
+struct PCol {
+    List<const Item*> its;
+    List<const Spanner*> stoppers, starters;
+    
+    /// Can this be broken? true eg. for bars. 
+    bool breakable;
+
+    /// does this column have items, does it have spacings attached?
+    bool used;
+
+    /// prebreak is put before end of line.
+    PCol *prebreak;
+    /**
+    if broken here, then (*this) column is discarded, and prebreak
+    is put at end of line, owned by Col
+    */
+
+    /// postbreak at beginning of the new line
+    PCol *postbreak;
+    /**  \See{prebreak}
+    */
+    PCol *daddy;
+    /*
+    if this column is pre or postbreak, then this field points to the parent.
+    */
+    /// if lines are broken then this column is in #line#
+    const Line_of_score *line;
+
+    /// if lines are broken then this column x-coord #hpos#
+    Real hpos;
+
+
+    /****************************************************************/
+
+    void add(const Item*i);
+
+    Interval width() const;
+    ~PCol();
+    PCol(PCol * parent);
+
+    /// which col comes first?
+    static int compare(const PCol &c1, const PCol &c2);
+    /**
+    signed compare on columns.
+
+    return < 0 if c1 < c2.
+    */
+
+    void OK() const;
+    void set_breakable();
+    void print()const;
+};
+/**
+    This is a class to address items vertically. It contains the data for:
+    \begin{itemize}
+    \item
+    unbroken score
+    \item
+    broken score
+    \item
+    the linespacing problem
+    \end{itemize}
+  */
+
+#include "compare.hh"
+instantiate_compare(const PCol &, PCol::compare);
+     
+
+/// ideal spacing between two columns
+struct Idealspacing {
+
+    /// the ideal distance
+    Real space;
+
+    /// Hooke's constant: how strong are the "springs" attached to columns
+    Real hooke;
+
+    /// the two columns
+    const PCol *left, *right;
+    
+    void print()const;
+    void OK() const ;
+    Idealspacing(const PCol *left,const PCol *right);    
+};
+
+#endif
index 0721e19fd46959af4c61dc41779641b140306f29..394f3be14b4cf840d90b9dcf0dca5e0819c1a0c7 100644 (file)
--- a/proto.hh
+++ b/proto.hh
@@ -1,7 +1,6 @@
 #include "real.hh"
 
-class Vector;
-class Matrix;
+class Parametric_symbol;
 class Line_of_score;
 class Line_of_staff;
 class PCol;
@@ -46,6 +45,7 @@ struct Note_req;
 struct Lyric_req;
 struct Script_req;
 struct Rest_req;
+struct Rhythmic_req;
 struct Chord;
 struct Stem_req;
 struct Span_req;
@@ -73,4 +73,4 @@ struct Tex_stream;
 struct Identifier;
 struct Keyword;
 class Mixed_qp;
-typedef  Mixed_qp Optimisation_problem;
+class Paperdef;
index 16156d1321eb9f8c30f4bd2a67907bd4c332bbae..44a87c0dd4d4416ca4912e06f6283b00a2093f16 100644 (file)
--- a/pscore.cc
+++ b/pscore.cc
@@ -1,5 +1,6 @@
 // utility functions for PScore
 #include "debug.hh"
+#include "dimen.hh"
 #include "line.hh"
 #include "pscore.hh"
 #include "tstream.hh"
@@ -60,7 +61,7 @@ PScore::get_spacing(PCol*l, PCol*r)
     
     Idealspacing*ip =new Idealspacing(l,r);
     suz.bottom().add(ip);
-    //    l->used = r->used = true;
+
     return ip;
 }
 
@@ -80,19 +81,17 @@ PScore::add(PCol *p)
 {
     cols.bottom().add(p);
 }
-/*
-    todo: config of width
-    */
+
 PScore::PScore()
 {
-    linewidth = 15;            // in cm for now
+    linewidth = convert_dimen(15,"cm");
 }
 
 void
 PScore::output(Tex_stream &ts)
 {
     int l=1;
-    ts << "% linewidth " << linewidth * HOR_TO_PT << " pt\n";
+    ts << "% linewidth " << print_dimen(linewidth )+"\n";
     for (PCursor<Line_of_score*> lic(lines); lic.ok(); lic++) {
        ts << "% line of score no. " << l++ <<"\n";
        ts << lic->TeXstring();
@@ -100,3 +99,42 @@ PScore::output(Tex_stream &ts)
            ts << "\\interscoreline\n";
     }  
 }
+
+svec<Item*>
+PScore::select_items(PStaff*ps , PCol*pc)
+{
+    svec<Item*> ret;
+    assert(ps && pc);
+    for (PCursor<const Item*> ic(pc->its); ic.ok(); ic++){
+       if (ic->pstaff_ == ps)
+           ret.add((Item*)(const Item*)ic);
+    }
+    return ret;
+}
+
+void
+PScore::OK()const
+{
+    for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
+       cc->OK();
+    for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
+       ic->OK();
+    
+}
+void
+PScore::print() const
+{
+    
+     #ifndef NPRINT
+   mtor << "PScore { width "<<print_dimen(linewidth);
+    mtor << "\ncolumns: ";
+    for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
+       cc->print();
+    
+    mtor << "\nideals: ";
+    for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
+       ic->print();
+    mtor << "}\n";
+   #endif 
+}
+
index 75da46a4a5274341443e96878e6e344c90ec23e9..5ae4c37951649695cca690a9f1e99339500f56d3 100644 (file)
--- a/pscore.hh
+++ b/pscore.hh
@@ -5,7 +5,7 @@
 
 
 #include "vray.hh"
-#include "cols.hh"
+#include "pcol.hh"
 #include "pstaff.hh"
 
 /// all stuff which goes onto paper
@@ -32,6 +32,8 @@ struct PScore {
     PointerList<Spanner *> spanners;
 
     /****************************************************************/
+
+    svec<Item*> select_items(PStaff*, PCol*);
     
     void calc_breaking();
     /**
@@ -69,9 +71,10 @@ struct PScore {
 
     PCursor<PCol *> find_col(PCol *);
     void clean_cols();
-    void problem_OK() ;
-
+    void problem_OK()const ;
+    void OK()const ;
     PScore();
+    void print() const;
 };
 /** notes, signs, symbols in a score can be grouped in two ways:
     horizontally (staffwise), and vertically (columns). #PScore#
index de535a6518230599223d76325ca5390a68efb171..8d17b9dd194c00d72cd0002d148dbd9eaa5fcd2b 100644 (file)
--- a/pstaff.hh
+++ b/pstaff.hh
@@ -3,11 +3,15 @@
 
 #include "list.hh"
 #include "item.hh"
+#include "symbol.hh"
 
 /// items grouped vertically.
 class PStaff {
+
 public:
-    Stretchable_symbol *stafsym;
+    Parametric_symbol *stafsym;
+    virtual Symbol get_stafsym(Real width)const=0; // mayybe overkill
+
     List<const Spanner*> spans;
     List<Item*> its;
 
diff --git a/qlp.hh b/qlp.hh
index 54d31910ba4fbf427a36bff0852853ee336dad5d..b539fe6b865798de9a309e9a10c961ec75d72360 100644 (file)
--- a/qlp.hh
+++ b/qlp.hh
@@ -19,7 +19,7 @@ public:
     /**
       use a KKT method to assert optimality of sol
       */
-    /// solve the problem using a variable metric method
+    /// solve the problem using a projected gradient method
     Vector solve(Vector start) const;
     
     int dim() const{
@@ -85,5 +85,5 @@ public:
     x^T QUAD x /2 + b^T x 
 */
 
-typedef Mixed_qp Optimisation_problem;
+
 #endif
index 27029ba8d759dc6ecbb12da35be11b716a030919..27816e5b4325f8f7b0caa1e5f2467790cd3b9576 100644 (file)
@@ -1,48 +1,38 @@
 #include "request.hh"
+#include "debug.hh"
+
+void
+Request::print() const    
+{
+#ifndef NPRINT
+    mtor << "Req{ unknown }\n";
+#endif
+}
+
 Request::Request(Voice_element*v)
 {
     elt = v;
-    tag = UNKNOWN;
 }
 
-Note_req::Note_req(Voice_element*v):
-    Request(v)
+Note_req::Note_req(Voice_element*v)
+    : Rhythmic_req(v)
 {
     name = 'c';
     octave = 0;
     accidental = 0;
     forceacc = false;
-    balltype = 1;
-    dots = 0;
-    tag = NOTE;
 }
 
-Rest_req::Rest_req(Voice_element*v)
+Rhythmic_req::Rhythmic_req(Voice_element*v)
      :Request(v)
 {
     balltype = 1;
     dots = 0;
-    tag =REST;    
 }
 
 Request::Request()
 {
     elt = 0;
-    tag = UNKNOWN;    
-}
-
-Note_req*
-Request::note()
-{
-    assert(tag == NOTE);
-    return (Note_req*)this;
-}
-
-Rest_req*
-Request::rest()
-{
-    assert(tag == REST);
-    return (Rest_req*)this;
 }
 
 
@@ -60,11 +50,7 @@ wholes(int dur, int dots)
 }
 
 Real
-Note_req::duration() const {    
-    return wholes( balltype,dots);
-}
-Real
-Rest_req::duration() const{
+Rhythmic_req::duration() const {    
     return wholes( balltype,dots);
 }
 
index 0cd0fe0903cd86e5f597184ab6c3ca1a20d9b140..79846e7e6947fdd1414e6e8d6d62d48a546deb92 100644 (file)
@@ -7,13 +7,16 @@
 #include "mtime.hh"
 struct Request {
     Voice_element*elt;
+#if 0
     enum {
        UNKNOWN, NOTE, REST, LYRIC, SCRIPT, CHORD, BEAM,
        BRACKET, STEM, SLUR, CRESC, DECRESC, ABSDYNAMIC
     } tag;
-
-    Note_req *note();
-    Rest_req *rest();
+#endif
+    virtual void print()const ;
+    virtual Note_req *note() {return 0;}
+    virtual Rest_req *rest() {return 0;}
+    virtual  Rhythmic_req*rhythmic() { return 0;}
     Request(Voice_element*);
     Request();
     virtual Real duration() const { return 0.0; }
@@ -50,18 +53,22 @@ struct Request {
     beams/stems to look up the balls it has to connect to.  */
        
 
-    
+struct Rhythmic_req : Request {
+    int balltype;
+    int dots;
+    Real duration() const;
+    Rhythmic_req(Voice_element*);
+    Rhythmic_req*rhythmic() { return this;} 
+};
+
 /// Put a note of specified type, height, and with accidental on the staff.
-struct Note_req : Request {
+struct Note_req : Rhythmic_req {
     char name;
     int octave;
     int accidental;
     bool forceacc;
-    int balltype;
-    int dots;
-    
-    Real duration() const;
     Note_req(Voice_element*v);
+    Note_req*note() { return this;}
 };
 /**
 Staff has to decide if the ball should be hanging left or right. This
@@ -73,6 +80,19 @@ is also for the Staff to decide. The Staff can decide on positioning
 based on ottava commands and the appropriate clef.
 */
 
+
+///Put a rest on the staff.
+struct Rest_req : Rhythmic_req {
+
+    Rest_req(Voice_element*v) : Rhythmic_req(v) {  }
+    Rest_req * rest() { return this;}
+};
+/**
+Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
+*/
+
+#if 0
+
 ///Put a lyric above or below (?) this staff.
 struct Lyric_req : Request {
     String text;
@@ -82,7 +102,7 @@ struct Lyric_req : Request {
 ///Put a script above or below this ``note''    
 struct Script_req : Request {
     int orientation;
-    Symbol *sym;
+    Symbol sym;
 };
 /**
 eg upbow, downbow. Why a request? These symbols may conflict with slurs and brackets, so this
@@ -90,17 +110,6 @@ also a request
 */
 
 
-///Put a rest on the staff.
-struct Rest_req : Request {
-    int balltype;
-    int dots;
-    Rest_req(Voice_element*);
-    Real duration() const;
-};
-/**
-Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
-*/
-
 
 
 ///Draw a (Guitar) chord above or below this ``note''
@@ -191,5 +200,5 @@ struct Decresc_req : Span_req, Dynamic {
 struct Absdynamic_req : Request, Dynamic {
         Loudness loudness;
 };
-
+#endif
 #endif
index a7fade6fc5f487378434f554eab1f7c59798f18c..d2a85d62cee60f9ceb7d0fe5b0b0554ddd129dfc 100644 (file)
@@ -7,8 +7,8 @@
 #include "command.hh"
 #include "molecule.hh"
 #include "rhythmstaf.hh"
-#include "symbol.hh"
+#include "lookupsyms.hh"
+#include "sccol.hh" 
 
 Rhythmic_column::Rhythmic_column(Score_column*s, Rhythmic_staff *rs)
     : Staff_column(s)
@@ -69,21 +69,16 @@ Rhythmic_column::process_requests()
     for (int i = 0 ; i < v_elts.sz(); i ++)
        for (PCursor<Request *> rqc(v_elts[i]->reqs); rqc.ok(); rqc++) {
            Request *rq= rqc;
-           switch(rq->tag){
-           case Request::NOTE:
-           case Request::REST:
+           if (rq->rhythmic()){
                if (the_note){
                    WARN << "too many notes.\n";
                    return;
                }
                the_note = rq;
-               break;
-               
-           default:
-               return;
            }
+           break;
+               
        }
-    
 }
 
 
@@ -91,14 +86,30 @@ void
 Rhythmic_column::typeset_command(Command *com, int breakst)
 {
     Item *i = new Item;
-    const Symbol*s=0;
+    Symbol s;
 
     if (com -> args[0] ==  "BAR" ) {
-       s = Symbol::find_bar(com->args[1]);     
+       s = Lookup::bar(com->args[1]);  
+    } else if (com->args[0] == "METER") {
+       Parametric_symbol *p = Lookup::meter("general");
+       svec<String> arg( com->args);
+       arg.del(0);
+       s = p->eval(arg);
     } else
        assert(false);
-    
-    i->output=new Molecule(Atom(s));
+
+    Molecule * m =new Molecule(Atom(s));
+    {
+       Interval wid;
+       svec<Item*> sv(staff_->pscore_->
+                      select_items(staff_->theline, score_column->pcol));
+       for (int j=0; j<sv.sz(); j++) {
+           wid.unite(sv[j]->output->extent().x);
+       }
+       if (!wid.empty())
+           m->translate(Offset(wid.max,0));
+    }
+    i->output=m;
     staff_->pscore_->typeset_item(i, score_column->pcol,
                                  staff_->theline,breakst);
 }
@@ -107,22 +118,25 @@ void
 Rhythmic_column::typeset_req(Request *rq)
 {
     Item *i = new Item;
-    const Symbol*s=0;
-
-    switch(rq->tag){
-    case Request::NOTE:
-       s = Symbol::find_ball(rq->note()->balltype);
-       break;
-    case Request::REST:
-       s = Symbol::find_rest(rq->rest()->balltype);
-       break;
-    default:
-       assert(false);
-       break;
-    }  
-    i->output = new Molecule(Atom(s));
-
-    staff_->pscore_->typeset_item(i, score_column->pcol, staff_->theline,0 );  
+    Symbol s;
+    int dots=0;
+
+    if (rq->note())
+       s = Lookup::ball(rq->note()->balltype);
+    if (rq->rhythmic())
+       dots=rq->rhythmic()->dots;
+    if (rq->rest())
+       s = Lookup::rest(rq->rest()->balltype);
+
+    Molecule *m = new Molecule(Atom(s));
+    if (dots) {
+       Symbol d = Lookup::dots(dots);
+       Molecule dm;
+       dm.add(Atom(d));
+       m->add_right(dm);
+    }
+    i->output=m;
+    staff_->pscore_->typeset_item(i, score_column->pcol, staff_->theline,0 );
 }
 
 void
index 1e56355cd709a8b21017c398016cf93aed896d54..8e362146e33d96ee5bf76c0840a7fe0a07f25962 100644 (file)
@@ -1,3 +1,13 @@
+/*
+  rhythmstaf.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef RHYTHMSTAF_HH
+#define RHYTHMSTAF_HH
+#include "stcol.hh"
+
 struct Rhythmic_staff;
 
 /// column of Rhythmic_staff
@@ -29,3 +39,7 @@ struct Rhythmic_staff : Staff {
     Staff_column * create_col(Score_column*);
 };
 
+
+#endif // RHYTHMSTAF_HH
+
+
diff --git a/sccol.cc b/sccol.cc
new file mode 100644 (file)
index 0000000..2895533
--- /dev/null
+++ b/sccol.cc
@@ -0,0 +1,28 @@
+#include "sccol.hh"
+#include "debug.hh"
+
+Score_column::Score_column(Mtime w)
+{
+    when = w;
+    pcol = new PCol(0);
+    musical = false;
+}
+
+bool
+Score_column::used() {
+    return pcol->used;
+}
+
+void
+Score_column::print() const
+{
+#ifndef NPRINT
+    mtor << "Score_column { mus "<< musical <<" at " <<  when<<'\n';
+    mtor << "durations: [";
+    for (int i=0; i < durations.sz(); i++)
+       mtor << durations[i] << " ";
+    mtor << "]\n";
+    pcol->print();
+    mtor << "}\n";
+#endif
+}
diff --git a/sccol.hh b/sccol.hh
new file mode 100644 (file)
index 0000000..9c22c27
--- /dev/null
+++ b/sccol.hh
@@ -0,0 +1,46 @@
+/*
+  sccol.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef SCCOL_HH
+#define SCCOL_HH
+#include "pcol.hh"
+#include "mtime.hh"
+
+
+struct Score_column {
+    PCol * pcol;
+    svec<Mtime> durations;
+    Mtime when;
+
+    /// 
+    bool musical;
+    
+
+    Score_column(Mtime when);
+
+    static int compare(Score_column & c1, Score_column &c2) {
+       return sgn(c1.when - c2.when);
+    }
+    void set_breakable() {
+        pcol->set_breakable();
+    }
+    bool used();
+    void print() const;
+};
+/**
+
+    When typesetting hasn't started on PScore yet, the columns which
+    contain data have a rhythmical position. Score_column is the type
+    with a rhythmical time attached to it. The calculation of
+    idealspacing is done with data in these columns. (notably: the
+    #durations# field)
+
+    */
+
+instantiate_compare(Score_column&, Score_column::compare);
+
+#endif // SCCOL_HH
+
diff --git a/scommands.cc b/scommands.cc
new file mode 100644 (file)
index 0000000..82fe9a1
--- /dev/null
@@ -0,0 +1,185 @@
+#include "scommands.hh"
+#include "debug.hh"
+
+/*
+  maybe it's time for a "narrowing" cursor?
+  */
+PCursor<Command*>
+Score_commands::first(Real w)
+{
+    PCursor<Command*> pc(*this);    
+    while (pc.ok() && pc->when < w)
+       pc++;
+    
+     return pc;
+}
+
+PCursor<Command*>
+Score_commands::last_insertion(Real w)
+{    
+    PCursor<Command*> pc(*this);    
+    while (pc.ok() && pc->when <= w)
+       pc++;
+    return pc;
+}
+
+void
+Score_commands::add_seq(svec<Command> com)
+{
+    if (!com.sz())
+       return;
+    Real when = com[0].when;
+
+    PCursor<Command*> pc(last_insertion(when));
+    for (int i = 0; i < com.sz(); i++) {
+       Command *c = new Command(com[i]);
+       assert(com[i].when == when);
+       if (!pc.ok())
+           pc.add(c);
+       else
+           pc.insert(c);
+    }
+}
+
+void
+Score_commands::set_breakable(Real when)
+{
+    bool found_typeset(false);
+    PCursor<Command*> cc = first(when);
+    for (; cc.ok() && cc->when == when; cc++) {
+       if (cc->isbreak())
+           return;
+       if (cc->code == TYPESET)
+           found_typeset=true;
+    }
+
+    assert(!found_typeset);
+    
+    svec<Command> seq;
+    Command k(when);
+    k.code = BREAK_PRE;
+    seq.add(k);
+    k.code = BREAK_MIDDLE;
+    seq.add(k);
+    k.code = BREAK_POST;
+    seq.add(k);
+    k.code = BREAK_END;
+    seq.add(k);
+
+    add_seq(seq);
+}
+bool
+Score_commands::is_breakable(Real w)
+{
+    PCursor<Command*> cc = first(w);
+    for (; cc.ok() && cc->when == w; cc++) {
+       if (cc->isbreak())
+           return true;
+    }
+    return false;
+}
+void
+Score_commands::add_command_to_break(Command pre, Command mid,Command post)
+{
+    Real w = pre.when;
+    
+    Command k(w);
+    
+    PCursor<Command*> c ( first(w));
+    while (!c->isbreak())
+       c++;
+    c.add(new Command(pre));
+
+    while (!c->isbreak())
+       c++;
+    c.add(new Command(mid));
+
+    while (!c->isbreak())
+       c++;
+    c.add(new Command(post));
+}
+
+void
+Score_commands::add(Command c)
+{
+    bool encapsulate =false;
+
+    Command pre(c.when);
+    Command mid(c.when);
+    Command post(c.when);
+
+
+    if (c.code == TYPESET) {
+       if (c.args[0] == "BAR") {
+           set_breakable(c.when);
+           encapsulate  = true;
+           mid = c;
+           pre = c;
+       }
+       if (c.args[0] == "METER" && is_breakable(c.when)) {
+           encapsulate = true;
+           mid = c;
+           pre = c;
+           post =c;
+       }
+    }
+    
+    if (encapsulate)
+       add_command_to_break(pre, mid, post);    
+    else {
+       svec<Command> seq;
+       seq.add(c);    
+       add_seq(seq);
+    }
+}
+
+/*
+    first and last column should be breakable.
+    Remove any command past the last musical column.
+    */
+void
+Score_commands::clean(Real l)
+{
+    assert(l>0);
+    if (!is_breakable(0.0)) {
+       Command c(0.0);
+       c.code = TYPESET;
+       c.args.add("BAR");
+       c.args.add("empty");
+       add(c);
+    }
+    
+    PCursor<Command*> bot(bottom());
+
+    while (bot.ok() && bot->when > l) {
+
+       mtor <<"removing "<< bot->code <<" at " << bot->when<<'\n';
+       bot.del();
+       bot = bottom();
+    }
+
+    if (!is_breakable(l)) {
+       Command c(l);
+       c.code = TYPESET;
+       c.args.add("BAR");
+       c.args.add("||");
+       add(c);
+    }
+    OK();
+}
+
+void
+Score_commands::OK() const
+{
+    for (PCursor<Command*> cc(*this); cc.ok() && (cc+1).ok(); cc++) {
+       assert(cc->when <= (cc+1)->when);
+    }
+}
+
+void
+Score_commands::print() const
+{
+    for (PCursor<Command*> cc(*this); cc.ok() ; cc++) {
+       cc->print();
+    }
+}
diff --git a/scommands.hh b/scommands.hh
new file mode 100644 (file)
index 0000000..15c844c
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+  lilypond, (c) 1996 Han-Wen Nienhuys
+*/
+#ifndef SCOMMANDS_HH
+#define SCOMMANDS_HH
+
+#include "proto.hh"
+#include "command.hh"
+#include "vray.hh"
+#include "list.hh"
+
+struct Score_commands : public      PointerList<Command*> {
+    void add(Command);
+    void add_seq(svec<Command>);
+    void clean(Real last);
+    void set_breakable(Real when);
+    bool is_breakable(Real w);
+    PCursor<Command*> last_insertion(Real w);
+    PCursor<Command*> first(Real w);
+    void add_command_to_break(Command pre, Command mid,Command post);
+    void OK() const;
+    void print() const;
+};
+/** the list of commands in Score. Put in a separate class, since it
+  otherwise clutters the methods of Score.  */
+
+#endif
+
index f5e357ecdbab7bfa3b13794d3154a6691d96870d..0f8bbf70de0b6b763add44afceac9c8e1d20e1d7 100644 (file)
--- a/score.cc
+++ b/score.cc
-
 #include "tstream.hh"
 #include "score.hh"
+#include "sccol.hh"
 #include "pscore.hh"
 #include "staff.hh"
-#include "misc.hh"
 #include "debug.hh"
+#include "paper.hh"
 
 void
-Score::add_command_seq(svec<Command *> com)
-{
-    if (!com.sz())
-       return;
-    Real when = com[0]->when;
-
-    PCursor<Command*> pc(commands_);    
-    while (pc.ok()&&pc->when <= when)
-       pc++;
-    
-    for (int i = 0; i < com.sz(); i++) {
-       assert(com[i]->when == when);
-       if (!pc.ok())
-           pc.add(com[i]);
-       else
-           pc.insert(com[i]);
-    }
-    
-}
-
-void
-Score::add(Command *c)
+Score::output(String s)
 {
-    svec<Command*> seq;    
-    if (c->code == TYPESET && c->args[0] == "BAR") {
-       /* should be encapsulated in BREAKs
-
-          THIS SUX.
-
-        */
-
-       Command k;
-       
-       k.when = c->when;
-       k.code = BREAK_PRE;
-       
-       seq.add(new Command(k));
-       seq.add(new Command(*c));
-       k.code = BREAK_MIDDLE;
-       seq.add(new Command(k));
-       seq.add(new Command(*c));
-       k.code = BREAK_POST;
-       seq.add(new Command(k));
-       k.code = BREAK_END;
-       seq.add(new Command(k));
-    }
-    else
-       seq.add(new Command(*c));
+    OK();
+    if (paper->outfile=="")
+       paper->outfile = s;
     
-    add_command_seq(seq);
-}
-
-void
-Score::add(Staff*s)
-{
-    s->score_ = this;
-    staffs_.bottom().add(s);    
+    *mlog << "output to " << paper->outfile << "...\n";
+    Tex_stream the_output(paper->outfile);    
+    pscore_->output(the_output);
 }
 
 
-void
-Score::do_pcols()
-{
-    PCursor<Score_column*> sc(cols_);
-    for (;sc.ok(); sc++) {
-       pscore_->add(sc->pcol);
-    }
-}
-/*
-    this sux. Really makeshift.
-
-    first and last column should be breakable.
-    Remove any command past the last musical column.
-    */
-void
-Score::do_miscs()
-{
-    Command c;
-
-    {
-       Command c;
-       c.when = 0.0;
-       c.code = TYPESET;
-       c.args.add("BAR");
-       c.args.add("empty");
-       add(&c);
-    }
-    
-    PCursor<Command*> bot(commands_.bottom());
-    Real l = last();    
-    while (bot.ok() && bot->when > l) {
-
-       mtor <<"removing "<< bot->code <<" at " << bot->when<<'\n';
-       bot.del();
-       bot = commands_.bottom();
-    }
-
-    if (bot->when != l || bot->code != BREAK_END) {
-       Command c;
-       c.code = TYPESET;
-       c.when = l;
-       c.args.add("BAR");
-       c.args.add("||");
-       add(&c);
-    }
-   commands_.OK();
-}
-
-Mtime
-Score::last() const
-{    
-    Mtime l = 0;
-    for (PCursor<Staff*> stc(staffs_); stc.ok(); stc++) {
-       l = MAX(l, stc->last());
-    }
-    return l;
-}
-void
-Score::clean_commands() 
-{
-    Mtime l= last();
-    for (PCursor<Command*> cc(commands_); cc.ok(); ) {
-       if (cc->when > l){
-           mtor << "remming \n";
-           cc.del();
-       } else
-           cc++;
-    }
-}
 void
 Score::process()
 {
-     do_miscs();
+    if (!paper)
+       paper = new Paperdef;
+
+    commands_.clean(last());
     
     /// distribute commands to disciples
     distribute_commands();
@@ -238,18 +124,30 @@ Score::distribute_commands(void)
        sc->add_commands(commands_);
     }
 }
+void
+Score::add(Staff*s)
+{
+    s->score_ = this;
+    staffs_.bottom().add(s);    
+}
 
 
 void
-Score::output(String s)
+Score::do_pcols()
 {
-    OK();
-    if (outfile=="")
-       outfile = s;
-    
-    *mlog << "output to " << outfile << "...\n";
-    Tex_stream the_output(outfile);    
-    pscore_->output(the_output);
+    PCursor<Score_column*> sc(cols_);
+    for (; sc.ok(); sc++) {
+       pscore_->add(sc->pcol);
+    }
+}
+Mtime
+Score::last() const
+{    
+    Mtime l = 0;
+    for (PCursor<Staff*> stc(staffs_); stc.ok(); stc++) {
+       l = MAX(l, stc->last());
+    }
+    return l;
 }
 
 void
@@ -265,12 +163,11 @@ Score::OK() const
     for (PCursor<Score_column*> cc(cols_); cc.ok() && (cc+1).ok(); cc++) {
        assert(cc->when <= (cc+1)->when);
     }
-    for (PCursor<Command*> cc(commands_); cc.ok() && (cc+1).ok(); cc++) {
-       assert(cc->when <= (cc+1)->when);
-    }
+    commands_.OK();
 #endif    
 }
 
+
 void
 Score::print() const
 {
@@ -282,38 +179,18 @@ Score::print() const
     for (PCursor<Score_column*> sc(cols_); sc.ok(); sc++) {
        sc->print();
     }
+    commands_.print();
     mtor << "}\n";
 #endif
 }
+
 Score::Score()
 {
     pscore_=0;
+    paper = 0;
 }
-/****************************************************************/
-
-Score_column::Score_column(Mtime w)
-{
-    when = w;
-    pcol = new PCol(0);
-    musical = false;
-}
-
-bool
-Score_column::used() {
-    return pcol->used;
-}
-
 void
-Score_column::print() const
+Score::add(Command*c)
 {
-    #ifndef NPRINT
-    mtor << "Score_column { mus "<< musical <<" at " <<  when<<'\n';
-    mtor << " # symbols: " << pcol->its.size() << "\n";
-    mtor << "durations: [" ;
-    for (int i=0; i < durations.sz(); i++)
-       mtor << durations[i] << " ";
-    mtor << "]\n}\n";
-    #endif
+    commands_.add(*c);
 }
-
-    
index 5ec7f33b5a413ba5c1ac68dbb57e7022d0f86542..c6af97c7a10d77fb395fe086961ca9f2fd07292e 100644 (file)
--- a/score.hh
+++ b/score.hh
@@ -2,49 +2,15 @@
 #define SCORE_HH
 
 #include "vray.hh"
-#include "cols.hh"
 #include "mtime.hh"
-#include "command.hh"
-
-struct Score_column {
-    PCol * pcol;
-    svec<Mtime> durations;
-    Mtime when;
-
-    /// 
-    bool musical;
-    
-
-    Score_column(Mtime when);
-
-    static int compare(Score_column & c1, Score_column &c2) {
-       return sgn(c1.when - c2.when);
-    }
-    void set_breakable() {
-        pcol->set_breakable();
-    }
-    bool used();
-    void print() const;
-};
-/**
-
-    When typesetting hasn't started on PScore yet, the columns which
-    contain data have a rhythmical position. Score_column is the type
-    with a rhythmical time attached to it. The calculation of
-    idealspacing is done with data in these columns. (notably: the
-    #durations# field)
-
-    */
-
-instantiate_compare(Score_column&, Score_column::compare);
-
+#include "scommands.hh"
 
 /// the total music def of one movement
 struct Score {
-    String outfile;
+    Paperdef *paper;
     /// staffs_ and commands_ form the problem definition.
     PointerList<Staff *> staffs_;
-    PointerList<Command*> commands_;
+    Score_commands commands_;
     
     /// "runtime" fields for setting up spacing    
     PointerList<Score_column*> cols_;
@@ -52,34 +18,35 @@ struct Score {
 
     /****************************************************************/
 
-    Score();
-    
-    /// add #Idealspacings# to #pscore_#
-    void calc_idealspacing();
+    Score();    
     void process();
 
     /// construction
     void add_staff(Staff *st);
 
-    void distribute_commands();
-    /** add the score wide commands (bars, breaks) to each staff so
-    they can process (typeset) them if needed */
     void OK() const;
     Score_column *find_col(Mtime,bool);
     void do_pcols();
-    void add(Command *);
+
     void add(Staff*);
-    void add_command_seq(svec<Command*> );
     void output(String fn);
     PCursor<Score_column*> create_cols(Mtime);
     void print() const;
-    void do_miscs() ;
+
     Mtime last() const;
+    
+    void add(Command*);
+    
+private:
+    
     void clean_cols();
-    void clean_commands();
-
+    void distribute_commands();
     void do_connect(PCol *c1, PCol *c2, Real d);
     void connect_nonmus(PCol* c1, PCol *c2, Real d);
+    /// add #Idealspacings# to #pscore_#
+    void calc_idealspacing();
+    /** add the score wide commands (bars, breaks) to each staff so
+    they can process (typeset) them if needed */
 };
 /**
         
index 12bf074d04bb837e762212dcc3b93cdd549ec572..0827c953f015cc38bec5910e35c2abf0ef22beca 100644 (file)
--- a/staff.cc
+++ b/staff.cc
@@ -1,6 +1,8 @@
 #include "staff.hh"
+#include "stcol.hh"
+#include "sccol.hh"
 #include "debug.hh"
-#include "pscore.hh"
+
 
 void
 Staff::clean_cols()
@@ -14,11 +16,6 @@ Staff::clean_cols()
     }
 }
 
-/*
-    maak een staff column, met specs in args.
-
-    (sorry wat is het vroeg vandaag..)
-    */
 Staff_column *
 Staff::get_col(Mtime w, bool mus)
 {
@@ -106,7 +103,7 @@ Staff::add_commands(PointerList<Command*> const &cl)
     }
 
     // now integrate break commands with other commands.
-    // may be do this in derived functions.
+    // maybe do this in derived functions.
 }
 
 void
@@ -146,39 +143,14 @@ Staff::last() const {
 void
 Staff::print() const
 {
+        #ifndef NPRINT
+
     mtor << "Staff {\n";
     for (PCursor<Voice*> vc(voices); vc.ok(); vc++) {
        vc->print();
        
     }
     mtor <<"}\n";
+    #endif
 }
 
-/****************************************************************/
-
-bool
-Staff_column::mus() const
-{
-    return score_column->musical;
-}
-
-Mtime
-Staff_column::when() const
-{
-    return score_column->when;
-}
-
-void
-Staff_column::add(Voice_element*ve)
-{
-    Mtime d= ve->duration;
-    if (d){
-       score_column->durations.add(d);
-    }
-       
-    v_elts.add(ve);
-}
-
-Staff_column::Staff_column(Score_column*s) {
-    score_column = s;
-}
index 49439f373bfafc8c1419a0c2c6126b29e6614254..cca8c35266412d745ca8397dc92c174bcbfdf507 100644 (file)
--- a/staff.hh
+++ b/staff.hh
@@ -5,25 +5,6 @@
 #include "voice.hh"
 #include "command.hh"
 
-struct Staff_column {
-    Score_column *score_column;
-
-    /// fields to collect data vertically.
-    svec<Voice_element *> v_elts;
-    svec<Command *> s_commands;
-    
-    Staff_column(Score_column*s); 
-    bool mus() const ;
-    Mtime when() const;
-    void add(Voice_element*ve);
-    /****************************************************************
-      VIRTUAL
-    ****************************************************************/
-    virtual void process_requests()=0;
-    virtual void process_commands()=0;
-    virtual ~Staff_column() { }
-};
-
 
 /// base class for a collection of voices.
 struct Staff {
diff --git a/stcol.cc b/stcol.cc
new file mode 100644 (file)
index 0000000..e9a80c8
--- /dev/null
+++ b/stcol.cc
@@ -0,0 +1,30 @@
+#include "stcol.hh"
+#include "sccol.hh"
+#include "voice.hh"
+
+bool
+Staff_column::mus() const
+{
+    return score_column->musical;
+}
+
+Mtime
+Staff_column::when() const
+{
+    return score_column->when;
+}
+
+void
+Staff_column::add(Voice_element*ve)
+{
+    Mtime d= ve->duration;
+    if (d){
+       score_column->durations.add(d);
+    }
+       
+    v_elts.add(ve);
+}
+
+Staff_column::Staff_column(Score_column*s) {
+    score_column = s;
+}
diff --git a/stcol.hh b/stcol.hh
new file mode 100644 (file)
index 0000000..2b23934
--- /dev/null
+++ b/stcol.hh
@@ -0,0 +1,33 @@
+/*
+  stcol.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef STCOL_HH
+#define STCOL_HH
+#include "proto.hh"
+#include "vray.hh"
+
+struct Staff_column {
+    Score_column *score_column;
+
+    /// fields to collect data vertically.
+    svec<Voice_element *> v_elts;
+    svec<Command *> s_commands;
+    
+    Staff_column(Score_column*s); 
+    bool mus() const ;
+    Real when() const;
+    void add(Voice_element*ve);
+    /****************************************************************
+      VIRTUAL
+    ****************************************************************/
+    virtual void process_requests()=0;
+    virtual void process_commands()=0;
+    virtual ~Staff_column() { }
+};
+
+
+#endif // STCOL_HH
+
index 35a949ecd52fc530ed2e8648eaa89e7fa45d6978..08c4ddf64355ee4070e484ecccb92242037b42df 100644 (file)
--- a/suzan.ly
+++ b/suzan.ly
@@ -2,13 +2,6 @@
 
 score{
        rhythmstaff {
-               voice { $ c4 c2 c4 $ }
+               voice { $c2 c2 c2 c2$ }
        }
-       rhythmstaff {
-               voice { $ c2  c2 $ }
-       }
-       rhythmstaff {
-               voice { $ c4  c4 c4 c4 $ }
-       }
-%      bar 2
 }
index 66771dc90aaf4c43ffe751d9ad54c7bda6110566..d67049cefa89f51cb6680c6130c12a62a8e62ea3 100644 (file)
--- a/symbol.cc
+++ b/symbol.cc
@@ -1,11 +1,35 @@
 #include "symbol.hh"
+
 Symbol::Symbol()
     :    dim(Interval(0,0),Interval(0,0))
 {
-    tex = "\\unknown";        
+    tex = "\\unknown";
 }
 Symbol::Symbol(String s, Box b)
-    : tex(s), dim(b)
+    :  dim(b)
+{
+    tex = s;
+}
+
+/****************************************************************/
+
+Symbol
+Parametric_symbol::eval(String args1)const
 {
+    svec<String> a;
+    a.add(args1);
+    return eval(a);
 }
 
+Symbol
+Parametric_symbol::eval(String args1,String arg2)const
+{
+    svec<String> a;
+    a.add(args1);
+    a.add(arg2);
+    return eval(a);
+}
+
+Parametric_symbol::~Parametric_symbol()
+{
+}
index 464a4237428c8fd87c73e9fe789e9c4cc70e9c14..6d6ed1acbe6304d0762bdbba4c18c2911248632d 100644 (file)
--- a/symbol.hh
+++ b/symbol.hh
@@ -2,25 +2,21 @@
 #define SYMBOL_HH
 #include "string.hh"
 #include "boxes.hh"
+
 struct Symbol {
     String tex;
     Box dim;
 
-    Symbol (String, Box );
-    static const Symbol*find_ball(int);
-    static const Symbol*find_rest(int);
-    static const Symbol*find_bar(String);
-    Symbol() ;
+    Symbol (String, Box);
+    Symbol();
 };
 
-/// a symbol with a variable width
-struct Stretchable_symbol {
-public:
-
-    /// return a string for a symbol in this width.
-    virtual String operator ()(Real width)=0;
-    virtual Interval height(Real width) const =0;
-    static const Stretchable_symbol* get_linestaff(int n);
+struct Parametric_symbol {    
+    
+    Symbol eval(String args1) const; // convenience
+    Symbol eval(String args1,String arg2) const; // convenience
+    virtual Symbol eval(svec<String> args)const =0;
+    virtual ~Parametric_symbol();    
 };
 
 #endif
index d00e751dc51a3e0b477566ad912be79a972a1e09..459deb1f670df5fed0982d2f741746d4335d398f 100644 (file)
@@ -1,27 +1,42 @@
 # index TeXstring,     xmin xmax ymin ymax
 
+# be careful with editing this:
+# the "index" entry is hardwired into lilypond.
+
 table balls
-       1       \wholeball      -5      5       -1      1
-       2       \halfball       -5      5       -1      1
-       4       \quartball      -5      5       -1      1       
+       1       \wholeball      -5pt    5pt     -1pt    1pt
+       2       \halfball       -5pt    5pt     -1pt    1pt
+       4       \quartball      -5pt    5pt     -1pt    1pt
 end
 
 table bars
-       empty   \emptybar       0       0       0       0
-       |       \maatstreep     0       1       0       10
-       ||      \finishbar      0       2       0       10
+       empty   \emptybar       0pt     0pt     0pt     0pt
+       |       \maatstreep     0pt     1pt     -8pt    8pt
+       ||      \finishbar      0pt     2pt     -8pt    8pt
 end
 
 table rests
-       1       \wholerest              -5      1       -1      1
-       2       \halfrest               -5      1       -1      1
-       4       \cquartrest             -5      2       -5      5
-       8       \eighthrest             -5      1       -1      1
-       16      \sixteenthrest          -5      1       -1      1
-       32      \thirtysecondrest       -1      1       -1      1
+       1       \wholerest              -5pt    1pt     -1pt    1pt
+       2       \halfrest               -5pt    1pt     -1pt    1pt
+       4       \cquartrest             -5pt    2pt     -5pt    5pt
+       8       \ceighthrest            -5pt    1pt     -1pt    1pt
+       16      \csixteenthrest         -5pt    1pt     -1pt    1pt
+       32      \cthirtysecondrest      -1pt    1pt     -1pt    1pt
 end
 
+table meters
+       C       \fourfourmeter          0pt     10pt    -5pt    5pt
+       C2      \allabreve              0pt     10pt    -5pt    5pt
+end
 
+# dims ignored for this table
+table param
+       meter   \generalmeter{%}{%}     -3pt    10pt    -5pt    5pt
+       linestaf \linestafsym{%}{%}     0pt     0pt     0pt     0pt
+end
 
-
-
+table dots
+       1       \singledot              0pt     4pt     -1pt    1pt
+       2       \doubledot              0pt     8pt     -1pt    1pt
+       3       \tripledot              0pt     12pt    -1pt    1pt
+end
index 5d295d0be5aafacf5eb41d5f015b2385198e8d39..b4de607b8d3a54a574510a4817c6b3ea7bff3c21 100644 (file)
@@ -1,23 +1,24 @@
 #include "misc.hh"
+#include "dimen.hh"
 #include "debug.hh"
 #include "real.hh"
 #include "symbol.hh"
 #include "assoc.hh"
 #include "symtable.hh"
-#include "const.hh"
 
-static Symbol unknown;
 
 
-// scary! What if Symtable resizes on the fly...?
-const Symbol *
+
+
+Symbol 
 Symtable::lookup(String s) const
 {
     if (elt_query(s))
-       return &(*this)[s];
+       return (*this)[s];
     else {
+        Symbol unknown;
        WARN<<"Unknown symbol " << s <<'\n';
-       return &unknown;
+       return unknown;
     }
 }
 
@@ -54,7 +55,7 @@ Symtables::read()
             String tex=r[i++];
             svec<Real> dims;
             for (int j=0; j < 4; j++)
-                dims.add( r[i++].fvalue() *1.0/CM_TO_PT);
+                dims.add( parse_dimen(r[i++]));
             
             Symbol s(tex, Box(dims));
             (*sp)[id] = s;
@@ -63,56 +64,5 @@ Symtables::read()
      }
 }
 
-Symtables the_sym_tables("symbol.ini");
-
-
-const Symbol*
-Symbol::find_ball(int j)
-{
-    if (j > 4) j = 4;
-    Symtable * st = the_sym_tables("balls");
-    return st->lookup(String(j));
-}
 
-const Symbol*
-Symbol::find_rest(int j)
-{
-    return the_sym_tables("rests")->lookup(String(j));
-}
-const Symbol*
-Symbol::find_bar(String s)
-{
-    return the_sym_tables("bars")->lookup(s);
-}
-/****************************************************************/
-// bare bones.
 
-struct Linestaf_symbol : Stretchable_symbol {
-    int lines;
-    String operator ()(Real w);
-    Linestaf_symbol(int n) { lines = n;}
-    Interval height(Real) const { return Interval(0,lines*1/CM_TO_PT); }
-};
-
-
-
-// should be done in TeX
-String
-Linestaf_symbol::operator()(Real w)
-{
-    String s;
-    s += "\\hbox to 0pt{";
-    s+= "\\vbox to 0pt{";
-    for (int i=0; i<lines; i++) {
-       if (i) s+= "\\vskip1pt";
-       s+= "\\hrule width " + String(w* HOR_TO_PT) +"pt";
-    }
-    s+="\\vss}\\hss}";
-    return s;
-}
-
-const Stretchable_symbol *
-Stretchable_symbol::get_linestaff(int n)
-{
-    return new Linestaf_symbol(n);
-}
index f390e285e01b26da27d608e1c896f944631ab99a..73c4079e70c48fd5729746c24eb1acba2ad76772 100644 (file)
@@ -1,5 +1,14 @@
+/*
+  lilypond, (c) 1996 Han-Wen Nienhuys
+*/
+#ifndef SYMTABLE_HH
+#define SYMTABLE_HH
+#include "assoc.hh"
+#include "string.hh"
+#include "symbol.hh"
+
 struct  Symtable : public Assoc<String, Symbol> {
-    const Symbol * lookup(String)const;
+    Symbol lookup(String)const;
 };
 
 
@@ -14,3 +23,6 @@ struct Symtables : private Assoc<String, Symtable*> {
 
 };
 
+
+#endif
+
index b06e2ee92f933057cc8787157c00abf701d5ebe8..72b5ccfd55eea9980a6362af23a4e1b2bbe2eaf5 100644 (file)
--- a/table.cc
+++ b/table.cc
@@ -10,6 +10,13 @@ static Keyword_ent  the_key_tab[]={
     "score", SCORE,
     "bar", BAR,
     "output", OUTPUT,
+    "cm", CM,
+    "pt", PT,
+    "in", IN,
+    "mm", MM,
+    "paper", PAPER,
+    "width", WIDTH,
+    "meter", METER,
     0,0
 } ;
 
index 908de8d4e1ac1c32784386bf8bce2a0e87c2fd89..b7c453b6e07065e84562087e2d8d24ca13e8e6b6 100644 (file)
@@ -1,20 +1,20 @@
 #include "line.hh"
 
 #include "list.hh"
-#include "cols.hh"
+#include "pcol.hh"
 #include "item.hh"
 #include "request.hh"
 #include "command.hh"
 
 #include "list.cc"
 #include "cursor.cc"
+#define PLC_instantiate(a) PL_instantiate(a); PL_instantiate(const a)
 
-
-PL_instantiate(Line_of_score);
-PL_instantiate(Line_of_staff);
-PL_instantiate(Item);
-PL_instantiate(Spanner);
-PL_instantiate(PStaff);
-PL_instantiate(Idealspacing);
-PL_instantiate(PCol);
+PLC_instantiate(Line_of_score);
+PLC_instantiate(Line_of_staff);
+PLC_instantiate(Item);
+PLC_instantiate(Spanner);
+PLC_instantiate(PStaff);
+PLC_instantiate(Idealspacing);
+PLC_instantiate(PCol);
 
index 40cd5b9fbe99c76f6e614c6735792ef9e36c0210..08f2eea88042750f42d848785bebd37fe899c219 100644 (file)
@@ -3,6 +3,8 @@
 #include "voice.hh"
 
 #include "staff.hh"
+#include "sccol.hh"
+#include "stcol.hh"
 
 #include "list.cc"
 #include "cursor.cc"
index b647f185983e6d9c599f5b9c835059325e268a58..6f2e92104c2fe4ae917eef30d87aafb36d681524 100644 (file)
@@ -3,7 +3,7 @@
 #include "molecule.hh"
 #include "list.cc"
 #include "cursor.cc"
-L_instantiate(Atom);
+PL_instantiate(Atom);
 PL_instantiate(Command);
 PL_instantiate(Request);
 
diff --git a/tex.cc b/tex.cc
index e11ebb90b826ed0b5a287461a6010bf57b7ab942..ae9dc1b5f3064bb2e9d7d6fc239a046394b4030c 100644 (file)
--- a/tex.cc
+++ b/tex.cc
@@ -1,28 +1,32 @@
-
+#include "dimen.hh"
 #include "tex.hh"
 #include "symbol.hh"
 #include "const.hh"
-/*
-    #TeXstring# should generate a TeX string to typeset the object in
-  a hbox or vbox of exactly the objects' dimension.
-*/
-
 
-/// #h# is in points
 String
 vstrut(Real h)
 {
-    return String("\\vrule height ") + h + "pt depth 0pt width 0pt";
+    return String("\\vrule height ") + print_dimen(h) + "depth 0pt width 0pt";
 }
 
 
-/// the staff with five lines.
- struct  Fiveline_staff: Stretchable_symbol {
-     String operator()(Real width) {
-       String s("\\normalebalk{ ");
-       s+=width * HOR_TO_PT;
-       s+= "pt}";
-       return s;
-    }    
-};
+static void
+substitute_arg(String& r, String arg)
+{
+    int p = r.pos('%');
+    if (!p ) return ;
+    else p--;
+    r = r.left(p) + arg + r.right(r.len() - p -1);
+}
+
 
+String
+substitute_args(String source, svec<String> args)    
+{
+    String retval (source);
+    for (int i = 0 ; i < args.sz(); i++)
+        substitute_arg(retval, args[i]);
+    while (retval.pos('%'))
+        substitute_arg(retval, "");
+    return retval;
+}
diff --git a/tex.hh b/tex.hh
index fd4a0b6ddfa5d84b3e71204eeabd4314fdc92f1e..2f60630fd597760965e02386dceed1aafea7f60a 100644 (file)
--- a/tex.hh
+++ b/tex.hh
@@ -4,28 +4,14 @@
 #include "string.hh"
 #include "boxes.hh"
 
-/// anything which can be output
-struct Output {
-    virtual String TeXstring() const=0;
-    /** generate a TeX string, which typesets the symbol. Vertical
-     base position is the "origin" of the staff
-    */
-    virtual Box extent() const=0;
-};
+String
+substitute_args(String source, svec<String> args);
 /**
-  any output should (at least) be outputtable for TeX, and have a
-  dimension
-*/
-
-
-/// an idea
-struct Text_gob : Output {
-    String text;
-    // fonts, sizes, etc?
-    virtual String TeXstring() const;
-    virtual Box extent() const;
-};
+  this structure provides a simple macro mechanism:
 
+  if source == "tex%bla%", then
+  eval({"X","Y"})  == "texXblaY"
+  */
 
 /// #h# is in points
 String vstrut(Real h);
index c47fca6da6da3b2f52be6da849d012cf7c01fb8d..b7c88f1b0bc7a379d6c1c1be9e3bf84e512da2b3 100644 (file)
@@ -1,16 +1,15 @@
 #include <fstream.h>
 #include <time.h>
 #include "tex.hh"
-#include "misc.hh"
+#include "main.hh"
 #include "tstream.hh"
 #include "debug.hh"
 
 Tex_stream::Tex_stream(String filename) 
 {
-    
     os = new ofstream(filename);
     if (!*os)
-       error("can't open " + filename);
+       error("can't open `" + filename+"\'");
     nest_level = 0;
     outputting_comment=false;
     header();
@@ -18,16 +17,16 @@ Tex_stream::Tex_stream(String filename)
 void
 Tex_stream::header()
 {
-    *os << "% Creator: " << get_version() << "\n";
+    *os << "% Creator: " << get_version();
     *os << "% Automatically generated, at ";
     time_t t(time(0));
-    *os << ctime(&t)<<"\n";
+    *os << ctime(&t);
 //*os << "% from input file ..\n";    
 }
 Tex_stream::~Tex_stream()
 {
-    assert(nest_level == 0);
     delete os;
+    assert(nest_level == 0);
 }
 
 // print string. don't forget indent.
index ac6d33166d6058b2638a5a94b99d6c1a5237ed50..907f229481dfab5e88c0add8af1858c8a3fa30eb 100644 (file)
--- a/voice.cc
+++ b/voice.cc
@@ -4,7 +4,7 @@
 void
 Voice_element::add(Request*r)
 {
-    if (r->tag == Request::NOTE ||r->tag == Request::REST) {
+    if (r->rhythmic()) {
        assert (!duration);         
        duration = r->duration();
     }
@@ -32,18 +32,23 @@ Voice_element::Voice_element()
 void
 Voice::print() const
 {
+        #ifndef NPRINT
+
     mtor << "start: "<< start<<eol;
     for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
        vec->print();
+#endif
 }
 void
 Voice_element::print() const
 {
+#ifndef NPRINT
     mtor << "voice_element { dur :"<< duration <<"\n";
     for (PCursor<Request*> rc(reqs); rc.ok(); rc++) {
-       mtor << "reqtag: " << rc->tag<<eol;
+       rc->print();
     }
     mtor << "}\n";
+#endif
 }
 
 Mtime