]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.16 release/0.0.16
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 20 Dec 1996 23:03:06 +0000 (00:03 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 20 Dec 1996 23:03:06 +0000 (00:03 +0100)
48 files changed:
.dstreamrc
Documentation/CodingStyle
Documentation/Makefile
Documentation/design
Documentation/inputformat [new file with mode: 0644]
Makefile
README
Sources.make
Variables.make
flower/TODO
flower/Variables.make
flower/interval.cc
flower/interval.hh
flower/vray.hh
hdr/identifier.hh
hdr/identparent.hh
hdr/inputcommand.hh
hdr/inputmusic.hh
hdr/lexer.hh
hdr/notename.hh
hdr/parseconstruct.hh
hdr/proto.hh
kortjakje.ly
lilyponddefs.tex
maartje.ly
make_version
pavane.ly
src/beam.cc
src/getcommands.cc
src/identifier.cc [new file with mode: 0644]
src/inputcommand.cc
src/inputmusic.cc
src/key.cc
src/lexer.l
src/main.cc
src/note.cc
src/notename.cc
src/paper.cc
src/parser.y
src/score.cc
src/slur.cc
src/staff.cc
src/symbol.cc
src/symtable.cc
src/table.cc
src/texslur.cc
src/version.cc
symbol.ini

index a449d3f57455b6768ddcc5660ba5e1206122f6c4..2a2dc4300226782763fd63ca1af55977ebb5bd7b 100644 (file)
@@ -1,6 +1,7 @@
 #class name            silence?
 
-yyFlexLexer            1
+My_flex_lexer          0
+yyFlexLexer            0
 PCol                   0
 Score_column           1
 Ineq_constrained_qp    1
@@ -8,8 +9,13 @@ Spacing_problem        1
 Colinfo                        1
 Mixed_qp               1
 PScore                 1
-Parser                 0
-Lexer                  1
+
+# yydebug
+Parser                 1
+
+# FlexLexer debug
+Lexer                  0
+
 parse_duration         1
 parse_pitch            1
 Col_configuration      1
index 2c621ee06c5c514fd32c8825e9df2f79c1ce039f..0669c2094a60eefb89da375d30d3009667600931 100644 (file)
@@ -64,7 +64,7 @@ certain parts of LilyPond: the P stands for Printer, and the P-classes
 are supposed to be more lowlevel than the others. Example:
 
        Staff uses PStaff, PScore and PCol to do the typesetting of
-symbols. Staff is are the "brains" for PStaff
+symbols. Staff is  the "brains" for PStaff
 
 NB: in PCursor (which is part of the library) P stands for PointerCursor
 
index 577debd174a368b94659797341886db5ad7935a5..7aa470764b3bc1d677724b30d97caa32c1d8d275 100644 (file)
@@ -1,6 +1,6 @@
 
 DOCFILES=commands CodingStyle algorithms Makefile breaking\
-       slurfont pointers design literature
+       slurfont pointers design literature inputformat
 
 dist:
        ln $(DOCFILES) $(DDIR)/Documentation/
\ No newline at end of file
index 58cd69a0c5e568fe4246abf89796299387d15923..e1a317a29e05949c2c816a35abd970e4295a78c6 100644 (file)
@@ -23,3 +23,4 @@ are determined.
 
 5. Output
 
+Very simple, just walk all Line_of_* and follow the links over there
\ No newline at end of file
diff --git a/Documentation/inputformat b/Documentation/inputformat
new file mode 100644 (file)
index 0000000..e6c0de2
--- /dev/null
@@ -0,0 +1,62 @@
+General format of a construct:
+
+       BLOCKNAME {  <info to go with this block>   }
+
+Some types allow declarations:
+
+       IDENTIFIER = BLOCKNAME {
+               <info to go with this block>
+       }
+
+       ..
+
+       BLOCKNAME {
+               IDENTIFIER
+               ...
+       }
+
+
+In musicmode, eg,
+
+       ''!c8.-"text"_v
+
+
+a lot of characters parse differently
+than in "command" mode, eg,
+
+       identifier = score { .. }
+
+So you have to signal that to the tokenizer. This is done with
+'$'. '$' is a delimiter, which used by the tokenizer only.
+
+* musicmode: The brace still is used to group grammatical groups.
+* musicmode: "word" are preceded by a '\' (backslash)
+
+This means you can write some stuff in a zillion ways:
+
+1.     $\var = \blockname { ... } $
+
+2.     var = blockname { $ ... $ } 
+
+3.     var = $ $ $\blockname {  ... $ } 
+
+COMMENTS
+
+not really crystallized; you can use '#' or '%' as line comment
+
+OTHER
+
+A correctly parsed .ly does not guarantuee output. A lot (most) of the
+checking is done *after* parsing (some checks are after the break calc!)
+I'm sorry.
+
+The parser's job is to construct appropriate objects. It will *only*
+detect parse errors.
+
+LilyPond first reads 'symbol.ini', which contains declarations crucial
+to proper operation of LilyPond (symbol tables)
+
+This language looks a lot like Rayce's which in turn owes a lot to the
+POVRay raytracer. Now, I know, musictypesetting and Raytracing do not
+necessarily require the same input format, but I was just to lazy to
+make up a new/better input format. Suggestions welcome.
index 219147706d905373374bd097e6cb383ee4a5df7d..4b7e107435d77cd124fc481abc732c2a95048584 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -56,10 +56,10 @@ parser.hh: parser.cc
 version.o: $(obs) version.hh
 
 hdr/version.hh: Variables.make make_version
-       make_version $(MAJVER) $(MINVER) $(PATCHLEVEL)  > $@
+       make_version $(MAJVER) $(MINVER) $(PATCHLEVEL) "$(CXX) $(CXXVER)" > $@
 
 $(CCDIR)/lexer.cc: lexer.l
-       $(FLEX) -+ -t $< > $@
+       $(FLEX)  -t $< > $@
 
 dist:
        -mkdir $(DDIR)
diff --git a/README b/README
index 757ed1d17351d5bd3e1ca5655425b887efc1704e..310ebb1cb174a3ae4bac8dfb20230bcd23af8c1d 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,7 @@
 -*-text-*-
 
+last update: 96/12/12, 0.0.16
+
 INTRODUCTION
 
 This is a beta version of LilyPond (a music typesetter). Please send
@@ -13,16 +15,26 @@ LilyPond is updated very frequently, the latest version is always available at:
 
 PREREQUISITES
 
-TeX, the MusixTeX fonts, g++ > v2.7. The "flower" library, which
-should be available from the same source you got this from. The
-Makefile uses perl for trivial operation, but you could tinker with it
-to use sed or awk.
+Compilation:
+
+       - Unix (any decent Linux distrib is fine)
+       - GNU C++ v2.7  or better
+       - GNU make.
+       - flex
+       - bison/yacc
+       - The "flower" library
+       - which should be available from the same source you got this from.
+
+Operation:
+
+       - TeX
+       - the MusixTeX fonts
+
+The Makefile uses perl for trivial
+operations, and you could tinker with it to use sed or awk.
 
 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.
 Do:
 
        tar zxf flower-1.11.9.tar.gz
@@ -32,7 +44,11 @@ Do:
        cd lilypond-1.2.13
        make
 
-why G++ >= 2.7? LilyPond & flower lib uses builtin bool and typeof.
+why G++ >= 2.7? LilyPond & flower lib uses:
+
+       builtin bool
+       typeof
+       operator <?, operator >?
 
 USING
 
@@ -45,23 +61,22 @@ what I type in my xterm:
 
 This is what the output looks like over here.
 
-hw:~/musix/spacer$ lilypond kortjakje.ly
-LilyPond version 0.0.9 compiled on Nov  7 1996 at 23:38:21
-Parsing ... [kortjakje.ly]
-Processing ... Calculating ... 
+hw:~/musix/spacer$ lilypond maartje.ly
+LilyPond version 0.0.16 compiled on Dec 11 1996 at 13:54:27
+Parsing ... [symbol.ini][maartje.ly]
+Processing ... Calculating ... Postprocessing ... 
 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, 3076 bytes).
+(lilyponddefs.tex) (lelie.uit) [1] [2] )
+Output written on test.dvi (2 pages, 8072 bytes).
 Transcript written on test.log.
 
 hw:~/musix/spacer$ xdvi test&
-[1] 1667
-
+[1] 1468
 
 PROBLEMS
 
@@ -74,8 +89,7 @@ HOW DOES IT WORK
 * Use The Source, Luke. If you don't know C++, you can try editing
 .dstreamrc for copious debugging output. (use -d)
 
-* the subdir Documentation/ contains some in depth matter on LilyPond
-algorithms
+* the subdir Documentation/ contains some more-in-depth matter on LilyPond
 
 * The source is commented in the DOC++ style.
 Check out doc++ at
index 7a648e169b270592ae1af233e8290c1b1d8b5617..25bd89dfb16a6a760e09d0d7a0917f55b7a5d604 100644 (file)
@@ -39,7 +39,7 @@ mycc=   qlp.cc qlpsolve.cc leastsquares.cc\
        swalker.cc scoreline.cc\
        simplewalker.cc\
        texbeam.cc texslur.cc clef.cc key.cc slur.cc beam.cc\
-       idealspacing.cc inputcommand.cc grouping.cc\
+       idealspacing.cc inputcommand.cc grouping.cc identifier.cc\
        template1.cc template2.cc template3.cc template4.cc\
        version.cc
 
index 34bfb9fb6f8c83d777b88f772688511febf85dd3..35959bd20c2b270b744e51165065f10d5f947660 100644 (file)
@@ -6,10 +6,11 @@
 OPTIFLAG=-DNDEBUG -DNPRINT -O2
 DEBUGFLAG=-g
 # turn off -pipe if linker doesn't support it
-EXTRACXXFLAGS=-pipe -Wall -W  -pedantic 
+EXTRACXXFLAGS=-pipe -Wall -W   -Wmissing-prototypes 
+#      -Woverloaded-virtual
 
 ####
-#### EN USER CONFIGURABLE part.
+#### END USER CONFIGURABLE part.
 ####
 
 ifdef PROFILEFLAG
@@ -28,8 +29,9 @@ endif
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=15
+PATCHLEVEL=16
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
+CXXVER=`$(CXX) --version`
 
 # directories
 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
index 9d4ade3bcd4f1eb14101ff34f01c0212b4eeb8b5..6ce4b741d24e680a18156f11d44fea713ca54e68 100644 (file)
@@ -1,3 +1,6 @@
+
+       * PointerVec ?
+
        * PCursor -> Pointer_cursor / PointerCursor ?
 
        * efficient copy cons for List
@@ -12,9 +15,6 @@
 
        * use template handle in handle.hh for strings.
 
-       * Restricted cursor/list: make sublist from a list, and use rcursor
-as if list is as big as the sublist.
-
        * move towards gnu or STL?
 
                parsestream.h
index 83a740ac4a24fb07ec52da8b350cdd3d35cf3ce9..ca0275af87b09721188d4d3a2ed80720d5b07f5e 100644 (file)
@@ -1,6 +1,6 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=15
+PATCHLEVEL=16
 
 PACKAGENAME=flower
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
index 6fac1f55dca0d754382282d600e35d25aab5309a..f176c7486fe5738ab5150ac46f22cdfab5b1ae4c 100644 (file)
@@ -17,20 +17,24 @@ Interval::length() const {
     assert(max >= min);
     return max-min;
 }
+
 void
 Interval::unite(Interval h)
 {
+    compare(h, *this );
     if (h.min<min)
        min = h.min;
     if (h.max>max)
        max = h.max;
 }
+
 void
 Interval::intersect(Interval h)
 {
     min = MAX(h.min, min);
     max = MIN(h.max, max);
 }
+
 Interval
 intersection(Interval a, Interval const&b)
 {
@@ -38,6 +42,7 @@ intersection(Interval a, Interval const&b)
     return a;
     
 }
+
 int
 Interval::compare(const Interval&a,Interval const&b)
 {
@@ -62,8 +67,8 @@ intersect(Interval x, Interval const &y)
     return x;
 }
     
-
-Interval::operator String() const
+String
+Interval::str() const
 {
     if (empty())
        return "[empty]";
index a7a269153bf42ba9e34502011909dd0358a27bd4..5331c1d12534f78da11277ba627743905f366f20 100644 (file)
@@ -16,6 +16,9 @@
 struct Interval {
     Real min, max;
 
+    /****************/
+    
+    Real center() { return (min + max) /2;}
     void translate(Real t) {
        min += t;
        max += t;
@@ -31,6 +34,10 @@ struct Interval {
                
     }
     void unite(Interval h) ;
+    /**
+      PRE
+      *this and h are comparable
+      */
     void intersect(Interval h);
 
     Real length() const;
@@ -49,13 +56,17 @@ struct Interval {
        return *this;
     }
     bool elt_q(Real r);
-    operator String() const;
+    String str() const;
 
     /// partial ordering
     static compare(const Interval&,Interval const&);
+    /**
+      inclusion ordering. Crash if not comparable.
+      */
 };
 /**
-  this represents the closed interval [min,max]
+  this represents the closed interval [min,max].
+  No invariants
   */
 
 Interval intersection(Interval, Interval const&);
@@ -64,6 +75,19 @@ Interval intersection(Interval, Interval const&);
 
 instantiate_compare(Interval&, Interval::compare);
 
+
+inline
+Interval operator +(double a,Interval i )
+{
+    i += a;
+    return i;
+}
+
+inline
+Interval operator +(Interval i,double a ){
+    return a+i;
+}
+
 #endif // INTERVAL_HH
 
 
index 180008c4c6ea91e16ecc8b6ef30d5583f5e558ad..39913fc423956389e20f2e93df457bb4c6d36a34 100644 (file)
@@ -28,32 +28,35 @@ protected:
     /// stretch or shrink  array.
     void remax(int newmax) {    
        T* newarr = new T[newmax];
-       size = (newmax < size) ? newmax : size;
-       arrcpy(newarr, thearray, size);
+       size_ = (newmax < size_) ? newmax : size_;
+       arrcpy(newarr, thearray, size_);
        
        delete[] thearray;
        thearray = newarr;
        max = newmax;
     }
-    int size;
+    int size_;
 
 public:
     /// check invariants
     void OK() const {
-       assert(max >= size && size >=0);
+       assert(max >= size_ && size_ >=0);
        if (max) assert(thearray);
     }
-    /// report the size. See {setsize}
-    int sz() const  { return size; }
+    /// report the size_. See {setsize_}
 
-    /// POST: sz() == 0
-    void clear() { size = 0; }
+    int size() const  { return size_; }
+    int sz() const  { return size(); }
+    
+    /// POST: size() == 0
+    void clear() { size_ = 0; }
+
+    svec() { thearray = 0; max =0; size_ =0; }
 
-    svec() { thearray = 0; max =0; size =0; }
-    /// set the size to #s#
+    /// set the size_ to #s#
     void set_size(int s) {
        if (s >= max) remax(s);
-       size = s;    
+       size_ = s;    
     }
     /** POST: sz() == s.
     Warning: contents are unspecified */
@@ -62,8 +65,8 @@ public:
 
     /// return a  "new"ed copy of array 
     T* copy_array() const {
-       T* Tarray = new T[size];
-       arrcpy(Tarray, thearray, size);
+       T* Tarray = new T[size_];
+       arrcpy(Tarray, thearray, size_);
        return Tarray;
     }
     // depracated
@@ -71,60 +74,60 @@ public:
        return copy_array();    
     }
     void operator=(svec const & src) {
-       set_size (src.size);
-       arrcpy(thearray,src.thearray, size);
+       set_size (src.size_);
+       arrcpy(thearray,src.thearray, size_);
     }
     svec(const svec & src) {
        thearray = src.copy_array();
-       max = size = src.size;  
+       max = size_ = src.size_;        
     }
 
-    /// tighten array size.
-    void precompute () { remax(size); }
+    /// tighten array size_.
+    void precompute () { remax(size_); }
 
     /// this makes svec behave like an array
     T &operator[] (const int i) const {
-       assert(i >=0&&i<size);
+       assert(i >=0&&i<size_);
        return ((T*)thearray)[i];       
     }
 
     /// add to the end of array
     void add(T x) {
-       if (size == max)
+       if (size_ == max)
            remax(2*max + 1);
 
        // T::operator=(T &) is called here. Safe to use with automatic
        // vars
-       thearray[size++] = x;
+       thearray[size_++] = x;
     }
 
     /// junk last entry.
-    void pop() { size -- ; }
+    void pop() { size_ -- ; }
 
     /// return last entry
     T& last(int j=0) {
-       return (*this)[size-j-1];
+       return (*this)[size_-j-1];
     }
     T last(int j=0) const {
-       return (*this)[size-j-1];
+       return (*this)[size_-j-1];
     }
     void swap (int i,int j) {
        T t((*this)[i]);
        (*this)[i]=(*this)[j];
        (*this)[j]=t;
     }
-    bool empty() { return !size; }
+    bool empty() { return !size_; }
     void insert(T k, int j) {
-       assert(j >=0 && j<= size);
-       set_size(size+1);
-       for (int i=size-1; i > j; i--)
+       assert(j >=0 && j<= size_);
+       set_size(size_+1);
+       for (int i=size_-1; i > j; i--)
            thearray[i] = thearray[i-1];
        thearray[j] = k;
     }
     void del(int i) {
-       assert(i >=0&& i < size);
-       arrcpy(thearray+i, thearray+i+1, size-i-1);
-       size--;
+       assert(i >=0&& i < size_);
+       arrcpy(thearray+i, thearray+i+1, size_-i-1);
+       size_--;
     }
     // quicksort.
     void sort (int (*compare)(T& , T& ),
@@ -145,9 +148,17 @@ public:
        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);      
+       int s = size_;
+       set_size(size_ + src.size_);
+       arrcpy(thearray+s,src.thearray, src.size_);     
+    }
+    svec<T> subvec(int lower, int upper) {
+       assert(lower >= 0 && lower <=upper&& upper <= size_);
+       svec<T> r;
+       int s =upper-lower;
+       r.set_size(s);
+       arrcpy(r.thearray, thearray  + lower, s);
+       return r;
     }
 };
 /**
index 3ac537f63e1b84914d7bd2bc7aa014964a60087e..da4bfb6b7b913e71c11b64a9daa1ba62c1dc05e4 100644 (file)
 #include "symtable.hh"
 #include "inputstaff.hh"
 #include "inputmusic.hh"
+#include "notename.hh"
+#include "lookup.hh"
 
 #define make_id_class(Idclass, Class, accessor)        \
 struct Idclass : Identifier {\
+    virtual const char *classname() { return #Class; }\
     Idclass(String s, Class*st):Identifier(s) { data = st; }\
     virtual Class* accessor(bool copy=false) {\
        if (copy)\
@@ -24,11 +27,14 @@ struct Idclass : Identifier {\
     ~Idclass() { delete accessor(); }\
 }\
 
+
+
 make_id_class(Lookup_id, Lookup, lookup);
 make_id_class(Symtables_id, Symtables, symtables);
 make_id_class(Staff_id, Input_staff, staff);
 make_id_class(M_chord_id, Music_general_chord, mchord);
 make_id_class(M_voice_id, Music_voice, mvoice);
+make_id_class(Notetab_id, Notename_tab, notename_tab);
 
 #endif // IDENTIFIER_HH
 
index dafeed96fae0d3683fed6f5a129784bd877328fe..2e65537fc077915b564fd53477909feca410d29a 100644 (file)
@@ -17,14 +17,16 @@ struct Identifier
     
     Identifier(String n) : name(n) { }
     virtual ~Identifier() {}
-    
-    virtual Input_staff * staff(bool = false) { assert(false); }
-    virtual Horizontal_music*hmusic(bool = false) { assert(false); }
-    virtual Vertical_music*vmusic(bool = false) { assert(false); }
-    virtual Music_voice *mvoice(bool = false) { assert(false); }
-    virtual Symtables *symtables(bool = false) { assert(false); }
-    virtual Music_general_chord *mchord(bool = false) { assert(false); }
-    virtual Lookup*lookup(bool = false) { assert(false); }
+    virtual const char*classname() { return "new Identifier"; }
+    void error();
+    virtual Input_staff * staff(bool = false) { error(); return 0; }
+    virtual Horizontal_music*hmusic(bool = false) { error(); return 0; }
+    virtual Vertical_music*vmusic(bool = false) { error(); return 0; }
+    virtual Music_voice *mvoice(bool = false) { error(); return 0; }
+    virtual Symtables *symtables(bool = false) { error(); return 0; }
+    virtual Music_general_chord *mchord(bool = false) { error(); return 0; }
+    virtual Lookup*lookup(bool = false) { error(); return 0; }
+    virtual Notename_tab*notename_tab(bool = false) { error(); return 0; }
 };
 #endif // IDENTPARENT_HH
 
index 21aeaeacb486309abd72ac58c9cff65afc042293..0f32a34d488028585e82d483b1ab26ff368f9205 100644 (file)
@@ -22,7 +22,7 @@ struct Input_command {
 };
 
 Input_command* get_meterchange_command( int,int);
-Input_command* get_key_interpret_command(svec<String>);
+Input_command* get_key_interpret_command(svec<int >);
 Input_command* get_clef_interpret_command(String w);
 Input_command *get_reset_command();
 Input_command *get_partial_command(Real u);
index d33e157fe8b80ef3785e9f731f5335713fd3ef51..57ddf79443f0960b6ac8f3e0418c46bf19480c50 100644 (file)
@@ -16,25 +16,64 @@ struct Voice_list : public PointerList<Voice*> {
     void junk();
 };
 
-struct Vertical_music {
-    virtual Vertical_simple *simple() { return 0;}
+/// ABC for input structures
+struct Input_music {
     virtual Voice_list convert()=0;
     virtual Real length()=0;
     virtual void translate_time(Real dt)=0;
-    virtual Vertical_music *clone() const = 0;
-    virtual ~Vertical_music() {}
+    virtual ~Input_music();
     virtual void print() const =0;
+    // virtual void transpose(...) const =0;
+};
+/**
+
+  Input_music is anything that can simply be regarded as/converted to
+  a set of voices "cooperating" or independant. It has some basic
+  characteristics that real music has too:
+
+  - it is rhythmic (it has a length, and can be translated horizontally)
+  - a pitch (it can be transposed)
+
+  */
+
+
+
+/// 
+struct Vertical_music : Input_music {
+    virtual Vertical_music *clone() const = 0;
+
+    /// check if it is a simple voice
+    virtual Vertical_simple *simple() { return 0;}
 };
+/**
+  chord like :
+
+  - different music forms which start at the same time ( stacked "vertically" )
+
+  This class really doesn't do very much, but it enables you to say
 
-struct Horizontal_music {
+  a Music_voice is a List<Vertical_music>
+  
+  */
+
+///
+struct Horizontal_music : Input_music {
     virtual Voice_list convert()=0;
-    virtual Real length()=0;
-    virtual void translate_time(Real dt)=0;
     virtual Horizontal_music *clone() const = 0;
-    virtual ~Horizontal_music() {}
-    virtual void print() const =0;
 };
+/**
+  voice like.
+
+  different music forms which start after each other ( concatenated,
+  stacked "horizontally )
+
+  This class really doesn't do very much, but it enables you to say
 
+  a Chord is a List<Horizontal_music>
+ */
+
+/// the most basic element of a chord: a simple voice
 struct Vertical_simple : Vertical_music {
     Voice * voice_;            // should be a  real member
     
@@ -53,6 +92,7 @@ struct Vertical_simple : Vertical_music {
     virtual void print() const ;
 };
 
+/// the only child of Horizontal_music
 struct Music_voice : Horizontal_music {
     IPointerList<Vertical_music*> voice_ ;
     
@@ -70,7 +110,7 @@ struct Music_voice : Horizontal_music {
     void concatenate(Music_voice*);
     virtual void print() const ;
 };
-
+///
 struct Music_general_chord : Vertical_music {
     IPointerList<Horizontal_music*> chord_;
 
index f1cddd1e27f1024b974e2279973c16dca137672a..7284dd40eb2f54487383ad7fbb1a6bc83e8fe490 100644 (file)
@@ -4,7 +4,7 @@
 #include "proto.hh"
 
 void new_input(String s);
-bool close_input();
+
 int yylex();
 void yyerror(const char *s);
 bool busy_parsing();
index ef04a0da7cc0350d4fe9e1ef3ef61afa1ffcb176..fc134c926f6227b19927aab1f0c9173ec90a2b91 100644 (file)
@@ -1,2 +1,24 @@
+/*
+  notename.hh -- part of LilyPond
 
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef NOTENAME_HH
+#define NOTENAME_HH
+
+#include "string.hh"
+
+struct Notename_tab {
+    String notetab[7*5];
+    
+    void set(int l, int s, String nm);
+    void lookup(int &large, int &small, String s);
+};
+
+void set_notename_tab(Notename_tab*n);
 void lookup_notename(int &large, int &small, String s);
+
+
+#endif // NOTENAME_HH
+
index ab50c15a1b8ff517d99cefbc0fd07ae8ef185b3b..f0d8a4ba380e862daa9001c7c8ad8baf4182de95 100644 (file)
@@ -1,11 +1,24 @@
-#include "proto.hh"
+/*
+  parseconstruct.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
 
-void set_default_duration(String);
-void set_default_pitch(String);
+#ifndef PARSECONSTRUCT_HH
+#define PARSECONSTRUCT_HH
+
+#include "proto.hh"
+void set_default_duration(int *);
+void get_default_duration(int *);
+void set_default_octave(String);
 Staff * get_new_rhythmstaff();
-Voice_element * get_note_element(String,String);
-Voice_element* get_rest_element(String,String);
+Voice_element * get_note_element(String,int * ,int *);
+Voice_element* get_rest_element(String,int *);
 Staff * get_new_melodicstaff();
 void add_requests( Voice_element*v, svec<Request*>&req);
 Request* get_request(char);
 
+
+
+#endif // PARSECONSTRUCT_HH
+
index 5f935911474fbc4e570ed2cea36a79467b8688e4..ebc4fd1398741010b8e65072ae0186a2d929714e 100644 (file)
@@ -89,4 +89,5 @@ struct Music_general_chord;
 struct Input_score;
 struct Input_staff;
 struct Input_command;
+struct Notename_tab;
 #endif // PROTO_HH
index 967d2632c19b5fd01c0521cbb3e90a9fbad04784..392bd19678b4ccda068ef463735f372b2498804b 100644 (file)
@@ -2,7 +2,7 @@
 % 
 % bare bones version. (written down from memory :-)
 
-melodie = music {$ \octave {c}
+melodie = music {$\octave {}
        %%% theme
          c c g g       a a     g2      f f     e e     d d  c2
          g g   f f     e e     d d     g g     f f     e e     d d
@@ -12,10 +12,10 @@ melodie = music {$ \octave {c}
 $}
 
 begeleiding = $\music {
-       \octave {`c}
+       \octave { ` }
        %%% theme
        `c c    e c     f c     e c     d `b    c `a    `f `g   `c2
-       \octave {`c}
+       \octave { ` }
        e `g    d `g    c `g    `b `g   e `g    d `g    c `g    `b `g
        %%%% var 1
        r8 e8() c       r8 e8() c       r8 f8()c        r8 e8()c
index fe056efa23bb90f49ffc8810713929b7cb1d0fdb..5f42c07c51fd6b3ca185b18439abbb7e66eb9336 100644 (file)
@@ -12,6 +12,7 @@
        \newdimen\interstaffrule
 
 \def\musixtwentydefs{
+       \font\textfont=cmr10
        \font\slurufont=xslu20
        \font\slurdfont=xsld20
        \font\slurhfont=xslz20
@@ -25,6 +26,7 @@
        \musixcalc
 }
 \def\musixsixteendefs{
+       \font\textfont=cmr8
        \font\slurufont=xslu16
        \font\slurdfont=xsld16
        \font\slurhfont=xslz20 % sigh
@@ -89,7 +91,7 @@
 
 \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\generalmeter#1#2{\vbox to 0pt{\vss\textfont\hbox{#1}\hbox{#2}}}
 \def\lineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
 
 \def\beauty{%
index d580b626ecf73f6b907c9b1dbaeef15083be7cf1..912f9e97eed459d17332c2ae79593ad7c9f13dec 100644 (file)
@@ -45,7 +45,7 @@ staff { melodic
 
        commands {
        skip 0:0.125
-       skip 2:0
+       skip 1:0 % BUG!!
        key $ fis cis gis $
        skip 2:0
        key $ $
index 5098f79f1dac681710002891e9b6a4247e8a7392..188855e0f977fe5f8410a77c0e86311821c82b64 100755 (executable)
@@ -5,4 +5,5 @@ echo '#define MAJORVERSION ' $1
 echo '#define MINORVERSION ' $2
 echo '#define PATCHLEVEL ' $3
 echo '#define VERSIONSTR "'$1.$2.$3'"'
+echo '#define COMPILER "'$4'"'
 echo '#endif'
index c8fb84fcb1b679bc3d9d93f9b0f0475cf5661935..5c1703cfc9955e6ae2233cfcc9e81f73de421405 100644 (file)
--- a/pavane.ly
+++ b/pavane.ly
@@ -8,7 +8,7 @@
 horn =
 staff {melodic
        music{  $
-       \octave { 'c }
+       \octave { ' }
        \duration { 8}
 
 % 1
@@ -20,7 +20,7 @@ staff {melodic
 % 11
        )`b [`fis `a `b] cis4 `b4       `fis2 r2
        cis4 d4()[d cis d e]
-\octave { c }
+       \octave { '` }
                                        a4 gis2.
        a4 b4()[b a b 'cis]             fis4 e4 cis2
        e4 fis4 () [fis e fis gis]      cis4 `b4()`b8 r8 r4
@@ -31,7 +31,7 @@ staff {melodic
        cis4 `b4()`b8 r8 r4             r1
        r2 r4 r4                        
 %% cut 'n paste.
-       \octave { 'c }
+       \octave { ' }
        d2( [)d e cis `b]               `a4 [`b cis] [cis `b] `b4
        fis2( [)fis g e d]              cis4 [d e(] [)e fis d cis]
        `b4 [cis d(] [)d e cis `b]      cis2 r2
index 6c7e6599cf8e7780b495ae1f109b64aab01774ce..c897ebfc6650eb35cc56a591c368f5a50d508772 100644 (file)
@@ -124,6 +124,9 @@ Beam::process()
 {
     calculate();
 
+    /*
+      quick and dirty!
+      */
     for (PCursor<Stem*> i(stems); i.ok(); i++)
        i->beams_left = i->beams_right = intlog2(ABS(i->flag)) - 2;
 
@@ -192,7 +195,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)
        
     if (next){
        int rhalfs = here->beams_right - next->beams_left;
-       int rwholebeams = here->beams_right <? next->beams_left; // g++
+       int rwholebeams = here->beams_right <? next->beams_left; 
 
        Real w = next->hpos() - here->hpos();
        Atom a = paper()->lookup_->beam(sl, w + stemdx);
index 8a133bdd5c7ecf3a3ebb9084a21fadaffd12ac47..1ac2cc0bcb9af7deb4ddd34e0785692d3e8fc4df 100644 (file)
@@ -3,18 +3,6 @@
 #include "parseconstruct.hh"
 #include "command.hh"
 
-Command*
-get_key_interpret_command(svec<Scalar> which)
-{
-    Command*c = new Command;
-    c->code = INTERPRET;    
-    c->args= which;
-    String k("KEY");
-    c->args.insert(k,0 );
-    c->priority = 200;
-    return c;
-}
-
 Command*
 get_key_typeset_command(svec<Scalar>which)
 {
diff --git a/src/identifier.cc b/src/identifier.cc
new file mode 100644 (file)
index 0000000..5b55289
--- /dev/null
@@ -0,0 +1,11 @@
+#include <assert.h>
+
+#include "identparent.hh"
+#include "lexer.hh"
+
+void
+Identifier::error()
+{
+    String e("Wrong identifier type: ");
+    yyerror(e + classname());
+}
index 121271e4f0daecaa56da60e5686b3a95e86dba77..938fc3e01a04cf1edad1a49969c5090ca0a1f0f3 100644 (file)
@@ -61,13 +61,13 @@ get_grouping_command(svec<int>a )
 }
 
 Input_command*
-get_key_interpret_command(svec<String>a ) 
+get_key_interpret_command(svec<int >a ) 
 {
     Input_command*c = new Input_command;
     c->args.add("KEY");
-    for (int i=0; i < a.sz(); i ++)
+    for (int i=0; i < a.sz(); i ++) {
        c->args.add(a[i]);
-    
+    }
     return c;
 }
 
index 45d00e1fb604c011be1bdb9d01bffbcf5864afa1..6d3186bf73b4373b0a16a44b6454f0c8c96482f9 100644 (file)
@@ -1,7 +1,9 @@
 #include "debug.hh"
 #include "inputmusic.hh"
 #include "voice.hh"
-
+Input_music::~Input_music()
+{
+}
 Vertical_simple::Vertical_simple()
 {
     voice_ = new Voice;
index 55c79c0e1f68519455ff53c4a7307eaef36abc59..0a5af6ffd79acc28aad423c94201da84320c820a 100644 (file)
@@ -1,5 +1,4 @@
 #include "key.hh"
-#include "notename.hh"
 
 const int OCTAVES=14;
 const int ZEROOCTAVE=7;
@@ -44,9 +43,9 @@ Key::read(svec<Scalar> s)
     for (int j = 0; j < 7; j++)
        accidentals[j] = 0;
    
-    for (int i=0; i < s.sz(); i++) {
-       int large, small;
-       lookup_notename(large, small, s[i]);
+    for (int i=0; i < s.sz(); ) {
+       int large = s[i++];
+       int small = s[i++];
        accidentals[large]=small;
 
        newkey.add(large);
@@ -65,8 +64,8 @@ Key::oldkey_undo(svec<Scalar>s)
        newkey[i] = 0;
        
     for (int i=0; i < s.sz(); i++) {
-       int large, small;
-       lookup_notename(large, small, s[i]);
+       int large = s[i++];
+       int small = s[i++];
        newkey[large] = small;
     }
     for (int i=0; i < newkey.sz(); i++)
index f83cf144df65ff5f045910cba000c2de60e2aefe..c5c51f70b69b1e519ade8cc5c0460c99bb7a495d 100644 (file)
@@ -4,14 +4,32 @@
 #include <stdio.h>
 #include "glob.hh"
 #include "string.hh"
-
+#include "notename.hh"
 #include "lexer.hh"
 #include "keyword.hh"
 #include "vray.hh"
 #include "parser.hh"
 #include "debug.hh"
+#include "sstack.hh"
+
+struct Input_file {
+       istream*is;
+       int line;
+       String name;
+
+       Input_file(String);
+       ~Input_file();
+};
+
+/// lexer with provisions for include files.
+struct My_flex_lexer : yyFlexLexer {
+    sstack<Input_file*> include_stack;
+    void new_input(String s);
+    bool  close_input();
+};
+
+My_flex_lexer *lexer=0;
 
-sstack<istream *> include_stack;
 static int last_print;
 const int DOTPRINT=50; // every 50 lines dots
 %}
@@ -26,20 +44,23 @@ const int DOTPRINT=50; // every 50 lines dots
 %x quote
 
 
-NOTECOMMAND    \\{WORD}
+
+A              [a-zA-Z]
+AA             {A}|_
+N              [0-9]
+AN             {AA}|{N}
+
+WORD           {A}{AN}*
+ALPHAWORD      {A}+
+INT            -?{N}+
+REAL           {INT}(\.{N}*)?
+
 OPTSIGN                !?
-NOTENAMEI       A|B|C|D|E|F|G|As|Bes|Ces|Des|Es|Fes|Ges|Ais|Bis|Cis|Dis|Eis|Fis|Gis
-NOTENAMEII     a|b|c|d|e|f|g|as|bes|ces|des|es|fes|ges|ais|bis|cis|dis|eis|fis|gis
-NOTENAMEIII      Ases|Beses|Ceses|Deses|Eses|Feses|Geses|Aisis|Bisis|Cisis|Disis|Eisis|Fisis|Gisis
-NOTENAMEIIII      ases|beses|ceses|deses|eses|feses|geses|aisis|bisis|cisis|disis|eisis|fisis|gisis
-RESTNAME        r|s
-NOTENAME        {NOTENAMEI}|{NOTENAMEII}|{NOTENAMEIII}|{NOTENAMEIIII}
-PITCH          ['`]*{OPTSIGN}{NOTENAME}
-DURNAME                1|2|4|8|16|32
-DURATION       {DURNAME}\.*
-FULLNOTE       {PITCH}{DURATION}?
-WORD           [a-zA-Z][a-zA-Z0-9_]+
-REAL           -?[0-9]+(\.[0-9]*)?
+PITCHMOD       ['`]*{OPTSIGN}
+RESTNAME       r|s|p
+NOTECOMMAND    \\{WORD}
+NOTENAME       {ALPHAWORD}
+DOTS           \.+
 
 %%
 
@@ -47,9 +68,27 @@ REAL         -?[0-9]+(\.[0-9]*)?
        BEGIN(notes); 
 }
 
+<notes>{RESTNAME}      {
+       const char *s = YYText();
+       yylval.string = new String (s); 
+       mtor << "rest:"<< yylval.string;
+       return RESTNAME;
+}
+
+<notes>{NOTENAME}      {
+       int *p=yylval.ii;
+       lookup_notename(p[0], p[1], YYText());
+       mtor << "notename: "<< YYText()<<eol;
+       if (p[0] < 0) {
+               String e("notename does not exist: ");
+               error(e + YYText());
+       }
+       return NOTENAME;
+}
+
 <notes>{NOTECOMMAND}   {
        String c = YYText() +1;
-
+       mtor << "\\word: " << YYText()+1<<eol;
        int l = lookup_keyword(c);
        if (l != -1)
                return l;
@@ -59,34 +98,33 @@ REAL                -?[0-9]+(\.[0-9]*)?
                return IDENTIFIER;
        }
        String *sp = new String( c);
-       mtor << "new id: " << *sp;
+
        yylval.string=sp;
        return NEWIDENTIFIER;
 }
 
-<notes>{RESTNAME}      {
-       const char *s = YYText();
-       yylval.string = new String (s); 
-       mtor << "rest:"<< yylval.string;
-       return RESTNAME;
-}
-<notes>{PITCH} {
+<notes>{PITCHMOD}      {
        const char *s = YYText();
+       mtor << "pitchmod:"<< YYText()<<eol;
        yylval.string = new String (s);
-       mtor << "pitch:"<< *yylval.string;
-       return PITCH;
+       return PITCHMOD;
 }
-<notes>{DURATION}      {
-       yylval.string = new String (YYText());
-       return DURATION;
+<notes>{DOTS}          {
+       yylval.i = strlen(YYText());
+       return DOTS;
+}
+<notes>{INT}           {
+       yylval.i = String(YYText()).value();
+       return INT;
 }
 <notes>\|              {
 }
 <notes>[:space:]+              {
 }
-<notes>[ \t\n]+                {
+<notes>[%#].*\n                { 
+
 }
-<notes>[%#].*$         { 
+<notes>[ \t\n]+                {
 
 }
 <notes>\$      {
@@ -122,10 +160,14 @@ REAL              -?[0-9]+(\.[0-9]*)?
 }
 
 <<EOF>> {
-       if(!close_input())
-               yyterminate();
+       mtor << "<<EOF>>";
+
+       if (! ((My_flex_lexer*) this)->close_input())
+         yyterminate(); // can't move this, since it actually rets a YY_NULL
 }
+
 {WORD}         {
+       mtor << "word: " << YYText()<<eol;
        String c = YYText();
        int l = lookup_keyword(c);
        if (l != -1)
@@ -136,7 +178,7 @@ REAL                -?[0-9]+(\.[0-9]*)?
                return IDENTIFIER;
        }
        String *sp = new String( c);
-       mtor << "new id: " << *sp;
+       mtor << "new id: " << *sp << eol;
        yylval.string=sp;
        return NEWIDENTIFIER;
 }
@@ -145,12 +187,12 @@ REAL              -?[0-9]+(\.[0-9]*)?
        Real r;
        int cnv=sscanf (YYText(), "%lf", &r);
        assert(cnv == 1);
-       mtor  << "token (REAL)" << r;
+       mtor  << "REAL" << r<<'\n';
        yylval.real = r;
        return REAL;
 }
 
-[\{\}\[\]\(\)] {
+[{}]   {
 
        mtor << "parens\n";
        return YYText()[0];
@@ -175,7 +217,23 @@ REAL               -?[0-9]+(\.[0-9]*)?
 
 %%
 
-yyFlexLexer *lexer=0;
+int
+yylex() {
+       return lexer->yylex();
+}
+
+void
+yyerror(const char *s)
+{
+    String e;
+    if (lexer->include_stack.empty()) {
+       *mlog << "error at EOF" << s;
+    }else 
+       *mlog << lexer->include_stack.top()->name <<  ": " <<
+        lexer->lineno() <<  ": error:" << s << '\n';
+  exit(1);
+}
+
 
 bool
 busy_parsing()
@@ -183,65 +241,78 @@ busy_parsing()
     return lexer;      
 }
 
-// set the  new input to s, remember old file.
 void
-new_input(String s)
-{    
-    istream *newin ;
-    
-    if (s=="")
-       newin = &cin;
-    else
-       newin = new ifstream( s ); //
-    
-   if ( ! *newin)
-      error("cant open "  + s);
-   cout << "["<<s<<flush;
-   
-   include_stack.push(newin);
+kill_lexer()
+{
+       delete lexer;
+       lexer = 0;
+}
 
-   if (!lexer) {
-       lexer = new yyFlexLexer;
-       lexer->set_debug( !monitor.silence("Lexer"));
+void
+new_input(String s)
+{
+    if (!lexer) {
+       lexer = new My_flex_lexer;
+       lexer->set_debug( !monitor.silence("Lexer") && check_debug);
    }           
-   
-   lexer->switch_streams(newin);
+   lexer->new_input(s);
 }
 
+/****************/
 
-// pop the inputstack.
-bool
-close_input()
+Input_file::Input_file(String s)
 {
-
-  istream *closing= include_stack.pop();
-  if (closing != &cin)
-      delete closing;
-  
-  cout << "]" << flush;
-  
-  if (include_stack.empty()) {
-       return false ;
-  } else 
-      lexer->switch_streams(include_stack.top());  
-  return true;  
+    name = s;
+    line = 1;
+    if (s=="")
+       is = &cin;
+    else
+       is = new ifstream( s ); //
+    
+   if ( ! *is) {
+       String e("cant open "  + s);
+       if (lexer)
+             yyerror(e);
+       else
+             error(e);
+   }
+   cout << "["<<s<<flush;
 }
 
-int
-yylex() {
-       return lexer->yylex();
+Input_file::~Input_file()
+{
+  if (is != &cin)
+      delete is;
+  cout << "]" << flush;  
 }
+/****************/
 
+// set the  new input to s, remember old file.
 void
-yyerror(const char *s)
-{
-  *mlog << "error in line " << lexer->lineno() <<  ": " << s << '\n';
-  exit(1);
+My_flex_lexer::new_input(String s)
+{    
+   if (!include_stack.empty())
+       include_stack.top()->line = lineno();
+
+   Input_file *newin = new Input_file(s);
+   include_stack.push(newin);
+   switch_streams(newin->is);
+   yylineno = 1;
 }
 
-void
-kill_lexer()
+// pop the inputstack.
+bool
+My_flex_lexer::close_input()
 {
-       delete lexer;
-       lexer = 0;
+    Input_file *old = include_stack.pop();
+     bool ok =         true;
+    if (include_stack.empty()) {
+       ok = false;
+    } else {
+       Input_file *i = include_stack.top();
+       switch_streams(i->is);
+       yylineno = i->line;     
+    }
+    delete old;
+    return ok;
 }
index 35f20603bae481460dcfe4a1fbced1bc25e61239..7ff09dfc347d0cd3016806fb923053070de042b2 100644 (file)
@@ -32,6 +32,7 @@ void notice()
        "LilyPond, a music typesetter.\n"
        "Copyright (C) 1996 by\n"
        "  Han-Wen Nienhuys <hanwen@stack.nl>\n"
+       "  Jan-Nieuwenhuizen <jan@digicash.com>\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"
index f5911c0edad611c963299d78135bbfc9798b6fe8..fe269792eb8ca11e2bfd8eec6eda7e1acbff96fb 100644 (file)
 
 int default_duration = 4, default_dots=0, default_octave=0;
 
-void
-parse_duration(const char *a, int &j, int &intdur, int &dots)
-{    
-    String durstr;    
-    while (isdigit(a[j])) 
-       {
-       durstr += a[j++];
-       }
-
-    dots=default_dots;
-    
-    while (a[j] == '.') 
-       {
-       j++;
-       dots++;
-       }
-    
-    intdur = (durstr.len()) ?
-       durstr.value():default_duration;
-
-    mtor << "dur " << intdur << "dots " << dots<<eol;
-}
-
-
 void
 parse_octave (const char *a, int &j, int &oct)
 {    
@@ -50,14 +26,11 @@ parse_octave (const char *a, int &j, int &oct)
 }
 
 void 
-parse_pitch( const char *a, int &j, int &oct, bool & overide_acc,
-            int & large, int & small)
+parse_pitchmod( const char *a, int &j, int &oct, bool & overide_acc)
 {
     // octave
     oct =default_octave;
     parse_octave(a,j,oct);
-
-    mtor << "oct " << oct;
        
     // accidental
     overide_acc = false;
@@ -68,36 +41,20 @@ parse_pitch( const char *a, int &j, int &oct, bool & overide_acc,
        j++;
        }
 
-    
-    // notename.
-    String nm;
-    while (isalpha(a[j])) 
-       {
-       nm += a[j++];
-       }
-    if (isupper(nm[0]))
-       {
-       oct--;  
-       nm.lower();
-       }
-        
-
-    lookup_notename(large,small,nm);
-    mtor << "override: " << overide_acc;    
-    mtor << "pitch "<< large <<", "<<small<<"\n";    
+    mtor << "oct " << oct;
+    mtor << "override: " << overide_acc;        
 }
 
 
 Voice_element *
-get_note_element(String pitch, String durstr)
+get_note_element(String pitch, int * notename, int * duration )
 {
     Voice_element*v = new Voice_element;
     int i=0;
     
-    int dur, dots;
-    parse_duration(durstr, i, dur, dots);
-    i=0;
-
+    int dur = duration[0];
+    int dots=duration[1];
+    
     Note_req * rq = new Note_req;
 
     if (dur >= 2) {
@@ -105,13 +62,12 @@ get_note_element(String pitch, String durstr)
        v->add(st);
     }
     
-    int oct, pit, acc;
+    int oct;
     bool forceacc;
-    parse_pitch(pitch, i, oct, forceacc, pit, acc);
-    rq->name =pit;
-    
+    parse_pitchmod(pitch, i, oct, forceacc);
+    rq->name =notename[0];
+    rq->accidental = notename[1];
     rq->octave = oct;
-    rq->accidental = acc;
     rq->forceacc = forceacc;
     rq->balltype = dur;
     rq->dots = dots;
@@ -124,19 +80,14 @@ get_note_element(String pitch, String durstr)
 }
 
 Voice_element *
-get_rest_element(String, String durstr)
+get_rest_element(String,  int * duration )
 {    
     Voice_element*v = new Voice_element;
-    int i=0;
-    
-    int dur, dots;
-    parse_duration(durstr, i, dur, dots);
-    i=0;
 
     Rest_req * rq = new Rest_req;
   
-    rq->balltype = dur;
-    rq->dots = dots;    
+    rq->balltype = duration[0];
+    rq->dots = duration[1];    
     rq->print();
     v->add(rq);
 
@@ -144,15 +95,22 @@ get_rest_element(String, String durstr)
 }
 
 void
-set_default_duration(String d)
+get_default_duration(int *p)
 {
-    int i=0;
-    parse_duration(d, i, default_duration, default_dots);
+   *p++ = default_duration;
+    *p = default_dots;
+}
+
+void
+set_default_duration(int *p)
+{
+     default_duration = *p++;
+     default_dots = *p++;
 }
 
 
 void
-set_default_pitch(String d)
+set_default_octave(String d)
 {
     int i=0;
     default_octave=0;
index 8ebc4df2442a6bc0ffaab666259ccf31970d4a41..dec6d47701c222d1f5143266674fab14f510b2dd 100644 (file)
@@ -1,30 +1,48 @@
 #include "glob.hh"
 #include "string.hh"
+#include "notename.hh"
+#include "lexer.hh"
+#include "identifier.hh"
 
+static Notename_tab * defaulttab = 0;
 
-/// change this along with lex file for other notenames.
-const char *notetab[] = 
+void
+set_notename_tab(Notename_tab*n)
 {
-"ceses", "ces", "c", "cis", "cisis",
-"deses", "des", "d", "dis", "disis",
-"eses", "es", "e", "eis", "eisis",
-"feses", "fes", "f", "fis", "fisis",
-"geses", "ges", "g", "gis", "gisis",
-"ases", "as", "a", "ais", "aisis",
-"beses", "bes", "b", "bis", "bisis",
-0
-};
+    delete defaulttab;
+    defaulttab = n;
+}
 
 void
 lookup_notename(int &large, int &small, String s)
 {
-    int i;
-    for (i =0; notetab[i]; i++)
+    if (!defaulttab)
+       set_notename_tab(lookup_identifier("default_table")->
+                        notename_tab(true));
+    
+    defaulttab->lookup(large, small, s);
+}
+    
+
+void
+Notename_tab::lookup(int &large, int &small, String s)
+{    
+    large = -1;
+    small = 0;
+
+    for (int i =0; i < 7*5; i++)
        if (s == notetab[i]) 
            {
            large = i /5;
            small = i %5 - 2;
            return;         
            }
-    assert(false);    
+}
+
+
+void
+Notename_tab::set(int l, int s, String n)
+{
+    assert(l < 8 && s <= 2 && s >= -2 && l >=0);
+    notetab[l * 5 + s +2] = n;
 }
index 29fcd240e43598cc25efb5fdbb665163465e0edc..fe2a30d136a9d1f875a16a73bb39863ffd60b4ca 100644 (file)
@@ -4,7 +4,7 @@
 #include "debug.hh"
 #include "lookup.hh"
 #include "dimen.hh"
-#include "textdb.hh"
+
 
 
 // golden ratio
index 87c685a4d977f5a9f0dc4d26575556c0e7623b47..91f6deaca13cb144edfe2a8284be02916a614ae6 100644 (file)
@@ -1,7 +1,7 @@
 %{ // -*-Fundamental-*-
 #include <iostream.h>
-#include "lookup.hh"
 
+#include "lookup.hh"
 #include "lexer.hh"
 #include "paper.hh"
 #include "inputstaff.hh"
@@ -15,7 +15,6 @@
 #include "dimen.hh"
 #include "identifier.hh"
 
-
 #ifndef NDEBUG
 #define YYDEBUG 1
 #endif
@@ -42,6 +41,7 @@ Paperdef*default_paper();
     Music_voice *mvoice; 
     int i;
     char c;
+    int ii[10];
 
     svec<String> * strvec;
     svec<Input_command*> *commandvec;
@@ -55,6 +55,7 @@ Paperdef*default_paper();
     Lookup*lookup;
     Interval *interval;
     Box *box;
+    Notename_tab *notename_tab;
 }
 
 %token VOICE STAFF SCORE TITLE  BAR NOTENAME OUTPUT
@@ -62,22 +63,23 @@ Paperdef*default_paper();
 %token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND
 %token KEY CLEF VIOLIN BASS MULTI TABLE CHORD VOICES
 %token PARTIAL RHYTHMIC MELODIC MUSIC GROUPING
-
-%token END SYMBOLTABLES TEXID TABLE 
+%token END SYMBOLTABLES TEXID TABLE NOTENAMES
 
 %token <id>  IDENTIFIER
 %token <string> NEWIDENTIFIER 
-%token <string> PITCH DURATION RESTNAME
+%token <string> PITCHMOD DURATION RESTNAME
+%token <ii> NOTENAME 
 %token <real> REAL
 %token <string> STRING
 %token <i> OPEN_REQUEST_PARENS CLOSE_REQUEST_PARENS
-
+%token <i> DOTS INT
 %type <consstr> unit
+%type <intvec> pitch_list
 
 %type <id> declaration 
 %type <paper> paper_block paper_body
 %type <real> dim
-
+%type <ii> duration
 %type <el> voice_elt full_element
 %type <command> score_command staff_command skipcommand
 %type <score> score_block score_body
@@ -87,8 +89,7 @@ Paperdef*default_paper();
 %type <commandvec> score_commands_block score_commands_body
 %type <commandvec> staff_commands_block staff_commands_body
 %type <request> post_request pre_request
-%type <strvec> pitch_list
-%type <string> clef_id
+%type <string> clef_id pitchmod
 %type <vertical> vertical_music  
 %type <chord> music_chord music_chord_body
 %type <horizontal>  horizontal_music
@@ -99,7 +100,7 @@ Paperdef*default_paper();
 %type <symtable> symtable symtable_body
 %type <lookup> symtables symtables_body
 %type <symbol> symboldef
-
+%type <notename_tab> notename_tab notename_tab_body
 
 %%
 
@@ -108,6 +109,11 @@ mudela:    /* empty */
                add_score($2);
        }
        | mudela add_declaration { }
+       | mudela mudela_command  {}
+       ;
+
+mudela_command:
+       notename_tab                    { set_notename_tab($1); }
        ;
 
 /*
@@ -135,8 +141,27 @@ declaration:
                $$ = new Lookup_id(*$1, $3);
                delete $1;
        }
+       | NEWIDENTIFIER '=' notename_tab {
+               $$ = new Notetab_id(*$1, $3);
+               delete $1;
+       }
        ;
 
+notename_tab:
+       NOTENAMES '{' notename_tab_body '}'     { $$ = $3; }
+       ;
+
+notename_tab_body:                             {
+               $$ = new Notename_tab;
+       }
+       | IDENTIFIER                            {
+               $$ = $1->notename_tab(true);
+       }
+       | notename_tab_body STRING int int                      {
+               $$->set($3, $4, *$2);
+               delete $2;
+       }
+       ;
 
 /*
        SCORE
@@ -181,7 +206,7 @@ staff_commands_body:
 
 staff_command:
        skipcommand
-       | KEY  pitch_list       {/*UGH*/
+       | KEY pitch_list        {/*UGH*/
                $$ = get_key_interpret_command(*$2);
                delete $2;
        }
@@ -332,7 +357,7 @@ post_request:
        CLOSE_REQUEST_PARENS            { $$ = get_request($1); }
        ;
 
-pre_requests:   
+pre_requests:
        | pre_requests pre_request {
                pre_reqs.add($2);
        }
@@ -342,54 +367,68 @@ pre_request:
        OPEN_REQUEST_PARENS             { $$ = get_request($1); }
        ;
 
+
+
 voice_command:
-       DURATIONCOMMAND '{' DURATION '}'        {
-               set_default_duration(*$3);
-               delete $3;
+       DURATIONCOMMAND '{' duration '}'        {
+               set_default_duration($3);
        }
-       | OCTAVECOMMAND '{' PITCH '}'   {
-               set_default_pitch(*$3);
+       | OCTAVECOMMAND '{' pitchmod '}'        {
+               set_default_octave(*$3);
                delete $3;
        }
        ;
 
-voice_elt:
-       PITCH DURATION                  {
-               $$ = get_note_element(*$1, *$2);
-               delete $1;
-               delete $2;
+duration:              {
+               get_default_duration($$);
        }
-       |  RESTNAME DURATION            {
-               $$ = get_rest_element(*$1, *$2);
-               delete $1;
-               delete $2;
+       | int           {
+               get_default_duration($$);
+               $$[0] = $1;
        }
-       | PITCH                         { $$ = get_note_element(*$1, "");
+       | int DOTS      {
+               $$[0] = $1;
+               $$[1] = $2;
+       }
+       ;
+
+pitchmod:              { $$ = new String; }
+       |PITCHMOD       
+       ;
+
+voice_elt:     
+       pitchmod NOTENAME duration                      {
+               $$ = get_note_element(*$1, $2, $3);
                delete $1;
        }
-       |  RESTNAME             { $$ = get_rest_element(*$1, "");
+       | RESTNAME duration             {
+               $$ = get_rest_element(*$1, $2);
                delete $1;
+
        }
        ;
+
 /*
        UTILITIES
 */
 pitch_list:                    {
-               $$ = new svec<String>;
+               $$ = new svec<int>;
        }
-       | pitch_list PITCH      {
-               $$->add(*$2);
-               delete $2;              
+       | pitch_list NOTENAME   {
+               $$->add($2[0]);
+               $$->add($2[1]);         
        }
+       ;
 
 int:
        REAL                    {
                $$ = int($1);
                if (ABS($1-Real(int($$))) > 1e-8)
                        yyerror("expecting integer number");
-               
        }
+       | INT
        ;
+
 int_list:
        /* */           {
                $$ = new svec<int>;
@@ -496,6 +535,5 @@ parse_file(String s)
 Paperdef*
 default_paper()
 {
-       return  new Paperdef(
-               lookup_identifier("default_table")->lookup(true));
+       return new Paperdef(lookup_identifier("default_table")->lookup(true));
 }
index 2be27345d30d4b38eddf7dfe0d331e059b4e2455..ca468ee6ae3c71698dd5a8448801ee08fc090e26 100644 (file)
@@ -75,41 +75,41 @@ Score::create_cols(Real w)
     c1->musical = false;
     c2->musical = true;
     
-    PCursor<Score_column*> scc(cols_);
+    PCursor<Score_column*> i(cols_);
 
-    for (; scc.ok(); scc++) {
-       assert(scc->when != w);
-       if (scc->when > w)
+    for (; i.ok(); i++) {
+       assert(i->when != w);
+       if (i->when > w)
            break;
     }
 
-    if (!scc.ok()) {
+    if (!i.ok()) {
        cols_.bottom().add(c1);
        cols_.bottom().add(c2);
-       scc = cols_.bottom();
-       scc --;
+       i = cols_.bottom();
+       i --;
     } else {
-       scc.insert(c1);
-       scc.insert(c2);
-       scc -= 2;
+       i.insert(c1);
+       i.insert(c2);
+       i -= 2;
     }
-    return scc;
+    return i;
 }
 
 PCursor<Score_column*>
 Score::find_col(Real w,bool mus)
 {
-    PCursor<Score_column*> scc(cols_);
-    for (; scc.ok(); scc++) {
-       if (scc->when == w && scc->musical == mus)
-           return scc;
-       if (scc->when > w)
+    PCursor<Score_column*> i(cols_);
+    for (; i.ok(); i++) {
+       if (i->when == w && i->musical == mus)
+           return i;
+       if (i->when > w)
            break;
     }
-    scc = create_cols(w);
+    i = create_cols(w);
     if (mus)
-       scc++;
-    return scc;
+       i++;
+    return i;
 }
 
 void
@@ -124,8 +124,8 @@ Real
 Score::last() const
 {    
     Real l = 0;
-    for (PCursor<Staff*> stc(staffs_); stc.ok(); stc++) {
-       l = MAX(l, stc->last());
+    for (PCursor<Staff*> i(staffs_); i.ok(); i++) {
+       l = MAX(l, i->last());
     }
     return l;
 }
index 8b46ec771b9e35471682d2e665e634abd2569f9e..5d9eb0de44ba6fc95718b54aab88f76d76fa0026 100644 (file)
@@ -85,10 +85,9 @@ Slur::brew_molecule()
     assert(left->line == right->line);
     int minp=1000, maxp=-1000; // todo
     for (int i=0; i<encompass.sz(); i++) {
-       minp = MIN(encompass[i]->position, minp);
-       maxp = MAX(encompass[i]->position, maxp);
-    }
-    
+       minp = encompass[i]->position <? minp;
+       maxp = encompass[i]->position <? maxp;
+    }    
     assert(encompass.sz()>0);  // todo
     int pos1 = encompass.last()->position;
     int pos2 = encompass[0]->position;
index 521d31635dbdb5a6d848bcb38ecde545a9c99913..cbe0e59bbb77130da3d916c76c82ce6776488d78 100644 (file)
@@ -30,12 +30,12 @@ Staff::paper() const
 void
 Staff::clean_cols()
 {
-    PCursor<Staff_column *> stc(cols);
-    for(; stc.ok(); ){
-       if (!stc->score_column->used())
-           stc.del();
+    PCursor<Staff_column *> i(cols);
+    for(; i.ok(); ){
+       if (!i->score_column->used())
+           i.del();
        else
-           stc++;
+           i++;
     }
 }
 
index ce9507f8b830d6dd9572034011d84fb1f4bdeffb..d9ffea7afbb565ae1d13bafd8d0dfebeb0bb1bed 100644 (file)
@@ -1,6 +1,6 @@
 #include "symbol.hh"
 #include "vray.hh"
-#include "textdb.hh"
+
 
 Symbol::Symbol()
     :    dim(Interval(0,0),Interval(0,0))
index bc5d173869d79c60cbd074914581b56d784e7077..87ed983da3e7187d9db0f1b36978644ca0fc823b 100644 (file)
@@ -1,5 +1,4 @@
 #include "misc.hh"
-#include "textdb.hh"
 #include "dimen.hh"
 #include "debug.hh"
 #include "real.hh"
@@ -7,6 +6,7 @@
 #include "assoc.hh"
 #include "associter.hh"
 #include "symtable.hh"
+
 Symtables::Symtables()
 {
 }
index a61676159a7784f51991297abb6eaf39a67e42e9..5e199beb9eee7ca6412b9f735007293c928a7b8b 100644 (file)
@@ -32,6 +32,7 @@ static Keyword_ent the_key_tab[]={
     "start", START_T,
     "table", TABLE,
     "symboltables", SYMBOLTABLES,
+    "notenames", NOTENAMES,
     "texid", TEXID,
     "chord", CHORD,
     "multi", MULTI,
index 4a7fe02bc29b97d2048375109edaf00c2adfbf6f..eab9822940842a201bc1660efc10047fc42371b8 100644 (file)
@@ -174,7 +174,7 @@ Lookup::big_slur(int dy , Real &dx, int dir)
 {
     assert(dx >= convert_dimen(24,"pt"));
     Real slur_extra =ABS(dy)  /2.0 + 2; 
-    int l_dy = Real (dy)/2 + slur_extra*dir;
+    int l_dy = int(Real (dy)/2 + slur_extra*dir);
     int r_dy =  dy - l_dy;
     
     Real left_wid = dx/4.0;
index 401273b6b11d1cbca02641a59759aa1ada638f6b..3e81f115004fcdb96b213eed418c61f5ef5cf48f 100644 (file)
@@ -1,6 +1,7 @@
 #include "version.hh"
 
-static char *s = "LilyPond version " VERSIONSTR " compiled on " __DATE__ " at " __TIME__ "\n";
+static char *s = "LilyPond version " VERSIONSTR " compiled on "
+   __DATE__ " at " __TIME__ " with " COMPILER "\n";
 
 const char *
 get_version()
index 3e149c7a669040d6eaceb6cbb7e41ff883594cc4..fc53d30f8d9591902dd9864a282cbdf6c68d551c 100644 (file)
@@ -1,6 +1,6 @@
 %
-% spacing info for LilyPond. Do not edit this. It has a lot of hard-wired stringconstants
-%
+% spacing info for LilyPond. Do not edit this.
+% It has a lot of hard-wired stringconstants
 %
 
 table_sixteen = symboltables {
@@ -95,8 +95,8 @@ table_sixteen = symboltables {
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 table_twenty = symboltables {
-       
-       texid   "\musixtwentydefs"
+
+    texid      "\musixtwentydefs"
 
 
     % index TeXstring,         xmin xmax ymin ymax
@@ -184,4 +184,32 @@ table_twenty = symboltables {
 
 }
 
-default_table = symboltables { table_sixteen }
\ No newline at end of file
+%
+% common dutch names for notes. "es" means flat, "is" means sharp
+%
+
+dutch_names = notenames {
+       "ceses" 0 -2 "ces" 0 -1         "c" 0 0         "cis" 0 1 "cisis" 0 2
+       "deses" 1 -2 "des" 1 -1         "d" 1 0         "dis" 1 1 "disis" 1 2
+       "eses"  2 -2 "es"  2 -1         "e" 2 0         "eis" 2 1 "eisis" 2 2
+       "feses" 3 -2 "fes" 3 -1         "f" 3 0         "fis" 3 1 "fisis" 3 2
+       "geses" 4 -2 "ges" 4 -1         "g" 4 0         "gis" 4 1 "gisis" 4 2
+       "ases"  5 -2 "as"  5 -1         "a" 5 0         "ais" 5 1 "aisis" 5 2
+       "beses" 6 -2 "bes" 6 -1         "b" 6 0         "bis" 6 1 "bisis" 6 2
+}
+
+%
+% f = flat, s = sharp.
+%
+english_names = notenames {
+       "cff" 0 -2 "cf" 0 -1    "c" 0 0         "cs" 0 1 "css" 0 2
+       "dff" 1 -2 "df" 1 -1    "d" 1 0         "ds" 1 1 "dss" 1 2
+       "eff" 2 -2 "ef" 2 -1    "e" 2 0         "es" 2 1 "ess" 2 2
+       "fff" 3 -2 "ff" 3 -1    "f" 3 0         "fs" 3 1 "fss" 3 2
+       "gff" 4 -2 "gf" 4 -1    "g" 4 0         "gs" 4 1 "gss" 4 2
+       "aff" 5 -2 "af" 5 -1    "a" 5 0         "as" 5 1 "ass" 5 2
+       "bff" 6 -2 "bf" 6 -1    "b" 6 0         "bs" 6 1 "bss" 6 2
+}
+
+default_table = symboltables { table_sixteen }
+notenames { dutch_names }
\ No newline at end of file