[PD] naming objects

Claude Heiland-Allen claudiusmaximus at goto10.org
Mon Apr 26 18:59:04 CEST 2010

Mathieu Bouchard wrote:
> On Mon, 26 Apr 2010, Claude Heiland-Allen wrote:
>> One way of fixing this once and for all would be to have a separate 
>> [objectmaker] for each canvas (including abstractions, but not 
>> subpatches, ie, those canvases that have a t_canvasenvironment 
>> attached to them - at least that is how I understand that part of Pd's 
>> code).
> Thanks for bringing back the topic. There was a thread about that on 
> pd-dev in september 2006, e.g. :
> http://lists.puredata.info/pipermail/pd-dev/2006-09/007591.html
> http://lists.puredata.info/pipermail/pd-dev/2006-09/007605.html
> http://lists.puredata.info/pipermail/pd-dev/2006-09/007607.html
> http://lists.puredata.info/pipermail/pd-dev/2006-09/007608.html
> http://lists.puredata.info/pipermail/pd-dev/2006-09/007609.html
> etc

Thanks for the references.

>> I have a vague sketch of an implementation like this already, but it's 
>> quite brutal to the core of Pd so I doubt the changes would be 
>> accepted by anyone without me cleaning it up a lot and providing a 
>> clean .diff to a current development version of Pd...
> cleanliness is in the eye of the beholder... if you spend a lot of time 
> cleaning, you can realise that it doesn't look any cleaner to the people 
> you want to please, or else it can look dirtier.


> apart from that, I think that you deserve good luck with this project 
> and I am happy to learn that you succeeded.

Still got abstraction support to re-enable, hopefully it will work as 
planned - then I can claim success :-)  Thanks :-)

> but how does «t_pd *pd_newest» work in that context ?

newest is set when typedmess() sees that (target == pd_objectmaker).  So 
the default pd_objectmaker defers to the canvas-local objectmaker, which 
sets pd_objectmaker to itself (before retrying after any ondemand load) 
or a child (for imported libraries) objectmaker before calling 
typedmess() and inspecting newest.  So it's just another layer of 
baroque hackery, with special behaviour needed in [bang] [float] 
[symbol] and probably a couple of others

some names changed for no good reason other than to see what would break 
in the rest of Pd:

/* called when no more-specific method is found, happily this happens
    at the top level canvas-local factory, so we can switch the default
    td_legacy_objectmaker before too much damage is done... */
static void td_objectfactory_anything(td_objectfactory *of, t_symbol *s, 
int argc, t_atom *argv) {
   newest = 0;
   td_list *n;
   td_ondemand *od = td_map_lookup(of->ondemand, s);
   if (od) {
     /* push object factory */
     td_objectfactory *old = td_legacy_objectmaker;
     td_legacy_objectmaker = of;
     /* load on demand */
     td_map_delete(of->ondemand, s);
     /* retry creation */
     /* typedmess tests for td_legacy_objectmaker */
     typedmess(&td_legacy_objectmaker->pd, s, argc, argv);
     /* pop object factory */
     td_legacy_objectmaker = old;
     if (newest) {
   for (n = of->children; n; n = n->next) {
     td_objectfactory *c = n->p;
     td_objectfactory *old = td_legacy_objectmaker;
     td_legacy_objectmaker = c;
     /* typedmess tests for td_legacy_objectmaker */
     typedmess(&td_legacy_objectmaker->pd, s, argc, argv);
     td_legacy_objectmaker = old;
     if (newest) {


More information about the Pd-list mailing list