[PD] implementing tooltips WAS: Pd-extended 0.43 updates: lots of new editing features
Mathieu Bouchard
matju at artengine.ca
Tue Jul 12 23:16:42 CEST 2011
On Tue, 12 Jul 2011, Mathieu Bouchard wrote:
> On Tue, 12 Jul 2011, Jonathan Wilkes wrote:
>
>> Mathieu Bouchard <matju at artengine.ca> wrote:
>>> EXTERN int canvas_isabstraction(t_canvas *x);
>>> declared in #include "g_canvas.h"
>>
>> but it takes a t_canvas and I have a t_object.
>
> pd_class(x)==canvas_class ? canvas_isabstraction((t_canvas *)x) : 0;
>
> thus you check whether it makes sense to cast the pointer to t_canvas*, and
> if it does, you call the function, otherwise you know that it's not an
> abstraction.
sorry, pd_class(x) is just *(x), so it assumes that typeof(x) is t_pd*, or
in other words, t_class**.
so you can write
pd_class((t_pd *)x)==canvas_class ? canvas_isabstraction((t_canvas *)x) : 0;
or just
*(t_pd *)x==canvas_class ? canvas_isabstraction((t_canvas *)x) : 0;
_______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
More information about the Pd-list
mailing list