]> git.donarmstrong.com Git - lilypond.git/commitdiff
(re_rhythmed_music): search music expression for
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 12 Nov 2004 23:33:44 +0000 (23:33 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 12 Nov 2004 23:33:44 +0000 (23:33 +0000)
context-id, surround by \new Voice if not found. Fixes:
addlyrics-second-staff.ly

ChangeLog
lily/parser.yy

index e83c20d21e3462f3d956fcd985db234f50a10bd0..3c16bd2fa6eb73f9276d2a785ee3bcc33fa8a65a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-11-13  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * lily/parser.yy (re_rhythmed_music): search music expression for
+       context-id, surround by \new Voice if not found. Fixes:
+       addlyrics-second-staff.ly
+
 2004-11-12  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * Documentation/index.html.in: Fix url to one big page.  (backportme)
index 54edb3afdc38da8e521e8450ac2eaf08be36ad05..3b2b4ec8eaf0617fb609a6810d9f5e5601e1ce07 100644 (file)
@@ -100,6 +100,20 @@ is_regular_identifier (SCM id)
   return v;
 }
 
+
+SCM
+get_first_context_id (SCM type, Music *m)
+{
+       SCM id = m->get_property ("context-id");
+       if (SCM_BOOL_T == scm_equal_p (m->get_property ("context-type"), type)
+           && scm_is_string (m->get_property ("context-id"))
+           && scm_c_string_length (id) > 0)
+       {
+               return id;
+       }
+       return SCM_EOL;
+}
+
 SCM
 make_simple_markup (SCM encoding, SCM a)
 {
@@ -1269,11 +1283,15 @@ new_lyrics:
 
 re_rhythmed_music:
        Grouped_music_list new_lyrics {
-
-               SCM name = $1->get_property ("context-id");
-               //if (name == SCM_EOL)
+               Music * voice = $1;
+               SCM name = get_first_context_id (scm_makfrom0str ("Voice"), voice); 
                if (!scm_is_string (name))
-                       name = scm_makfrom0str ("");
+               {
+                       name = get_next_unique_context ();
+                       voice = context_spec_music (scm_makfrom0str ("Voice"),
+                                                   name,
+                                                   voice, SCM_EOL);
+               }
 
                SCM context = scm_makfrom0str ("Lyrics");
                Music *all = MY_MAKE_MUSIC ("SimultaneousMusic");
@@ -1287,12 +1305,10 @@ re_rhythmed_music:
                                get_next_unique_context (), com, SCM_EOL);
                        lst = scm_cons (csm->self_scm (), lst);
                }
-               /* FIXME: only first lyric music is accepted,
-                         the rest is junked */
-               all->set_property ("elements", scm_cons ($1->self_scm (),
+               all->set_property ("elements", scm_cons (voice->self_scm (),
                        lst));
                $$ = all;
-               scm_gc_unprotect_object ($1->self_scm ());
+               scm_gc_unprotect_object (voice->self_scm ());
        }
        | LYRICSTO {
                THIS->lexer_->push_lyric_state ();