From 9960665d40411d204105d16d31f621f48064d84a Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 12 Nov 2004 23:33:44 +0000 Subject: [PATCH] (re_rhythmed_music): search music expression for context-id, surround by \new Voice if not found. Fixes: addlyrics-second-staff.ly --- ChangeLog | 6 ++++++ lily/parser.yy | 32 ++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e83c20d21e..3c16bd2fa6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-11-13 Han-Wen Nienhuys + + * 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 * Documentation/index.html.in: Fix url to one big page. (backportme) diff --git a/lily/parser.yy b/lily/parser.yy index 54edb3afdc..3b2b4ec8ea 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -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 (); -- 2.39.5