From 1507f6c441f48837732d2c26a452c64d082e71da Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Fri, 9 Sep 2011 14:33:38 +0200 Subject: [PATCH] parser.yy et al: Turn \transpose into a music function. --- lily/lily-lexer.cc | 1 - lily/parser.yy | 7 ------- ly/music-functions-init.ly | 9 +++++++++ scm/ly-syntax-constructors.scm | 4 ---- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index ba6429c3ea..47fd1522db 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -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}, diff --git a/lily/parser.yy b/lily/parser.yy index 26b1af7d14..df08aefe15 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -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")) { diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index b3a0098607..5e1225431a 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -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) diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm index 540cc24d74..e25539c469 100644 --- a/scm/ly-syntax-constructors.scm +++ b/scm/ly-syntax-constructors.scm @@ -89,10 +89,6 @@ '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))) -- 2.39.2