From a9a322cf85466c4556a522380cfdc68c8cdc8952 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:28:31 +0000 Subject: [PATCH] lilypond-0.0.24 --- NEWS | 6 +++- TODO | 16 ++++++++- input/pavane.ly | 11 +++--- src/lexer.l | 77 +++++++++++++++++++++++++++++++++++++----- src/staff.cc | 19 +++++++++-- src/timedescription.cc | 2 +- src/warn.cc | 6 ++-- 7 files changed, 114 insertions(+), 23 deletions(-) diff --git a/NEWS b/NEWS index 93baaa2807..696755258e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +pl 24: + - Lyrics + - Commands in music-mode (an input feature) (there you are, Mats) pl 23: - TODO file inc'd @@ -6,9 +9,10 @@ pl 23: - error.pod,faq.pod - Markers - configure script - - scrapped VPATH - inputfile name in output. Internal changes: + - scrapped VPATH + - Make dependencies per .o - Split Input_* parsing steps to enable marking Bugfixes: - unconnected columns diff --git a/TODO b/TODO index 70e3590b8a..9b81ff8667 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ + BUGS * first clef @@ -9,6 +10,10 @@ SEVERELY LACKING: INPUTLANGUAGE + * lexer condition stack + + * lose the $ and @? + * figured bass? * transposition @@ -19,6 +24,10 @@ INPUTLANGUAGE SMALLISH PROJECTS + * make spanner for staffsym + + * Lyric_req : Text_req, Rhythmic_req + * Lookup::tex_glissando, Lookup::tex_bracket, Lookup::tex_cresc, Lookup::tex_decresc (use texbeam.cc as an example.) @@ -45,7 +54,7 @@ SMALLISH PROJECTS * fix symbols in parser.o: `Warning: size of symbol' - * Viola clef (->jan?!) + * Viola clef DOC @@ -54,6 +63,9 @@ DOC * all errors FUTURE + * Command_req + + * scrap stem_request? * Text_pstaff/Lyric_staff @@ -71,6 +83,8 @@ FUTURE * Implement all requests + * merge key{item} & localkey{item} + * QLP for beams? * stacked slurs. diff --git a/input/pavane.ly b/input/pavane.ly index ec31ea1aa0..b820506b60 100644 --- a/input/pavane.ly +++ b/input/pavane.ly @@ -33,8 +33,8 @@ staff {melodic e4 fis4 () [fis e fis gis] | cis4 `b4()`b8 r8 r4^"tr\`es soutenu" | - r4 r4 | %2/4 meter - + \command { \meter 2 *4 } r4 r4 | + \command { \meter 4 *4 } 'cis4_"\dyn ppp" 'd4 () ['d 'cis 'd 'e] | a4 gis2. | a4 b4()[b a b 'cis] | @@ -70,7 +70,9 @@ staff {melodic | [f a 'c] \plet{1/1} 'e4-^ () ['e f-> a-> 'c->] | 'e4._"sf" 'e8()'c4 r4 | r1 | - r4 r4-\fermata + \command { \meter 2 *4 } r4 r4-\fermata + \command { \meter 4 *4 } + \octave { ' } |d2( [)d e cis `b] | `a4 [`b cis] [cis `b] `b4 | @@ -104,13 +106,10 @@ score { commands { meter 4 *4 skip 18:0 - meter 2 *4 skip 1:0 - meter 4 *4 skip 20:0 bar "|:" skip 9:0 - meter 2* 4 skip 1:0 bar ":|" meter 4* 4 diff --git a/src/lexer.l b/src/lexer.l index 2b15b352e8..1d758796b2 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -20,6 +20,7 @@ %x notes %x incl %x quote +%x lyrics @@ -27,6 +28,9 @@ A [a-zA-Z] AA {A}|_ N [0-9] AN {AA}|{N} +PUNCT [?!,.:;] +ACCENT [\\'"^] +TEX {AA}|-|{PUNCT}|{ACCENT} WORD {A}{AN}* ALPHAWORD {A}+ @@ -39,6 +43,8 @@ RESTNAME r|s|p NOTECOMMAND \\{WORD} NOTENAME {ALPHAWORD} DOTS \.+ +LYRICS {TEX}+ +COMMENT [%#].*\n %% @@ -46,6 +52,10 @@ DOTS \.+ BEGIN(notes); } +\@ { + BEGIN(lyrics); +} + {RESTNAME} { const char *s = YYText(); yylval.string = new String (s); @@ -95,8 +105,7 @@ DOTS \.+ yylval.i = String(YYText()).value(); return INT; } -[%#].*\n { - +{COMMENT} { } [ \t\n]+ { @@ -114,13 +123,8 @@ DOTS \.+ yylval.string = new String(s); return STRING; } -[()\[\]|/.^>_-] { - return yylval.c = YYText()[0]; - -} . { - String s("lexer error: illegal character found: " + String(YYText())); - yyerror(s); + return yylval.c = YYText()[0]; } \" { @@ -135,6 +139,61 @@ DOTS \.+ return STRING; } +{DOTS} { + yylval.i = strlen(YYText()); + return DOTS; +} +{INT} { + yylval.i = String(YYText()).value(); + return INT; +} +{NOTECOMMAND} { + String c = YYText() +1; + mtor << "\\word: " << YYText()+1<\"[^\"]*\" { + String s (YYText()+1); + s = s.left(s.len()-1); + yylval.string = new String(s); + return STRING; +} +{LYRICS} { + String s (YYText()); + int i = 0; + while ((i=s.pos("_")) != 0)// ugh. Whats this. + *((char*)s.cptr() + i - 1) = ' '; + if ((i=s.pos("\\,")) !=0) + { + *((char*)s.cptr() + i) = 'c'; + s = s.left(i+1) + " " + s.right(s.len()-i-1); + } + yylval.string = new String(s); + return STRING; +} +\| { + return YYText()[0]; +} +{COMMENT} { + +} +[ \t\n]+ { +} +@ { + BEGIN(INITIAL); +} + <> { mtor << "<>"; @@ -193,7 +252,7 @@ include { BEGIN(incl); } } -%.* { +{COMMENT} { //ignore } . { diff --git a/src/staff.cc b/src/staff.cc index c6a65e016e..69fc3123b8 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -1,7 +1,7 @@ #include "staff.hh" #include "score.hh" #include "voice.hh" -#include "swalker.hh" +#include "staffwalker.hh" #include "stcol.hh" #include "sccol.hh" #include "staffcommands.hh" @@ -15,10 +15,25 @@ Staff::do_commands(PointerList score_wide, PointerList staff_wide) { Input_commands commands; + + // bring in commands from voices. + for (iter_top(voices, i); i.ok(); i++) { + Moment here = i->start; + for (iter_top(i->elts, j); j.ok(); j++) { + for (iter_top(j->reqs, k); k.ok(); k++) { + if (k->command()){ + commands.find_moment(here); + commands.add(*k->command()->com_p_, + score_l_->markers_assoc_); + } + } + here += j->duration; + } + } for (iter_top(score_wide,i); i.ok(); i++) commands.add(**i, score_l_->markers_assoc_); for (iter_top(staff_wide,i); i.ok(); i++) - commands.add(**i,score_l_->markers_assoc_); + commands.add(**i, score_l_->markers_assoc_); commands.parse(this); } diff --git a/src/timedescription.cc b/src/timedescription.cc index 9ffb981c85..275a47f0d9 100644 --- a/src/timedescription.cc +++ b/src/timedescription.cc @@ -68,7 +68,7 @@ Time_description::set_meter(int l, int o) one_beat = 1/Moment(o); whole_per_measure = Moment(l) * one_beat; if(whole_in_measure) - error_t("Meterchange should be at start of measure", when); + error_t("Meterchange should be at start of measure", *this); } void diff --git a/src/warn.cc b/src/warn.cc index 82a004875a..87f7152e41 100644 --- a/src/warn.cc +++ b/src/warn.cc @@ -27,8 +27,8 @@ error(String s) void error_t(const String& s, const Moment& r) { - String t_mom = String(trunc(r)) + (r - Moment(trunc(r))); - String e=s+ "(t = " + t_mom + ")"; + String t_mom = String(trunc(r)) + String(r - Moment(trunc(r))); + String e=s+ " (t = " + t_mom + ")"; error(e); } @@ -36,6 +36,6 @@ error_t(const String& s, const Moment& r) void error_t(const String& s, Time_description const &t_tdes) { - String e=s+ "(at " + t_tdes.bars + ": " + t_tdes.whole_in_measure + ")\n"; + String e=s+ " (at t=" + t_tdes.bars + ": " + t_tdes.whole_in_measure + ")\n"; error(e); } -- 2.39.5