lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function lookup


From: John Mangual
Subject: Re: function lookup
Date: Mon, 15 Dec 2008 06:06:51 -0500

So there is a distinction between parser keywords and music functions?

On Sun, Dec 14, 2008 at 12:43 PM, Neil Puttock <address@hidden> wrote:
Hi John,

2008/12/14 John Mangual <address@hidden>:
> how would i go about looking up the scheme source code for a specific
> function like "transpose" or "tuple" or "key"

It depends on whether the function is a parser keyword or music
function; if it's the latter (you can check this by looking at
appendix B.14, Identifiers) then you're most likely to find it in
ly/music-functions-init.ly.

In the case of keywords, you'll have to follow the trail from the
parser.  For example, here's the parser entry for \transpose:

       | 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);
       }

The MAKE_SYNTAX macro calls the Scheme function transpose-music, which
you'll find in scm/ly-syntax-constructors.scm:

(define-ly-syntax-simple (transpose-music pitch music)
 (make-music 'TransposedMusic
             'element (ly:music-transpose music pitch)))

Regards,
Neil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]