"Trevor Daniels" <t.dani...@treda.co.uk> writes:

> David Kastrup wrote Wednesday, August 24, 2016 7:48 AM
>
>
>> "Trevor Daniels" <t.dani...@treda.co.uk> writes:
>> 
>>> Prompted by the recent discussion on lute tablature, I tried coding a
>>> Scheme engraver to create the duration grobs but quickly ran into a
>>> problem.  I need to collect information from both a Listener and an
>>> Acknowledger so the obvious place to build the grob is in
>>> stop-translator-timestep,
>> 
>> No, no, no.  stop-translator-timestep really is only for cleanup work.
>> Stuff is no longer in working order then.  You want process-acknowledged
>> here I think.
>> 
>> There will always be a call to process-acknowledged whenever grobs have
>> been created, and _reading_ stuff from grobs should be delayed until
>> then since other acknowledgers might _write_ stuff into a grob even
>> after your personal acknowledger has been called.  So the basic workflow
>> is to use the various acknowledgers to _record_ the grobs you are
>> interested in and _write_ stuff into them (or do read/write stuff that
>> more or less is accumulative and/or really unrelated to other
>> engravers), and then use the process-acknowledged hook for processing
>> (including _reading_) the grobs you had recorded.
>> 
>> You can create new grobs in process-acknowledged.  That will lead to a
>> new cycle of acknowledger calls followed by process-acknowledged.  Only
>> when all those cycles are over is stop-translator-timestep called, and
>> then creating grobs is no longer an option.
>
> Thanks David.  That's beautifully clear, and much better than the rather
> terse sentence in the CG which misled me:
>
> "If useful things are to be done to the acknowledged grobs, this
> should be deferred until all the acknowledging has finished, i.e.,
> store the acknowledged grobs and process the information in a
> process-acknowledged () or stop-translation-timestep () function."
>
> I took what appeared to be the stop-translation-timestep option.

You can still "process" parts of the grob there (if that means just
reading out properties and possibly setting context properties based on
them) but stop-translation-timestep is a cleanup hook, and other
engravers might have already cleaned up stuff you might have wanted to
use.  And _creating_ grobs in there is clean out since engravers and
other code may no longer be in a state where they could process them.

-- 
David Kastrup

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

Reply via email to