From: fred Date: Sun, 24 Mar 2002 19:28:28 +0000 (+0000) Subject: lilypond-0.0.24 X-Git-Tag: release/1.5.59~5578 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f19cf2ccb3f4ecb37d4aede7f813d3604ff560a6;p=lilypond.git lilypond-0.0.24 --- diff --git a/Documentation/lilyinput.pod b/Documentation/lilyinput.pod index d359bb39bd..4e8367d3d0 100644 --- a/Documentation/lilyinput.pod +++ b/Documentation/lilyinput.pod @@ -30,13 +30,18 @@ In musicmode, eg, ''!c8.-"text"_v +and in lyricmode, eg, + + Twink- le, twink- le litt- le star,2 + 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. +'$'. '$' is a delimiter, which used by the tokenizer only. The same +goes for lyrics, it has a '@' delimiter. =item * musicmode: The brace still is used to group grammatical groups. diff --git a/hdr/lyricitem.hh b/hdr/lyricitem.hh new file mode 100644 index 0000000000..7fda46142e --- /dev/null +++ b/hdr/lyricitem.hh @@ -0,0 +1,19 @@ +// +// lyricitem.hh -- part of LilyPond +// +// copyright 1997 Jan Nieuwenhuizen + +#ifndef LYRIC_ITEM_HH +#define LYRIC_ITEM_HH + +#include "textitem.hh" + +struct Lyric_item : Text_item { + /****************/ + Lyric_item(Lyric_req* lreq_l, int voice_count_i); + virtual void do_pre_processing(); +}; + + +#endif // LYRICITEM_HH + diff --git a/hdr/parseconstruct.hh b/hdr/parseconstruct.hh index 6a22127a38..9bc9434ffc 100644 --- a/hdr/parseconstruct.hh +++ b/hdr/parseconstruct.hh @@ -17,7 +17,9 @@ void set_plet(int,int); Staff * get_new_rhythmstaff(); Voice_element * get_note_element(String,int * ,int *); Voice_element* get_rest_element(String,int *); +Voice_element* get_word_element(Text_def*, int*); Staff * get_new_melodicstaff(); +Staff * get_new_lyricstaff(); void add_requests( Voice_element*v, Array&req); Request* get_request(char); void set_text_style(String); @@ -25,7 +27,7 @@ Script_def* get_scriptdef(char); Text_def*get_text(String s); Request*get_script_req(int d , Script_def*def); Request*get_text_req(int d , Text_def*def); - - +Voice_element*get_command_element(Input_command*); +Voice_element*get_barcheck_element(); #endif // PARSECONSTRUCT_HH diff --git a/hdr/pcol.hh b/hdr/pcol.hh index a0f2a87624..1d3ff34ca8 100644 --- a/hdr/pcol.hh +++ b/hdr/pcol.hh @@ -79,7 +79,7 @@ private: */ #include "compare.hh" -instantiate_compare(const PCol &, PCol::compare); +instantiate_compare(PCol &, PCol::compare); #endif diff --git a/src/lookup.cc b/src/lookup.cc index 200ae0994b..befa542706 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -29,7 +29,7 @@ Lookup::add(String s, Symtable*p) } Symbol -Lookup::text( String style, String text , int dir) +Lookup::text(String style, String text, int dir) { Array a; @@ -66,6 +66,7 @@ Lookup::rest(int j) { return (*symtables_)("rests")->lookup(String(j)); } + Symbol Lookup::fill(Box b) { @@ -73,6 +74,7 @@ Lookup::fill(Box b) s.dim = b; return s; } + Symbol Lookup::accidental(int j) { @@ -143,7 +145,7 @@ Lookup::linestaff(int lines, Real wid) { Symbol s; s.dim.x = Interval(0,wid); - Real dy=(lines-1)*internote()*2; + Real dy = (lines >0) ? (lines-1)*internote()*2 : 0; s.dim.y = Interval(0,dy); Array a; @@ -152,7 +154,7 @@ Lookup::linestaff(int lines, Real wid) s.tex = (*symtables_)("param")->lookup("linestaf").tex; s.tex = substitute_args(s.tex, a); - + return s; } diff --git a/src/lyricitem.cc b/src/lyricitem.cc new file mode 100644 index 0000000000..b0afc3000b --- /dev/null +++ b/src/lyricitem.cc @@ -0,0 +1,20 @@ +#include "request.hh" +#include "paper.hh" +#include "lyricitem.hh" +#include "stem.hh" +#include "molecule.hh" +#include "lookup.hh" +#include "textdef.hh" + +Lyric_item::Lyric_item(Lyric_req* lreq_l, int voice_count_i) + : Text_item(lreq_l,0) +{ + pos_i_ = voice_count_i * -4 ; // fontsize dependant. TODO + dir_i_ = -1; +} + +void +Lyric_item::do_pre_processing() +{ + // override Text_item +} diff --git a/src/parser.y b/src/parser.y index c11143f0d1..771734025b 100644 --- a/src/parser.y +++ b/src/parser.y @@ -61,10 +61,10 @@ Paperdef*default_paper(); } %token VOICE STAFF SCORE TITLE BAR NOTENAME OUTPUT -%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS +%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND %token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND %token KEY CLEF VIOLIN BASS MULTI TABLE CHORD VOICES -%token PARTIAL RHYTHMIC MELODIC MUSIC GROUPING CADENZA +%token PARTIAL RHYTHMIC MELODIC MUSIC LYRIC GROUPING CADENZA %token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET %token MARK GOTO @@ -85,8 +85,8 @@ Paperdef*default_paper(); %type dim %type duration %type duration_length -%type voice_elt full_element -%type score_command staff_command skipcommand +%type voice_elt full_element lyrics_elt +%type score_command staff_command position_command %type score_block score_body %type staff_block staff_init staff_body %type int @@ -98,7 +98,7 @@ Paperdef*default_paper(); %type music %type music_chord music_chord_body -%type music_voice_body music_voice +%type music_voice_body music_voice %type dinterval %type box @@ -214,6 +214,9 @@ score_commands_body: { $$ = new Array; } | score_commands_body score_command { $$->add($2); } + | score_commands_body position_command { + $$->add($2); + } ; staff_commands_block: COMMANDS '{' staff_commands_body '}' { @@ -225,11 +228,13 @@ staff_commands_body: | staff_commands_body staff_command { $$->add($2); } + | staff_commands_body position_command { + $$->add($2); + } ; staff_command: - skipcommand - | KEY pitch_list {/*UGH*/ + KEY pitch_list {/*UGH*/ $$ = get_key_interpret_command(*$2); delete $2; } @@ -248,7 +253,7 @@ duration_length: } ; -skipcommand: +position_command: SKIP int ':' duration_length { $$ = get_skip_command($2, *$4); delete $4; @@ -257,10 +262,10 @@ skipcommand: $$ = get_goto_command(*$2); delete $2; } + ; score_command: - skipcommand - | BAR STRING { + BAR STRING { $$ = get_bar_command(*$2); delete $2; } @@ -325,6 +330,9 @@ staff_init: | MELODIC { $$ = new Input_staff( "melodic"); } + | LYRIC { + $$ = new Input_staff( "lyric"); + } ; staff_body: @@ -365,7 +373,6 @@ music_voice_body: { } ; - music_chord: '{' music_chord_body '}' { $$ = $2; } ; @@ -393,8 +400,16 @@ full_element: pre_requests voice_elt post_requests { add_requests($2, post_reqs); $$ = $2; } + | MARK STRING { + $$ = get_mark_element(*$2); + delete $2; + } + | COMMAND '{' staff_command '}' { $$=get_command_element($3); } + | COMMAND '{' score_command '}' { $$=get_command_element($3); } + | '|' { $$ = get_barcheck_element(); } + | lyrics_elt ; - + post_requests: { assert(post_reqs.empty()); @@ -415,8 +430,7 @@ close_request_parens: ; open_request_parens: - '|' {$$='|'} - |')' {$$=')'} + ')' {$$=')'} |'[' {$$='['} ; @@ -526,12 +540,13 @@ voice_elt: delete $1; } - | MARK STRING { - $$ = get_mark_element(*$2); - delete $2; - } ; +lyrics_elt: + mudela_text duration { + $$ = get_word_element($1, $2); + }; + /* UTILITIES */ @@ -648,12 +663,17 @@ parse_file(String s) *mlog << "Parsing ... "; #ifdef YYDEBUG - yydebug = !monitor.silence("Parser") && check_debug; + yydebug = !monitor.silence("InitParser") && check_debug; #endif set_lexer(); lexer->new_input("symbol.ini"); yyparse(); + +#ifdef YYDEBUG + yydebug = !monitor.silence("Parser") && check_debug; +#endif + lexer->new_input(s); yyparse(); kill_lexer(); @@ -666,3 +686,5 @@ default_paper() return new Paperdef( lexer->lookup_identifier("default_table")->lookup(true)); } + + diff --git a/src/slur.cc b/src/slur.cc index e5dbf385ac..d4a3d0d96d 100644 --- a/src/slur.cc +++ b/src/slur.cc @@ -90,7 +90,7 @@ Slur::do_post_processing() } Molecule* -Slur::brew_molecule() const +Slur::brew_molecule_p() const { Molecule*output = new Molecule; @@ -112,7 +112,7 @@ Slur::brew_molecule() const if (!rnote_p->extremal) right_off+= Offset(-0.5, -dir); - int dy = right_off.y - left_off.y; + int dy = int(right_off.y - left_off.y); Real nw_f = paper()->note_width(); Real nh_f = paper()->internote(); diff --git a/src/textdef.cc b/src/textdef.cc index 26dee59a71..e3829c65db 100644 --- a/src/textdef.cc +++ b/src/textdef.cc @@ -6,19 +6,19 @@ Text_def::Text_def() { - align = 1; // right - style = "roman"; + align_i_ = 1; // right + style_str_ = "roman"; } Atom -Text_def::create(Paperdef*p) const +Text_def::create_atom(Paperdef*p) const { - return p->lookup_p_->text(style, text, -align); + return p->lookup_p_->text(style_str_, text_str_, -align_i_); } void Text_def::print() const { - mtor << "Text `" << text << "\', style " << - style << "align " <