Quoting Hans-Christoph Steiner <[EMAIL PROTECTED]>:

>
> Is there anyway to check whether a symbol already exists?

i don't know of any.


2 suggestions:
a) a symbol is a pointer
if you get a symbol as "t_symbol*s" and s!=NULL, then you can safely  
assume that the symbol already exists (except someone evil sent you  
garbage)
so you can implement:
int symbol_exists(t_symbol*s) { return (0!=s); }

b) you can always make sure, that a certain string is always  
represented as a symbol; which guarantees that your symbol exists.
int symbol_exists(char*string) { gensym(string); return 1; }


in practice, i think both implementations are rather a joke.
what do you need this for?


finally, you can bind a "class" to a symbol and lookup the class by it's name.


fma.dsr
IOhannes




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



_______________________________________________
PD-dev mailing list
[email protected]
http://lists.puredata.info/listinfo/pd-dev

Reply via email to