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: Carl Sorensen
Subject: Re: how to define a boolean?
Date: Sun, 9 Aug 2009 05:48:20 -0600



On 8/9/09 5:21 AM, "Marc Hohl" <address@hidden> wrote:

> Trevor Daniels schrieb:
>> [...]
>>> 
>>> 
>>> From what I see on the console output, the calls of \myMusicFunc
>>> are evaluated first, so myBool is #t  and the callbacks come in action
>>> afterwards (the first slur claims #t, every other slur reads #f), so
>>> apparently they don't influence each other the way I expected them to
>>> do.
>> 
>> That's right.  AIUI, Music functions act on
>> the music stream, before layout commences, so
>> all music functions have completed before the
>> first callback.  I don't know what you are
>> trying to do, but the example looks rather
>> like overriding a grob property might achieve
>> it.
> Thank for clarification.
> I think I have a solution for my specific problem, because it seems that
> the callback
> can change the value and for the next time called, he uses the proper
> value, like this:
> 
> #(define-public (slur::boolean grob)
>   ;; just a test function to try and switch boolean values
>     (display "\nWithin callback\n")
>     (display "myBool: ")(display myBool)(newline)
>     (if myBool
>         (set! myBool #f)
>         (set! myBool #t))
>     (display "myBool: ")(display myBool)(newline)
>     (ly:slur::print grob))

Yes.  You can have the callbacks interact chronologically, since the music
is engraved chronologically.

You can have music functions interact in parse order (the order they appear
in the input file).

You can have music functions affect the behavior of callbacks.

But you CANNOT have callbacks affect music functions; all music functions
will have been evaluated before the first callback is evalutated.

Thanks,

Carl





reply via email to

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