]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/music-functions.scm (pitch-of-note): new function.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 4 Feb 2006 13:39:18 +0000 (13:39 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 4 Feb 2006 13:39:18 +0000 (13:39 +0000)
* ly/music-functions-init.ly: add \octave and \addquote

* lily/parser.yy (music_function_chord_body): softcode \octave.
(lilypond_header): softcode \addquote

ChangeLog
lily/beaming-info.cc
lily/lily-lexer.cc
lily/parser.yy
ly/music-functions-init.ly
scm/music-functions.scm

index 9ccc5d06aad6fa291d88d019e85f5a61ec671bcc..60622914528b34bb3034971dced09aeb3155e0ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-02-04  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scm/music-functions.scm (pitch-of-note): new function.
+
+       * ly/music-functions-init.ly: add \octave and \addquote
+
+       * lily/parser.yy (music_function_chord_body): softcode \octave.
+       (lilypond_header): softcode \addquote
+
 2006-02-03  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * flower/include/std-vector.hh[STD_VECTOR]: Do not include
index c4444c17a6553754b500fe523582b65a75625dc9..27dcc682654d69316d9bb1a35972635c4ee181cb 100644 (file)
@@ -77,8 +77,7 @@ Beaming_info_list::beamify (Moment &beat_length, bool subdivide)
 
   do
     splits[d].beamify (beat_length, subdivide);
-  while (flip (&d) != LEFT)
-    ;
+  while (flip (&d) != LEFT);
 
   int middle_beams = (split ? 1
                      : min (splits[RIGHT].beam_extend_count (LEFT),
index ddf8510e9dc99bc2c892383d8e04f61eb6f8cc8c..c4f2731cac66e0460eada184ecc2158827d8d271 100644 (file)
@@ -26,7 +26,6 @@ static Keyword_ent the_key_tab[]
 = {
   {"accepts", ACCEPTS},
   {"addlyrics", ADDLYRICS},
-  {"addquote", ADDQUOTE},
   {"alias", ALIAS},
   {"alternative", ALTERNATIVE},
   {"book", BOOK},
@@ -57,7 +56,6 @@ static Keyword_ent the_key_tab[]
   {"new", NEWCONTEXT},
   {"notemode", NOTEMODE},
   {"objectid", OBJECTID},
-  {"octave", OCTAVE},
   {"once", ONCE},
   {"override", OVERRIDE},
   {"paper", PAPER},
index 080406a08a83c1600568623e7c020aae12d23ef2..651ef44a5266808cb24f6c4e1c5775181b1a984f 100644 (file)
@@ -450,9 +450,6 @@ object_id_setting:
 toplevel_expression:
        lilypond_header {
                THIS->lexer_->set_identifier (ly_symbol2scm ("$defaultheader"), $1);
-       }
-       | add_quote {
-       
        }
        | book_block {
                Book *book = $1;
@@ -871,6 +868,7 @@ Alternative_music:
 Repeated_music:
        REPEAT simple_string bare_unsigned Music Alternative_music
        {
+               /*TODO: move to Scheme.*/
                Music *beg = $4;
                int times = $3;
                SCM alts = scm_is_pair ($5) ? scm_car ($5) : SCM_EOL;
@@ -1064,9 +1062,9 @@ Prefix_composite_music:
        }
 
        | TIMES fraction Music  
-
        {
-               int n = scm_to_int (scm_car ($2)); int d = scm_to_int (scm_cdr ($2));
+               int n = scm_to_int (scm_car ($2));
+               int d = scm_to_int (scm_cdr ($2));
                Music *mp = $3;
 
                $$= MY_MAKE_MUSIC ("TimeScaledMusic");
@@ -1568,15 +1566,6 @@ music_function_chord_body:
        ;
 
 
-add_quote:
-       ADDQUOTE string Music {
-               SCM adder = ly_lily_module_constant ("add-quotable");
-               
-               scm_call_2 (adder, $2, $3->self_scm ());
-               $3->unprotect();
-       }
-       ;
-
 command_element:
        command_event {
                $$ = MY_MAKE_MUSIC ("EventChord");
@@ -1592,12 +1581,6 @@ command_element:
                skip->set_spot (@$);
                $$ = skip;
        }
-       | OCTAVE pitch {
-               Music *m = MY_MAKE_MUSIC ("RelativeOctaveCheck");
-               $$ = m;
-               $$->set_spot (@$);
-               $$->set_property ("pitch", $2);
-       }
        | E_BRACKET_OPEN {
                Music *m = MY_MAKE_MUSIC ("LigatureEvent");
                m->set_property ("span-direction", scm_from_int (START));
index 77bdedc9fb9f3beb1d950a8372a296c3e357270e..cf185485b6a37a02923c87d5804ce3e907425e02 100644 (file)
@@ -406,3 +406,20 @@ Example:
 spacingTweaks =
 #(def-music-function (parser location parameters) (list?)
    (make-music 'SequentialMusic 'void #t))
+
+octave =
+#(def-music-function (parser location pitch-note) (ly:music?)
+   "octave check"
+
+   (make-music 'RelativeOctaveCheck
+              'origin location
+              'pitch (pitch-of-note pitch-note) 
+              ))
+
+addquote =
+#(def-music-function (parser location name music) (string? ly:music?)
+   "Add a piece of music to be quoted "
+   (add-quotable name music)
+   (make-music 'SequentialMusic 'void #t))
+
+   
index b0ff69a6dbff5ae4669fd6dd9c019a9540cc0584..724165a88f399d9e02d4877f256990bd1763860b 100644 (file)
@@ -963,3 +963,14 @@ use GrandStaff as a context. "
           (ly:make-duration 0 0) '())))
     (ly:music-compress skip (ly:music-length mus))
     skip))
+
+(define-public (pitch-of-note event-chord)
+
+  (let*
+      ((evs (filter (lambda (x) (memq 'note-event (ly:music-property x 'types)))
+                   (ly:music-property event-chord 'elements))))
+
+    (if (pair? evs)
+       (ly:music-property (car evs) 'pitch)
+       #f)))
+