]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.6 release/0.0.6
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 15 Nov 1996 10:08:37 +0000 (11:08 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 15 Nov 1996 10:08:37 +0000 (11:08 +0100)
71 files changed:
.dstreamrc
CodingStyle [new file with mode: 0644]
Makefile
README
Sources.make
TODO
break.cc
debug.hh
flower/Makefile
flower/TODO
flower/list.hh
flower/matrix.cc
flower/pcursor.hh
flower/string.hh
flower/vector.cc
flower/vray.hh
identifier.cc
identifier.hh [new file with mode: 0644]
keyword.hh
lexer.hh
lexer.l
lilyponddefs.tex
line.cc
line.hh
linespace.hh
linestaff.cc
linestaff.hh
lookupsyms.cc
lookupsyms.hh
maartje.ly
melodicstaff.cc [new file with mode: 0644]
melodicstaff.hh [new file with mode: 0644]
misc.cc
molecule.hh
note.cc
paper.cc
paper.hh
parseconstruct.hh
parser.y
pcol.hh
proto.hh
pscore.cc
pscore.hh
pstaff.cc
pstaff.hh
qlp.cc
request.cc
request.hh
rhythmstaf.cc [deleted file]
rhythmstaf.hh [deleted file]
rhythmstaff.cc [new file with mode: 0644]
rhythmstaff.hh [new file with mode: 0644]
scommands.hh
score.cc
score.hh
simpleprint.cc [new file with mode: 0644]
simplestaff.cc [new file with mode: 0644]
simplestaff.hh [new file with mode: 0644]
staff.cc
staff.hh
stcol.hh
symbol.cc
symbol.hh
symbol.ini
symtable.cc
symtable.hh
table.cc
template1.cc
template2.cc
template3.cc
voice.hh

index fccd8d5c370abbf57e3f130634b0a7cf463cf8bc..7dcded772c958b47d12310322094d384c43927ee 100644 (file)
@@ -15,4 +15,7 @@ parse_duration                1
 parse_pitch            1
 Col_configuration      1
 Command                        1
-Score_commands         1
\ No newline at end of file
+Score_commands         1
+Note_req               1
+Rhythmic_req           1
+Rest_req               1
\ No newline at end of file
diff --git a/CodingStyle b/CodingStyle
new file mode 100644 (file)
index 0000000..c5d730c
--- /dev/null
@@ -0,0 +1,55 @@
+CODING STANDARDS:
+
+Functions and methods do not return errorcodes, but use assert for
+checking status. 
+
+INDENTATION, in emacs:
+
+
+(add-hook 'c-mode-hook
+         '(lambda ()(setq c-basic-offset 4)))
+
+
+(add-hook 'c++-mode-hook
+         '(lambda() (c-set-style "Stroustrup")
+            )
+         )
+
+
+CLASSES and TYPES:
+
+       This_is_a_class
+
+DATA MEMBERS
+
+       Class:member
+
+if the member's name resembles its type, then we use
+
+       Class Fubular { ..}
+
+       Class::fubular_
+
+COMMENTS
+
+/// short description
+class Class {
+       ///
+       Data data_member_;
+       /**
+               ..
+       */
+
+       /****************/
+
+       /// short memo
+       member();
+       /**
+               long doco of member()
+       */
+};
+/**
+       Class documentation.
+*/
+
+Unfortunately most of the code isn't really documented that good.
\ No newline at end of file
index c1636f40128720cc272ea64c39b79db2e8fb07a2..c85f6fd2ff33d249e78ea2673d1050cfcaeb2782 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 MAJVER=0
 MINVER=0
-PATCHLEVEL=5
+PATCHLEVEL=6
 
 # 
 #
@@ -20,16 +20,19 @@ PACKAGENAME=lilypond
 DNAME=$(PACKAGENAME)-$(VERSION)
 othersrc=lexer.l parser.y
 SCRIPTS=make_version make_patch genheader
-IFILES=dimen.tex symbol.ini suzan.ly maartje.ly  lilyponddefs.tex test.tex .dstreamrc
+IFILES=dimen.tex symbol.ini suzan.ly maartje.ly\
+       lilyponddefs.tex test.tex .dstreamrc
 OFILES=Makefile Sources.make 
-DOC=COPYING README TODO
+DOC=COPYING README TODO CodingStyle
 DFILES=$(hdr) $(mycc) $(othersrc) $(OFILES) $(IFILES) $(SCRIPTS) $(DOC)
 
 #compiling
 LOADLIBES=-L$(FLOWERDIR) -lflower
 FLOWERDIR=../flower
-#DEFINES=-DNDEBUG -DNPRINT -O2                         # speedy
-DEFINES=-g                                     # lots of debugging info
+# speedy
+#DEFINES=-DNDEBUG -DNPRINT -O2
+# lots of debugging info
+DEFINES=-g
 
 CXXFLAGS=$(DEFINES) -I$(FLOWERDIR) -pipe -Wall -W  -pedantic 
 FLEX=flex
diff --git a/README b/README
index 0ad234c7ff2b2c8ae4d661ed2d371033b96d0d1a..b60e7f2bbdd333c9876a0a9f1e9d724f8a1df7f9 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,6 @@
+-*-text-*-
 
+INTRODUCTION
 
 This is a beta version of LilyPond (a music typesetter). This release is
 preliminary, please do not distribute. Please send your helpful comments and
@@ -6,6 +8,51 @@ patches to me,
 
   hanwen@stack.urc.tue.nl
 
-If you actually want to use this, you'd better use the "speed"
-compilation flags in the Makefile
+PREREQUISITES
 
+TeX, the MusixTeX fonts, g++ > v2.7. The "flower" library, which should be
+available from the same source you got this from.
+
+COMPILING
+
+You will need GNU C++ v2.7 or better and GNU make.  If you actually
+want to use this, you'd better use the "speedy" compilation flags in
+the Makefile.
+
+USING
+
+No, you shouldn't. Really. If you're still not discouraged; this is
+what I type in my xterm:
+
+       lilypond maartje.ly
+       tex test
+       xdvi test&
+
+This is what the output looks like over here.
+
+hw:~/musix/spacer$ lilypond maartje.ly
+LilyPond version 0.0.6 compiled on Nov  2 1996 at 01:25:29
+Parsing ... [maartje.ly]
+output to lelie.uit...
+hw:~/musix/spacer$ tex test
+This is TeX, Version 3.14159 (C version 6.1)
+(test.tex
+Hyphenation patterns for english, dutch, loaded.
+(lilyponddefs.tex) (lelie.uit) [1] )
+Output written on test.dvi (1 page, 1964 bytes).
+Transcript written on test.log.
+hw:~/musix/spacer$ xdvi test&
+[1] 3130
+hw:~/musix/spacer$ 
+
+
+PROBLEMS
+
+If LilyPond bombs out, then please recompile using -g, and send a gdb
+stacktrace of the crash.
+
+
+HOW DOES IT WORK
+
+Use The Source, Luke. If you don't know C++, you can try editing
+.dstreamrc for copious debugging output.
index 6c420edad718bdd1b0875d7e49c6e2932b7550f2..deb1a524c45e2918d6d73925115ed9efc87bd58d 100644 (file)
@@ -1,17 +1,20 @@
-hdr=    qlp.hh       \
-       linespace.hh   qlpsolve.hh\
-       pcol.hh   proto.hh pstaff.hh  line.hh\
+# -*- Makefile-*-
+# sourcefiles to be shipped. Also for depedencies
+
+hdr=    qlp.hh linespace.hh qlpsolve.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   rhythmstaf.hh\
+       tstream.hh rhythmstaff.hh\
        parseconstruct.hh  debug.hh globvars.hh keyword.hh\
        misc.hh score.hh notename.hh lexer.hh symtable.hh\
        symbol.hh main.hh dimen.hh paper.hh lookupsyms.hh\
-       sccol.hh stcol.hh scommands.hh
+       sccol.hh stcol.hh scommands.hh melodicstaff.hh\
+       identifier.hh simplestaff.hh
 
 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\
+       pscore.cc tex.cc item.cc pcol.cc staff.cc rhythmstaff.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\
@@ -19,5 +22,6 @@ mycc=   qlp.cc qlpsolve.cc \
        pstaff.cc  tstream.cc version.cc\
        calcideal.cc scores.cc identifier.cc \
        dimen.cc paper.cc lookupsyms.cc scommands.cc\
-       sccol.cc stcol.cc getcommands.cc\
+       sccol.cc stcol.cc getcommands.cc simplestaff.cc\
+       melodicstaff.cc simpleprint.cc\
        template1.cc template2.cc template3.cc
diff --git a/TODO b/TODO
index cce684e09c926ab7e985ab354dfac7adcc3d46ff..d60c09dbb723301fdf14310a190418bab04184bb 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,6 @@
-melodie staff.
+fonttables -> fontdims
+clear IDENTIFIERs
+Paperdef -> fontsize .
 beam + stem
 
 
index b8dc1827bc79b4af4e50bb828ec29f59bccac0c0..7d5a02a10e16f54435d4d5f1c5f96b8efffd8925 100644 (file)
--- a/break.cc
+++ b/break.cc
@@ -2,7 +2,7 @@
     do calculations for breaking problem
     
     */
-
+#include "paper.hh"
 #include "linespace.hh"
 #include "debug.hh"
 #include "line.hh"
@@ -17,7 +17,7 @@ PScore::solve_line(svec<const PCol *> curline) const
    sp.add_column(curline[0], true, 0.0);
    for (int i=1; i< curline.sz()-1; i++)
        sp.add_column(curline[i]);
-   sp.add_column(curline.last(), true, linewidth);
+   sp.add_column(curline.last(), true, paper_->linewidth);
 
    // misschien  moeven uit Spacing_problem? 
    for (PCursor<Idealspacing *> i(suz); i.ok(); i++) {
index 200585608b7868697c75b25cb31fb2d5a8f5cd66..fb3a07059392048105261d69eae1ae65da4d1410 100644 (file)
--- a/debug.hh
+++ b/debug.hh
@@ -4,20 +4,25 @@
 #include <iostream.h>
 #include "dstream.hh"
 
+void error(String s);          // errors
 
-
+// warnings
+void warning(String s);
 #define WARN warnout << "warning: "<<__FUNCTION__ << "(): "
 extern ostream &warnout ;
-extern ostream *mlog;  
-extern ostream *nulldev;  
+
+// progress
+extern ostream *mlog;
+
+// debugging
 extern Dstream monitor; // monitor
 
 #ifdef NPRINT
-#define mtor *nulldev
+#define mtor if (0) monitor    // clever hack 
 #else
 #define mtor monitor.identify_as(__PRETTY_FUNCTION__)
 #endif
-void error(String s);
-void warning(String s);
+
+
 
 #endif
index 5b40b40629817682a943e50b257f51e3f6648d72..3e9a70ce15c656506105fa5cbe739664a9ca2bbf 100644 (file)
@@ -1,6 +1,6 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=5
+PATCHLEVEL=6
 
 PACKAGENAME=flower
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
index bcb4e27042caf2994c8f8fc91b2a70b34b45927c..f7070ecd07f59e2e73b0822fb56c0fce08dab805 100644 (file)
@@ -1,5 +1,7 @@
        * PointerList<T>:List<T> -> PointerList<T>:List<T*>
 
+       * PCursor -> Pointer_cursor / PointerCursor ?
+
        * efficient copy cons for List
 
        * change String::pos
index 6edf4aebc4c25ba4b72b356e86f43bb19a11af27..5a825fa89ef87ace4a9b7b2ac0bede4c5da0a31d 100644 (file)
@@ -11,9 +11,9 @@ template<class T> class Link;
 template<class T>
 class List
 {
+ public:
     List(List const&src);
 
- public:
     /// construct empty list                
     List();
     
index 1afe5951c8babf8d8c409f1ed5a4f46918615e72..b95a4ab1f9ddc3ebdeef0fb6330bc72f886bff8f 100644 (file)
@@ -1,6 +1,4 @@
 #include "matrix.hh"
-#include "string.hh"
-
 
 Real
 Matrix::norm() const
index eb0e8f15f951339c26555cb0467c77dd6e607814..095bcc45bf697cf0f47362c3c914042c9377c51f 100644 (file)
@@ -25,7 +25,7 @@ struct PCursor : public Cursor<T> {
     PCursor(const List<T> & l) : Cursor<T> (l) {}
 
     PCursor( const Cursor<T>& cursor ) : Cursor<T>(cursor) { }
-    T operator ->() { return  *(*this); }
+    T operator ->() const { return  *(*(Cursor<T> *)this); }
 
 };
 /**
index d3d27742610a1a38724e2d8886a2bd1c5ff30a78..77912beda2f1bd3b79797375d66459a799cecf72 100644 (file)
@@ -50,6 +50,7 @@ public:
     char *copy_array() const; //  return a "new"-ed copy of contents
 
     const char *ptr() const;
+    const char *ptr() { return ((const String *)this)->ptr(); }
     /// return the data. Don't use for writing the data.
     operator const char *() const { return ptr(); }
     
index 2cbfdfc8991c9fafc89618a831973af538fa4f2d..bb3008ee5e902cd7318c028fc0bd8a2919d43879 100644 (file)
@@ -1,5 +1,4 @@
 #include "vector.hh"
-#include "string.hh"
 
 Vector::Vector(const Vector&n)
           :dat(n.dat)
@@ -9,7 +8,9 @@ Vector::Vector(const Vector&n)
 Vector
 Vector::operator-() const
 {
-    Vector v(*this); v*=-1; return v;
+    Vector v(*this);
+    v*=-1;
+    return v;
 }
 
 void
index d56cad00d634b3dbbce029ac9956ab97366bcdd1..c03e651034208436be148ddcf12fb6d2f9b24e87 100644 (file)
@@ -141,6 +141,11 @@ public:
        sort(compare, lower, last-1);
        sort(compare, last+1, lower);
     }
+    void concat(svec<T> const &src) {
+       int s = size;
+       set_size(size + src.size);
+       arrcpy(thearray+s,src.thearray, src.size);      
+    }
 };
 /**
 
index 9eab42e114e57aef4e0901e5c13f4260955f7378..94d48c8d7455990c08e0a2a7265178c02120346d 100644 (file)
@@ -1,22 +1,21 @@
 #include <assert.h>
-#include "keyword.hh"
+#include "identifier.hh"
+#include "staff.hh"
 #include "lexer.hh"
 #include "parser.hh"
 
-Identifier::Identifier()
+Identifier::Identifier(String n)
+    :name  (n)
 {
     data = 0;
-    type = IDENTIFIER;
 }
 
 
 Identifier::~Identifier()
 {
-    if (!data)
-       return;
-    switch (type) {
-    case IDENTIFIER:
-    default:
-       assert(false);
-    }
+}
+
+Staff_id::~Staff_id()
+{
+    delete staff();
 }
diff --git a/identifier.hh b/identifier.hh
new file mode 100644 (file)
index 0000000..0510f18
--- /dev/null
@@ -0,0 +1,32 @@
+
+/*
+  identifier.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef IDENTIFIER_HH
+#define IDENTIFIER_HH
+#include "proto.hh"
+#include "string.hh"
+
+struct Identifier
+{
+    void *data;
+    String name;
+    
+    Identifier(String n) ;
+    virtual ~Identifier();
+    virtual Staff * staff() { assert(false); }
+};
+
+struct Staff_id : Identifier {
+    Staff_id(String s, Staff*st):Identifier(s) { data = st; }
+    virtual Staff* staff() { return (Staff*) data; }
+    ~Staff_id();
+};
+
+
+
+#endif // IDENTIFIER_HH
+
index 42267ef57a5cb29167ffc12eed102022590763bf..df4547ad7698dd82ae3b8a9ec4a66a1dc3f7a0fe 100644 (file)
@@ -12,12 +12,3 @@ struct Keyword_table
     Keyword_table(Keyword_ent *);
     int     lookup(const char *s) const;
 };
-
-struct Identifier
-{
-    void *data;
-    int type;
-
-    Identifier();
-    ~Identifier();
-};
index 28753603ef35731e43b15d0ee39568dda2e1cb3e..31be74169fa52b1443c0ec37ee44ca5bc3a83579 100644 (file)
--- a/lexer.hh
+++ b/lexer.hh
@@ -9,6 +9,7 @@ int yylex();
 void yyerror(char *s);
 
 int lookup_keyword(String s);
-Identifier* lookup_identifier(String s);
 
+Identifier* lookup_identifier(String s);
+void add_identifier(Identifier*i);
 #endif
diff --git a/lexer.l b/lexer.l
index 46a30cf7526d3619145902c1d4eaf233c10cc4f6..008f813bf5410f65759143025a62cf91d733542f 100644 (file)
--- a/lexer.l
+++ b/lexer.l
@@ -92,11 +92,17 @@ REAL                [0-9]+(\.[0-9]*)?
 }
 {WORD}         {
        int l = lookup_keyword(YYText());
-       if (l == -1){
-            yylval.id = lookup_identifier(YYText());
-           return IDENTIFIER;
-        } else
-            return l;
+       if (l != -1)
+               return l;
+       Identifier * id = lookup_identifier(YYText());
+       if (id) {               
+               yylval.id = id;
+               return IDENTIFIER;
+       }
+       String *sp = new String( YYText());
+       mtor << "new id: " << *sp;
+       yylval.string=sp;
+       return NEWIDENTIFIER;
 }
 
 {REAL}         {
@@ -113,7 +119,7 @@ REAL                [0-9]+(\.[0-9]*)?
        mtor << "parens\n";
        return YYText()[0];
 }
-[:           {
+[:=]           {
        char c = YYText()[0];
        mtor << "misc char" <<c<<"\n";
        return c;
index 9b18faf8802d55a8133e906938cf0ba641bb7088..24dd6171502106cbc6066359b153ea1ed334ab20 100644 (file)
@@ -1,41 +1,53 @@
+%%
+%% include file for LilyPond
+\def\mdef#1#2{\def#1{{\musicfnt\char#2}}}
+
+%% musix defs
+       \parindent=0pt
+       \newdimen\interlinedist
+       \newcount\n
+       \newdimen\balkhoog
+       \newdimen\staffrulethickness
+       \newdimen\interstaffrule
+
 \def\musixtwentydefs{
        \font\musicfnt=musix20
-
-%      \hulplijnbreedte5pt
-       %\hlijnhoogte1pt
-       %\balkskip4pt
+       \interlinedist=5pt
+       \balkhoog=20pt
+       \staffrulethickness=0.4pt
+       \interstaffrule=\balkhoog
+       \advance\interstaffrule by-\staffrulethickness
+       \divide\interstaffrule by 4
+       \advance\interstaffrule by -\staffrulethickness         
 }
+
 \def\interstaffline{
        \vskip 20pt%
 }
 
 \musixtwentydefs
-\def\mdef#1#2{\def#1{{\musicfnt\char#2}}}
+
 \mdef\quartball{'007}
 \mdef\halfball{'010}
 \mdef\wholeball{'011}
-\mdef\wholerest{'075}
 \mdef\halfrest{'074}
-\mdef\quartrest{'076}
-\mdef\eighthrest{'077}
-\mdef\sixteenthrest{'078}
-\mdef\thirtysecondrest{'079}
+\mdef\wholerest{'075}
+\mdef\quartrest{62}
+\mdef\eighthrest{63}
+\mdef\sixteenthrest{64}
+\mdef\thirtysecondrest{65}
 \mdef\sharp{'065}
 \mdef\flat{'063}
 \mdef\natural{'067}
 \mdef\singledot{'00}
 \mdef\doubledot{'01}
 \mdef\tripledot{'02}
+\mdef\mussepline{155}
 
+\def\maatstreep{\vrule height\balkhoog}
+\def\finishbar{\vrule height\balkhoog  width 1pt}
+\def\generalmeter#1#2{\vbox to 0pt{\vss\rm\hbox{#1}\hbox{#2}}}
 
-
-\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
        \vskip 10pt
 }
 
-\newcount\n
-\def\linestafsym#1#2{\hbox to 0pt{\vbox to 0pt{\n=0%
+%
+% a staffsymbol with #1 lines, width #2
+% bottom at baseline
+\def\linestafsym#1#2{\hbox to 0pt%
+  {\vbox to 0pt{\vss%
+       \vskip-\interlinedist
+       \n=0%
        \loop\ifnum\n<#1\advance\n by1%
-       \ifnum\n>1\vskip2pt\fi \hrule width#2\repeat\vss}\hss}}
+               \vskip\interstaffrule \hrule height \staffrulethickness width#2
+               \repeat
+       }%
+\hss}}
 
 \def\vcenter#1{\vbox to 0pt{\vss #1\vss}}
 
@@ -57,4 +77,6 @@
 
 \def\lsingledot{\kern-6pt\singledot}
 \def\ldoubledot{\kern-6pt\doubledot}
-\def\ltripledot{\kern-6pt\tripledot}
\ No newline at end of file
+\def\ltripledot{\kern-6pt\tripledot}
+
+
diff --git a/line.cc b/line.cc
index ebe9595d3b78b1a94e534d9559cff414c56b3557..a6e0f7c68a711764e84a67074f1207e27a7b5761 100644 (file)
--- a/line.cc
+++ b/line.cc
@@ -1,6 +1,7 @@
 #include "line.hh"
 #include "dimen.hh"
 #include "symbol.hh"
+#include "paper.hh"
 #include "pcol.hh"
 #include "pscore.hh"
 
@@ -16,7 +17,7 @@ Line_of_staff::TeXstring() const
     // the staff itself: eg lines, accolades
     s += "\\hbox{";
     {
-       Symbol sym = pstaff_->get_stafsym(scor->score->linewidth);
+       Symbol sym = pstaff_->get_stafsym(scor->score->paper_->linewidth);
        s+=sym.tex;
        PCursor<const PCol *> cc(scor->cols);
        Real lastpos=cc->hpos;
@@ -105,7 +106,7 @@ Line_of_staff::maxheight() const
 {
     Interval y;
     {
-       Symbol s = pstaff_->stafsym->eval(scor->score->linewidth);
+       Symbol s = pstaff_->stafsym->eval(scor->score->paper_->linewidth);
        y = s.dim.y;
     }
     PCursor<const PCol *> cc(scor->cols);
diff --git a/line.hh b/line.hh
index ec45bd577cded00100880f8e1777ca04cbefed02..3e698659e9a2f24a8ec690d572771a101c8d1e20 100644 (file)
--- a/line.hh
+++ b/line.hh
@@ -6,7 +6,7 @@
 */
 
 #include "real.hh"
-#include "list.hh"
+#include "plist.hh"
 #include "vray.hh"
 #include "glob.hh"
 #include "pstaff.hh"
index e5b23ca7f0504a829424cd54c1a47187695de3a3..b9d850c602ceef687b3429ecd5204044fef39d6f 100644 (file)
@@ -2,7 +2,7 @@
 #define PROBLEM_HH
 
 #include "glob.hh"
-#include "list.hh"
+#include "plist.hh"
 #include "vray.hh"
 #include "pcol.hh"
 #include "matrix.hh"
index dd9227b155eeaebd9c0e00fbf4452d82c52a2061..7cd081dc497e63b2f29e2645aa01f56f6c32069b 100644 (file)
@@ -2,11 +2,14 @@
 #include "symbol.hh"
 #include "lookupsyms.hh"
 #include "dimen.hh"
+#include "paper.hh"
+#include "pscore.hh"
 
-Linestaff::Linestaff(int l)
+Linestaff::Linestaff(int l, PScore *s)
+    : PStaff(s)
 {
     nolines = l;
-    stafsym = Lookup::linestaff(l); 
+    stafsym = s->paper_->lookup_->linestaff(l); 
 }
 
 Symbol
index 33e9d39f4e0d2409205ebc592fc1a119d4015375..891269dd9d496ba63873a7b88a932884f41df9a0 100644 (file)
@@ -4,7 +4,8 @@ struct Linestaff : PStaff {
     
     int nolines;
 
-    Symbol get_stafsym(Real width)const;
-    Linestaff(int);
+/****************/
     
+    Symbol get_stafsym(Real width)const;
+    Linestaff(int, PScore*);   
 };
index 14b3ab11e3c4fe0a53443f40f7a27b962861ffcb..f0624cad1e0b29dc1822dd888a072726f14f183a 100644 (file)
@@ -3,35 +3,50 @@
 #include "symtable.hh"
 #include "dimen.hh"
 #include "tex.hh"
+void
+Lookup::parse(Text_db&t)
+{
+    symtables_->read(t) ;
+}
 
-Symtables the_sym_tables("symbol.ini");
+Lookup::Lookup()
+{
+    symtables_ = new Symtables;
+}
+
+Lookup::~Lookup()
+{
+    delete symtables_;
+}
 
 Symbol
 Lookup::ball(int j)
 {
-    if (j > 4) j = 4;
-    Symtable * st = the_sym_tables("balls");
+    if (j > 4)
+       j = 4;
+
+    Symtable * st = (*symtables_)("balls");
     return st->lookup(String(j));
 }
 
 Symbol
 Lookup::rest(int j)
 {
-    return the_sym_tables("rests")->lookup(String(j));
+    return (*symtables_)("rests")->lookup(String(j));
 }
 
 
- Symbol
+Symbol
 Lookup::bar(String s)
 {
-    return the_sym_tables("bars")->lookup(s);
+    return (*symtables_)("bars")->lookup(s);
 }
  Symbol
 Lookup::dots(int j)
 {
     if (j>3)
        error("max 3 dots");
-    return the_sym_tables("dots")->lookup(j);
+    return (*symtables_)("dots")->lookup(j);
 }
 
 /****************************************************************/
@@ -39,7 +54,7 @@ Lookup::dots(int j)
 
 struct Linestaf_symbol : Parametric_symbol {
     int lines;
-    Linestaf_symbol(int n) { lines = n;}
+    Linestaf_symbol(int n, Symtables*s): Parametric_symbol(s) { lines = n;}
     Symbol eval(svec<String>)const;
 };
 
@@ -51,26 +66,27 @@ Linestaf_symbol::eval(svec<String> w)const
 
     Symbol s;
     s.dim.x = Interval(0,wid);
-    s.dim.y = Interval(0, lines*convert_dimen(5,"pt"));
+    Real dy=lines*convert_dimen(5,"pt");
+    s.dim.y = Interval(0,dy);
     svec<String> a;
     a.add(lines);
     a.add(w[0]);
-    s.tex = the_sym_tables("param")->lookup("linestaf").tex;
+    s.tex = (*symtables_)("param")->lookup("linestaf").tex;
     s.tex = substitute_args(s.tex, a);
     return s;
 }
 
-/****************************************************************
- */
+/****************************************************************/
 
 
 struct Meter_sym:Parametric_symbol {
 
+    Meter_sym(Symtables*s) : Parametric_symbol(s){  }
     Symbol eval(svec<String> a) const{
        Symbol s;
        s.dim.x = Interval( convert_dimen(-5,"pt"), convert_dimen(10,"pt"));
        s.dim.y = Interval(0, convert_dimen(10,"pt") ); // todo
-       String src = the_sym_tables("param")->lookup("meter").tex;
+       String src = (*symtables_)("param")->lookup("meter").tex;
        s.tex = substitute_args(src,a);
        return s;
     }
@@ -80,12 +96,12 @@ struct Meter_sym:Parametric_symbol {
 Parametric_symbol *
 Lookup::meter(String )
 {
-    return new Meter_sym;
+    return new Meter_sym(symtables_);
 }
 
 Parametric_symbol *
 Lookup::linestaff(int n)
 {
-    return new Linestaf_symbol(n);
+    return new Linestaf_symbol(n,symtables_);
 }
 
index d4e08667dbae8533192dd63280d3b6a1b45f25d0..a3c0750d0e4e213cf9ece91b71b4b3b96e3780ea 100644 (file)
@@ -7,12 +7,19 @@
 #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);
+    Symtables *symtables_;
+    
+    /****************/
+
+    void parse (Text_db&t);
+    Parametric_symbol *linestaff(int n);
+    Parametric_symbol *meter(String);
+    Symbol ball(int);
+    Symbol rest(int);
+    Symbol bar(String);
+    Symbol dots(int);
+    Lookup();
+    ~Lookup();
 };
 
 #endif
index 508389a12ed03ca7d79f6814f683f8a79201614a..00d4ea8d5ee334872a92def835aecf0fffacd7f1 100644 (file)
@@ -1,23 +1,26 @@
-% erg lang
 
 
+ritme = rhythmstaff {
+       voice { $ c2 r32 r32 r16 r8 r4 c2 c2 c2 c2 c2
+               c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
+}
+melody=
+melodicstaff {
+  voice { $ c2.. r8 r4 r8 r16 r32 r32 d8 e8 f8 g8 a8 b8 'c8 c8 r4 c4 c4 c4 c4 c4 c4 $ }
+}
 score {
        paper {
                unitspace 3 cm
        }
-       rhythmstaff {
-               voice { $ c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
-       }
-       rhythmstaff {
-               voice { $ c2.. r8 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4
-               r2 r4 r1
-       $ }
-       }
+       staff { ritme }
+       staff { melody }
        commands {
                meter 4 4
                skip 3:0
                meter 2 4
-               skip 8:0
+               skip 19:0
        }
 }
 
+
+
diff --git a/melodicstaff.cc b/melodicstaff.cc
new file mode 100644 (file)
index 0000000..60d9a6f
--- /dev/null
@@ -0,0 +1,54 @@
+#include "melodicstaff.hh"
+#include "paper.hh"
+#include "molecule.hh"
+#include "linestaff.hh"
+#include "rhythmstaff.hh"
+#include "sccol.hh" 
+
+void
+Melodic_staff::set_output(PScore*ps)
+{
+    theline = new Linestaff(5,ps);
+    Simple_staff::set_output(ps);
+}
+
+void
+Melodic_column::typeset_command(Command *com, int breakst)
+{
+    Item *i = create_command_item(com);
+    typeset_item(i, breakst);
+}
+
+void
+Melodic_column::typeset_req(Request *rq)
+{
+    Item *i = create_req_item(rq);
+    if (rq->note()) {
+       int h = rq->note()->height();
+       Real dy = staff_->paper()->interline()/2;
+       i->output->translate(Offset(0,(h-2)*dy));
+    }
+    typeset_item(i);
+}
+
+/*
+  creation
+  */
+Staff *
+get_new_melodicstaff()
+{
+    return new Melodic_staff;
+}
+
+
+Staff_column*
+Melodic_staff::create_col(Score_column*s)
+{
+    return new Melodic_column(s,this);
+}
+
+Melodic_staff*
+Melodic_staff::clone()const
+{
+    return new Melodic_staff(*this);
+}
diff --git a/melodicstaff.hh b/melodicstaff.hh
new file mode 100644 (file)
index 0000000..a91a413
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+  rhythmstaf.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef MELODICSTAFF_HH
+#define MELODICSTAFF_HH
+
+#include "simplestaff.hh"
+
+/// five line staff, no multiple voices
+struct Melodic_staff : public Simple_staff
+{
+    Staff_column * create_col(Score_column*);
+    virtual void set_output(PScore *);
+    virtual Melodic_staff*clone()const;
+};
+
+struct Melodic_column : public Simple_column {
+    virtual void typeset_req(Request *rq);
+  virtual void typeset_command(Command *, int brs);
+  //    virtual void typeset_item(Item*, int=1);
+    Melodic_column(Score_column*s,Simple_staff*rs) :
+       Simple_column(s,rs) { }
+//    virtual Melodic_column*clone()const;
+};
+
+#endif // MELODICSTAFF_HH
+
+
diff --git a/misc.cc b/misc.cc
index 3a8658f4a02057a113ce44166b6e6abb0d48f056..174e4224bcec5e436aa84cb21830e77e14cb9a6e 100644 (file)
--- a/misc.cc
+++ b/misc.cc
@@ -18,10 +18,9 @@ double log2(double x) {
 
 
 // golden ratio
-const Real PHI = (1+sqrt(5))/2;
+ const Real PHI = (1+sqrt(5))/2;
 const double ENGRAVERS_SPACE = PHI;
-const double WHOLE_SPACE = 5.0; // should be settable from input
+
 
 
   
index 05ec64e3e09b13843ee2b837db373dba80c31b86..0c69f74040de1632861c417011340b87ea8ce8f5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MOLECULE_HH
 #define MOLECULE_HH
 
-#include "list.hh"
+#include "plist.hh"
 #include "boxes.hh"
 #include "item.hh"
 #include "symbol.hh"
diff --git a/note.cc b/note.cc
index 2307729a3cf4ed7935c35fd8c8066d6a366f7697..bb0702f1433eff9c61459a0593f3969ed9e141ac 100644 (file)
--- a/note.cc
+++ b/note.cc
@@ -63,8 +63,6 @@ parse_pitch( const char *a, int &j, int &oct, bool & overide_acc,
        }
 
     
-    mtor << "ov " << overide_acc;
-    
     // notename.
     String nm;
     while (isalpha(a[j])) 
@@ -78,8 +76,9 @@ parse_pitch( const char *a, int &j, int &oct, bool & overide_acc,
        }
         
 
-    lookup_notename(large,small,nm);    
-    mtor << "int "<< large <<" "<<small<<" ";    
+    lookup_notename(large,small,nm);
+    mtor << "override: " << overide_acc;    
+    mtor << "pitch "<< large <<", "<<small<<"\n";    
 }
 
 
@@ -98,13 +97,18 @@ get_note_element(String pitch, String durstr)
     int oct, pit, acc;
     bool forceacc;
     parse_pitch(pitch, i, oct, forceacc, pit, acc);
-
+    char nm =  pit + 'c';
+    if (nm > 'g')
+       nm += 'a' - 'h';
+    rq->name =nm;
+    
     rq->octave = oct;
     rq->accidental = acc;
     rq->forceacc = forceacc;
     rq->balltype = dur;
     rq->dots = dots;
     
+    rq->print();
 
     v->add(rq);
     return v;
@@ -124,7 +128,7 @@ get_rest_element(String, String durstr)
   
     rq->balltype = dur;
     rq->dots = dots;    
-
+    rq->print();
     v->add(rq);
     return v;
 }
index 5afee7d56f1f009baf9268d36c7e8cce59b82bbc..6e5e87bda8329aa3338752fe6bdebb69b0ab08da 100644 (file)
--- a/paper.cc
+++ b/paper.cc
@@ -1,8 +1,57 @@
 #include "paper.hh"
+#include "debug.hh"
+#include "lookupsyms.hh"
 #include "dimen.hh"
+#include "textdb.hh"
 
 Paperdef::Paperdef()
 {
-    width = convert_dimen(15,"cm");            // in cm for now
-    whole_width= convert_dimen(5,"cm");
+    linewidth = convert_dimen(15,"cm");                // in cm for now
+    whole_width= convert_dimen(2,"cm");
+    lookup_ = new Lookup();
+    parse();
+    
+}
+
+void 
+Paperdef::parse()
+{
+    Text_db symini("symbol.ini");
+
+    
+    while (!symini.eof()) {
+       
+        Text_record  r(  symini++);
+       
+        if  (r[0] == "symboltables")
+            lookup_->parse(symini);     
+    }
+}
+
+Paperdef::~Paperdef()
+{
+    delete lookup_;
+}
+
+Real
+Paperdef::interline() const
+{
+    return lookup_->ball(4).dim.y.length();
+}
+
+Real
+Paperdef::standard_height() const
+{
+    return convert_dimen(20,"pt");
+}
+
+void
+Paperdef::print() const
+{
+#ifndef NPRINT
+    mtor << "Paper {width: " << print_dimen(linewidth);
+    mtor << "whole: " << print_dimen(whole_width);
+    mtor << "out: " <<outfile;
+    mtor << "}\n";
+#endif
 }
index b48391a4b994a5a56a1ea07a0027aa97f5e81d4a..9ce4d2bf4e475425a7757cc573e9955669ccaa64 100644 (file)
--- a/paper.hh
+++ b/paper.hh
@@ -1,13 +1,20 @@
-
-
+#include "proto.hh"
 #include "real.hh"
 #include "string.hh"
+
 struct Paperdef {
-    Paperdef();
+    Lookup *lookup_;
     String outfile;
-    Real width;
+    Real linewidth;
     /// how much space does a whole note take (ideally?)
     Real whole_width;
-    // maybe add pointsize?
-    // symbol init?
+    
+    /****************/
+    void parse();
+    Paperdef();
+    ~Paperdef();
+    Real interline()const;
+    Real standard_height()const;
+    void print() const;
 };
+
index d2f2c1ac4ae67480fc4a78f4f0c4be044f3fe9ab..ea5c2fe55a5f3e11f5331514d390b0f61cca2a98 100644 (file)
@@ -5,7 +5,7 @@ Staff * get_new_rhythmstaff();
 Voice_element * get_note_element(String,String);
 Voice_element* get_rest_element(String,String);
 Command *  get_bar_command(Real);
-
+Staff * get_new_melodicstaff();
 Command* get_meterchange_command( int,int);
 Command* get_meter_command( Real,int,int);
 Command* get_skip_command( int,Real);
index ebc4c54f8b340dfc0f6e03a3fbf44950579c6daf..7e2be63a68bb279c649508c531ab22ddb4b37964 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -11,6 +11,7 @@
 #include "debug.hh"
 #include "parseconstruct.hh"
 #include "dimen.hh"
+#include "identifier.hh"
 
 #ifndef NDEBUG
 #define YYDEBUG 1
 
 %token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT
 %token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS
+%token MELODICSTAFF
 
 %type <consstr> unit
-%token <id> IDENTIFIER
+%token <id>  IDENTIFIER
+%token <string> NEWIDENTIFIER 
 %token <string> PITCH DURATION RESTNAME
 %token <real> REAL
 %token <string> STRING
-
+%type <id> declaration 
 %type <paper> paper_block paper_body
 %type <real> dim
 %type <voice> voice_block voice_body voice_elts voice_elts_dollar
 %type <command> score_command
 %type <score> score_block score_body
 %type <staff> staff_block  rhythmstaff_block rhythmstaff_body
+%type <staff> melodicstaff_block melodicstaff_body staffdecl
 %type <i> int
 %type <scommands> score_commands_block score_commands_body
 
 %%
 
 mudela:        /* empty */
-       | score_block { 
-               add_score($1);
+       | mudela score_block { 
+               add_score($2);
+       }
+       | mudela add_declaration {      }
+       ;
+
+add_declaration: declaration   {
+               add_identifier($1);
+       }
+       ;
+
+declaration:
+       NEWIDENTIFIER '=' staff_block  {
+               $$ = new Staff_id(*$1, $3);
+               delete $1; // this sux
        }
        ;
 
@@ -86,7 +103,7 @@ paper_block:
 
 paper_body:
        /* empty */                     { $$ = new Paperdef; }
-       | paper_body WIDTH dim          { $$->width = $3;}
+       | paper_body WIDTH dim          { $$->linewidth = $3;}
        | paper_body OUTPUT STRING      { $$->outfile = *$3;
                delete $3;
        }
@@ -104,9 +121,16 @@ unit:      CM              { $$ = "cm"; }
        |PT             { $$ = "pt"; }
        ;
        
-
+/*
+       staff
+*/
 staff_block:
-       rhythmstaff_block
+       staffdecl
+       | rhythmstaff_block
+       | melodicstaff_block
+       ;
+
+staffdecl: STAFF '{' IDENTIFIER '}' { $$ = $3->staff(); }
        ;
 
 rhythmstaff_block:
@@ -118,6 +142,18 @@ rhythmstaff_body:
        | rhythmstaff_body voice_block  { $$->add_voice($2); }  
        ;
 
+melodicstaff_block:
+       MELODICSTAFF '{' melodicstaff_body '}'  { $$ = $3; }
+       ;
+
+melodicstaff_body:
+       /* empty */                     { $$ = get_new_melodicstaff(); }
+       | melodicstaff_body voice_block         { $$->add_voice($2); }  
+       ;
+
+/*
+       voice
+*/
 voice_block:
        VOICE '{' voice_body '}'        { $$ = $3; }
        ;
@@ -183,4 +219,5 @@ parse_file(String s)
 #endif
    new_input(s);
    yyparse();
+   *mlog << "\n";
 }
diff --git a/pcol.hh b/pcol.hh
index 203482b10e1b1d12ead779cbc5fa2278f8abf1a8..f28617190a968471c737389fe3da7c0557e0ace7 100644 (file)
--- a/pcol.hh
+++ b/pcol.hh
@@ -3,7 +3,7 @@
 
 #include "glob.hh"
 #include "boxes.hh"
-#include "list.hh"
+#include "plist.hh"
 #include "item.hh"
 
 /// stuff grouped vertically.
index ba93e7a52671d4e8e7248b1b0faeb414be9e5e3a..268eda6b5332e1479b321594c22e577f43192eb7 100644 (file)
--- a/proto.hh
+++ b/proto.hh
@@ -69,7 +69,6 @@ struct Staff_column;
 struct Staff;
 struct Command;
 struct Symbol;
-struct Stretchable_symbol;
 struct Output;
 struct Text_gob;
 struct Voice;
@@ -83,8 +82,9 @@ class Mixed_qp;
 class Paperdef;
 class Score_commands;
 class Parametric_symbol;
-
-
+struct Lookup;
+struct Symtables;
+struct Symtable;
 
 #endif // PROTO_HH
 
index 773554375c8e2d280f1337c07575352531a58d68..e1c8a7204a542a8843da392e7a650d6af35bee9a 100644 (file)
--- a/pscore.cc
+++ b/pscore.cc
@@ -1,5 +1,6 @@
 // utility functions for PScore
 #include "debug.hh"
+#include "paper.hh"
 #include "molecule.hh"
 #include "dimen.hh"
 #include "line.hh"
@@ -95,16 +96,16 @@ PScore::add(PCol *p)
     cols.bottom().add(p);
 }
 
-PScore::PScore()
+PScore::PScore( Paperdef*p)
 {
-    linewidth = convert_dimen(15,"cm");        // default
+    paper_ = p;
 }
 
 void
 PScore::output(Tex_stream &ts)
 {
     int l=1;
-    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();
@@ -135,11 +136,13 @@ PScore::OK()const
        ic->OK();
 #endif
 }
+
 void
 PScore::print() const
 {    
 #ifndef NPRINT
-    mtor << "PScore { width "<<print_dimen(linewidth);
+    mtor << "PScore { paper ";
+    paper_->print();
     mtor << "\ncolumns: ";
     for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
        cc->print();
index b22582e3f6fb8bb7f27ceee9eb7cc9d356552329..58a6910bbd6731765463d95ad7db6a8c6fbbf855 100644 (file)
--- a/pscore.hh
+++ b/pscore.hh
@@ -10,8 +10,7 @@
 
 /// all stuff which goes onto paper
 struct PScore {
-    /// width of paper
-    Real linewidth;
+    Paperdef *paper_;          // indirection.
     
     /// the columns, ordered left to right
     PointerList<PCol *> cols;
@@ -73,7 +72,7 @@ struct PScore {
     void clean_cols();
     void problem_OK()const ;
     void OK()const ;
-    PScore();
+    PScore(Paperdef*);
     void print() const;
 };
 /** notes, signs, symbols in a score can be grouped in two ways:
index c922fe99969cdf396cb78fe9e65c57a4907497da..255fceeaddb53225544f86f07ec61f7d8116994e 100644 (file)
--- a/pstaff.cc
+++ b/pstaff.cc
@@ -1,7 +1,8 @@
 #include "pstaff.hh"
 
-PStaff::PStaff()
+PStaff::PStaff(PScore*ps)
 {
+    pscore_=ps;
     stafsym = 0;
 }
 
index 8d17b9dd194c00d72cd0002d148dbd9eaa5fcd2b..bf33c6b4374955b5f32cefec2b76ff0e80321b4d 100644 (file)
--- a/pstaff.hh
+++ b/pstaff.hh
@@ -1,22 +1,22 @@
 #ifndef PSTAFF_HH
 #define PSTAFF_HH
 
-#include "list.hh"
+#include "plist.hh"
 #include "item.hh"
 #include "symbol.hh"
 
 /// items grouped vertically.
-class PStaff {
-
-public:
+struct PStaff {
     Parametric_symbol *stafsym;
-    virtual Symbol get_stafsym(Real width)const=0; // mayybe overkill
+    PScore * pscore_;
+    
+    virtual Symbol get_stafsym(Real width)const=0; // maybe overkill
 
     List<const Spanner*> spans;
     List<Item*> its;
 
     void add(Item*i);
-    PStaff();
+    PStaff(PScore*);
     virtual ~PStaff() {}
 };
 
diff --git a/qlp.cc b/qlp.cc
index c76946e8668b07a318a5f162c218b44d5e2d62ff..3dd8e4227e036810b539c717d699c3a83ce3fa1d 100644 (file)
--- a/qlp.cc
+++ b/qlp.cc
@@ -4,7 +4,7 @@
 #include "choleski.hh"
 
 void
-Mixed_qp::add_equality_cons(Vector v, double r)
+Mixed_qp::add_equality_cons(Vector , double )
 {
     assert(false);
 }
index 27816e5b4325f8f7b0caa1e5f2467790cd3b9576..88fdb3349fd18f29343f2e5201800e0e6db9a876 100644 (file)
@@ -23,18 +23,49 @@ Note_req::Note_req(Voice_element*v)
     forceacc = false;
 }
 
+int
+Note_req::height() const
+{
+    int s = name -'c';
+    if (s < 0)
+       s+=7;
+    return  s + octave*7;
+}
+
+/****************************************************************/
 Rhythmic_req::Rhythmic_req(Voice_element*v)
      :Request(v)
 {
     balltype = 1;
     dots = 0;
 }
+void
+Rhythmic_req::print() const
+{
+    mtor << "rhythmic: " << balltype ;
+    int d =dots;
+    while (d--)
+       mtor << '.';
+    mtor<<"\n";
+}
+void
+Note_req::print() const
+{
+    mtor << "note: " << name << " oct: "<< octave;
+    Rhythmic_req::print();
+}
 
 Request::Request()
 {
     elt = 0;
 }
 
+void
+Rest_req::print() const
+{
+    mtor << "rest, " ;
+    Rhythmic_req::print();
+}
 
 Real
 wholes(int dur, int dots)
index f2dc5f7144f2c6eb3473f965ba9f78815a4df2e2..8ebb1468c01ad316c5df4c90104d87f06b68d841 100644 (file)
@@ -5,14 +5,12 @@
 #include "glob.hh"
 #include "string.hh"
 
+/// a voice element wants something printed
 struct Request {
     Voice_element*elt;
-#if 0
-    enum {
-       UNKNOWN, NOTE, REST, LYRIC, SCRIPT, CHORD, BEAM,
-       BRACKET, STEM, SLUR, CRESC, DECRESC, ABSDYNAMIC
-    } tag;
-#endif
+    
+    /****************/
+
     virtual void print()const ;
     virtual Note_req *note() {return 0;}
     virtual Rest_req *rest() {return 0;}
@@ -53,12 +51,17 @@ struct Request {
     beams/stems to look up the balls it has to connect to.  */
        
 
+/// a request with a duration
 struct Rhythmic_req : Request {
     int balltype;
     int dots;
+    
+    /****************/
+
     Real duration() const;
     Rhythmic_req(Voice_element*);
-    Rhythmic_req*rhythmic() { return this;} 
+    Rhythmic_req*rhythmic() { return this;}
+    void print ()const;
 };
 
 /// Put a note of specified type, height, and with accidental on the staff.
@@ -67,8 +70,14 @@ struct Note_req : Rhythmic_req {
     int octave;
     int accidental;
     bool forceacc;
+    
+    /****************/
+
+    // return height from central c (in halflines)
+    int height()const; 
     Note_req(Voice_element*v);
     Note_req*note() { return this;}
+    virtual void print() const;
 };
 /**
 Staff has to decide if the ball should be hanging left or right. This
@@ -83,7 +92,7 @@ based on ottava commands and the appropriate clef.
 
 ///Put a rest on the staff.
 struct Rest_req : Rhythmic_req {
-
+    void print()const;
     Rest_req(Voice_element*v) : Rhythmic_req(v) {  }
     Rest_req * rest() { return this;}
 };
diff --git a/rhythmstaf.cc b/rhythmstaf.cc
deleted file mode 100644 (file)
index 0b9e90e..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-#include "request.hh"
-#include "debug.hh"
-#include "linestaff.hh"
-#include "staff.hh"
-#include "pstaff.hh"
-#include "pscore.hh"
-#include "command.hh"
-#include "molecule.hh"
-#include "rhythmstaf.hh"
-#include "lookupsyms.hh"
-#include "sccol.hh" 
-
-Rhythmic_column::Rhythmic_column(Score_column*s, Rhythmic_staff *rs)
-    : Staff_column(s)
-{
-    the_note = 0;
-    staff_ = rs;
-}
-
-Rhythmic_staff::Rhythmic_staff()
-{
-    theline = new Linestaff(1);
-}
-void
-Rhythmic_staff::set_output(PScore* ps )
-{
-    pscore_ = ps;
-    pscore_->add(theline);
-}
-
-// should integrate handling of BREAK commands into Staff_column
-void
-Rhythmic_column::process_commands( )
-{
-    int breakstat = BREAK_END - BREAK_PRE;
-    for (int i = 0 ; i < s_commands.sz(); i++) {
-       Command *com = s_commands[i];
-       switch (com->code){
-       case INTERPRET:
-           break;
-       case BREAK_PRE:
-       case BREAK_MIDDLE:
-       case BREAK_POST:
-       case BREAK_END:
-           score_column->set_breakable();
-           breakstat = com->code- BREAK_PRE;
-           break;
-           
-       case TYPESET:
-           typeset_command ( com , breakstat);
-           break;
-       default :
-           break;
-       }
-       
-    }
-}
-/**
- accept:
-
-    BREAK: all
-    TYPESET: bar, meter
-
-    */
-
-
-
-void
-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;
-           if (rq->rhythmic()){
-               if (the_note){
-                   WARN << "too many notes.\n";
-                   return;
-               }
-               the_note = rq;
-           }
-           break;
-       }
-}
-
-
-void
-Rhythmic_column::typeset_command(Command *com, int breakst)
-{
-    Item *i = new Item;
-    Symbol s;
-
-    if (com -> args[0] ==  "BAR" ) {
-       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);
-
-    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);
-}
-
-void
-Rhythmic_column::typeset_req(Request *rq)
-{
-    Item *i = new Item;
-    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 );
-}
-
-void
-Rhythmic_staff::grant_requests()
-{
-    for  (PCursor<Staff_column*> cc(cols); cc.ok(); cc++) {
-       Rhythmic_column *rp = (Rhythmic_column*)*cc;
-       if (rp->the_note)
-           rp->typeset_req( rp->the_note);
-    }
-}
-
-Staff_column*
-Rhythmic_staff::create_col(Score_column*s)
-{
-    Rhythmic_column *rc = new Rhythmic_column(s,this);
-
-    return rc;
-}
-
-Staff *
-get_new_rhythmstaff()
-{
-    return new Rhythmic_staff;
-}
diff --git a/rhythmstaf.hh b/rhythmstaf.hh
deleted file mode 100644 (file)
index 69b61ec..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-  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
-struct Rhythmic_column : Staff_column {
-    // mega-stupido. only do notes, one at a time
-    Request *the_note;
-    Rhythmic_staff* staff_;
-
-    /****************/
-    
-    void typeset_req(Request *rq);
-    void take_request(Request *rq);
-    void typeset_command(Command *, int brs);
-    void process_commands( );
-    void process_requests();
-
-    Rhythmic_column(Score_column*s,Rhythmic_staff*rs);
-};
-
-
-/// simple percussion staff
-struct Rhythmic_staff : Staff {
-    /// indirection to the PStaff.
-    PStaff *theline;
-
-    /****************/
-    void set_output(PScore *);
-    void process_commands( PCursor<Command*> &where);
-
-    void grant_requests();
-    Staff_column * create_col(Score_column*);
-    Rhythmic_staff();
-};
-
-
-#endif // RHYTHMSTAF_HH
-
-
diff --git a/rhythmstaff.cc b/rhythmstaff.cc
new file mode 100644 (file)
index 0000000..4e564bd
--- /dev/null
@@ -0,0 +1,52 @@
+#include "molecule.hh"
+#include "linestaff.hh"
+#include "rhythmstaff.hh"
+#include "paper.hh"
+#include "sccol.hh" 
+
+
+void
+Rhythmic_staff::set_output(PScore*ps)
+{
+    theline = new Linestaff(1,ps);
+    Simple_staff::set_output(ps);
+}
+
+
+void
+Rhythmic_column::typeset_command(Command *com, int breakst)
+{
+    Item *i = create_command_item(com);
+    i->output->translate(Offset(0,
+                               -staff_->score_->paper_->standard_height()/2));
+    typeset_item(i, breakst);
+}
+
+void
+Rhythmic_column::typeset_req(Request *rq)
+{
+    Item *i =create_req_item(rq);
+    typeset_item(i);
+}
+
+/*
+  creation
+  */
+Staff *
+get_new_rhythmstaff()
+{
+    return new Rhythmic_staff;
+}
+
+
+Staff_column*
+Rhythmic_staff::create_col(Score_column*s)
+{
+    return new Rhythmic_column(s,this);
+}
+
+Rhythmic_staff*
+Rhythmic_staff::clone() const
+{
+    return new Rhythmic_staff(*this);
+}
diff --git a/rhythmstaff.hh b/rhythmstaff.hh
new file mode 100644 (file)
index 0000000..7fe7c6a
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+  rhythmstaf.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef RHYTHMSTAF_HH
+#define RHYTHMSTAF_HH
+
+#include "simplestaff.hh"
+
+/// all notes on one line
+struct Rhythmic_staff : public Simple_staff
+{
+    //  Rhythmic_staff();
+    Staff_column * create_col(Score_column*);
+    virtual void set_output(PScore *);
+    virtual Rhythmic_staff*clone()const;
+};
+
+/// this does the typesetting
+struct Rhythmic_column : public Simple_column {
+    virtual void typeset_req(Request *rq);
+    virtual void typeset_command(Command *, int brs);
+  
+
+//    virtual void typeset_item(Item *rq, int=1);
+    Rhythmic_column(Score_column*s,Simple_staff*rs) :
+       Simple_column(s,rs) { }
+//    virtual Rhythmic_column*clone()const;
+};
+
+#endif // RHYTHMSTAF_HH
+
+
index ee3b4591ab1e03407fc116c87fb22458da8e7cc8..9106f2bfccc9f89451bc49a3ab32226bdeb94b75 100644 (file)
@@ -7,7 +7,7 @@
 #include "proto.hh"
 #include "command.hh"
 #include "vray.hh"
-#include "list.hh"
+#include "plist.hh"
 
 struct Score_commands : public PointerList<Command*> {
     void process_add(Command);
index 3c95fd179002bfd593583d0d3dcd908572beedc1..097e2aa50d12f1d936f4f25045437999d2fd8793 100644 (file)
--- a/score.cc
+++ b/score.cc
@@ -29,6 +29,7 @@ Score::output(String s)
 void
 Score::process()
 {
+    *mlog << "Processing ...";
     set(commands_->parse(last()));
     commands_->print();
     
@@ -40,7 +41,7 @@ Score::process()
     /// distribute commands to disciples
     distribute_commands();
     
-    pscore_ = new PScore;
+    pscore_ = new PScore(paper_);
     for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
        sc->set_output(pscore_);
        sc->process();
@@ -52,9 +53,11 @@ Score::process()
     clean_cols();
     OK();
     //    print();
+    *mlog << "Calculating ... ";
     pscore_->calc_breaking();
     // TODO: calculate vertical structs
     // TODO: calculate mixed structs.
+    *mlog << "\n";
 }
 
 // remove empty cols with no spacing attached.
index e58f87f0581ff3db8f6103692c6564332c19df45..176d7fa47a0f7e55f9217eb2666f8c9346e6bf10 100644 (file)
--- a/score.hh
+++ b/score.hh
@@ -2,7 +2,7 @@
 #define SCORE_HH
 #include "vray.hh"
 #include "proto.hh"
-#include "list.hh"
+#include "plist.hh"
 
 
 /// the total music def of one movement
diff --git a/simpleprint.cc b/simpleprint.cc
new file mode 100644 (file)
index 0000000..91b7761
--- /dev/null
@@ -0,0 +1,79 @@
+#include "lookupsyms.hh"
+#include "request.hh"
+#include "pscore.hh"
+#include "paper.hh"
+#include "simplestaff.hh"
+#include "molecule.hh"
+#include "sccol.hh"
+
+Item *
+Simple_column::create_req_item(Request *rq)
+{
+    Item *i = new Item;
+    Symbol s;
+    int dots=0;
+
+    if (rq->note())
+       s = staff_->paper()->lookup_->ball(rq->note()->balltype);
+    else if (rq->rest())
+       s = staff_->paper()->lookup_->rest(rq->rest()->balltype);
+
+    if (rq->rhythmic())
+       dots=rq->rhythmic()->dots;
+
+
+    Molecule *m = new Molecule(Atom(s));
+    if (dots) {
+       Symbol d = staff_->paper()->lookup_->dots(dots);
+       Molecule dm;
+       dm.add(Atom(d));
+       m->add_right(dm);
+    }
+    i->output=m;
+    return i;
+}
+Item *
+Simple_column::create_command_item(Command *com)
+{
+    Item *i = new Item;
+    Symbol s;
+
+    if (com -> args[0] ==  "BAR" ) {
+       s = staff_->paper()->lookup_->bar(com->args[1]);        
+    } else if (com->args[0] == "METER") {
+       Parametric_symbol *p = staff_->paper()->lookup_->meter("general");
+       svec<String> arg( com->args);
+       arg.del(0);
+       s = p->eval(arg);
+    } else
+       assert(false);
+
+    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;
+    return i;
+}
+
+void
+Simple_column::typeset_item(Item *i, int breakst)
+{
+    // ugh
+    staff_->pscore_->typeset_item(i, score_column->pcol,
+                                 staff_->theline,breakst);
+}
+
+void
+Simple_staff::set_output(PScore* ps )
+{
+    pscore_ = ps;
+    pscore_->add(theline);
+}
diff --git a/simplestaff.cc b/simplestaff.cc
new file mode 100644 (file)
index 0000000..763a9ed
--- /dev/null
@@ -0,0 +1,86 @@
+#include "request.hh"
+#include "debug.hh"
+#include "staff.hh"
+#include "command.hh"
+#include "simplestaff.hh"
+#include "sccol.hh" 
+
+
+
+
+Simple_column::Simple_column(Score_column*s, Simple_staff *rs)
+    : Staff_column(s)
+{
+    the_note = 0;
+    staff_ = rs;
+}
+
+Simple_staff::Simple_staff()
+{
+    theline = 0;
+}
+
+// should integrate handling of BREAK commands into Staff_column
+void
+Simple_column::process_commands( )
+{
+    int breakstat = BREAK_END - BREAK_PRE;
+    for (int i = 0 ; i < s_commands.sz(); i++) {
+       Command *com = s_commands[i];
+       switch (com->code){
+       case INTERPRET:
+           break;
+       case BREAK_PRE:
+       case BREAK_MIDDLE:
+       case BREAK_POST:
+       case BREAK_END:
+           score_column->set_breakable();
+           breakstat = com->code- BREAK_PRE;
+           break;
+           
+       case TYPESET:
+           typeset_command ( com , breakstat);
+           break;
+       default :
+           break;
+       }       
+    }
+}
+/**
+ accept:
+
+    BREAK: all
+    TYPESET: bar, meter
+
+    */
+
+
+
+void
+Simple_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;
+           if (rq->rhythmic()){
+               if (the_note){
+                   WARN << "too many notes.\n";
+                   return;
+               }
+               the_note = rq;
+           }
+           break;
+       }
+}
+
+void
+Simple_staff::grant_requests()
+{
+    for  (PCursor<Staff_column*> cc(cols); cc.ok(); cc++) {
+       Simple_column *rp = (Simple_column*)*cc;
+       if (rp->the_note)
+           rp->typeset_req( rp->the_note);
+    }
+}
+
+
diff --git a/simplestaff.hh b/simplestaff.hh
new file mode 100644 (file)
index 0000000..e2efafe
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+  simplestaff.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef SIMPLESTAFF_HH
+#define SIMPLESTAFF_HH
+
+#include "stcol.hh"
+#include "staff.hh"
+/*
+   mega-stupido staffs and cols: they do notes one at each moment.   
+   */
+
+struct Simple_staff;
+
+/// column of Simple_staff: store one request
+struct Simple_column : Staff_column {
+
+    Request *the_note;
+    Simple_staff* staff_;
+
+    /****************/
+    
+    virtual void typeset_req(Request *rq)=0;
+    virtual void typeset_command(Command *, int brs)=0;
+    virtual void typeset_item(Item *, int=1);
+
+    Item *create_command_item(Command *com);
+    Item *create_req_item(Request *rq);
+    void take_request(Request *rq);
+    
+    virtual void process_commands( );
+    virtual void process_requests();
+
+    Simple_column(Score_column*s,Simple_staff*rs);
+};
+
+
+/// Simple  staff: one note at a time
+struct Simple_staff : Staff {
+    /// indirection to the PStaff.
+    PStaff *theline;
+
+    /****************/
+    virtual void set_output(PScore *);
+
+    void process_commands( PCursor<Command*> &where);
+    void grant_requests();
+//    virtual Staff*clone()const;
+
+    Simple_staff();
+};
+
+#endif // SIMPLESTAFF_HH
+
+
+
index 7dd2666dc9ff02167982979b81158457d0096484..8b5c0782c54524d13e5eda247ba2fa1ac7b4e592 100644 (file)
--- a/staff.cc
+++ b/staff.cc
@@ -3,6 +3,20 @@
 #include "sccol.hh"
 #include "debug.hh"
 
+Staff::Staff(Staff const&src)
+{
+    PL_copy(voices,src.voices);
+    PL_copy(commands,src.commands);
+    assert(!cols.size());      // cols is a runtime field.
+
+    score_ = src.score_;
+    pscore_ = src.pscore_;
+}
+
+Paperdef*
+Staff::paper() const{
+    return score_->paper_;
+}
 
 void
 Staff::clean_cols()
@@ -23,7 +37,7 @@ Staff::get_col(Real w, bool mus)
     assert(sc->when == w);
     PCursor<Staff_column *> stc(cols);
     for (; stc.ok(); stc++) {
-       if (*sc  < *stc->score_column)
+       if (*stc->score_column > *sc) // too far
            break;
        if (sc == stc->score_column)
            return stc;
@@ -131,7 +145,8 @@ Staff::OK() const
 
 
 Real
-Staff::last() const {
+Staff::last() const
+{
     Real l = 0.0;
     for (PCursor<Voice*> vc(voices); vc.ok(); vc++) {
        l = MAX(l, vc->last());
@@ -143,20 +158,18 @@ Staff::last() const {
 void
 Staff::print() const
 {
-        #ifndef NPRINT
-
+#ifndef NPRINT
     mtor << "Staff {\n";
     for (PCursor<Voice*> vc(voices); vc.ok(); vc++) {
        vc->print();
        
     }
     mtor <<"}\n";
-    #endif
+#endif
 }
 
 Staff::Staff()
 {
     score_ =0;
-    pscore_=0;
-    
+    pscore_=0;    
 }
index 3d39c6e78bdb89dc047436a264398bb1d888f121..f2c7294de00cfcd2ca540586811f58a1c957b69c 100644 (file)
--- a/staff.hh
+++ b/staff.hh
@@ -13,6 +13,8 @@ struct Staff {
 
     /// commands in chronological order
     PointerList<Command *> commands;
+
+    /// runtime field
     PointerList<Staff_column*> cols;
 
     /// indirections to the Score and PScore
@@ -20,11 +22,11 @@ struct Staff {
     PScore *pscore_;
 
     /****************************************************************/
-    
+    Staff(const Staff&src);
     void add_voice(Voice *v);
     void add_staff_column(Staff_column *sp);
 
-        
+    Paperdef*paper()const;
     /// interpret all requests and add items to #destination#.
     void process();
     /**
@@ -53,12 +55,11 @@ struct Staff {
     /****************************************************************
       VIRTUALS
     ****************************************************************/
-    
+    virtual Staff*clone()const=0;    
     virtual void set_output(PScore * destination)=0;
     virtual void grant_requests()=0;    
     virtual Staff_column * create_col(Score_column * )=0;
     virtual ~Staff() { }
-
 };
 #endif
 
index 060d585fdedf8198d26abf03b011e58eb55ab713..1d8b09c61ec557e4c4b1ed1204714913a9630472 100644 (file)
--- a/stcol.hh
+++ b/stcol.hh
@@ -9,6 +9,7 @@
 #include "proto.hh"
 #include "vray.hh"
 
+/// store simultaneous requests
 struct Staff_column {
     Score_column *score_column;
 
@@ -23,6 +24,7 @@ struct Staff_column {
     /****************************************************************
       VIRTUAL
     ****************************************************************/
+    //virtual Staff_column *clone() const=0;
     virtual void process_requests()=0;
     virtual void process_commands()=0;
     virtual ~Staff_column() { }
index d67049cefa89f51cb6680c6130c12a62a8e62ea3..907f1d7282d34bd33111b76f5340b51c3a326bd6 100644 (file)
--- a/symbol.cc
+++ b/symbol.cc
@@ -30,6 +30,3 @@ Parametric_symbol::eval(String args1,String arg2)const
     return eval(a);
 }
 
-Parametric_symbol::~Parametric_symbol()
-{
-}
index 6d6ed1acbe6304d0762bdbba4c18c2911248632d..4f26e04e662ec8453116e68b2714aace617ebcf3 100644 (file)
--- a/symbol.hh
+++ b/symbol.hh
@@ -2,6 +2,7 @@
 #define SYMBOL_HH
 #include "string.hh"
 #include "boxes.hh"
+#include "proto.hh"
 
 struct Symbol {
     String tex;
@@ -12,11 +13,15 @@ struct Symbol {
 };
 
 struct Parametric_symbol {    
+    Symtables*symtables_;      // indirection 
+
+    /*****************/
     
+    Parametric_symbol(Symtables*s) { symtables_ = s; }
     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();    
+    virtual ~Parametric_symbol(){}
 };
 
 #endif
index 26c0a31bffdd62ac27ca82884620bb326f3b4c31..3671dae8afdfe8138979d813d26d05630ced9d48 100644 (file)
@@ -1,27 +1,31 @@
+
+
+
+symboltables
 # index TeXstring,     xmin xmax ymin ymax
 
 # be careful with editing this:
 # the "index" entry is hardwired into lilypond.
 
 table balls
-       1       \wholeball      -5pt    5pt     -1pt    1pt
-       2       \halfball       -5pt    5pt     -1pt    1pt
-       4       \quartball      -5pt    5pt     -1pt    1pt
+       1       \wholeball      -5pt    5pt     -2.5pt  2.5pt
+       2       \halfball       -5pt    5pt     -2.5pt  2.5pt
+       4       \quartball      -5pt    5pt     -2.5pt  2.5pt
 end
 
 table bars
        empty   \emptybar       0pt     0pt     0pt     0pt
-       |       \maatstreep     0pt     1pt     -8pt    8pt
-       ||      \finishbar      0pt     2pt     -8pt    8pt
+       |       \maatstreep     0pt     1pt     -12pt   12pt
+       ||      \finishbar      0pt     2pt     -12pt   12pt
 end
 
 table rests
        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
+       4       \quartrest              -5pt    2pt     -5pt    5pt
+       8       \eighthrest             0pt     5pt     0pt     8pt
+       16      \sixteenthrest          0pt     6pt     0pt     12pt
+       32      \thirtysecondrest       0pt     6pt     0pt     16pt
 end
 
 table meters
@@ -39,4 +43,5 @@ table dots
        1       \lsingledot             0pt     8pt     -1pt    1pt
        2       \ldoubledot             0pt     12pt    -1pt    1pt
        3       \ltripledot             0pt     16pt    -1pt    1pt
-end
+end 
+end # symboltables
\ No newline at end of file
index b4de607b8d3a54a574510a4817c6b3ea7bff3c21..eedb25a4e5235d6f3d700d52ce5865c16f0fde27 100644 (file)
@@ -7,9 +7,6 @@
 #include "symtable.hh"
 
 
-
-
-
 Symbol 
 Symtable::lookup(String s) const
 {
@@ -25,21 +22,16 @@ Symtable::lookup(String s) const
 Symtable* 
 Symtables::operator()(String s) 
 {
-    if (!done_reading){        // read on demand
-       *mlog << '(' << fname ;
-       read();
-       done_reading = true;
-       *mlog << ")\n";
-    }
     return Assoc<String, Symtable*>::operator[](s);
 } 
 
 void
-Symtables::read()
+Symtables::read(Text_db &symini)
 {
-     Text_db symini(fname);
      while (!symini.eof()) {
         Text_record  r(  symini++);
+        if (r[0] == "end" )
+            return;
         assert (r[0] == "table");
         
         String tabnam = r[1];
index 73c4079e70c48fd5729746c24eb1acba2ad76772..a1443a7d3b1b4b15a4edc0e7fa9dc2494ffebb58 100644 (file)
@@ -13,12 +13,7 @@ struct  Symtable : public Assoc<String, Symbol> {
 
 
 struct Symtables : private Assoc<String, Symtable*> {
-    String fname;
-    bool done_reading;
-    Symtables(String s) : fname (s) {
-       done_reading = false;
-    }
-    void read() ;
+    void read(Text_db&) ;
     Symtable* operator()(String s);
 
 };
index da2af9575ed504101855bbbc5aa5fe792dbdf9cd..53525743998509539178f72cc13b1f5947be88d1 100644 (file)
--- a/table.cc
+++ b/table.cc
@@ -1,12 +1,14 @@
 #include "glob.hh"
 #include "debug.hh"
 #include "string.hh"
+#include "identifier.hh"
 #include "keyword.hh"
 #include "parser.hh"
 
 static Keyword_ent  the_key_tab[]={
     "voice", VOICE,
     "rhythmstaff", RHYTHMSTAFF,
+    "melodicstaff", MELODICSTAFF,
     "score", SCORE,
     "bar", BAR,
     "output", OUTPUT,
@@ -20,6 +22,7 @@ static Keyword_ent  the_key_tab[]={
     "unitspace", UNITSPACE,
     "skip", SKIP,
     "commands", COMMANDS,
+    "staff", STAFF,
     0,0
 } ;
 
@@ -37,7 +40,13 @@ Identifier*
 lookup_identifier(String s)
 {
     if (!the_id_tab.elt_query(s))
-        the_id_tab[s]= new Identifier;
+       return 0;
     
     return the_id_tab[s];
 }
+
+void
+add_identifier(Identifier*i)
+{    
+    the_id_tab[i->name] = i;
+}
index b7c453b6e07065e84562087e2d8d24ca13e8e6b6..01aba139e2762e1fd57aa3ed1ec22e3f2100366e 100644 (file)
@@ -1,12 +1,14 @@
 #include "line.hh"
 
-#include "list.hh"
+#include "plist.hh"
 #include "pcol.hh"
 #include "item.hh"
 #include "request.hh"
 #include "command.hh"
 
 #include "list.cc"
+
+#include "plist.cc"
 #include "cursor.cc"
 #define PLC_instantiate(a) PL_instantiate(a); PL_instantiate(const a)
 
index 08f2eea88042750f42d848785bebd37fe899c219..1c54a2cb9490072fddf499c63a7dac2ab5378bef 100644 (file)
@@ -7,6 +7,7 @@
 #include "stcol.hh"
 
 #include "list.cc"
+#include "plist.cc"
 #include "cursor.cc"
 PL_instantiate(Score_column);
 PL_instantiate(Staff_column);
index 6f2e92104c2fe4ae917eef30d87aafb36d681524..92921bb29a897b9c7c20bb1f8249df15f39b984a 100644 (file)
@@ -2,6 +2,7 @@
 #include "command.hh"
 #include "molecule.hh"
 #include "list.cc"
+#include "plist.cc"
 #include "cursor.cc"
 PL_instantiate(Atom);
 PL_instantiate(Command);
index b580972b233366fd7a479dd3e4688892c0de8853..b409fa4cd34bccfeb058f9c61c03cbff0d64f316 100644 (file)
--- a/voice.hh
+++ b/voice.hh
@@ -2,7 +2,7 @@
 #define VOICE_HH
 
 
-#include "list.hh"
+#include "plist.hh"
 #include "request.hh"
 
 /// class for  horizontal stuff.
@@ -28,7 +28,7 @@ struct Voicegroup {
     /// don't know how to identify these.
 };
 
-/// 
+/// one horizontal bit. 
 struct Voice_element {
     Real duration;
     const Voicegroup *group;
@@ -37,6 +37,9 @@ struct Voice_element {
 
     List<const Item *> granted_items;
     List<const Spanner *> granted_spanners;
+
+    /****************/
+    
     void add(Request*);
     Voice_element();