From: fred Date: Sun, 24 Mar 2002 19:34:48 +0000 (+0000) Subject: lilypond-0.0.41 X-Git-Tag: release/1.5.59~5217 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d60a92df22e293e74178b383c4f9a3a77513e1e3;p=lilypond.git lilypond-0.0.41 --- diff --git a/.dstreamrc b/.dstreamrc index 2b36f41544..c7b8c24c77 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -1,4 +1,5 @@ # class name silence? +Dstream 1 My_flex_lexer 1 yyFlexLexer 1 @@ -23,9 +24,9 @@ Lexer 1 parse_duration 1 parse_pitchmod 1 Col_configuration 1 -Request 1 -Note_req 1 -Rhythmic_req 1 +Request 0 +Note_req 0 +Rhythmic_req 0 Rest_req 1 delete_identifiers 1 Command 1 @@ -39,7 +40,7 @@ Input_cursor 1 Commands_at 1 Input_command 1 Time_description 1 -Melodic_req 1 +Melodic_req 0 Midi_walker 1 Stem_req 1 Group_change_req 1 diff --git a/Documentation/language.pod b/Documentation/language.pod index e316fdc14e..88a008ca23 100644 --- a/Documentation/language.pod +++ b/Documentation/language.pod @@ -1,3 +1,4 @@ + =head1 NAME language.pod -- state of the art mudela-vapourware. @@ -129,6 +130,17 @@ voices on one staff? We might be able to do without the staff{} construct, but I doubt if it will make things easier. +=head1 CONCRETE PROPOSAL + +Any optional request/modifier should follow the note/rest-name/lyric: + + old new + ''!a a!'' + [a()a]()a a[( a)]( a) + +the []() construct doesn't look nice. We might make an exception for +spanning requests. + =head1 THOUGHTS =head2 Typing diff --git a/TODO b/TODO index b3d03f91ba..89b5570bf1 100644 --- a/TODO +++ b/TODO @@ -14,12 +14,12 @@ before 0.1 * caching of Register_group_register hierarchies. - * midi esp.: use I32 iso int where 32 bits are needed (or assumed...) - This is an assorted collection of stuff that will be done, might be done, or is an idea that I want to think about STUFF + * midi esp.: use I32 iso int where 32 bits are needed (or assumed...) + * generate all (.hh) files into out dirs * sort out headers, see m2m @@ -29,9 +29,6 @@ STUFF * make install. BUGS - - * barf if no score_wde_music - * plet bugs: scales.ly * key at clef change. @@ -46,12 +43,12 @@ BUGS * Group_feature at start of music. + * parser error handling (can you say Segfault?) + SEVERELY LACKING: * grace notes - * dynamics (hairpins) - INPUTLANGUAGE * lose the $ and @ ? @@ -134,7 +131,9 @@ FUTURE * implement better breaking algorithm - * Implement all requests + * Text_crescendo + + * clean solution for staffsize in items. * merge key{item} & localkey{item}? diff --git a/init/dutch.ini b/init/dutch.ini index 6502ec4452..884dfd0df7 100644 --- a/init/dutch.ini +++ b/init/dutch.ini @@ -2,17 +2,82 @@ % common dutch names for notes. "es" means flat, "is" means sharp % +ceses = melodic { 0 0 -2 0 } +ces = melodic { 0 0 -1 0 } +c = melodic { 0 0 0 0 } +cis = melodic { 0 0 1 0 } +cisis = melodic { 0 0 2 0 } +deses = melodic { 0 1 -2 0 } +des = melodic { 0 1 -1 0 } +d = melodic { 0 1 0 0 } +dis = melodic { 0 1 1 0 } +disis = melodic { 0 1 2 0 } +eses = melodic { 0 2 -2 0 } +es = melodic { 0 2 -1 0 } +e = melodic { 0 2 0 0 } +eis = melodic { 0 2 1 0 } +eisis = melodic { 0 2 2 0 } +feses = melodic { 0 3 -2 0 } +fes = melodic { 0 3 -1 0 } +f = melodic { 0 3 0 0 } +fis = melodic { 0 3 1 0 } +fisis = melodic { 0 3 2 0 } +geses = melodic { 0 4 -2 0 } +ges = melodic { 0 4 -1 0 } +g = melodic { 0 4 0 0 } +gis = melodic { 0 4 1 0 } +gisis = melodic { 0 4 2 0 } +ases = melodic { 0 5 -2 0 } +as = melodic { 0 5 -1 0 } +a = melodic { 0 5 0 0 } +ais = melodic { 0 5 1 0 } +aisis = melodic { 0 5 2 0 } +beses = melodic { 0 6 -2 0 } +bes = melodic { 0 6 -1 0 } +b = melodic { 0 6 0 0 } +bis = melodic { 0 6 1 0 } +bisis = melodic { 0 6 2 0 } -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 -} + +% +% upper case: 1 octave lower. +% + + +Ceses = melodic { -1 0 -2 0 } +Ces = melodic { -1 0 -1 0 } +C = melodic { -1 0 0 0 } +Cis = melodic { -1 0 1 0 } +Cisis = melodic { -1 0 2 0 } +Deses = melodic { -1 1 -2 0 } +Des = melodic { -1 1 -1 0 } +D = melodic { -1 1 0 0 } +Dis = melodic { -1 1 1 0 } +Disis = melodic { -1 1 2 0 } +Eses = melodic { -1 2 -2 0 } +Es = melodic { -1 2 -1 0 } +E = melodic { -1 2 0 0 } +Eis = melodic { -1 2 1 0 } +Eisis = melodic { -1 2 2 0 } +Feses = melodic { -1 3 -2 0 } +Fes = melodic { -1 3 -1 0 } +F = melodic { -1 3 0 0 } +Fis = melodic { -1 3 1 0 } +Fisis = melodic { -1 3 2 0 } +Geses = melodic { -1 4 -2 0 } +Ges = melodic { -1 4 -1 0 } +G = melodic { -1 4 0 0 } +Gis = melodic { -1 4 1 0 } +Gisis = melodic { -1 4 2 0 } +Ases = melodic { -1 5 -2 0 } +As = melodic { -1 5 -1 0 } +A = melodic { -1 5 0 0 } +Ais = melodic { -1 5 1 0 } +Aisis = melodic { -1 5 2 0 } +Beses = melodic { -1 6 -2 0 } +Bes = melodic { -1 6 -1 0 } +B = melodic { -1 6 0 0 } +Bis = melodic { -1 6 1 0 } +Bisis = melodic { -1 6 2 0 } -notenames { dutch_names } \ No newline at end of file diff --git a/init/dynamic.ini b/init/dynamic.ini index 000439dce6..da3725b2ed 100644 --- a/init/dynamic.ini +++ b/init/dynamic.ini @@ -4,7 +4,7 @@ pp = dynamic { 6 } p = dynamic { 5 } mp = dynamic { 4 } mf = dynamic { 3 } -f = dynamic { 2 } +df = dynamic { 2 } % f is a notename too. ff = dynamic { 1 } fff = dynamic { 0 } diff --git a/init/swedish.ini b/init/swedish.ini index b3c26940da..f120a6a701 100644 --- a/init/swedish.ini +++ b/init/swedish.ini @@ -3,17 +3,39 @@ % % by Mats Bengtsson. -swedish_names = -notenames { - "cessess" 0 -2 "cess" 0 -1 "c" 0 0 "ciss" 0 1 "cississ" 0 2 - "dessess" 1 -2 "dess" 1 -1 "d" 1 0 "diss" 1 1 "dississ" 1 2 - "essess" 2 -2 "ess" 2 -1 "e" 2 0 "eiss" 2 1 "eississ" 2 2 - "fessess" 3 -2 "fess" 3 -1 "f" 3 0 "fiss" 3 1 "fississ" 3 2 - "gessess" 4 -2 "gess" 4 -1 "g" 4 0 "giss" 4 1 "gississ" 4 2 - "assess" 5 -2 "ass" 5 -1 "a" 5 0 "aiss" 5 1 "aississ" 5 2 - "hessess" 6 -2 "b" 6 -1 "h" 6 0 "hiss" 6 1 "hississ" 6 2 -} - - -notenames { swedish_names } +cessess = melodic { 0 0 -2 0 } +cess = melodic { 0 0 -1 0 } +c = melodic { 0 0 0 0 } +ciss = melodic { 0 0 1 0 } +cississ = melodic { 0 0 2 0 } +dessess = melodic { 0 1 -2 0 } +dess = melodic { 0 1 -1 0 } +d = melodic { 0 1 0 0 } +diss = melodic { 0 1 1 0 } +dississ = melodic { 0 1 2 0 } +essess = melodic { 0 2 -2 0 } +ess = melodic { 0 2 -1 0 } +e = melodic { 0 2 0 0 } +eiss = melodic { 0 2 1 0 } +eississ = melodic { 0 2 2 0 } +fessess = melodic { 0 3 -2 0 } +fess = melodic { 0 3 -1 0 } +f = melodic { 0 3 0 0 } +fiss = melodic { 0 3 1 0 } +fississ = melodic { 0 3 2 0 } +gessess = melodic { 0 4 -2 0 } +gess = melodic { 0 4 -1 0 } +g = melodic { 0 4 0 0 } +giss = melodic { 0 4 1 0 } +gississ = melodic { 0 4 2 0 } +assess = melodic { 0 5 -2 0 } +ass = melodic { 0 5 -1 0 } +a = melodic { 0 5 0 0 } +aiss = melodic { 0 5 1 0 } +aississ = melodic { 0 5 2 0 } +hessess = melodic { 0 6 -2 0 } +b = melodic { 0 6 -1 0 } +h = melodic { 0 6 0 0 } +hiss = melodic { 0 6 1 0 } +hississ = melodic { 0 6 2 0 } diff --git a/input/standchen.ly b/input/standchen.ly index 672d747bf5..98daf3b69f 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -93,28 +93,28 @@ melodie = music { $ \clef\violin %#% =f2. | f2. | %%23 - [ a8._\mf 'cis16 ] 'f4. 'e | + [ a8.\mf 'cis16 ] 'f4. 'e | %%24 [ 'd8. a16 ] fis4. d | %%25 %#% 'cis\grace\stemup - [ b_\mf( ) ais b ]2/3 'd4. b | + [ b\mf( ) ais b ]2/3 'd4. b | %%26 { a2. fis2. } | %#%\tighten\newline %%27 - [ 'e_\f( )'dis 'e ]2/3 'g4. 'cis | + [ 'e\df( )'dis 'e ]2/3 'g4. 'cis | %%28 { 'd2. fis2. } | %#%\volta1 %%29 - { \music { bes2( [ 'd8.( ))g16 ] } \music{ g2_\mf [ bes8. bes16 ] } } | + { \music { bes2( [ 'd8.( ))g16 ] } \music{ g2\mf [ bes8. bes16 ] } } | %%30 { \music{ a4. [ a-. a-. a-. ] } \music{ fis4. [ fis-.( fis-. )fis-. ] } } | %%31 { \music{ a4. [ a-. a-. a-. ] } \music{ g4. [ cis-.( e-. )g-. ] } } | %%32 - { a2 fis2_\pp } { a4 fis4 } | + { a2 fis2\pp } { a4 fis4 } | %%33 %#% { b2(^ g2 } [v { 'd8.( b8. } { b16 ) ) g16 } ] | { \music{ b2( [ 'd8.( ) )g16 ] } \music{ g2 [ b8. b16 ] } } | @@ -141,12 +141,12 @@ melodie = music { $ \clef\violin 'cis2 r4 | %%41 %#% { > 'fis4. 'cis4._f } 'e [ 'e( ) 'd >! 'cis ] | - { 'fis4. 'cis4.\f } 'e [ 'e( )'d 'cis ]2/3 | + { 'fis4. 'cis4.\df } 'e [ 'e( )'d 'cis ]2/3 | %%42 [ b8. 'cis16 ] 'd4^> b r | %%43 %#% [^ { b8._{ }_{ }_{ }_{ }_{ }_f g2. } 'cis16 ] 'd4^> b r | - [ b8.\f 'cis16 ] 'd4^> b r | + [ b8.\df 'cis16 ] 'd4^> b r | %%44 %#% [^ { > b8. fis2 } 'cis16 ] 'd4^> b >! r | [ b8. 'cis16 ] 'd4^> b r | @@ -157,7 +157,7 @@ melodie = music { $ \clef\violin %#% { =a2. fis2. } | { a2. fis2. } | %%47 - [ 'e\f( )'dis 'e ]2/3 'g4.^> 'cis | + [ 'e\df( )'dis 'e ]2/3 'g4.^> 'cis | %%48 %#% { fis2.(v ='d2.\stemup(^ } % { fis2. 'd2. } | @@ -171,7 +171,7 @@ melodie = music { $ \clef\violin %%51 { a2. cis2. } | %%52 - { fis2 d2 } { a4 fis4_\pp } | + { fis2 d2 } { a4 fis4\pp } | %%53 %#% { bes2 g2 } [ { 'd8.^>( bes8. } { ) bes16 g16 } ] | { bes2 g2 } { [ 'd8.^> bes8. } { bes16 g16 ] } | diff --git a/lib/include/proto.hh b/lib/include/proto.hh index 4b3a8f91c5..a58e2969c1 100644 --- a/lib/include/proto.hh +++ b/lib/include/proto.hh @@ -1,3 +1,4 @@ + /* proto.hh -- part of LilyPond @@ -100,7 +101,6 @@ struct Command_req; struct Note_req; struct Notehead; struct Notehead_register; -struct Notename_tab; struct Offset; struct Output; struct PCol; @@ -135,6 +135,7 @@ struct Source; struct Source_file; struct Spacing_req ; struct Span_req; +struct Span_dynamic_req; struct Spanner; struct Subtle_req; struct Staff; diff --git a/lily/bar-reg.cc b/lily/bar-reg.cc index b72eca8755..c7c0d05e3d 100644 --- a/lily/bar-reg.cc +++ b/lily/bar-reg.cc @@ -8,7 +8,7 @@ #include "bar-reg.hh" #include "bar.hh" -#include "commandrequest.hh" +#include "command-request.hh" #include "score-column.hh" #include "time-description.hh" diff --git a/lily/clef-reg.cc b/lily/clef-reg.cc index 2d9dcc112b..791b724083 100644 --- a/lily/clef-reg.cc +++ b/lily/clef-reg.cc @@ -10,7 +10,7 @@ #include "clef-reg.hh" #include "clef-item.hh" #include "debug.hh" -#include "commandrequest.hh" +#include "command-request.hh" #include "time-description.hh" #include "staff-column.hh" diff --git a/lily/crescendo.cc b/lily/crescendo.cc new file mode 100644 index 0000000000..9b2a169631 --- /dev/null +++ b/lily/crescendo.cc @@ -0,0 +1,36 @@ +/* + crescendo.cc -- implement Crescendo + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "crescendo.hh" +#include "lookup.hh" +#include "paper-def.hh" + +Crescendo::Crescendo(int s) +{ + staff_size_i_ = s; + grow_dir_i_ =0; + dir_i_ = -1 ; +} + +Spanner* +Crescendo::do_break_at(PCol*, PCol*)const +{ + return new Crescendo(*this); +} + + +Molecule* +Crescendo::brew_molecule_p() const return m_p ; +{ + m_p = new Molecule; + Real w_f = width().length(); + Symbol s( paper()->lookup_l()->hairpin(w_f, grow_dir_i_ < 0) ); + m_p->add(Atom(s)); + int pos = (dir_i_ >0) ? staff_size_i_ + 4 : - 4 ; + m_p->translate(Offset(0,pos * paper()->internote())); +} diff --git a/lily/dynamic-reg.cc b/lily/dynamic-reg.cc index 88f0b502f4..0ea23ac689 100644 --- a/lily/dynamic-reg.cc +++ b/lily/dynamic-reg.cc @@ -7,7 +7,7 @@ */ #include "dynamic-reg.hh" -#include "musicalrequest.hh" +#include "musical-request.hh" #include "text-item.hh" #include "lookup.hh" #include "paper-def.hh" diff --git a/lily/headreg.cc b/lily/headreg.cc index dc5d72d572..7f1a9bbae8 100644 --- a/lily/headreg.cc +++ b/lily/headreg.cc @@ -8,7 +8,7 @@ #include "headreg.hh" #include "paper-def.hh" #include "complex-walker.hh" -#include "musicalrequest.hh" +#include "musical-request.hh" Notehead_register::Notehead_register() { diff --git a/lily/identifier.cc b/lily/identifier.cc index fbf806edf7..e4712f8a5a 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -49,9 +49,3 @@ Real_id::do_print() const mtor << *((Real_id*)this)->real(false)<< "\n"; } -void -Notetab_id::do_print() const -{ - mtor << "unknown" << "\n"; -} - diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh new file mode 100644 index 0000000000..3d5a1eb18d --- /dev/null +++ b/lily/include/command-request.hh @@ -0,0 +1,117 @@ +/* + command-request.hh -- declare Non musical requests + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef COMMANDREQUEST_HH +#define COMMANDREQUEST_HH + +#include "request.hh" +#include "varray.hh" + +/** Request which are assumed to be "happening" before the + musical requests. */ +struct Command_req : virtual Request { + REQUESTMETHODS(Command_req, command); + + virtual Measure_grouping_req * measuregrouping() { return 0; } + virtual Clef_change_req * clefchange() { return 0; } + virtual Key_change_req * keychange() { return 0; } + virtual Partial_measure_req * partial() { return 0; } + virtual Meter_change_req * meterchange() { return 0; } + virtual Bar_req *bar() { return 0; } + virtual Cadenza_req *cadenza() { return 0; } + virtual Timing_req*timing() { return 0; } +}; + + +/** Baseclass for meter/partial req. It has to be handled by + Staff_{walker,column} baseclass. */ +struct Timing_req : Command_req { + REQUESTMETHODS(Timing_req, timing); +}; + + +struct Partial_measure_req : Timing_req { + Moment duration_; + + Partial_measure_req(Moment); + REQUESTMETHODS(Partial_measure_req, partial); +}; + +/** + todo: allow C meter + */ +struct Meter_change_req : Timing_req { + int beats_i_, one_beat_i_; + + Meter_change_req(); + void set(int,int); + REQUESTMETHODS(Meter_change_req, meterchange); +}; + +/// toggle Cadenza mode +struct Cadenza_req : Timing_req { + /// turn on? + bool on_b_; + Cadenza_req(bool); + REQUESTMETHODS(Cadenza_req,cadenza); +}; + +/// check if we're at start of a measure. +struct Barcheck_req : Timing_req { + + REQUESTMETHODS(Barcheck_req,barcheck); +}; + +struct Measure_grouping_req: Timing_req { + Array beat_i_arr_; + Array elt_length_arr_; + + REQUESTMETHODS(Measure_grouping_req, measuregrouping); +}; + +struct Group_change_req : Command_req { + String newgroup_str_; + REQUESTMETHODS(Group_change_req, groupchange); +}; + +/** draw a (repeat)-bar. This something different than #Barcheck_req#, + the latter should only happen at the start of a measure. */ +struct Bar_req : Command_req { + String type_str_; + Bar_req(String); + int compare(const Bar_req&)const; + REQUESTMETHODS(Bar_req,bar); +}; +struct Terminate_voice_req : Command_req { + REQUESTMETHODS(Terminate_voice_req,terminate); +}; + +struct Group_feature_req : Command_req { + int stemdir_i_; + Group_feature_req(); + REQUESTMETHODS(Group_feature_req, groupfeature); +}; + + +struct Key_change_req : Command_req { + Array melodic_p_arr_; + + Key_change_req(); + Key_change_req(Key_change_req const&); + ~Key_change_req(); + REQUESTMETHODS(Key_change_req, keychange); +}; + +struct Clef_change_req : Command_req { + String clef_str_; + Clef_change_req(String); + REQUESTMETHODS(Clef_change_req, clefchange); +}; + +#endif // COMMANDREQUEST_HH diff --git a/lily/include/commandrequest.hh b/lily/include/commandrequest.hh index 71b8331661..e69de29bb2 100644 --- a/lily/include/commandrequest.hh +++ b/lily/include/commandrequest.hh @@ -1,117 +0,0 @@ -/* - commandrequest.hh -- declare Non musical requests - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef COMMANDREQUEST_HH -#define COMMANDREQUEST_HH - -#include "request.hh" -#include "varray.hh" - -/** Request which are assumed to be "happening" before the - musical requests. */ -struct Command_req : virtual Request { - REQUESTMETHODS(Command_req, command); - - virtual Measure_grouping_req * measuregrouping() { return 0; } - virtual Clef_change_req * clefchange() { return 0; } - virtual Key_change_req * keychange() { return 0; } - virtual Partial_measure_req * partial() { return 0; } - virtual Meter_change_req * meterchange() { return 0; } - virtual Bar_req *bar() { return 0; } - virtual Cadenza_req *cadenza() { return 0; } - virtual Timing_req*timing() { return 0; } -}; - - -/** Baseclass for meter/partial req. It has to be handled by - Staff_{walker,column} baseclass. */ -struct Timing_req : Command_req { - REQUESTMETHODS(Timing_req, timing); -}; - - -struct Partial_measure_req : Timing_req { - Moment duration_; - - Partial_measure_req(Moment); - REQUESTMETHODS(Partial_measure_req, partial); -}; - -/** - todo: allow C meter - */ -struct Meter_change_req : Timing_req { - int beats_i_, one_beat_i_; - - Meter_change_req(); - void set(int,int); - REQUESTMETHODS(Meter_change_req, meterchange); -}; - -/// toggle Cadenza mode -struct Cadenza_req : Timing_req { - /// turn on? - bool on_b_; - Cadenza_req(bool); - REQUESTMETHODS(Cadenza_req,cadenza); -}; - -/// check if we're at start of a measure. -struct Barcheck_req : Timing_req { - - REQUESTMETHODS(Barcheck_req,barcheck); -}; - -struct Measure_grouping_req: Timing_req { - Array beat_i_arr_; - Array elt_length_arr_; - - REQUESTMETHODS(Measure_grouping_req, measuregrouping); -}; - -struct Group_change_req : Command_req { - String newgroup_str_; - REQUESTMETHODS(Group_change_req, groupchange); -}; - -/** draw a (repeat)-bar. This something different than #Barcheck_req#, - the latter should only happen at the start of a measure. */ -struct Bar_req : Command_req { - String type_str_; - Bar_req(String); - int compare(const Bar_req&)const; - REQUESTMETHODS(Bar_req,bar); -}; -struct Terminate_voice_req : Command_req { - REQUESTMETHODS(Terminate_voice_req,terminate); -}; - -struct Group_feature_req : Command_req { - int stemdir_i_; - Group_feature_req(); - REQUESTMETHODS(Group_feature_req, groupfeature); -}; - - -struct Key_change_req : Command_req { - Array melodic_p_arr_; - - Key_change_req(); - Key_change_req(Key_change_req const&); - ~Key_change_req(); - REQUESTMETHODS(Key_change_req, keychange); -}; - -struct Clef_change_req : Command_req { - String clef_str_; - Clef_change_req(String); - REQUESTMETHODS(Clef_change_req, clefchange); -}; - -#endif // COMMANDREQUEST_HH diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh new file mode 100644 index 0000000000..858cd44075 --- /dev/null +++ b/lily/include/crescendo.hh @@ -0,0 +1,27 @@ +/* + crescendo.hh -- declare Crescendo + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef CRESCENDO_HH +#define CRESCENDO_HH + +#include "spanner.hh" + +class Crescendo : public Spanner { + int staff_size_i_; +public: + int grow_dir_i_; + int dir_i_; + Crescendo(int staff_size_i); +private: + Spanner* do_break_at( PCol*, PCol*) const; + Molecule*brew_molecule_p()const; + NAME_MEMBERS(Crescendo); +}; + +#endif // CRESCENDO_HH diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index aa8d110012..6312582bf0 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -12,7 +12,6 @@ #include "symtable.hh" #include "input-staff.hh" #include "input-music.hh" -#include "notename.hh" #include "lookup.hh" #include "script-def.hh" #include "request.hh" @@ -38,7 +37,6 @@ 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); make_id_class(Request_id, Request, request); #endif // IDENTIFIER_HH diff --git a/lily/include/identparent.hh b/lily/include/identparent.hh index 8071dcd4f5..a8b75b0fd3 100644 --- a/lily/include/identparent.hh +++ b/lily/include/identparent.hh @@ -34,7 +34,6 @@ struct Identifier { IDACCESSOR(Music_general_chord, mchord) IDACCESSOR(Lookup,lookup) IDACCESSOR(Real,real) - IDACCESSOR(Notename_tab, notename_tab) IDACCESSOR(Request, request) protected: diff --git a/lily/include/input-music.hh b/lily/include/input-music.hh index 1d7a8caa66..7a35bbfd19 100644 --- a/lily/include/input-music.hh +++ b/lily/include/input-music.hh @@ -61,7 +61,6 @@ struct Simple_music : Input_music { virtual Input_music *clone() const { return new Simple_music(*this); } - }; /// Complex_music consists of multiple voices @@ -76,7 +75,6 @@ struct Complex_music : Input_music { void concatenate(Complex_music*); virtual bool find_plet_start_bo(char c, Moment& moment_r); virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i); - }; diff --git a/lily/include/lexer.hh b/lily/include/lexer.hh index 6a9d21a98e..8a55f1a585 100644 --- a/lily/include/lexer.hh +++ b/lily/include/lexer.hh @@ -23,15 +23,14 @@ void set_lexer(); /// lexer with provisions for include files. struct My_flex_lexer : yyFlexLexer { - Array include_stack; - Assoc *the_id_tab; - Keyword_table * keytable; - Notename_tab * defaulttab; + Array include_stack_; + Assoc *identifier_assoc_p_; + Keyword_table * keytable_p_; int errorlevel_i_; + /* *************** */ - int ret_notename(int *p, String text, int octave_mod); + char const* here_ch_c_l(); - void set(Notename_tab *n); int lookup_keyword(String); void lookup_notename(int &large, int &small, String s); void LexerError(const char *); diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh new file mode 100644 index 0000000000..6d96117ff2 --- /dev/null +++ b/lily/include/musical-request.hh @@ -0,0 +1,236 @@ +/* + musical-request.hh -- declare Musical requests + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef MUSICALREQUESTS_HH +#define MUSICALREQUESTS_HH + +#include "request.hh" + + +/** + A request which is coupled to a #Voice_element# with nonzero duration. + Base class only + */ +struct Musical_req : virtual Request { + + virtual Skip_req* skip() { return 0; } + virtual Dynamic_req* dynamic() { return 0; } + virtual Absolute_dynamic_req * absdynamic() { return 0; } + virtual Subtle_req * subtle() { return 0; } + virtual Span_dynamic_req * span_dynamic() { return 0; } + REQUESTMETHODS(Musical_req, musical); +}; + + +struct Skip_req : Musical_req { + Moment duration_; + + virtual Moment duration() const; + REQUESTMETHODS(Skip_req, skip); +}; +/** a request with a duration. + This request is used only a base class. + */ +struct Rhythmic_req : virtual Musical_req { + int balltype; + int dots; + Moment plet_factor; + /* *************** */ + static int compare(const Rhythmic_req &, const Rhythmic_req &); + virtual Moment duration() const; + Rhythmic_req(); + Rhythmic_req(int,int); + REQUESTMETHODS(Rhythmic_req, rhythmic); +}; + +struct Spacing_req :virtual Request { + Moment next; + Real distance; + Real strength; + /* *************** */ + Spacing_req(); + REQUESTMETHODS(Spacing_req, spacing); +}; + +struct Blank_req : Spacing_req, Rhythmic_req { + REQUESTMETHODS(Spacing_req, spacing); + +}; + +/// Put a text above or below (?) this staff. +struct Text_req : virtual Musical_req { + /// preferred position (above/below) + int dir_i_; + /// the characteristics of the text + Text_def *tdef_p_; + /* *************** */ + Text_req(int d, Text_def*); + ~Text_req(); + Text_req(Text_req const&); + static int compare(const Text_req&,const Text_req&); + REQUESTMETHODS(Text_req,text); +}; + +/** Put a text in lyric_staff + @see Lyric_staff + */ +struct Lyric_req : public Rhythmic_req, Text_req { + Lyric_req(Text_def* t_p); + REQUESTMETHODS(Lyric_req, lreq_l); +}; + +/// request which has some kind of pitch +struct Melodic_req :virtual Musical_req +{ + /// 0 is c, 6 is b + int notename_i_; + /// 0 is central c + int octave_i_; + + /// 0 natural, 1 sharp, etc + int accidental_i_; + + /// force/supress printing of accidental. + bool forceacc_b_; + + /// return height from central c (in halflines) + int height()const; + /// return pitch from central c (in halfnotes) + int pitch()const; + Melodic_req(); + + REQUESTMETHODS(Melodic_req,melodic); +}; + +/// Put a note of specified type, height, and with accidental on the staff. +struct Note_req : Rhythmic_req, virtual Melodic_req { + + + Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); } + REQUESTMETHODS(Note_req, note); + }; + +/** +Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded. +*/ +class Rest_req : public Rhythmic_req { +public: + REQUESTMETHODS(Rest_req,rest); +}; + +/** + attach a stem to the noteball. + Rhythmic_req parent needed to determine if it will fit inside a beam. + */ +struct Stem_req : Rhythmic_req { + /// preferred direction for the stem + int dir_i_; + Stem_req(int s, int dots); + REQUESTMETHODS(Stem_req,stem); +}; + +/** + Requests to start or stop something. + This type of request typically results in the creation of a #Spanner# +*/ +struct Span_req : virtual Musical_req { + /// should the spanner start or stop, or is it unwanted? + enum { + NOSPAN, START, STOP + } spantype ; + static int compare(const Span_req &r1, const Span_req &r2); + REQUESTMETHODS(Span_req,span); + + Span_req(); + +}; + +/** + request for backward plet generation. + + ugr. Place in hierarchy? + */ +struct Plet_req : virtual Request { + char type_c_; + int dur_i_; + int type_i_; + Plet_req(); + + REQUESTMETHODS(Plet_req,plet); +}; + +/** Start / stop a beam at this note. if #nplet# is set, the staff will try to put an +appropriate number over the beam + */ +struct Beam_req : Span_req { + int nplet; + + /* *************** */ + REQUESTMETHODS(Beam_req,beam); + + Beam_req(); +}; + +/// a slur +struct Slur_req : Span_req { + REQUESTMETHODS(Slur_req,slur); + +}; + + +/** Put a script above or below this ``note''. eg upbow, downbow. Why + a request? These symbols may conflict with slurs and brackets, so + this also a request */ +struct Script_req : Musical_req { + int dir_i_; + Script_def *scriptdef_p_; + + /* *************** */ + static int compare(const Script_req &, const Script_req &); + Script_req(int d, Script_def*); + REQUESTMETHODS(Script_req,script); + ~Script_req(); + Script_req(Script_req const&); +}; + +/** A helper in the hierarchy. Each dynamic is bound to one note ( a + crescendo spanning multiple notes is thought to be made of two + "dynamics": a start and a stop). Dynamic changes can occur in a + smaller time than the length of its note, therefore fore each + Dynamic request carries a time, measured from the start of its + note. + */ +struct Subtle_req : virtual Musical_req { + Moment subtime_; + REQUESTMETHODS(Subtle_req, subtle); +}; + +struct Dynamic_req : Subtle_req { + /// for absolute dynamics + enum Loudness { + FFF, FF, F, MF, MP, P, PP, PPP + }; + static String loudness_str(Loudness); + REQUESTMETHODS(Dynamic_req, dynamic); +}; + +struct Absolute_dynamic_req : Dynamic_req { + Loudness loudness_; + Absolute_dynamic_req(); + REQUESTMETHODS(Absolute_dynamic_req, absdynamic); +}; + +struct Span_dynamic_req : Dynamic_req, Span_req { + /// Grow or shrink the volume: 1=cresc, -1 = decresc + int dynamic_dir_i_; + Span_dynamic_req(); + REQUESTMETHODS(Span_dynamic_req, span_dynamic); +}; + +#endif // MUSICALREQUESTS_HH diff --git a/lily/include/parseconstruct.hh b/lily/include/parseconstruct.hh index 7b9e3e3ec2..ff47bdcbad 100644 --- a/lily/include/parseconstruct.hh +++ b/lily/include/parseconstruct.hh @@ -17,7 +17,7 @@ void set_duration_mode(String s); void get_default_duration(int *); void set_default_octave(String); void set_plet(int,int); -Voice_element * get_note_element(String,int * ,int *); +Voice_element * get_note_element(Note_req * ,int *); Voice_element* get_rest_element(String,int *); Voice_element* get_word_element(Text_def*, int*); void add_requests( Voice_element*v, Array&req); diff --git a/lily/include/slur.hh b/lily/include/slur.hh index 87f1fe855e..c8363075c4 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -25,8 +25,7 @@ struct Slur : Directional_spanner { void add(Notehead*); void set_default_dir(); - Spanner* do_break_at( PCol*, PCol*) const; - void process(); + Spanner* do_break_at( PCol*, PCol*) const; private: Molecule*brew_molecule_p()const; NAME_MEMBERS(Slur); diff --git a/lily/input-music.cc b/lily/input-music.cc index f1047e8bf9..8ccc9071b8 100644 --- a/lily/input-music.cc +++ b/lily/input-music.cc @@ -1,7 +1,7 @@ #include "debug.hh" #include "input-music.hh" #include "voice.hh" -#include "musicalrequest.hh" +#include "musical-request.hh" #include "voice-element.hh" void diff --git a/lily/key-reg.cc b/lily/key-reg.cc index 84b0e268c6..24189a532b 100644 --- a/lily/key-reg.cc +++ b/lily/key-reg.cc @@ -11,10 +11,10 @@ #include "time-description.hh" #include "key-reg.hh" #include "key-item.hh" -#include "commandrequest.hh" +#include "command-request.hh" #include "staff-column.hh" #include "local-key-reg.hh" -#include "musicalrequest.hh" +#include "musical-request.hh" Key_register::Key_register() { diff --git a/lily/lexer.l b/lily/lexer.l index 10c5ee6b03..29738a70aa 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -4,7 +4,6 @@ #include "string.hh" #include "string-convert.hh" -#include "notename.hh" #include "lexer.hh" #include "varray.hh" #include "parser.hh" @@ -14,6 +13,11 @@ #include "main.hh" #include "identparent.hh" +#define start_quote() \ + yy_push_state(quote);\ + yylval.string = new String + + %} %option c++ @@ -35,8 +39,8 @@ A [a-zA-Z] AA {A}|_ N [0-9] AN {AA}|{N} -PUNCT [?!,.:;] -ACCENT [\\'"^] +PUNCT [?!,.:;'] +ACCENT \\[`'"^] NATIONAL [\241-\377] TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL} @@ -49,8 +53,6 @@ OPTSIGN !? PITCHMOD ['`]*{OPTSIGN} RESTNAME r|s|p NOTECOMMAND \\{WORD} -NOTENAME [a-z]+ -UNOTENAME [A-Z][a-z]* DOTS \.+ LYRICS {TEX}+ COMMENT [%#].*\n @@ -71,16 +73,18 @@ COMMENT [%#].*\n mtor << "rest:"<< yylval.string; return RESTNAME; } -{UNOTENAME} { - int *p=yylval.ii; - return ret_notename(p, YYText(), -1); -} +{ALPHAWORD} { + String str = YYText(); + mtor << "word: " << str<< eol; + Identifier * id = lookup_identifier(str); + if (id) { + yylval.id = id; + return id->token_code_i_; + } -{NOTENAME} { - int *p=yylval.ii; - return ret_notename(p, YYText(), 0); + yylval.string=new String( str ); + return STRING; } - {NOTECOMMAND} { String c = YYText() +1; mtor << "\\word: " << YYText()+1<{PITCHMOD} { - const char *s = YYText(); - mtor << "pitchmod:"<< YYText()<{DOTS} { yylval.i = strlen(YYText()); return DOTS; @@ -119,28 +117,29 @@ COMMENT [%#].*\n \$ { yy_pop_state(); } -\"[^"]*\" { - String s (YYText()+1); - s = s.left_str(s.length_i()-1); - yylval.string = new String(s); - return STRING; +\" { + start_quote(); } . { return yylval.c = YYText()[0]; } + \" { - yy_push_state(quote); + start_quote(); } -[^"]* { - yylval.string = new String (YYText()); +[^"]+ { + *yylval.string += YYText(); } \" { - mtor << "quoted string\n"; + mtor << "quoted string: `" << *yylval.string << "'\n"; yy_pop_state(); return STRING; } +\" { + start_quote(); +} {DOTS} { yylval.i = strlen(YYText()); return DOTS; @@ -157,7 +156,9 @@ COMMENT [%#].*\n return l; /* let's try passing tex's typesetting macros like \ss \alpha \c */ - String* str_p = new String(YYText());//huh? + String* str_p = new String(YYText()); + yylval.string=str_p; + mtor << "\\word: `" << *str_p << "'\n"; return STRING; /* and skip identifiers... @@ -169,16 +170,12 @@ COMMENT [%#].*\n String *sp = new String( c); yylval.string=sp; + return STRING; */ } -\"[^"]*\" { - String s (YYText()+1); - s = s.left_str(s.length_i()-1); - yylval.string = new String(s); - return STRING; -} {LYRICS} { + /* ugr. This sux. */ String s (YYText()); int i = 0; while ((i=s.index_i("_")) != -1) // change word binding "_" to " " @@ -189,6 +186,7 @@ COMMENT [%#].*\n s = s.left_str(i+2) + " " + s.right_str(s.length_i()-i-2); } yylval.string = new String(s); + mtor << "lyric : `" << s << "'\n"; return STRING; } \| { diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index a0152c9f3c..ff0814f216 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -3,7 +3,7 @@ #include "scalar.hh" #include "lookup.hh" #include "paper-def.hh" -#include "musicalrequest.hh" +#include "musical-request.hh" #include "notehead.hh" #include "misc.hh" diff --git a/lily/local-key-reg.cc b/lily/local-key-reg.cc index f13ec98b9f..ddbd8dc5f8 100644 --- a/lily/local-key-reg.cc +++ b/lily/local-key-reg.cc @@ -4,8 +4,8 @@ (c) 1997 Han-Wen Nienhuys */ -#include "musicalrequest.hh" -#include "commandrequest.hh" +#include "musical-request.hh" +#include "command-request.hh" #include "local-key-reg.hh" #include "local-key-item.hh" #include "complex-walker.hh" diff --git a/lily/lyric-item.cc b/lily/lyric-item.cc index cb8c7547e4..6e3fdf02b8 100644 --- a/lily/lyric-item.cc +++ b/lily/lyric-item.cc @@ -1,4 +1,4 @@ -#include "musicalrequest.hh" +#include "musical-request.hh" #include "paper-def.hh" #include "lyric-item.hh" #include "stem.hh" diff --git a/lily/meter-reg.cc b/lily/meter-reg.cc index a27737c076..f15e5ddb09 100644 --- a/lily/meter-reg.cc +++ b/lily/meter-reg.cc @@ -8,7 +8,7 @@ #include "meter-reg.hh" #include "meter.hh" -#include "commandrequest.hh" +#include "command-request.hh" Meter_register::Meter_register() diff --git a/lily/molecule.cc b/lily/molecule.cc index c52fdc7b32..bfd298bfac 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -30,6 +30,10 @@ Atom::Atom(Symbol s) String Atom::TeXstring() const { + /* infinity checks. */ + assert( abs(off.x) < 100 CM); + assert( abs(off.y) < 100 CM); + // whugh.. Hard coded... String s("\\placebox{%}{%}{%}"); Array a; diff --git a/lily/musical-request.cc b/lily/musical-request.cc new file mode 100644 index 0000000000..be9667c1a0 --- /dev/null +++ b/lily/musical-request.cc @@ -0,0 +1,359 @@ +/* + request.cc -- implement all musical requests. + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "musical-request.hh" +#include "misc.hh" +#include "debug.hh" +#include "script-def.hh" +#include "text-def.hh" +#include "voice.hh" +#include "voice-element.hh" + +void +Stem_req::do_print() const +{ + Rhythmic_req::do_print(); + mtor << "dir : " << dir_i_; +} + +Stem_req::Stem_req(int s, int d) + : Rhythmic_req(s,d) +{ + dir_i_ = 0; +} + +/* ************** */ +void Musical_req::do_print()const{} +void Request::do_print() const{} + +/* *************** */ + +void +Request::print() const +{ + mtor << name() << " {"; + do_print(); + mtor << "}\n"; +} + + + +void +Span_req::do_print() const +{ +#ifndef NPRINT + mtor << spantype ; +#endif +} + +Request::Request() +{ + elt_l_ = 0; + defined_ch_c_l_ = 0; +} +Request::Request(Request const&src) +{ + elt_l_ = 0; + defined_ch_c_l_ = src.defined_ch_c_l_; +} +/* *************** */ +Spacing_req::Spacing_req() +{ + next = 0; + distance = 0; + strength = 0; +} +void +Spacing_req::do_print()const +{ +#ifndef NPRINT + mtor << "next " << next << "dist " << distance << "strength\n"; +#endif +} + +void +Blank_req::do_print()const +{ + Spacing_req::do_print(); +} +/* *************** */ +Melodic_req::Melodic_req() +{ + notename_i_ = 0; + octave_i_ = 0; + accidental_i_ = 0; + forceacc_b_ = false; +} + +void +Melodic_req::do_print() const +{ + mtor << "notename: " << notename_i_ << " acc: " <align_i_ = 0; // centre + dir_i_ = -1; // lyrics below (invisible) staff +} + +void +Lyric_req::do_print() const +{ + Rhythmic_req::do_print(); + Text_req::do_print(); +} +/* *************** */ +void +Note_req::do_print() const +{ + Melodic_req::do_print(); + Rhythmic_req::do_print(); +} +/* *************** */ +void +Rest_req::do_print() const +{ + Rhythmic_req::do_print(); +} + +/* *************** */ +Beam_req::Beam_req() +{ + nplet = 0; +} + +void Beam_req::do_print()const{} +/* *************** */ +void Slur_req::do_print()const{} +/* *************** */ +int +Span_req:: compare(const Span_req &r1, const Span_req &r2) +{ + return r1.spantype - r2.spantype; +} + +Span_req::Span_req() +{ + spantype = NOSPAN; +} + +/* *************** */ +Script_req::Script_req(int d , Script_def*def) +{ + dir_i_ = d; + scriptdef_p_ = def; +} + +int +Script_req::compare(const Script_req &d1, const Script_req &d2) +{ + return d1.dir_i_ == d2.dir_i_ && + d1.scriptdef_p_->compare(*d2.scriptdef_p_); +} + +Script_req::Script_req(Script_req const &s) + : Request( s ) +{ + dir_i_ = s.dir_i_; + scriptdef_p_ = new Script_def(*s.scriptdef_p_); +} + +void +Script_req::do_print() const +{ + mtor << " dir " << dir_i_ ; + scriptdef_p_->print(); +} + + +Script_req::~Script_req() +{ + delete scriptdef_p_; +} +/* *************** */ +int +Text_req:: compare(const Text_req &r1, const Text_req &r2) +{ + bool b1 = (r1.dir_i_ == r2.dir_i_); + bool b2 = (r1.tdef_p_ ->compare(*r2.tdef_p_)); + return b1 && b2; +} +Text_req::~Text_req() +{ + delete tdef_p_; + tdef_p_ = 0; +} + +Text_req::Text_req(Text_req const& src) +{ + tdef_p_ = new Text_def(*src.tdef_p_); + dir_i_ = src.dir_i_; +} + +Text_req::Text_req(int dir_i, Text_def* tdef_p) +{ + dir_i_ = dir_i; + tdef_p_ = tdef_p; +} + +void +Text_req::do_print() const +{ + mtor << " dir " << dir_i_ ; + tdef_p_->print(); +} + +/* *************** */ + +Moment +Skip_req::duration() const +{ + return duration_; +} + +void +Skip_req::do_print() const +{ + mtor << "duration: " << duration(); +} + +Voice * +Request::voice_l() +{ + if (!elt_l_) + return 0; + else + return (Voice*)elt_l_->voice_l_; +} +/* *************** */ + +void +Subtle_req::do_print() const +{ + mtor << " subtime " << subtime_; +} + +void +Dynamic_req::do_print() const +{ + Subtle_req::do_print(); +} + +void +Absolute_dynamic_req::do_print() const +{ + Dynamic_req::do_print(); + mtor << " loudness_" <; - defaulttab = 0; + keytable_p_ = new Keyword_table(the_key_tab); + identifier_assoc_p_ = new Assoc; errorlevel_i_ = 0; } int My_flex_lexer::lookup_keyword(String s) { - return keytable->lookup(s); + return keytable_p_->lookup(s); } Identifier* My_flex_lexer::lookup_identifier(String s) { - if (!the_id_tab->elt_query(s)) + if (!identifier_assoc_p_->elt_query(s)) return 0; - return (*the_id_tab)[s]; + return (*identifier_assoc_p_)[s]; } char const* My_flex_lexer::here_ch_c_l() { - return include_stack.top()->sourcefile_l_->ch_c_l() + yyin->tellg(); + return include_stack_.top()->sourcefile_l_->ch_c_l() + yyin->tellg(); } void My_flex_lexer::add_identifier(Identifier*i) { delete lookup_identifier(i->name); - (*the_id_tab)[i->name] = i; + (*identifier_assoc_p_)[i->name] = i; } My_flex_lexer::~My_flex_lexer() { - delete keytable; - delete defaulttab; - for (Assoc_iter ai(*the_id_tab); ai.ok(); ai++) { + delete keytable_p_; + + for (Assoc_iter + ai(*identifier_assoc_p_); ai.ok(); ai++) { mtor << "deleting: " << ai.key()<<'\n'; delete ai.val(); } - delete the_id_tab; + delete identifier_assoc_p_; } void My_flex_lexer::print_declarations()const { - for (Assoc_iter ai(*the_id_tab); ai.ok(); ai++) { + for (Assoc_iter ai(*identifier_assoc_p_); ai.ok(); ai++) { ai.val()->print(); } } @@ -140,13 +115,13 @@ My_flex_lexer::print_declarations()const String My_flex_lexer::spot()const { - return include_stack.top()->name + ": " + String( lineno() ); + return include_stack_.top()->name + ": " + String( lineno() ); } void My_flex_lexer::LexerError(const char *s) { - if (lexer->include_stack.empty()) { + if (lexer->include_stack_.empty()) { *mlog << "error at EOF" << s << '\n'; } else { char const* ch_c_l = here_ch_c_l(); @@ -165,14 +140,14 @@ My_flex_lexer::LexerError(const char *s) void My_flex_lexer::new_input(String s) { - if (!include_stack.empty()) { - include_stack.top()->line = lineno(); + if (!include_stack_.empty()) { + include_stack_.top()->line = lineno(); // should this be saved at all? - include_stack.top()->defined_ch_c_l_ = defined_ch_c_l; + include_stack_.top()->defined_ch_c_l_ = defined_ch_c_l; } Input_file *newin = new Input_file(s); - include_stack.push(newin); + include_stack_.push(newin); switch_streams(newin->is); yylineno = 1; @@ -182,12 +157,12 @@ My_flex_lexer::new_input(String s) bool My_flex_lexer::close_input() { - Input_file *old = include_stack.pop(); + Input_file *old = include_stack_.pop(); bool ok = true; - if (include_stack.empty()) { + if (include_stack_.empty()) { ok = false; } else { - Input_file *i = include_stack.top(); + Input_file *i = include_stack_.top(); switch_streams(i->is); yylineno = i->line; defined_ch_c_l = i->defined_ch_c_l_; diff --git a/lily/note.cc b/lily/note.cc index 496d892e5b..475e3e08ba 100644 --- a/lily/note.cc +++ b/lily/note.cc @@ -6,10 +6,10 @@ #include "string.hh" #include "real.hh" #include "debug.hh" -#include "musicalrequest.hh" -#include "commandrequest.hh" +#include "musical-request.hh" +#include "command-request.hh" #include "voice.hh" -#include "notename.hh" + #include "identparent.hh" #include "varray.hh" #include "text-def.hh" @@ -77,30 +77,11 @@ parse_octave (const char *a, int &j, int &oct) } } -void -parse_pitch( const char *a, Melodic_req* mel_l) -{ - int j=0; - - // octave - mel_l->octave_i_ = default_octave; - parse_octave(a,j,mel_l->octave_i_); - - // accidental - mel_l->forceacc_b_ = false; - - if (a[j] == '!'){ - mel_l->forceacc_b_ = true; - j++; - } -} - Voice_element * -get_note_element(String pitch, int * notename, int * duration ) +get_note_element(Note_req *rq, int * duration ) { Voice_element*v = new Voice_element; v->defined_ch_c_l_ = defined_ch_c_l; - int dur = duration[0]; int dots = duration[1]; @@ -115,12 +96,6 @@ get_note_element(String pitch, int * notename, int * duration ) if ( !defined_ch_c_l ) defined_ch_c_l = lexer->here_ch_c_l(); - Note_req * rq = new Note_req; - rq->notename_i_ =notename[0]; - rq->accidental_i_ = notename[1]; - parse_pitch(pitch, rq); - rq->octave_i_ += notename[2]; - rq->balltype = dur; rq->dots = dots; rq->plet_factor = Moment(default_plet_dur, default_plet_type); diff --git a/lily/notehead.cc b/lily/notehead.cc index 4d0157abe9..fb0c1166c1 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -5,7 +5,7 @@ #include "paper-def.hh" #include "lookup.hh" #include "molecule.hh" -#include "musicalrequest.hh" +#include "musical-request.hh" diff --git a/lily/parser.y b/lily/parser.y index ebec63fbef..bc8876b5e4 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -13,8 +13,8 @@ #include "parseconstruct.hh" #include "dimen.hh" #include "identifier.hh" -#include "commandrequest.hh" -#include "musicalrequest.hh" +#include "command-request.hh" +#include "musical-request.hh" #include "voice-element.hh" #ifndef NDEBUG @@ -32,90 +32,127 @@ int fatal_error_i = 0; %union { - Request * request; - Real real; - Identifier *id; - Voice *voice; - Voice_element *el; - String *string; - const char *consstr; - Paper_def *paper; - Midi_def* midi; - Input_music *music; - Music_general_chord *chord; - Music_voice *mvoice; - int i; - char c; - int ii[10]; - Moment *moment; - + Array *melreqvec; Array * strvec; Array *intvec; - Array *melreqvec; - Input_staff *staff; + Box *box; + Identifier *id; + Input_music *music; Input_score *score; - Symtables * symtables; - Symtable * symtable; - Symbol * symbol; - Lookup*lookup; + Input_staff *staff; Interval *interval; - Box *box; - Notename_tab *notename_tab; + Lookup*lookup; + Melodic_req * melreq; + Midi_def* midi; + Moment *moment; + Music_general_chord *chord; + Music_voice *mvoice; + Note_req *notereq; + Paper_def *paper; + Real real; + Request * request; Script_def * script; + String *string; + Symbol * symbol; + Symtable * symtable; + Symtables * symtables; Text_def * textdef; + Voice *voice; + Voice_element *el; + char c; + const char *consstr; + int i; + int ii[10]; } -%token VOICE STAFF SCORE TITLE BAR OUTPUT MULTIVOICE DYNAMIC -%token CM_T IN_T PT_T MM_T PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND -%token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND -%token KEY CLEF TABLE VOICES STEM -%token PARTIAL MUSIC GROUPING CADENZA -%token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET -%token GOTO -%token MIDI TEMPO - -%token IDENTIFIER REAL_IDENTIFIER REQUEST_IDENTIFIER -%token PITCHMOD DURATION RESTNAME -%token NOTENAME -%token REAL -%token STRING - -%token DOTS INT -%type unit -%type pitch_list -%type open_request_parens close_request_parens close_plet_parens -%type declaration -%type declarable_identifier -%type paper_block paper_body -%type midi_block midi_body -%type dim real -%type default_duration explicit_duration notemode_duration mudela_duration -%type notename -%type duration_length -%type voice_elt full_element lyrics_elt command_elt - -%type score_block score_body -%type staff_block staff_init staff_body -%type int -%type intastint_list -%type post_request pre_request command_req -%type pitchmod -%type music -%type music_chord music_chord_body - -%type music_voice_body music_voice - -%type dinterval -%type box -%type symtable symtable_body -%type symtables symtables_body -%type symboldef -%type notename_tab notename_tab_body -%type script_dir -%type