[PD-cvs] pd/src builtins.c,1.1.2.40,1.1.2.41
Mathieu Bouchard
matju at users.sourceforge.net
Fri Jul 20 09:29:02 CEST 2007
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22628
Modified Files:
Tag: desiredata
builtins.c
Log Message:
[select] supports mixed floats and symbols
Index: builtins.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v
retrieving revision 1.1.2.40
retrieving revision 1.1.2.41
diff -C2 -d -r1.1.2.40 -r1.1.2.41
*** builtins.c 20 Jul 2007 06:33:21 -0000 1.1.2.40
--- builtins.c 20 Jul 2007 07:28:59 -0000 1.1.2.41
***************
*** 1307,1315 ****
static t_class *sel2_class;
struct t_selectelement {
! t_word e_w;
t_outlet *out;
};
struct t_sel2 : t_object {
- t_atomtype type;
t_int nelement;
t_selectelement *vec;
--- 1307,1314 ----
static t_class *sel2_class;
struct t_selectelement {
! t_atom a;
t_outlet *out;
};
struct t_sel2 : t_object {
t_int nelement;
t_selectelement *vec;
***************
*** 1319,1327 ****
static void sel2_float(t_sel2 *x, t_float f) {
! if (x->type == A_FLOAT) {select_each(e,x) if (e->e_w.w_float==f) {outlet_bang(e->out); return;}}
outlet_float(x->rejectout, f);
}
static void sel2_symbol(t_sel2 *x, t_symbol *s) {
! if (x->type == A_SYMBOL) {select_each(e,x) if (e->e_w.w_symbol==s) {outlet_bang(e->out); return;}}
outlet_symbol(x->rejectout, s);
}
--- 1318,1326 ----
static void sel2_float(t_sel2 *x, t_float f) {
! select_each(e,x) if (e->a.a_type==A_FLOAT ) if (e->a.a_float==f) {outlet_bang(e->out); return;}
outlet_float(x->rejectout, f);
}
static void sel2_symbol(t_sel2 *x, t_symbol *s) {
! select_each(e,x) if (e->a.a_type==A_SYMBOL) if (e->a.a_symbol==s) {outlet_bang(e->out); return;}
outlet_symbol(x->rejectout, s);
}
***************
*** 1338,1346 ****
x->atom = *argv;
outlet_new(x, &s_bang);
! if (argv->a_type == A_FLOAT) {
! floatinlet_new(x, &x->atom.a_float); outlet_new(x, &s_float);
! } else {
! symbolinlet_new(x, &x->atom.a_symbol); outlet_new(x, &s_symbol);
! }
return x;
} else {
--- 1337,1342 ----
x->atom = *argv;
outlet_new(x, &s_bang);
! if (argv->a_type == A_FLOAT) {floatinlet_new(x, &x->atom.a_float ); outlet_new(x, &s_float);}
! else {symbolinlet_new(x, &x->atom.a_symbol); outlet_new(x, &s_symbol);}
return x;
} else {
***************
*** 1348,1358 ****
x->nelement = argc;
x->vec = (t_selectelement *)getbytes(argc * sizeof(*x->vec));
- x->type = argv[0].a_type;
t_selectelement *e = x->vec;
for (int n = 0; n < argc; n++, e++) {
e->out = outlet_new(x, &s_bang);
! if ((x->type = argv->a_type) == A_FLOAT)
! e->e_w.w_float = atom_getfloatarg(n, argc, argv);
! else e->e_w.w_symbol = atom_getsymbolarg(n, argc, argv);
}
x->rejectout = outlet_new(x, &s_float);
--- 1344,1351 ----
x->nelement = argc;
x->vec = (t_selectelement *)getbytes(argc * sizeof(*x->vec));
t_selectelement *e = x->vec;
for (int n = 0; n < argc; n++, e++) {
e->out = outlet_new(x, &s_bang);
! e->a = argv[n];
}
x->rejectout = outlet_new(x, &s_float);
More information about the Pd-cvs
mailing list