diff options
author | Han-Wen Nienhuys <hanwen@xs4all.nl> | 1996-12-21 00:03:06 +0100 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@xs4all.nl> | 1996-12-21 00:03:06 +0100 |
commit | afa9eb0922477ed70c182b3fc023a3baedb5c6f0 (patch) | |
tree | ceb7dfb3f73a4670111f1433f97f09914c959def | |
parent | b346828b743d4fe2636a6e58597b3cb6d547357d (diff) |
release: 0.0.16
48 files changed, 696 insertions, 366 deletions
diff --git a/.dstreamrc b/.dstreamrc index a449d3f574..2a2dc43002 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -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 diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index 2c621ee06c..0669c2094a 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle @@ -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 diff --git a/Documentation/Makefile b/Documentation/Makefile index 577debd174..7aa470764b 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -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 diff --git a/Documentation/design b/Documentation/design index 58cd69a0c5..e1a317a29e 100644 --- a/Documentation/design +++ b/Documentation/design @@ -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 index 0000000000..e6c0de2261 --- /dev/null +++ b/Documentation/inputformat @@ -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. @@ -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) @@ -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 diff --git a/Sources.make b/Sources.make index 7a648e169b..25bd89dfb1 100644 --- a/Sources.make +++ b/Sources.make @@ -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 diff --git a/Variables.make b/Variables.make index 34bfb9fb6f..35959bd20c 100644 --- a/Variables.make +++ b/Variables.make @@ -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) diff --git a/flower/TODO b/flower/TODO index 9d4ade3bcd..6ce4b741d2 100644 --- a/flower/TODO +++ b/flower/TODO @@ -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 diff --git a/flower/Variables.make b/flower/Variables.make index 83a740ac4a..ca0275af87 100644 --- a/flower/Variables.make +++ b/flower/Variables.make @@ -1,6 +1,6 @@ MAJVER=1 MINVER=0 -PATCHLEVEL=15 +PATCHLEVEL=16 PACKAGENAME=flower VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL) diff --git a/flower/interval.cc b/flower/interval.cc index 6fac1f55dc..f176c7486f 100644 --- a/flower/interval.cc +++ b/flower/interval.cc @@ -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]"; diff --git a/flower/interval.hh b/flower/interval.hh index a7a269153b..5331c1d125 100644 --- a/flower/interval.hh +++ b/flower/interval.hh @@ -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 diff --git a/flower/vray.hh b/flower/vray.hh index 180008c4c6..39913fc423 100644 --- a/flower/vray.hh +++ b/flower/vray.hh @@ -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; } }; /** diff --git a/hdr/identifier.hh b/hdr/identifier.hh index 3ac537f63e..da4bfb6b7b 100644 --- a/hdr/identifier.hh +++ b/hdr/identifier.hh @@ -11,9 +11,12 @@ #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 diff --git a/hdr/identparent.hh b/hdr/identparent.hh index dafeed96fa..2e65537fc0 100644 --- a/hdr/identparent.hh +++ b/hdr/identparent.hh @@ -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 diff --git a/hdr/inputcommand.hh b/hdr/inputcommand.hh index 21aeaeacb4..0f32a34d48 100644 --- a/hdr/inputcommand.hh +++ b/hdr/inputcommand.hh @@ -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); diff --git a/hdr/inputmusic.hh b/hdr/inputmusic.hh index d33e157fe8..57ddf79443 100644 --- a/hdr/inputmusic.hh +++ b/hdr/inputmusic.hh @@ -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_; diff --git a/hdr/lexer.hh b/hdr/lexer.hh index f1cddd1e27..7284dd40eb 100644 --- a/hdr/lexer.hh +++ b/hdr/lexer.hh @@ -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(); diff --git a/hdr/notename.hh b/hdr/notename.hh index ef04a0da7c..fc134c926f 100644 --- a/hdr/notename.hh +++ b/hdr/notename.hh @@ -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 + diff --git a/hdr/parseconstruct.hh b/hdr/parseconstruct.hh index ab50c15a1b..f0d8a4ba38 100644 --- a/hdr/parseconstruct.hh +++ b/hdr/parseconstruct.hh @@ -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 + diff --git a/hdr/proto.hh b/hdr/proto.hh index 5f93591147..ebc4fd1398 100644 --- a/hdr/proto.hh +++ b/hdr/proto.hh @@ -89,4 +89,5 @@ struct Music_general_chord; struct Input_score; struct Input_staff; struct Input_command; +struct Notename_tab; #endif // PROTO_HH diff --git a/kortjakje.ly b/kortjakje.ly index 967d2632c1..392bd19678 100644 --- a/kortjakje.ly +++ b/kortjakje.ly @@ -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 diff --git a/lilyponddefs.tex b/lilyponddefs.tex index fe056efa23..5f42c07c51 100644 --- a/lilyponddefs.tex +++ b/lilyponddefs.tex @@ -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{% diff --git a/maartje.ly b/maartje.ly index d580b626ec..912f9e97ee 100644 --- a/maartje.ly +++ b/maartje.ly @@ -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 $ $ diff --git a/make_version b/make_version index 5098f79f1d..188855e0f9 100755 --- a/make_version +++ b/make_version @@ -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' @@ -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 diff --git a/src/beam.cc b/src/beam.cc index 6c7e6599cf..c897ebfc66 100644 --- a/src/beam.cc +++ b/src/beam.cc @@ -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); diff --git a/src/getcommands.cc b/src/getcommands.cc index 8a133bdd5c..1ac2cc0bcb 100644 --- a/src/getcommands.cc +++ b/src/getcommands.cc @@ -4,18 +4,6 @@ #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) { Command*c = new Command; diff --git a/src/identifier.cc b/src/identifier.cc new file mode 100644 index 0000000000..5b552898a9 --- /dev/null +++ b/src/identifier.cc @@ -0,0 +1,11 @@ +#include <assert.h> + +#include "identparent.hh" +#include "lexer.hh" + +void +Identifier::error() +{ + String e("Wrong identifier type: "); + yyerror(e + classname()); +} diff --git a/src/inputcommand.cc b/src/inputcommand.cc index 121271e4f0..938fc3e01a 100644 --- a/src/inputcommand.cc +++ b/src/inputcommand.cc @@ -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; } diff --git a/src/inputmusic.cc b/src/inputmusic.cc index 45d00e1fb6..6d3186bf73 100644 --- a/src/inputmusic.cc +++ b/src/inputmusic.cc @@ -1,7 +1,9 @@ #include "debug.hh" #include "inputmusic.hh" #include "voice.hh" - +Input_music::~Input_music() +{ +} Vertical_simple::Vertical_simple() { voice_ = new Voice; diff --git a/src/key.cc b/src/key.cc index 55c79c0e1f..0a5af6ffd7 100644 --- a/src/key.cc +++ b/src/key.cc @@ -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++) diff --git a/src/lexer.l b/src/lexer.l index f83cf144df..c5c51f70b6 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -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; } diff --git a/src/main.cc b/src/main.cc index 35f20603ba..7ff09dfc34 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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" diff --git a/src/note.cc b/src/note.cc index f5911c0eda..fe269792eb 100644 --- a/src/note.cc +++ b/src/note.cc @@ -11,30 +11,6 @@ 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) { while (1) @@ -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; diff --git a/src/notename.cc b/src/notename.cc index 8ebc4df244..dec6d47701 100644 --- a/src/notename.cc +++ b/src/notename.cc @@ -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; } diff --git a/src/paper.cc b/src/paper.cc index 29fcd240e4..fe2a30d136 100644 --- a/src/paper.cc +++ b/src/paper.cc @@ -4,7 +4,7 @@ #include "debug.hh" #include "lookup.hh" #include "dimen.hh" -#include "textdb.hh" + // golden ratio diff --git a/src/parser.y b/src/parser.y index 87c685a4d9..91f6deaca1 100644 --- a/src/parser.y +++ b/src/parser.y @@ -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)); } diff --git a/src/score.cc b/src/score.cc index 2be27345d3..ca468ee6ae 100644 --- a/src/score.cc +++ b/src/score.cc @@ -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; } diff --git a/src/slur.cc b/src/slur.cc index 8b46ec771b..5d9eb0de44 100644 --- a/src/slur.cc +++ b/src/slur.cc @@ -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; diff --git a/src/staff.cc b/src/staff.cc index 521d31635d..cbe0e59bbb 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -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++; } } diff --git a/src/symbol.cc b/src/symbol.cc index ce9507f8b8..d9ffea7afb 100644 --- a/src/symbol.cc +++ b/src/symbol.cc @@ -1,6 +1,6 @@ #include "symbol.hh" #include "vray.hh" -#include "textdb.hh" + Symbol::Symbol() : dim(Interval(0,0),Interval(0,0)) diff --git a/src/symtable.cc b/src/symtable.cc index bc5d173869..87ed983da3 100644 --- a/src/symtable.cc +++ b/src/symtable.cc @@ -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() { } diff --git a/src/table.cc b/src/table.cc index a61676159a..5e199beb9e 100644 --- a/src/table.cc +++ b/src/table.cc @@ -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, diff --git a/src/texslur.cc b/src/texslur.cc index 4a7fe02bc2..eab9822940 100644 --- a/src/texslur.cc +++ b/src/texslur.cc @@ -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; diff --git a/src/version.cc b/src/version.cc index 401273b6b1..3e81f11500 100644 --- a/src/version.cc +++ b/src/version.cc @@ -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() diff --git a/symbol.ini b/symbol.ini index 3e149c7a66..fc53d30f8d 100644 --- a/symbol.ini +++ b/symbol.ini @@ -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 |