]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.24
authorfred <fred>
Sun, 24 Mar 2002 19:28:28 +0000 (19:28 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:28:28 +0000 (19:28 +0000)
Documentation/lilyinput.pod
hdr/lyricitem.hh [new file with mode: 0644]
hdr/parseconstruct.hh
hdr/pcol.hh
src/lookup.cc
src/lyricitem.cc [new file with mode: 0644]
src/parser.y
src/slur.cc
src/textdef.cc

index d359bb39bd7483a62e23586bab45a3ea82d47b75..4e8367d3d006818efad7c6228c1003acb6da350b 100644 (file)
@@ -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 (file)
index 0000000..7fda461
--- /dev/null
@@ -0,0 +1,19 @@
+//
+//  lyricitem.hh -- part of LilyPond
+//
+//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+
+#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
+
index 6a22127a384035641ceea8ae14e0e7e39372208d..9bc9434ffc6f4c18cbb430fc6c13f55e1163a567 100644 (file)
@@ -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<Request*>&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
 
index a0f2a87624b76fb2008d7845ccb044f44477c0ac..1d3ff34ca849c02d56a8e58014df01abfebe0fc2 100644 (file)
@@ -79,7 +79,7 @@ private:
   */
 
 #include "compare.hh"
-instantiate_compare(const PCol &, PCol::compare);
+instantiate_compare(PCol &, PCol::compare);
      
 
 #endif
index 200ae0994b9693da588ee58b5d30cdb6277b86c3..befa5427065022d9ffd23d54e30de8549578a33e 100644 (file)
@@ -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<String> 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<String> 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 (file)
index 0000000..b0afc30
--- /dev/null
@@ -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
+}
index c11143f0d1d230cffe490ab4bb7e6363533ccaa0..771734025be4db62c1f02b82e4dcd13742138556 100644 (file)
@@ -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 <real> dim
 %type <ii> duration
 %type <moment> duration_length
-%type <el> voice_elt full_element
-%type <command> score_command staff_command skipcommand
+%type <el> voice_elt full_element lyrics_elt
+%type <command> score_command staff_command position_command
 %type <score> score_block score_body
 %type <staff> staff_block staff_init staff_body
 %type <i> int
@@ -98,7 +98,7 @@ Paperdef*default_paper();
 %type <music> music 
 %type <chord> music_chord music_chord_body
 
-%type <mvoice>  music_voice_body music_voice
+%type <mvoice>  music_voice_body music_voice 
 
 %type <interval> dinterval
 %type <box> box
@@ -214,6 +214,9 @@ score_commands_body:                        { $$ = new Array<Input_command*>; }
        | 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));
 }
+
+
index e5dbf385ac739e8bf3e268f7c7ce4f7c9db6867d..d4a3d0d96df3b54a566b093bf175a31705e2eb7f 100644 (file)
@@ -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();
index 26dee59a712d9b161617082f32c9b5fba208688e..e3829c65db7f8079ad27510d249f401baf8ef40c 100644 (file)
@@ -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 " <<align<<'\n';
+    mtor << "Text `" << text_str_ << "\', style " <<
+       style_str_ << "align " << align_i_ << '\n';
 }