[PD] atom_getsymbol

Ricky Graham rickygrahammusic at gmail.com
Wed Jan 11 06:37:18 CET 2017


>> I’m using A_DEFSYMBOL 
> 
> when using A_DEFSYMBOL, you don't deal with t_atom*s; instead you get a
> t_symbol* directly.
> so there is no use for atom_getsymbol()

Ah!

>> for the moment and *s seems to print to console
> 
> ???
> how?

I mean this: in the case of [pclass D]

void *pclass_new(t_symbol *s) {
post("%s", *s); //this prints “D” to the console
}

>> but I can’t seem to figure out how to get type t_symbol into an array.
> 
> into an array of what?
> this doesn't make sense (and i suspect that this is why it doesn't work
> for you)

Perhaps my wording is confusing. I want to pass the string into an array of chars, eventually. 

> 
>> atom_string seems to work with A_GIMME but that seems redundant as I’m only passing one symbol.
> 
> a symbol is a pointer to a "t_symbol" struct.
> the t_symbol struct has a member "s_name" which is a pointer to a
> zero-terminated immubtale string.
> most likely this is what you want.

It is. 

> 
> since symbols are statically allocated, this pointer will remain valid
> through the process's lifetime.
> so most likely, you don't want to "copy it to an array", but rather keep
> the pointer around and use it directly.
> there's only one exception to this: if you want to modify the string,
> then you *must* copy it first.

Yep! That’s what I want to do. What’s the easiest way to access and copy the string in this instance?

> 
> gfmdsar
> IOhannes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20170111/fd57fd77/attachment-0001.html>


More information about the Pd-list mailing list