[PD] coloring arrays

Mathieu Bouchard matju at artengine.ca
Mon Oct 24 18:56:14 CEST 2011

Le 2011-10-24 à 17:19:00, João Pais a écrit :
> can you explain clearly what you meant in these 2 paragraphs?

Do you have clear questions ?

>> Pd's data-structures don't have to be allocated as separate items. They
>> can be allocated in array-fashion, as one big block.

I can see in Pd's source code that it has separate handling of data 
structures for three cases : one for scalars, one for arrays, and one for 
searching canvases for scalars and arrays.

scalars are individually allocated, while arrays are allocated in groups. 
The latter is much more efficient in memory usage (though the difference 
matters only for large arrays of small structs).

>> What I say about Pd's data-structures doesn't apply to array-like types
>> defined in other plugins, such as GridFlow, iemmatrix, iem16, Gem, PDP.

Those plugins don't use t_word at all in their definitions of arrays. They 
might base their arrays on float, int, short, char, char[3], or whatever 
else, but they don't use t_word. For pd's data structures, using t_word is 
not sufficient, but it's necessary. Also, t_template and t_gpointer have 
to be used. Only in those circumstances you can use the built-in DS 
classes such as [get], [set], [struct], etc.

I've never used DS myself, but just looking at Miller's help files, I can 
see that [element], [getsize], [setsize] have to do with DS Arrays.

>> In theory, plugins can use data-structures and define new stuff about 
>> data-structures, but in practice, no-one ever did.

Actually, in 2004 and/or 2007 I had grepped for t_template and similar 
things in the Pd CVS (before it became SVN) because I was never hearing 
about DS externals, and I needed to know. But no, there was nothing. 
Nowadays, there is still nothing. It's possible to make other renderers of 
DS than just the standard set of [plot], [fillpolygon], etc., but no-one 

| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC

More information about the Pd-list mailing list