lilypond-user
[Top][All Lists]
Advanced

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

Scheme question


From: Steven Weber
Subject: Scheme question
Date: Fri, 2 Nov 2007 16:00:22 -0700

Hey everyone!

 

I’m hoping one of the Scheme gods on the list can tell me what I’m doing wrong here.  I’m trying to create  a markup function that will draw harp pedal diagrams.  To do that, I need a function that takes 7 parameters.  My function works fine as long as there are only 3 parameters – as soon as I add the fourth, everything blows up, with the following error:

 

programming error: no parser tag defined for this markup signature

continuing, cross fingers

(#<procedure baseHarpPedal-markup (layout props dpedal cpedal bpedal epedal)> . scheme0-scheme1-scheme2-scheme3)

 

Here’s what I’ve got:

 

\version "2.11.34"

 

#(define (pedalFlat location)

   (string-append location " -0.75 moveto " location " -1.75 lineto "))

#(define (pedalNatural location)

   (string-append location " -1.75 moveto " location " -3.25 lineto "))

#(define (pedalSharp location)

   (string-append location " -3.25 moveto " location " -4.25 lineto "))

 

% This block works

#(define-markup-command (baseHarpPedal layout props dpedal cpedal bpedal) (integer? integer? integer?)

  (interpret-markup layout props

   (markup

                (#:postscript

                 (string-append "2 setlinecap 0 0 moveto 0 -5 lineto -5.25 -2.50 moveto 6.75 -2.5 lineto stroke 2 setlinecap 0.5 setlinewidth "

                                (cond    ((= dpedal 1)  (pedalFlat "-4.5"))

                                                                ((= dpedal -1) (pedalSharp "-4.5"))

                                                                (else                         (pedalNatural "-4.5"))

                                )

                                (cond    ((= cpedal 1)  (pedalFlat "-3"))

                                                                ((= cpedal -1) (pedalSharp "-3"))

                                                                (else                         (pedalNatural "-3"))

                                )

                                (cond    ((= bpedal 1)  (pedalFlat "-1.5"))

                                                                ((= bpedal -1) (pedalSharp "-1.5"))

                                                                (else                         (pedalNatural "-1.5"))

                                )

                                "stroke" )))))

 

% This block doesn't

%{

#(define-markup-command (baseHarpPedal layout props dpedal cpedal bpedal epedal) (integer? integer? integer? integer?)

  (interpret-markup layout props

   (markup

                (#:postscript

                 (string-append "2 setlinecap 0 0 moveto 0 -5 lineto -5.25 -2.50 moveto 6.75 -2.5 lineto stroke 2 setlinecap 0.5 setlinewidth "

                                (cond    ((= dpedal 1)  (pedalFlat "-4.5"))

                                                                ((= dpedal -1) (pedalSharp "-4.5"))

                                                                (else                         (pedalNatural "-4.5"))

                                )

                                (cond    ((= cpedal 1)  (pedalFlat "-3"))

                                                                ((= cpedal -1) (pedalSharp "-3"))

                                                                (else                         (pedalNatural "-3"))

                                )

                                (cond    ((= bpedal 1)  (pedalFlat "-1.5"))

                                                                ((= bpedal -1) (pedalSharp "-1.5"))

                                                                (else                         (pedalNatural "-1.5"))

                                )

                                (cond    ((= epedal 1)  (pedalFlat "1.5"))

                                                                ((= epedal -1) (pedalSharp "1.5"))

                                                                (else                         (pedalNatural "1.5"))

                                )

                                "stroke" )))))

%}

 

\score

{

                % This line works

                c''1 _\markup { \baseHarpPedal #0 #1 #-1 }

               

                % This line doesn't

%            c''1 _\markup { \baseHarpPedal #0 #1 #-1 #0 }

}

 

Thanks!

 

--Steven


reply via email to

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