lilypond-user
[Top][All Lists]
Advanced

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

Re: how to define a boolean?


From: Marc Hohl
Subject: Re: how to define a boolean?
Date: Sat, 08 Aug 2009 19:59:30 +0200
User-agent: Thunderbird 2.0.0.22 (X11/20090608)

Mark Polesky schrieb:
Marc Hohl wrote:

Sorry if this is a stupid question, but here im totally stuck:

Not a stupid question. This involves "parser variables" which are
giving us developers troubles, too! If you're curious, you can
follow this long thread:
http://lists.gnu.org/archive/html/lilypond-devel/2009-07/msg00921.html

I followed this thread on -devel, but at some point, it went over my head, so
I didn't read in detail.
I need to define a boolean which is to be changed within a music-function
and a stencil callback.

For the music-function you can do this:

% you can also do:
% mybool = ##f
#(define mybool #f)

myfunc =
#(define-music-function (parser location note) (ly:music?)
  (ly:parser-define! parser 'mybool #t)
  (let* ((mybool (ly:parser-lookup parser 'mybool))
         (color  (if mybool red blue)))
    #{
      \override  NoteHead #'color = $color
      $note
    #}))
Thank you! At least I can play with this ...
The callback is a little trickier for me for the moment.
I'll get back to you.
Great. I am awaiting your response.

Marc
- Mark








reply via email to

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