On 2012/01/18 15:55:35, dak wrote:
On 2012/01/18 15:28:42, http://mike_apollinemike.com wrote:

> I don't think there's a risk that one engraver in a context will get
a
different
> version of an event than another engraver in a context.  This would
require
the
> NoteEvent to be reported more than once.

It would merely require using the same music expression more than once
without
copying it.  Music expressions are frontend material.  I am not really
comfortable messing with them.  Now it is true that if you put stuff
in a music
variable and access this using \var, you get a copy.  And music
functions in
general are not expected to worry about stomping over their arguments
destructively because of that.

But I still have a hard time believing that every Music variable is
guaranteed
to never have anybody ever look at it again once it has been seen by
an iterator
once.

No need to mess with virtual functions actually since this is all inside
of the rhythmic iterator (one could override the report function
non-virtually, but there is little point since it does almost nothing).
The following puts together all of the collected stuff.

void
Rhythmic_music_iterator::process (Moment m)
{
  if (last_processed_mom_ < Moment (0))
    {

      descend_to_bottom_context ();

      Stream_event *ev = get_music ()->to_event ();
      SCM arts = ev->get_property ("articulations");
      Context *c = get_outlet ();

      if (scm_is_pair (arts))
        {
          ev->set_property ("articulations", SCM_EOL);
          c->event_source ()->broadcast (ev);
          for (; scm_is_pair (arts); arts = scm_cdr (arts))
            c->event_source ()->broadcast (unsmob_stream_event (scm_car
(arts)));
        }
      else
        c->event_source ()->broadcast (ev);

      ev->unprotect ();
    }
  Simple_music_iterator::process (m);
}


http://codereview.appspot.com/5554048/

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to