Re: [frogs] How can I output Stream_event variables on the console?

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]




On 2/24/10 12:28 PM, "Marc Hohl" <marc@xxxxxxxxxx> wrote:

> Hello Reinhold, hello Carl,
> 
> Reinhold Kainhofer schrieb:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> 
>> Am Mittwoch, 24. Februar 2010 12:26:15 schrieb Carl Sorensen:
>>  
>>> On 2/24/10 1:51 AM, "Marc Hohl" <marc@xxxxxxxxxx> wrote:
>>>    
> How can I set a breakpoint?

Start by running gdb for lilypond:

gdb lilypond

at the gdb prompt, set a breakpoint:

b Class::function 

(with Class::function replaced by the actual routine you want to stop in)

or 

b sourcefile.cc:line

where sourcefile.cc is the name of the source file of the code you're trying
to test (no lily/ is necessary) and line is the line number.

Once you have your breakpoint set, run the code

run myfile.ly

lilypond will then run, and stop at the breakpoint.

Once it's stopped at the breakpoint, use pmusic to print the music event.

>>> and issuing the following command from the console when you've reached the
>>> breakpoint:
>>> 
>>> pmusic event
>>> 
>>> Once you've verified that this works, you could also execute those same
>>> Scheme procedures by using scm_call_1 from the C++ code if you didn't want
>>> to go through the debugger.
>>>    
>> 
>> Or you can simply call
>>   int Prob::print_smob (SCM smob, SCM port, scm_print_state*)
>> (Stream_event is a class derived from Prob)
>>  
> I assume that just pasting this line under
> 
> Stream_event *event = note_events_[i];
> 
> is not the whole deal (I tried this, it didn't work).

The way it would work if it did would be to write

event->print_smob(event->self_scm());

or something similar to that.


> 
> I'm sorry to say, but at the moment I am writing C stuff by looking at some
> engraver files and copy/paste everything into my file that looks as if
> it could
> work. That's not really satisfying, but I try to learn it that way.

Ouch, that's really hard.  Even if you have the right idea, the syntax of
C++ can be so picky that you get errors from bad syntax.

Perhaps you could post some test code, and get some feedback on it.

Thanks,

Carl


---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/