]> git.donarmstrong.com Git - lilypond.git/commitdiff
* Documentation/user/lilypond.tely: Add comment and workaround for
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 18 Apr 2004 14:13:37 +0000 (14:13 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 18 Apr 2004 14:13:37 +0000 (14:13 +0000)
gs-8.01 crash.  Fixes make web.

* lily/lexer.ll, lily/parser.yy:

* input/simple.ly: New file.

* input/simple-song.ly: Idem.

ChangeLog
Documentation/user/lilypond.tely
input/simple-song.ly [new file with mode: 0644]
input/simple.ly [new file with mode: 0644]
lily/beaming-info.cc
lily/parser.yy
lily/pitch.cc

index aafb8041ae8160c9d6d6dc75adc14be20fd0bed9..5ddb1543b31058c0d2e6f80109ae4a870727e169 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,26 @@
 2004-04-18  Jan Nieuwenhuizen  <janneke@gnu.org>
 
-       * lily/lexer.ll:
-       * lily/parser.yy: In lyrics mode, return LYRICS_STRING.  Use notes
-       mode at start of maininput.  Grok toplevel composite music
-       expression, put in score and book.
+       * Documentation/user/lilypond.tely: Add comment and workaround for
+       gs-8.01 crash.  Fixes make web.
+
+       Simplification of toplevel music.
+       
+       * lily/lexer.ll, lily/parser.yy:
+
+       * In LYRICS mode, return LYRICS_STRING.  This fixes one
+       shift/reduce problem.
+
+       * Use NOTES mode at start of maininput.
+
+       * Grok toplevel composite music expression, put in score and book.
+
+       * Grok \relative COMPOSITE_MUSIC, make relative on middleC.
+
+       * \addlyrics is a shortcut for \context Lyrics \lyricsto "" \lyrics
+
+       * input/simple.ly: New file.
+       
+       * input/simple-song.ly: Idem.
 
 2004-04-16  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
index 9f1e8e6a11d5035b805e0bf1e3005288ec45a981..c06925c2f0a61ea07261a75dedd919953f291d25 100644 (file)
@@ -102,7 +102,8 @@ Copyright @copyright{} 1999--2004 by the authors
 
 @vskip 20pt
 
-  
+%% Not yet debugged or reported.  This crashes gs-8.01:
+%% compiling gs-8.01 right now... -- jcn
 @lilypond[raggedright]
 \score {
     \context Lyrics \notes {
@@ -117,7 +118,6 @@ Copyright @copyright{} 1999--2004 by the authors
      }
 }
 @end lilypond
-  
 
 @end titlepage
 
diff --git a/input/simple-song.ly b/input/simple-song.ly
new file mode 100644 (file)
index 0000000..fed51a9
--- /dev/null
@@ -0,0 +1,16 @@
+%% A simple song in LilyPond
+<<
+    \relative {
+       \clef bass
+       d2 d c4 bes a2 \break
+       c2 c d4 f g2
+    }
+
+    \addlyrics {
+       My first Li -- ly song,
+       Not much can go wrong!
+    }
+>>
+
+%% Optional helper for automatic updating by convert-ly.  May be omitted.
+\version "2.3.0"
diff --git a/input/simple.ly b/input/simple.ly
new file mode 100644 (file)
index 0000000..744a969
--- /dev/null
@@ -0,0 +1,7 @@
+%% A simple piece in LilyPond, a scale.
+\relative {
+    c' d e f g a b c
+}
+
+%% Optional helper for automatic updating by convert-ly.  May be omitted.
+\version "2.3.0"
index 9382b6dc9ba1ed9eb2b0fa4f761ae2c663abcf0e..1e4e6c0956735298824d4291945578b09554e23d 100644 (file)
@@ -88,9 +88,7 @@ Beaming_info_list::beamify (Moment &beat_length,bool subdivide)
   do
     {
       if (splits[d].infos_.size () != 1)
-       {
-         splits[d].infos_.boundary (-d, 0).beams_i_drul_[-d] = middle_beams;
-       }
+       splits[d].infos_.boundary (-d, 0).beams_i_drul_[-d] = middle_beams;
     }
   while (flip (&d) != LEFT);
 
index 1382e8ae1b7f1297f2d092e3cd0fba2246338c5c..b4a509c615f1c9589d4725f4873926a08aa7f458 100644 (file)
@@ -164,6 +164,27 @@ set_property_music (SCM sym, SCM value)
        return p;
 }
 
+Music*
+make_music_relative (Pitch start, Music *music)
+{
+       Music *relative = MY_MAKE_MUSIC ("RelativeOctaveMusic");
+       relative->set_property ("element", music->self_scm ());
+       
+       Pitch last = music->to_relative_octave (start);
+       if (lily_1_8_relative)
+               music->set_property ("last-pitch", last.smobbed_copy ());
+       return relative;
+}
+
+Music*
+make_lyric_combine_music (SCM name, Music *music)
+{
+       Music *combine = MY_MAKE_MUSIC ("NewLyricCombineMusic");
+       combine->set_property ("element", music->self_scm ());
+       combine->set_property ("associated-context", name);
+       return combine;
+}
+
 %}
 
 /* We use SCMs to do strings, because it saves us the trouble of
@@ -196,19 +217,10 @@ yylex (YYSTYPE *s, void *v)
 
 %}
 
-%expect 4
+%expect 3
 
 /*
-  Four shift/reduce problems:
-
-1.     foo = bar.
-
-       "bar" -> String -> Lyric -> Music -> music-assignment
-
-       "bar" -> String -> string-assignment
-
-
-Similar problem for
+  Three shift/reduce problems:
 
 2. \markup identifier.
 
@@ -225,9 +237,6 @@ or
     \repeat { \repeat } \alternative 
 
 )
-
---hwn
-
  */
 
 
@@ -517,42 +526,9 @@ toplevel_expression:
        }
        ;
 
-/* FIXME: Experimental kludge for automatic relative music
-          This will change or go away.  */
-language: '@'
-       | '@' STRING {
-               /* FIXME? */
-               THIS->lexer_->push_initial_state ();
-               THIS->lexer_->new_input (ly_scm2string ($2) + ".ly",
-                                        THIS->lexer_->sources_);
-               THIS->lexer_->pop_state ();
-       }
-       ;
-
 toplevel_music:
        Composite_music {
        }
-       /* FIXME: Experimental kludge for automatic relative music
-                 This will change or go away.
-                 
-                 How to introduce: [\notes]\relative 'c { } in an
-                 implicit or otherwise intuitive way? */
-       | language Music_list {
-               SCM lst = $2;
-               Music *m = MY_MAKE_MUSIC ("SequentialMusic");
-               m->set_property ("elements", ly_car (lst));
-               m->set_spot (THIS->here_input ());
-               
-               Pitch middle_c;
-               $$ = MY_MAKE_MUSIC ("RelativeOctaveMusic");
-               $$->set_property ("element", m->self_scm ());
-
-               Pitch last = m->to_relative_octave (middle_c);
-               if (lily_1_8_relative)
-                       $$->set_property ("last-pitch", last.smobbed_copy ());
-
-               scm_gc_unprotect_object (m->self_scm ());
-       }
        ;
 
 embedded_scm:
@@ -561,8 +537,6 @@ embedded_scm:
        ;
 
 
-
-
 lilypond_header_body:
        {
                $$ = ly_make_anonymous_module ();
@@ -1192,33 +1166,39 @@ basic music objects too, since the meaning is different.
 
 relative_music:
        RELATIVE absolute_pitch Music {
-               Music *p = $3;
-               Pitch pit = *unsmob_pitch ($2);
-               $$ = MY_MAKE_MUSIC ("RelativeOctaveMusic");
-
-               $$->set_property ("element", p->self_scm ());
-               scm_gc_unprotect_object (p->self_scm ());
-
-               Pitch last = p->to_relative_octave (pit);
-               if (lily_1_8_relative)
-                       $$->set_property ("last-pitch", last.smobbed_copy ());
+               Music *m = $3;
+               Pitch start = *unsmob_pitch ($2);
+               $$ = make_music_relative (start, m);
+               scm_gc_unprotect_object (m->self_scm ());
+       }
+       | RELATIVE Composite_music {
+               Music *m = $2;
+               /* FIXME: why is octave==0 and default not middleC? */
+               Pitch middle_c (-1, 0, 0);
+               $$ = make_music_relative (middle_c, m);
+               scm_gc_unprotect_object (m->self_scm ());
        }
        ;
 
 re_rhythmed_music:
-       ADDLYRICS Music Music {
-       Music *l = MY_MAKE_MUSIC ("LyricCombineMusic");
-         l->set_property ("elements", scm_listify ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
-         scm_gc_unprotect_object ($3->self_scm ());
-         scm_gc_unprotect_object ($2->self_scm ());
-         $$ = l;
+       ADDLYRICS { THIS->lexer_->push_lyric_state (); }
+       /* cont */
+       Music {
+               THIS->lexer_->pop_state ();
+
+               Music *music = $3;
+               SCM name = scm_makfrom0str ("");
+               Music *combined = make_lyric_combine_music (name, music);
+               SCM context = scm_makfrom0str ("Lyrics");
+               $$ = context_spec_music (context, SCM_UNDEFINED, combined,
+                       SCM_EOL);
+               scm_gc_unprotect_object (music->self_scm ());
        }
        | LYRICSTO string Music {
-         Music *l = MY_MAKE_MUSIC ("NewLyricCombineMusic");
-         l->set_property ("element", $3->self_scm ());
-         scm_gc_unprotect_object ($3->self_scm ());
-         $$ = l;
-         l->set_property ("associated-context", $2);
+               Music *music = $3;
+               SCM name = $2;
+               $$ = make_lyric_combine_music (name, music);
+               scm_gc_unprotect_object (music->self_scm ());
        }
        ;
 
@@ -1496,30 +1476,30 @@ command_element:
        }
        | OCTAVE { THIS->push_spot (); }
          pitch {
-               Music *l = MY_MAKE_MUSIC ("RelativeOctaveCheck");
-               $$ = l;
+               Music *m = MY_MAKE_MUSIC ("RelativeOctaveCheck");
+               $$ = m;
                $$->set_spot (THIS->pop_spot ());
                $$->set_property ("pitch", $3);
        }
        | E_LEFTSQUARE {
-               Music *l = MY_MAKE_MUSIC ("LigatureEvent");
-               l->set_property ("span-direction", scm_int2num (START));
-               l->set_spot (THIS->here_input ());
+               Music *m = MY_MAKE_MUSIC ("LigatureEvent");
+               m->set_property ("span-direction", scm_int2num (START));
+               m->set_spot (THIS->here_input ());
 
                $$ = MY_MAKE_MUSIC ("EventChord");
-               $$->set_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
-               scm_gc_unprotect_object (l->self_scm ());
+               $$->set_property ("elements", scm_cons (m->self_scm (), SCM_EOL));
+               scm_gc_unprotect_object (m->self_scm ());
                $$->set_spot (THIS->here_input ());
        }
        | E_RIGHTSQUARE {
-               Music *l = MY_MAKE_MUSIC ("LigatureEvent");
-               l->set_property ("span-direction", scm_int2num (STOP));
-               l->set_spot (THIS->here_input ());
+               Music *m = MY_MAKE_MUSIC ("LigatureEvent");
+               m->set_property ("span-direction", scm_int2num (STOP));
+               m->set_spot (THIS->here_input ());
 
                $$ = MY_MAKE_MUSIC ("EventChord");
-               $$->set_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
+               $$->set_property ("elements", scm_cons (m->self_scm (), SCM_EOL));
                $$->set_spot (THIS->here_input ());
-               scm_gc_unprotect_object (l->self_scm ());
+               scm_gc_unprotect_object (m->self_scm ());
        }
        | E_BACKSLASH {
                $$ = MY_MAKE_MUSIC ("VoiceSeparator");
index 58e2b0baa48892191113b148dd2cf40db99ed474..8004d2fe6530284976da2ddb356699549ada7615 100644 (file)
@@ -20,6 +20,7 @@ Pitch::Pitch (int o, int n, int a)
   normalise ();
 }
 
+/* FIXME: why is octave == 0 and default not middleC ? */
 Pitch::Pitch ()
 {
   notename_ = 0;