]> git.donarmstrong.com Git - lilypond.git/commitdiff
parser.yy et al: Turn \transpose into a music function.
authorDavid Kastrup <dak@gnu.org>
Fri, 9 Sep 2011 12:33:38 +0000 (14:33 +0200)
committerDavid Kastrup <dak@gnu.org>
Sun, 11 Sep 2011 12:35:34 +0000 (14:35 +0200)
lily/lily-lexer.cc
lily/parser.yy
ly/music-functions-init.ly
scm/ly-syntax-constructors.scm

index ba6429c3ea2798344702178363f200071c0f73cc..47fd1522dba266d794f86fd502f220d5fcae10e3 100644 (file)
@@ -89,7 +89,6 @@ static Keyword_ent the_key_tab[]
   {"tempo", TEMPO},
   {"time", TIME_T},
   {"times", TIMES},
-  {"transpose", TRANSPOSE},
   {"type", TYPE},
   {"unset", UNSET},
   {"with", WITH},
index 26b1af7d144cc6d09269c19e70b03281daa88ce5..df08aefe1588d50e26566dfcb0355350224524f7 100644 (file)
@@ -215,7 +215,6 @@ void set_music_properties (Music *p, SCM a);
 %token SKIP "\\skip"
 %token TEMPO "\\tempo"
 %token TIMES "\\times"
-%token TRANSPOSE "\\transpose"
 %token TYPE "\\type"
 %token UNSET "\\unset"
 %token WITH "\\with"
@@ -1212,12 +1211,6 @@ prefix_composite_music:
                 $$ = MAKE_SYNTAX ("time-scaled-music", @$, $2, $3);
        }
        | repeated_music                { $$ = $1; }
-       | TRANSPOSE pitch_also_in_chords pitch_also_in_chords music {
-               Pitch from = *unsmob_pitch ($2);
-               Pitch to = *unsmob_pitch ($3);
-               SCM pitch = pitch_interval (from, to).smobbed_copy ();
-               $$ = MAKE_SYNTAX ("transpose-music", @$, pitch, $4);
-       }
        | mode_changing_head grouped_music_list {
                if ($1 == ly_symbol2scm ("chords"))
                {
index b3a009860753c54d7ab7549617ab4ba6f32d3ae5..5e1225431a2c08b9d80e06b8d0dee9fcf0ef09c0 100644 (file)
@@ -943,6 +943,15 @@ tag =
          (ly:music-property arg 'tags)))
    arg)
 
+transpose =
+#(define-music-function
+   (parser location from to music)
+   (ly:pitch? ly:pitch? ly:music?)
+
+   (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}.")
+   (make-music 'TransposedMusic
+               'element (ly:music-transpose music (ly:pitch-diff to from))))
+
 transposedCueDuring =
 #(define-music-function
    (parser location what dir pitch-note main-music)
index 540cc24d741ec655faebb126f7a19d841a3db496..e25539c469f794aaf6aa8fb7a04ef9c0f029bd52 100644 (file)
              'numerator (car fraction)
              'denominator (cdr fraction)))
 
-(define-ly-syntax-simple (transpose-music pitch music)
-  (make-music 'TransposedMusic
-             'element (ly:music-transpose music pitch)))
-
 (define-ly-syntax (tempo parser location text . rest)
   (let* ((unit (and (pair? rest)
                    (car rest)))