From: Han-Wen Nienhuys Date: Sun, 7 Nov 2004 18:46:26 +0000 (+0000) Subject: * lily/new-quote-iterator.cc (construct_children): set X-Git-Tag: release/2.5.14~606 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=81690554116358aa3e28711361e09865a783091d;p=lilypond.git * lily/new-quote-iterator.cc (construct_children): set quote_outlet_ if no quoted-context-{id,type} specified. * scripts/convert-ly.py (conv): \quote -> \quoteDuring. * lily/parser.yy (command_element): remove \quote. * ly/music-functions-init.ly (location): add quoteDuring music function. * lily/lexer.ll: allow \encoding in lyrics as well. Remove optional semicolon. (backportme) --- diff --git a/ChangeLog b/ChangeLog index 23ff2d909d..dfc0e767fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,17 @@ 2004-11-07 Han-Wen Nienhuys - * lily/lexer.ll: allow \encoding in lyrics as well. + * lily/new-quote-iterator.cc (construct_children): set + quote_outlet_ if no quoted-context-{id,type} specified. + + * scripts/convert-ly.py (conv): \quote -> \quoteDuring. + + * lily/parser.yy (command_element): remove \quote. + + * ly/music-functions-init.ly (location): add quoteDuring music + function. + + * lily/lexer.ll: allow \encoding in lyrics as well. Remove + optional semicolon. (backportme) 2004-11-06 Jan Nieuwenhuizen diff --git a/lily/lexer.ll b/lily/lexer.ll index 54c4c3cd0c..a1c7623703 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -164,7 +164,7 @@ HYPHEN -- } } -\\encoding{WHITE}* { +\\encoding{WHITE}* { yy_push_state (encoding); } \\version{WHITE}* { @@ -243,16 +243,14 @@ HYPHEN -- \\include { yy_push_state (incl); } -\"[^"]*\";? { /* got the include file name */ -/* FIXME: semicolon? */ +\"[^"]*\" { /* got the include file name */ String s (YYText ()+1); s = s.left_string (s.index_last ('"')); new_input (s, sources_); yy_pop_state (); } -\\{BLACK}*;?{WHITE} { /* got the include identifier */ -/* FIXME: semicolon? */ +\\{BLACK}*{WHITE} { /* got the include identifier */ String s = YYText () + 1; strip_trailing_white (s); if (s.length () && (s[s.length () - 1] == ';')) @@ -356,7 +354,6 @@ HYPHEN -- yylval.i = String_convert::dec2int (String (YYText () +1)); return E_UNSIGNED; } - \" { start_quote (); } diff --git a/lily/new-quote-iterator.cc b/lily/new-quote-iterator.cc index e3928cfcef..e1bdf20805 100644 --- a/lily/new-quote-iterator.cc +++ b/lily/new-quote-iterator.cc @@ -104,9 +104,17 @@ New_quote_iterator::construct_children () SCM name = get_music ()->get_property ("quoted-context-type"); SCM id = get_music ()->get_property ("quoted-context-id"); - Context *cue_context = get_outlet()->find_create_context (name, - ly_scm2string (id), SCM_EOL); - quote_outlet_.set_context (cue_context); + if (scm_is_string (id) + && scm_is_symbol (name)) + { + Context *cue_context = get_outlet()->find_create_context (name, + ly_scm2string (id), SCM_EOL); + quote_outlet_.set_context (cue_context); + } + else + { + quote_outlet_.set_context (get_outlet ()); + } Moment now = get_outlet ()->now_mom (); Moment stop = now + get_music()->get_length (); diff --git a/lily/parser.yy b/lily/parser.yy index a193206ffc..54edb3afdc 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1598,14 +1598,6 @@ command_element: $$ = skip; } - | QUOTE STRING duration_length { - Music *quote = MY_MAKE_MUSIC ("QuoteMusic"); - quote->set_property ("duration", $3); - quote->set_property ("quoted-music-name", $2); - quote->set_spot (THIS->here_input ()); - - $$ = quote; - } | OCTAVE { THIS->push_spot (); } pitch { Music *m = MY_MAKE_MUSIC ("RelativeOctaveCheck"); diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index cd9914887a..6e074d0a14 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -77,7 +77,7 @@ keepWithTag = %% doing %% def-music-function in a .scm causes crash. -quoteDuring = # +cueDuring = # (def-music-function (location what dir main-music) (string? ly:dir? ly:music?) @@ -113,6 +113,16 @@ quoteDuring = # (set! (ly:music-property quote-music 'element) main-music) return-value)) +quoteDuring = # +(def-music-function + (location what main-music) + (string? ly:music?) + (make-music 'NewQuoteMusic + 'element main-music + 'quoted-music-name what + 'origin location)) + + %{ TODO: diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 4ca282ea99..5c5ea69d36 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -2234,6 +2234,21 @@ conversions.append (((2, 4, 0), conv, '')) + +# nothing, just to make version numbers look good. +def conv (str): + str = re.sub (r'\\quote\s+"?([a-zA-Z0-9]+)"?\s+([0-9.*/]+)', + r'\\quoteDuring #"\1" { \skip \2 }', + str + ) + return str + +conversions.append (((2, 5, 0), + conv, + '')) + + + ################################ # END OF CONVERSIONS ################################