Making an argv atom array to pass to coll instance

May 15, 2007 at 5:53am

Making an argv atom array to pass to coll instance

I’ve instantiated a coll inside my object with newinstance(). The coll appears to be functional and responds to messages like “dblclick”.

So I’m attempting to create an argv atom array to pass to
void coll_merge(t_coll *xx, t_symbol *s, short ac, t_atom *av);

t_atom args[2];
argv[0].a_type = A_SYM;
argv[0].a_w.w_sym = gensym(“test”);
argv[1].a_type = A_LONG;
argv[1].a_w.w_long = 5;

mess2(mycoll, gensym(“merge”), 2, &args);

Passing the above prints a “coll: bad arguments for message ‘merge’” error in the max window.

What’s wrong with my args?

#31917
Jul 19, 2007 at 7:48pm

I’m confronted to the same problem,
Regardless your example wouldn’t work because you misspelled “args”
(“argv”), I’m also confronted to not being capable of giving arguments
to the message I send to my instance of coll.
(Xcode 2.4.1 on Intel macbook)

Let’s say:

// This works!//////////////////////////////////////////////
t_atom argu;
argu.a_type = A_SYM;
argu.a_w.w_sym = gensym(“myfile.col”);

t_object *my_coll = newinstance(gensym(“coll”),1,&argu)
//////////////////////////////////////////////////////////////////////////////////

// This works ///////////////////////////////////////
mess2(my_coll, gensym(“open”), 0, 0L);

////////////////////////////////////////////////////////////////////////////
// This doesn’t work (“error: coll: bad arguments for message ‘store’)
// Compiler warnings: passing argument 2 of ‘getfn(my_coll, gensym(“store”))’
// makes pointer from integer without a cast
//////////////////////////////////////////////////////////////////////////////////
t_atom args[2];
args[0].a_type = A_SYM;
args[0].a_w.w_sym = gensym(“store”);
args[1].a_type = A_LONG;
args[1].a_w.w_long = 5;

mess2(my_coll, gensym(“store”), 2, &args);
////////////////////////////////////////////////////////////////////////////

On 5/15/07, John Pitcairn wrote:
>
> I’ve instantiated a coll inside my object with newinstance(). The coll appears to be functional and responds to messages like “dblclick”.
>
> So I’m attempting to create an argv atom array to pass to
> void coll_merge(t_coll *xx, t_symbol *s, short ac, t_atom *av);
>
> t_atom args[2];
> argv[0].a_type = A_SYM;
> argv[0].a_w.w_sym = gensym(“test”);
> argv[1].a_type = A_LONG;
> argv[1].a_w.w_long = 5;
>
> mess2(mycoll, gensym(“merge”), 2, &args);
>
> Passing the above prints a “coll: bad arguments for message ‘merge’” error in the max window.
>
> What’s wrong with my args?
>

#104210
Jul 19, 2007 at 7:51pm

Sorry, I mispelled the code. Here’s again:

// This works!//////////////////////////////////////////////
t_atom argu;
argu.a_type = A_SYM;
argu.a_w.w_sym = gensym(“myfile.col”);

t_object *my_coll = newinstance(gensym(“coll”),1,&argu);
//////////////////////////////////////////////////////////////////////////////////

// This works ///////////////////////////////////////
mess2(my_coll, gensym(“open”), 0, 0L);

////////////////////////////////////////////////////////////////////////////
// This doesn’t work (“error: coll: bad arguments for message ‘store’)
// Compiler warnings: passing argument 2 of ‘getfn(my_coll, gensym(“store”))’
// makes pointer from integer without a cast
//////////////////////////////////////////////////////////////////////////////////
t_atom args[2];
args[0].a_type = A_LONG
args[0].a_w.w_long = 1;
args[1].a_type = A_LONG;
args[1].a_w.w_long = 5;

mess2(my_coll, gensym(“store”), 2, &args);
////////////////////////////////////////////////////////////////////////////

On 7/19/07, P C wrote:
> I’m confronted to the same problem,
> Regardless your example wouldn’t work because you misspelled “args”
> (“argv”), I’m also confronted to not being capable of giving arguments
> to the message I send to my instance of coll.
> (Xcode 2.4.1 on Intel macbook)
>
> Let’s say:
>
>
> // This works!//////////////////////////////////////////////
> t_atom argu;
> argu.a_type = A_SYM;
> argu.a_w.w_sym = gensym(“myfile.col”);
>
> t_object *my_coll = newinstance(gensym(“coll”),1,&argu)
> //////////////////////////////////////////////////////////////////////////////////
>
> // This works ///////////////////////////////////////
> mess2(my_coll, gensym(“open”), 0, 0L);
>
> ////////////////////////////////////////////////////////////////////////////
> // This doesn’t work (“error: coll: bad arguments for message ‘store’)
> // Compiler warnings: passing argument 2 of ‘getfn(my_coll, gensym(“store”))’
> // makes pointer from integer without a cast
> //////////////////////////////////////////////////////////////////////////////////
> t_atom args[2];
> args[0].a_type = A_SYM;
> args[0].a_w.w_sym = gensym(“store”);
> args[1].a_type = A_LONG;
> args[1].a_w.w_long = 5;
>
> mess2(my_coll, gensym(“store”), 2, &args);
> ////////////////////////////////////////////////////////////////////////////
>
>
>
>
>
>
> On 5/15/07, John Pitcairn wrote:
> >
> > I’ve instantiated a coll inside my object with newinstance(). The coll appears to be functional and responds to messages like “dblclick”.
> >
> > So I’m attempting to create an argv atom array to pass to
> > void coll_merge(t_coll *xx, t_symbol *s, short ac, t_atom *av);
> >
> > t_atom args[2];
> > argv[0].a_type = A_SYM;
> > argv[0].a_w.w_sym = gensym(“test”);
> > argv[1].a_type = A_LONG;
> > argv[1].a_w.w_long = 5;
> >
> > mess2(mycoll, gensym(“merge”), 2, &args);
> >
> > Passing the above prints a “coll: bad arguments for message ‘merge’” error in the max window.
> >
> > What’s wrong with my args?
> >
>

#104211

You must be logged in to reply to this topic.