From: Han-Wen Nienhuys Date: Sat, 21 Feb 2004 22:56:13 +0000 (+0000) Subject: * lily/parser.yy (command_element): extract quoted vector in X-Git-Tag: release/2.1.26~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f28a853889656703fd3ac8d065f235bf6d0e8e7f;p=lilypond.git * lily/parser.yy (command_element): extract quoted vector in parser. * input/regression/quote.ly: new file. * lily/parser.yy (command_element): \quote DURATION NAME: support cue notes. * lily/quote-iterator.cc (class Quote_iterator): new file. --- diff --git a/ChangeLog b/ChangeLog index b6440fe3e0..0ea6d3c87c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-02-21 Han-Wen Nienhuys + * lily/parser.yy (command_element): extract quoted vector in + parser. + * input/regression/quote.ly: new file. * lily/sequential-iterator.cc (process): only process if moment >= 0. diff --git a/input/regression/quote.ly b/input/regression/quote.ly index f8a47044bc..bd1d84c55d 100644 --- a/input/regression/quote.ly +++ b/input/regression/quote.ly @@ -13,8 +13,6 @@ bla = \notes\relative c' { fis4 fis fis fis } \score { \notes \relative c'' { - \set Score.quotes = \musicQuotes - c8 d8 \quote 2 "bla" es8 gis } } diff --git a/lily/parser.yy b/lily/parser.yy index 566af26bb6..8d6e4651f7 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1349,9 +1349,23 @@ command_element: $$ = skip; } | QUOTE duration_length STRING { - Music * quote = MY_MAKE_MUSIC("QuoteMusic"); - quote->set_mus_property ("duration", $2); - quote->set_mus_property ("quoted-name", $3); + SCM tab = THIS->lexer_->lookup_identifier ("musicQuotes"); + SCM evs = SCM_EOL; + if (scm_hash_table_p (tab) == SCM_BOOL_T) + { + SCM key = $3; // use symbol? + evs = scm_hash_ref (tab, key, SCM_BOOL_F); + } + Music * quote = 0; + if (scm_vector_p (evs) == SCM_BOOL_T) + { + quote = MY_MAKE_MUSIC("QuoteMusic"); + quote->set_mus_property ("duration", $2); + quote->set_mus_property ("quoted-events", evs); + } else { + THIS->here_input ().warning (_f ("Can\'t find music.")); + quote = MY_MAKE_MUSIC ("Event"); + } quote->set_spot (THIS->here_input ()); $$ = quote; } diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc index 680b616fe1..8439e5698f 100644 --- a/lily/quote-iterator.cc +++ b/lily/quote-iterator.cc @@ -79,16 +79,7 @@ binsearch_scm_vector (SCM vec, SCM key, bool (*is_less)(SCM a,SCM b)) void Quote_iterator::construct_children () { - SCM tab = get_outlet()->get_property ("quotes"); - if (scm_hash_table_p (tab) != SCM_BOOL_T) - { - get_music ()->origin ()->warning ("Context property `quotes' unset; cannot process quote."); - return ; - } - - SCM name = get_music ()->get_mus_property ("quoted-name"); SCM dur = get_music ()->get_mus_property ("duration"); - if (!unsmob_duration (dur)) return ; @@ -98,16 +89,13 @@ Quote_iterator::construct_children () Moment stop = now + unsmob_duration (dur)->get_length (); start_moment_ = now; - - event_vector_ = scm_hash_ref (tab, name, SCM_BOOL_F); + event_vector_ = get_music ()->get_mus_property ("quoted-events"); if (scm_vector_p (event_vector_) == SCM_BOOL_T) { event_idx_ = binsearch_scm_vector (event_vector_, now.smobbed_copy (), &moment_less); end_idx_ = binsearch_scm_vector (event_vector_, stop.smobbed_copy (), &moment_less); } - else - get_music ()->origin ()->warning ("Can't find requested source"); } diff --git a/scm/define-music-properties.scm b/scm/define-music-properties.scm index f033680d3b..e7cc07e34f 100644 --- a/scm/define-music-properties.scm +++ b/scm/define-music-properties.scm @@ -80,8 +80,8 @@ For chord inversions, this is negative.") "The function to run with \\applycontext. It must take a single argument, being the context.") (property-operations ,list? "Do these operations for instantiating the context.") - (predicate ,procedure? "the predicate of a \\outputproperty") - (quoted-name ,string? "The name of the voice to be quoted") + (predicate ,procedure? "the predicate of a \\outputproperty.") + (quoted-events ,vector? "A vector of with moment/event-list entries.") (type ,symbol? "The type of this music object. Determines iteration in some cases.") (types ,list? "The types of this music object; determines by what engraver this music expression is