Lilypond variable definitions - are they accessible from Scheme?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Lilypond variable definitions - are they accessible from Scheme?

Ian Hulin
HI all,
I'm working on the Guile Debugger Stuff, and would like to try debugging a music function definition such as:
conditionalMark = #(define-music-function (parser location) ()
    #{ \tag #'instrumental-part {\mark \default}  #} )

It appears conditionalMark does not get set up as an equivalent of a Scheme
(define conditionalMark = define-music-function(parser location () ...
although something gets defined because Scheme apparently recognizes
#(set-break! conditionalMark)
    later on in the file without signalling any Guile errors.
However the breakpoint trap is never encountered as define-music-function passed things on to ly:make-music-function, which is really C++ code ly_make_music_function, so Guile never finds out about the breakpoint.

Any ideas?

Cheers,

Ian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond variable definitions - are they accessible from Scheme?

Carl Sorensen



On 1/3/10 2:54 PM, "Ian Hulin" <[hidden email]> wrote:

> HI all,
> I'm working on the Guile Debugger Stuff, and would like to try debugging a
> music function definition such as:
> conditionalMark = #(define-music-function (parser location) ()
>     #{ \tag #'instrumental-part {\mark \default}  #} )
>
> It appears conditionalMark does not get set up as an equivalent of a Scheme
> (define conditionalMark = define-music-function(parser location () ...
> although something gets defined because Scheme apparently recognizes
> #(set-break! conditionalMark)
>     later on in the file without signalling any Guile errors.
> However the breakpoint trap is never encountered as define-music-function
> passed things on to ly:make-music-function, which is really C++ code
> ly_make_music_function, so Guile never finds out about the breakpoint.

I think that LilyPond variables are visible in Scheme.

I'm not sure why you can't set the breakpoint for conditionalMark.  If I had
to guess, it would be because define-music-function is a macro, not a Scheme
procedure, but that's a totally wild guess.

I've copied this to -devel, because this question is over my head.

Thanks,

Carl


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond variable definitions - are they accessible from Scheme?

Han-Wen Nienhuys-2
On Sun, Jan 3, 2010 at 10:00 PM, Carl Sorensen <[hidden email]> wrote:
>> I'm working on the Guile Debugger Stuff, and would like to try debugging a
>> music function definition such as:
>> conditionalMark = #(define-music-function (parser location) ()
>>     #{ \tag #'instrumental-part {\mark \default}  #} )
>>
>> It appears conditionalMark does not get set up as an equivalent of a Scheme
>> (define conditionalMark = define-music-function(parser location () ...
>> although something gets defined because Scheme apparently recognizes
>> #(set-break! conditionalMark)

you can see the defintion by doing

  #(display conditionalMark)

inside the .ly file.

The breakpoint failing may have to do with the call sequence.  See
parser.yy, run_music_function().  The function is called directly from
C++, without going through the GUILE evaluator, so I think that is why
there is no debugger trap.

--
Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen

---
----
Join the Frogs!

Loading...