lilypond-devel
[Top][All Lists]
Advanced

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

Re: Implementation of music streams


From: Han-Wen Nienhuys
Subject: Re: Implementation of music streams
Date: Mon, 15 May 2006 13:21:05 +0200
User-agent: Thunderbird 1.5 (X11/20060313)

Erik Sandberg schreef:
> Here's my plan on how to front-port music streams to the 2.9 branch.
>
> 1. Implement classes Dispatcher, Stream_event, Listener (move modules
> from my thesis fork)
> 2. Add dispatchers event_source_, and possibly events_below_, to Context
> class.
> 3. Make Context::try_music send stream events to the event_source_.

This step is now finished, patch attached. You can notice some

Can you also look my nits regarding warnings and SEND_EVENT_TO_CONTEXT below, and commit if "make web" still works?

additional stuff that has been added as well, which currently is
unused but will be used in future patches. You will notice that this
patch makes lily spit out lots of Junking Event messages, which are
harmless.

Can you make sure that in this patch those warnings are surpressed?
I don't want to leave lily in a state where it prints bazillions of messages.


Regarding SEND_EVENT_TO_CONTEXT(ctx, cl, ...)   and EVENT_PROPERTY:
I think the proper unproctect method nowadays is

  smob->unprotect()

also wouldn't it be possible to do away with EVENT_PROPERTY, and just do

  send_event_to_context (c, ev,
                         ly_symbol2scm ("key"), val,
                         ly_symbol2scm ("key2"), val2)

and in the macro do something like

  SCM args[] = { __VA_ARGS__ ,  0 };
  for (int i = 0; args[i]; i+=2)
      ..

I think that this reads more logically. Come to think of it, I don't see why SEND_EVENT_TO_CONTEXT should be a macro. Is there a reason why it can't be a function, except for the ly_symbol2scm() memoization?

If you want to keep the macro, then at least make sure the actual code body which says

    Stream_event *_e_ = new Stream_event (ctx, ly_symbol2scm (cl));
    ctx->event_source ()->distribute (_e_);
    scm_gc_unprotect_object (_e_->self_scm ());      

is in a function. That makes debugging a bit easier and reads more logically.

--

Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen

LilyPond Software Design
 -- Code for Music Notation
http://www.lilypond-design.com





reply via email to

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