Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32477
Modified Files:
Tag: desiredata
builtins.c
Log Message:
cleanup
Index: builtins.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v
retrieving revision 1.1.2.36
retrieving revision 1.1.2.37
diff -C2 -d -r1.1.2.36 -r1.1.2.37
*** builtins.c 19 Jul 2007 17:07:16 -0000 1.1.2.36
--- builtins.c 19 Jul 2007 17:48:25 -0000 1.1.2.37
***************
*** 49,54 ****
#endif
! #define a_float a_w.w_float
! #define a_symbol a_w.w_symbol
#define LIST_NGETBYTE 100 /* bigger that this we use alloc, not alloca */
--- 49,55 ----
#endif
! #define a_float a_w.w_float
! #define a_symbol a_w.w_symbol
! #define a_pointer a_w.w_gpointer
#define LIST_NGETBYTE 100 /* bigger that this we use alloc, not alloca */
***************
*** 157,162 ****
/* ---------------------- key and its relatives ------------------ */
! static t_symbol *key_sym, *keyup_sym, *keyname_sym;
! static t_class *key_class, *keyup_class, *keyname_class;
struct t_key : t_object {};
static void *key_new() {
--- 158,163 ----
/* ---------------------- key and its relatives ------------------ */
! static t_symbol *key_sym, *keyup_sym, *keyname_sym;
! static t_class *key_class, *keyup_class, *keyname_class;
struct t_key : t_object {};
static void *key_new() {
***************
*** 189,208 ****
outlet_float( x->out(0), atom_getfloatarg( 0, ac, av));
}
! static void key_free(t_key *x) {pd_unbind(x, key_sym);}
! static void keyup_free(t_keyup *x) {pd_unbind(x, keyup_sym);}
static void keyname_free(t_keyname *x) {pd_unbind(x, keyname_sym);}
static void key_setup() {
! key_class = class_new2("key",key_new,key_free,sizeof(t_key),CLASS_NOINLET,"");
! class_addfloat(key_class, key_float);
! key_sym = gensym("#key");
! keyup_class = class_new2("keyup",keyup_new,keyup_free,sizeof(t_keyup),CLASS_NOINLET,"");
! class_addfloat(keyup_class, keyup_float);
! keyup_sym = gensym("#keyup");
! class_sethelpsymbol(keyup_class, gensym("key"));
keyname_class = class_new2("keyname",keyname_new,keyname_free,sizeof(t_keyname),CLASS_NOINLET,"");
! class_addlist(keyname_class, keyname_list);
! keyname_sym = gensym("#keyname");
class_sethelpsymbol(keyname_class, gensym("key"));
}
--- 190,209 ----
outlet_float( x->out(0), atom_getfloatarg( 0, ac, av));
}
! static void key_free( t_key *x) {pd_unbind(x, key_sym);}
! static void keyup_free( t_keyup *x) {pd_unbind(x, keyup_sym);}
static void keyname_free(t_keyname *x) {pd_unbind(x, keyname_sym);}
static void key_setup() {
! key_class = class_new2("key", key_new, key_free, sizeof(t_key), CLASS_NOINLET,"");
! keyup_class = class_new2("keyup", keyup_new, keyup_free, sizeof(t_keyup), CLASS_NOINLET,"");
keyname_class = class_new2("keyname",keyname_new,keyname_free,sizeof(t_keyname),CLASS_NOINLET,"");
! class_addfloat(key_class, key_float);
! class_addfloat(keyup_class, keyup_float);
! class_addlist( keyname_class, keyname_list);
! class_sethelpsymbol(keyup_class, gensym("key"));
class_sethelpsymbol(keyname_class, gensym("key"));
+ key_sym = gensym("#key");
+ keyup_sym = gensym("#keyup");
+ keyname_sym = gensym("#keyname");
}
***************
*** 489,503 ****
if (!target) {
if (ap->a_type != A_SYMBOL) continue;
! else if (!(target = ap->a_symbol->thing)) {
! error("qlist: %s: no such object", ap->a_symbol->name);
! continue;
! }
ap++;
onset++;
count--;
! if (!count) {
! x->onset = onset2;
! continue;
! }
}
wasreentered = x->reentered;
--- 490,499 ----
if (!target) {
if (ap->a_type != A_SYMBOL) continue;
! target = ap->a_symbol->thing;
! if (!target) {error("qlist: %s: no such object", ap->a_symbol->name); continue;}
ap++;
onset++;
count--;
! if (!count) {x->onset = onset2; continue;}
}
wasreentered = x->reentered;
***************
*** 672,698 ****
static void alist_toatoms(t_binbuf *x, t_atom *to) {for (size_t i=0; i<x->n; i++) to[i] = x->v[i];}
!
! struct t_list_append : t_object {t_binbuf *alist;};
! struct t_list_prepend : t_object {t_binbuf *alist;};
! struct t_list_split : t_object {t_float f;};
! struct t_list_trim : t_object {};
! struct t_list_length : t_object {};
!
! t_class *list_append_class;
! t_class *list_prepend_class;
! t_class *list_split_class;
! t_class *list_trim_class;
! t_class *list_length_class;
static t_pd *list_append_new(t_symbol *s, int argc, t_atom *argv) {
t_list_append *x = (t_list_append *)pd_new(list_append_class);
! x->alist = binbuf_new(); alist_list(x->alist, 0, argc, argv);
! outlet_new(x, &s_list); inlet_new(x,x->alist, 0, 0);
return x;
}
static t_pd *list_prepend_new(t_symbol *s, int argc, t_atom *argv) {
t_list_prepend *x = (t_list_prepend *)pd_new(list_prepend_class);
! x->alist = binbuf_new(); alist_list(x->alist, 0, argc, argv);
! outlet_new(x, &s_list); inlet_new(x,x->alist,0,0);
return x;
}
--- 668,685 ----
static void alist_toatoms(t_binbuf *x, t_atom *to) {for (size_t i=0; i<x->n; i++) to[i] = x->v[i];}
! t_class *list_append_class; struct t_list_append : t_object {t_binbuf *alist;};
! t_class *list_prepend_class; struct t_list_prepend : t_object {t_binbuf *alist;};
! t_class *list_split_class; struct t_list_split : t_object {t_float f;};
! t_class *list_trim_class; struct t_list_trim : t_object {};
! t_class *list_length_class; struct t_list_length : t_object {};
static t_pd *list_append_new(t_symbol *s, int argc, t_atom *argv) {
t_list_append *x = (t_list_append *)pd_new(list_append_class);
! x->alist = binbuf_new(); alist_list(x->alist, 0, argc, argv); outlet_new(x, &s_list); inlet_new(x,x->alist, 0, 0);
return x;
}
static t_pd *list_prepend_new(t_symbol *s, int argc, t_atom *argv) {
t_list_prepend *x = (t_list_prepend *)pd_new(list_prepend_class);
! x->alist = binbuf_new(); alist_list(x->alist, 0, argc, argv); outlet_new(x, &s_list); inlet_new(x,x->alist,0,0);
return x;
}
***************
*** 701,740 ****
static void list_append_list(t_list_append *x, t_symbol *s, int argc, t_atom *argv) {
! t_atom *outv;
! int outc = x->alist->n + argc;
! ATOMS_ALLOCA(outv, outc);
atoms_copy(argc, argv, outv);
alist_toatoms(x->alist, outv+argc);
! outlet_list(x->outlet, &s_list, outc, outv);
! ATOMS_FREEA(outv, outc);
}
static void list_append_anything(t_list_append *x, t_symbol *s, int argc, t_atom *argv) {
! t_atom *outv;
! int outc = x->alist->n + argc + 1;
! ATOMS_ALLOCA(outv, outc);
SETSYMBOL(outv, s);
atoms_copy(argc, argv, outv + 1);
alist_toatoms(x->alist, outv + 1 + argc);
! outlet_list(x->outlet, &s_list, outc, outv);
! ATOMS_FREEA(outv, outc);
}
static void list_prepend_list(t_list_prepend *x, t_symbol *s, int argc, t_atom *argv) {
! t_atom *outv;
! int outc = x->alist->n + argc;
! ATOMS_ALLOCA(outv, outc);
alist_toatoms(x->alist, outv);
atoms_copy(argc, argv, outv + x->alist->n);
! outlet_list(x->outlet, &s_list, outc, outv);
! ATOMS_FREEA(outv, outc);
}
static void list_prepend_anything(t_list_prepend *x, t_symbol *s, int argc, t_atom *argv) {
! t_atom *outv;
! int outc = x->alist->n + argc + 1;
! ATOMS_ALLOCA(outv, outc);
alist_toatoms(x->alist, outv);
SETSYMBOL(outv + x->alist->n, s);
atoms_copy(argc, argv, outv + x->alist->n + 1);
! outlet_list(x->outlet, &s_list, outc, outv);
! ATOMS_FREEA(outv, outc);
}
static t_pd *list_split_new(t_floatarg f) {
--- 688,715 ----
static void list_append_list(t_list_append *x, t_symbol *s, int argc, t_atom *argv) {
! t_atom *outv; int outc = x->alist->n + argc; ATOMS_ALLOCA(outv, outc);
atoms_copy(argc, argv, outv);
alist_toatoms(x->alist, outv+argc);
! outlet_list(x->outlet, &s_list, outc, outv); ATOMS_FREEA(outv, outc);
}
static void list_append_anything(t_list_append *x, t_symbol *s, int argc, t_atom *argv) {
! t_atom *outv; int outc = x->alist->n+argc+1; ATOMS_ALLOCA(outv, outc);
SETSYMBOL(outv, s);
atoms_copy(argc, argv, outv + 1);
alist_toatoms(x->alist, outv + 1 + argc);
! outlet_list(x->outlet, &s_list, outc, outv); ATOMS_FREEA(outv, outc);
}
static void list_prepend_list(t_list_prepend *x, t_symbol *s, int argc, t_atom *argv) {
! t_atom *outv; int outc = x->alist->n + argc; ATOMS_ALLOCA(outv, outc);
alist_toatoms(x->alist, outv);
atoms_copy(argc, argv, outv + x->alist->n);
! outlet_list(x->outlet, &s_list, outc, outv); ATOMS_FREEA(outv, outc);
}
static void list_prepend_anything(t_list_prepend *x, t_symbol *s, int argc, t_atom *argv) {
! t_atom *outv; int outc = x->alist->n+argc+1; ATOMS_ALLOCA(outv, outc);
alist_toatoms(x->alist, outv);
SETSYMBOL(outv + x->alist->n, s);
atoms_copy(argc, argv, outv + x->alist->n + 1);
! outlet_list(x->outlet, &s_list, outc, outv); ATOMS_FREEA(outv, outc);
}
static t_pd *list_split_new(t_floatarg f) {
***************
*** 782,791 ****
return x;
}
! static void list_length_list(t_list_length *x, t_symbol *s, int argc, t_atom *argv) {
! outlet_float(x->outlet, (float)argc);
! }
! static void list_length_anything(t_list_length *x, t_symbol *s, int argc, t_atom *argv) {
! outlet_float(x->outlet, (float)argc+1);
! }
static void *list_new(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) {
--- 757,762 ----
return x;
}
! static void list_length_list( t_list_length *x, t_symbol *s, int argc, t_atom *argv) {outlet_float(x->outlet, (float)argc);}
! static void list_length_anything(t_list_length *x, t_symbol *s, int argc, t_atom *argv) {outlet_float(x->outlet, (float)argc+1);}
static void *list_new(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) {
***************
*** 799,809 ****
else if (s2 == gensym("trim")) newest = list_trim_new();
else if (s2 == gensym("length")) newest = list_length_new();
! else {
! error("list %s: unknown function", s2->name);
! newest = 0;
! }
}
! /* workaround for bug in m_class.c */
! pd_set_newest(newest);
return newest;
}
--- 770,777 ----
else if (s2 == gensym("trim")) newest = list_trim_new();
else if (s2 == gensym("length")) newest = list_length_new();
! else error("list %s: unknown function", s2->name);
}
! /* workaround for bug in kernel.c */
! if (newest) pd_set_newest(newest);
return newest;
}
***************
*** 845,849 ****
static void random_bang(t_random *x) {
int n = (int)x->f, nval;
! int range = (n < 1 ? 1 : n);
unsigned int randval = x->state;
x->state = randval = randval * 472940017 + 832416023;
--- 813,817 ----
static void random_bang(t_random *x) {
int n = (int)x->f, nval;
! int range = max(n,1);
unsigned int randval = x->state;
x->state = randval = randval * 472940017 + 832416023;
***************
*** 910,915 ****
#ifdef MSW
FILETIME ignorethis, ignorethat;
! BOOL retval;
! retval = GetProcessTimes(GetCurrentProcess(), &ignorethis, &ignorethat,
(FILETIME *)&x->kerneltime, (FILETIME *)&x->usertime);
if (!retval) {
--- 878,882 ----
#ifdef MSW
FILETIME ignorethis, ignorethat;
! BOOL retval = GetProcessTimes(GetCurrentProcess(), &ignorethis, &ignorethat,
(FILETIME *)&x->kerneltime, (FILETIME *)&x->usertime);
if (!retval) {
***************
*** 923,944 ****
static void cputime_bang2(t_cputime *x) {
#ifdef UNISTD
- float elapsedcpu;
struct tms newcputime;
times(&newcputime);
! elapsedcpu = 1000 * (newcputime.tms_utime + newcputime.tms_stime -
! x->setcputime.tms_utime - x->setcputime.tms_stime) / HZ;
#endif
#ifdef MSW
- float elapsedcpu;
FILETIME ignorethis, ignorethat;
LARGE_INTEGER usertime, kerneltime;
! BOOL retval;
! retval = GetProcessTimes(GetCurrentProcess(), &ignorethis, &ignorethat,
! (FILETIME *)&kerneltime, (FILETIME *)&usertime);
! if (retval)
! elapsedcpu = 0.0001 *
((kerneltime.QuadPart - x->kerneltime.QuadPart) +
! (usertime.QuadPart - x->usertime.QuadPart));
! else elapsedcpu = 0;
#endif
outlet_float(x->outlet, elapsedcpu);
--- 890,905 ----
static void cputime_bang2(t_cputime *x) {
#ifdef UNISTD
struct tms newcputime;
times(&newcputime);
! float elapsedcpu = 1000 * (newcputime.tms_utime + newcputime.tms_stime
! - x->setcputime.tms_utime - x->setcputime.tms_stime) / HZ;
#endif
#ifdef MSW
FILETIME ignorethis, ignorethat;
LARGE_INTEGER usertime, kerneltime;
! BOOL retval = GetProcessTimes(GetCurrentProcess(), &ignorethis, &ignorethat, (FILETIME *)&kerneltime, (FILETIME *)&usertime);
! float elapsedcpu = retval ? 0.0001 *
((kerneltime.QuadPart - x->kerneltime.QuadPart) +
! (usertime.QuadPart - x->usertime.QuadPart)) : 0;
#endif
outlet_float(x->outlet, elapsedcpu);
***************
*** 996,1001 ****
static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv) {
if (argc && argv->a_type != A_SYMBOL) startpost("%s:", x->sym->name);
! else startpost("%s: %s", x->sym->name,
! (argc>1 ? s_list : argc==1 ? s_symbol : s_bang).name);
postatom(argc, argv);
endpost();
--- 957,961 ----
static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv) {
if (argc && argv->a_type != A_SYMBOL) startpost("%s:", x->sym->name);
! else startpost("%s: %s", x->sym->name, (argc>1 ? s_list : argc==1 ? s_symbol : s_bang).name);
postatom(argc, argv);
endpost();
***************
*** 1115,1134 ****
float f3;
};
! static void *clip_new(t_floatarg f1, t_floatarg f2) {
t_clip *x = (t_clip *)pd_new(clip_class);
! floatinlet_new(x, &x->f2);
! floatinlet_new(x, &x->f3);
outlet_new(x, &s_float);
- x->f2 = f1;
- x->f3 = f2;
return x;
}
! static void clip_bang(t_clip *x) {
! outlet_float(x->outlet, (x->f1 < x->f2 ? x->f2 : (x->f1 > x->f3 ? x->f3 : x->f1)));
! }
! static void clip_float(t_clip *x, t_float f) {
! x->f1 = f;
! outlet_float(x->outlet, (x->f1 < x->f2 ? x->f2 : (x->f1 > x->f3 ? x->f3 : x->f1)));
! }
void arithmetic_setup() {
--- 1075,1087 ----
float f3;
};
! static void *clip_new(t_floatarg f2, t_floatarg f3) {
t_clip *x = (t_clip *)pd_new(clip_class);
! floatinlet_new(x, &x->f2); x->f2 = f2;
! floatinlet_new(x, &x->f3); x->f3 = f3;
outlet_new(x, &s_float);
return x;
}
! static void clip_bang( t_clip *x) { outlet_float(x->outlet, clip(x->f1,x->f2,x->f3));}
! static void clip_float(t_clip *x, t_float f) {x->f1 = f; outlet_float(x->outlet, clip(x->f1,x->f2,x->f3));}
void arithmetic_setup() {
***************
*** 1288,1303 ****
t_symbol *sym;
};
! static void send_bang(t_send *x) {
! if (x->sym->thing) pd_bang(x->sym->thing);}
! static void send_float(t_send *x, t_float f) {
! if (x->sym->thing) pd_float(x->sym->thing, f);}
! static void send_symbol(t_send *x, t_symbol *s) {
! if (x->sym->thing) pd_symbol(x->sym->thing, s);}
! static void send_pointer(t_send *x, t_gpointer *gp) {
! if (x->sym->thing) pd_pointer(x->sym->thing, gp);}
! static void send_list(t_send *x, t_symbol *s, int argc, t_atom *argv) {
! if (x->sym->thing) pd_list(x->sym->thing, s, argc, argv);}
! static void send_anything(t_send *x, t_symbol *s, int argc, t_atom *argv) {
! if (x->sym->thing) typedmess(x->sym->thing, s, argc, argv);}
static void *send_new(t_symbol *s) {
t_send *x = (t_send *)pd_new(send_class);
--- 1241,1250 ----
t_symbol *sym;
};
! static void send_bang( t_send *x) { if (x->sym->thing) pd_bang(x->sym->thing);}
! static void send_float( t_send *x, t_float f) { if (x->sym->thing) pd_float(x->sym->thing,f);}
! static void send_symbol( t_send *x, t_symbol *s) { if (x->sym->thing) pd_symbol(x->sym->thing,s);}
! static void send_pointer( t_send *x, t_gpointer *gp) { if (x->sym->thing) pd_pointer(x->sym->thing,gp);}
! static void send_list( t_send *x, t_symbol *s, int argc, t_atom *argv) {if (x->sym->thing) pd_list(x->sym->thing,s,argc,argv);}
! static void send_anything(t_send *x, t_symbol *s, int argc, t_atom *argv) {if (x->sym->thing) typedmess(x->sym->thing,s,argc,argv);}
static void *send_new(t_symbol *s) {
t_send *x = (t_send *)pd_new(send_class);
***************
*** 1321,1336 ****
t_symbol *sym;
};
! static void receive_bang(t_receive *x) {
! outlet_bang(x->outlet);}
! static void receive_float(t_receive *x, t_float f) {
! outlet_float(x->outlet, f);}
! static void receive_symbol(t_receive *x, t_symbol *s) {
! outlet_symbol(x->outlet, s);}
! static void receive_pointer(t_receive *x, t_gpointer *gp) {
! outlet_pointer(x->outlet, gp);}
! static void receive_list(t_receive *x, t_symbol *s, int argc, t_atom *argv) {
! outlet_list(x->outlet, s, argc, argv);}
! static void receive_anything(t_receive *x, t_symbol *s, int argc, t_atom *argv) {
! outlet_anything(x->outlet, s, argc, argv);}
static void *receive_new(t_symbol *s) {
t_receive *x = (t_receive *)pd_new(receive_class);
--- 1268,1277 ----
t_symbol *sym;
};
! static void receive_bang( t_receive *x) { outlet_bang(x->outlet);}
! static void receive_float( t_receive *x, t_float f) { outlet_float(x->outlet, f);}
! static void receive_symbol( t_receive *x, t_symbol *s) { outlet_symbol(x->outlet, s);}
! static void receive_pointer( t_receive *x, t_gpointer *gp) { outlet_pointer(x->outlet, gp);}
! static void receive_list( t_receive *x, t_symbol *s, int argc, t_atom *argv) { outlet_list(x->outlet, s, argc, argv);}
! static void receive_anything(t_receive *x, t_symbol *s, int argc, t_atom *argv) {outlet_anything(x->outlet, s, argc, argv);}
static void *receive_new(t_symbol *s) {
t_receive *x = (t_receive *)pd_new(receive_class);
***************
*** 1378,1382 ****
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);
}
--- 1319,1323 ----
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);
}
***************
*** 1387,1392 ****
static void sel2_free(t_sel2 *x) {free(x->vec);}
static void *select_new(t_symbol *s, int argc, t_atom *argv) {
- t_atom a;
if (argc == 0) {
argc = 1;
SETFLOAT(&a, 0);
--- 1328,1333 ----
static void sel2_free(t_sel2 *x) {free(x->vec);}
static void *select_new(t_symbol *s, int argc, t_atom *argv) {
if (argc == 0) {
+ t_atom a;
argc = 1;
SETFLOAT(&a, 0);
***************
*** 1454,1458 ****
else if (argv[0].a_type == A_FLOAT) outlet_float( e->out, argv[0].a_float);
else if (argv[0].a_type == A_SYMBOL) outlet_symbol( e->out, argv[0].a_symbol);
! else if (argv[0].a_type == A_POINTER) outlet_pointer(e->out, argv[0].a_w.w_gpointer);
} /* tb } */
return;
--- 1395,1399 ----
else if (argv[0].a_type == A_FLOAT) outlet_float( e->out, argv[0].a_float);
else if (argv[0].a_type == A_SYMBOL) outlet_symbol( e->out, argv[0].a_symbol);
! else if (argv[0].a_type == A_POINTER) outlet_pointer(e->out, argv[0].a_pointer);
} /* tb } */
return;
***************
*** 1477,1481 ****
else if (argv[0].a_type == A_FLOAT) outlet_float( e->out, argv[0].a_float);
else if (argv[0].a_type == A_SYMBOL) outlet_symbol( e->out, argv[0].a_symbol);
! else if (argv[0].a_type == A_POINTER) outlet_pointer(e->out, argv[0].a_w.w_gpointer);
} /* tb } */
return;
--- 1418,1422 ----
else if (argv[0].a_type == A_FLOAT) outlet_float( e->out, argv[0].a_float);
else if (argv[0].a_type == A_SYMBOL) outlet_symbol( e->out, argv[0].a_symbol);
! else if (argv[0].a_type == A_POINTER) outlet_pointer(e->out, argv[0].a_pointer);
} /* tb } */
return;
***************
*** 1504,1509 ****
static void *route_new(t_symbol *s, int argc, t_atom *argv) {
t_route *x = (t_route *)pd_new(route_class);
- t_atom a;
if (argc == 0) {
argc = 1;
SETFLOAT(&a, 0);
--- 1445,1450 ----
static void *route_new(t_symbol *s, int argc, t_atom *argv) {
t_route *x = (t_route *)pd_new(route_class);
if (argc == 0) {
+ t_atom a;
argc = 1;
SETFLOAT(&a, 0);
***************
*** 1566,1570 ****
} else if (c == 'p') {
vp->a_type = A_POINTER;
! vp->a_w.w_gpointer = gp;
gpointer_init(gp);
if (i) pointerinlet_new(x, gp);
--- 1507,1511 ----
} else if (c == 'p') {
vp->a_type = A_POINTER;
! vp->a_pointer = gp;
gpointer_init(gp);
if (i) pointerinlet_new(x, gp);
***************
*** 1650,1654 ****
};
struct t_unpack : t_object {
- t_object obj;
t_int n;
t_unpackout *vec;
--- 1591,1594 ----
***************
*** 1698,1702 ****
else if (type == A_FLOAT) outlet_float( u->outlet, ap->a_float);
else if (type == A_SYMBOL)outlet_symbol( u->outlet, ap->a_symbol);
! else outlet_pointer(u->outlet, ap->a_w.w_gpointer);
}
}
--- 1638,1642 ----
else if (type == A_FLOAT) outlet_float( u->outlet, ap->a_float);
else if (type == A_SYMBOL)outlet_symbol( u->outlet, ap->a_symbol);
! else outlet_pointer(u->outlet, ap->a_pointer);
}
}
***************
*** 1765,1769 ****
else if (u->type == 'p') {
if (!argc || argv->a_type != 'p') error("unpack: bad pointer");
! else outlet_pointer(u->outlet, argv->a_w.w_gpointer);
} else outlet_list(u->outlet, &s_list, argc, argv);
}
--- 1705,1709 ----
else if (u->type == 'p') {
if (!argc || argv->a_type != 'p') error("unpack: bad pointer");
! else outlet_pointer(u->outlet, argv->a_pointer);
} else outlet_list(u->outlet, &s_list, argc, argv);
}
***************
*** 1802,1817 ****
return x;
}
! static void spigot_bang(t_spigot *x) {
! if (x->state) outlet_bang(x->outlet);}
! static void spigot_pointer(t_spigot *x, t_gpointer *gp) {
! if (x->state) outlet_pointer(x->outlet, gp);}
! static void spigot_float(t_spigot *x, t_float f) {
! if (x->state) outlet_float(x->outlet, f);}
! static void spigot_symbol(t_spigot *x, t_symbol *s) {
! if (x->state) outlet_symbol(x->outlet, s);}
! static void spigot_list(t_spigot *x, t_symbol *s, int argc, t_atom *argv) {
! if (x->state) outlet_list(x->outlet, s, argc, argv);}
! static void spigot_anything(t_spigot *x, t_symbol *s, int argc, t_atom *argv) {
! if (x->state) outlet_anything(x->outlet, s, argc, argv);}
static void spigot_setup() {
t_class *c = spigot_class = class_new2("spigot",spigot_new,0,sizeof(t_spigot),0,"F");
--- 1742,1751 ----
return x;
}
! static void spigot_bang( t_spigot *x) { if (x->state) outlet_bang(x->outlet);}
! static void spigot_pointer( t_spigot *x, t_gpointer *gp) { if (x->state) outlet_pointer(x->outlet, gp);}
! static void spigot_float( t_spigot *x, t_float f) { if (x->state) outlet_float(x->outlet, f);}
! static void spigot_symbol( t_spigot *x, t_symbol *s) { if (x->state) outlet_symbol(x->outlet, s);}
! static void spigot_list( t_spigot *x, t_symbol *s, int argc, t_atom *argv) {if (x->state) outlet_list(x->outlet, s, argc, argv);}
! static void spigot_anything(t_spigot *x, t_symbol *s, int argc, t_atom *argv) {if (x->state) outlet_anything(x->outlet, s, argc, argv);}
static void spigot_setup() {
t_class *c = spigot_class = class_new2("spigot",spigot_new,0,sizeof(t_spigot),0,"F");
***************
*** 1851,1864 ****
return x;
}
! static void until_bang(t_until *x) {
! x->run = 1;
! x->count = -1;
! while (x->run && x->count) x->count--, outlet_bang(x->outlet);
! }
! static void until_float(t_until *x, t_float f) {
! x->run = 1;
! x->count = (int)f;
! while (x->run && x->count) x->count--, outlet_bang(x->outlet);
! }
static void until_bang2(t_until *x) {x->run = 0;}
static void until_setup() {
--- 1785,1790 ----
return x;
}
! static void until_bang(t_until *x) { x->run=1; x->count=-1; while (x->run && x->count) {x->count--; outlet_bang(x->outlet);}}
! static void until_float(t_until *x, t_float f) {x->run=1; x->count=(int)f; while (x->run && x->count) {x->count--; outlet_bang(x->outlet);}}
static void until_bang2(t_until *x) {x->run = 0;}
static void until_setup() {
***************
*** 1885,1892 ****
static void makefilename_setup() {
! makefilename_class = class_new2("makefilename",makefilename_new,0,sizeof(t_makefilename),0,"S");
! class_addfloat(makefilename_class, makefilename_float);
! class_addsymbol(makefilename_class, makefilename_symbol);
! class_addmethod2(makefilename_class, makefilename_set, "set","s");
}
--- 1811,1818 ----
static void makefilename_setup() {
! t_class *c = makefilename_class = class_new2("makefilename",makefilename_new,0,sizeof(t_makefilename),0,"S");
! class_addfloat(c, makefilename_float);
! class_addsymbol(c, makefilename_symbol);
! class_addmethod2(c, makefilename_set, "set","s");
}
***************
*** 1946,1950 ****
struct t_vcommon : t_pd {
int c_refcount;
! t_float c_f;
};
typedef struct t_value : t_object {
--- 1872,1876 ----
struct t_vcommon : t_pd {
int c_refcount;
! t_float f;
};
typedef struct t_value : t_object {
***************
*** 1959,1968 ****
if (!c) {
c = (t_vcommon *)pd_new(vcommon_class);
! c->c_f = 0;
c->c_refcount = 0;
pd_bind(c,s);
}
c->c_refcount++;
! return &c->c_f;
}
/* release a variable. This only frees the "vcommon" resource when the last interested party releases it. */
--- 1885,1894 ----
if (!c) {
c = (t_vcommon *)pd_new(vcommon_class);
! c->f = 0;
c->c_refcount = 0;
pd_bind(c,s);
}
c->c_refcount++;
! return &c->f;
}
/* release a variable. This only frees the "vcommon" resource when the last interested party releases it. */
***************
*** 1976,1991 ****
} else bug("value_release");
}
! int value_getfloat(t_symbol *s, t_float *f) {
! t_vcommon *c = (t_vcommon *)pd_findbyclass(s, vcommon_class);
! if (!c) return 1;
! *f = c->c_f;
! return 0;
! }
! int value_setfloat(t_symbol *s, t_float f) {
! t_vcommon *c = (t_vcommon *)pd_findbyclass(s, vcommon_class);
! if (!c) return 1;
! c->c_f = f;
! return 0;
! }
static void *value_new(t_symbol *s) {
t_value *x = (t_value *)pd_new(value_class);
--- 1902,1907 ----
} else bug("value_release");
}
! int value_getfloat(t_symbol *s, t_float *f) {t_vcommon *c=(t_vcommon *)pd_findbyclass(s,vcommon_class); if (!c) return 1; *f=c->f;return 0;}
! int value_setfloat(t_symbol *s, t_float f) {t_vcommon *c=(t_vcommon *)pd_findbyclass(s,vcommon_class); if (!c) return 1; c->f=f; return 0;}
static void *value_new(t_symbol *s) {
t_value *x = (t_value *)pd_new(value_class);
***************
*** 1995,2003 ****
return x;
}
-
static void value_bang(t_value *x) {outlet_float(x->outlet, *x->floatstar);}
static void value_float(t_value *x, t_float f) {*x->floatstar = f;}
static void value_ff(t_value *x) {value_release(x->sym);}
-
static void value_setup() {
value_class = class_new2("value",value_new,value_ff,sizeof(t_value),0,"S");
--- 1911,1917 ----
***************
*** 2052,2065 ****
}
void inmidi_byte(int portno, int byte) {
! if (midiin_sym->thing) {
! t_atom at[2]; SETFLOAT(at, byte); SETFLOAT(at+1, portno + 1);
! pd_list(midiin_sym->thing, 0, 2, at);
! }
}
void inmidi_sysex(int portno, int byte) {
! if (sysexin_sym->thing) {
! t_atom at[2]; SETFLOAT(at, byte); SETFLOAT(at+1, portno + 1);
! pd_list(sysexin_sym->thing, 0, 2, at);
! }
}
--- 1966,1973 ----
}
void inmidi_byte(int portno, int byte) {
! if ( midiin_sym->thing) {t_atom at[2]; SETFLOAT(at, byte); SETFLOAT(at+1, portno+1); pd_list( midiin_sym->thing, 0, 2, at);}
}
void inmidi_sysex(int portno, int byte) {
! if (sysexin_sym->thing) {t_atom at[2]; SETFLOAT(at, byte); SETFLOAT(at+1, portno+1); pd_list(sysexin_sym->thing, 0, 2, at);}
}
***************
*** 2079,2084 ****
}
static void notein_list(t_notein *x, t_symbol *s, int argc, t_atom *argv) {
! float pitch = atom_getfloatarg(0, argc, argv);
! float velo = atom_getfloatarg(1, argc, argv);
float channel = atom_getfloatarg(2, argc, argv);
if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out(2), channel);
--- 1987,1992 ----
}
static void notein_list(t_notein *x, t_symbol *s, int argc, t_atom *argv) {
! float pitch = atom_getfloatarg(0, argc, argv);
! float velo = atom_getfloatarg(1, argc, argv);
float channel = atom_getfloatarg(2, argc, argv);
if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out(2), channel);
***************
*** 2125,2130 ****
static void ctlin_list(t_ctlin *x, t_symbol *s, int argc, t_atom *argv) {
t_float ctlnumber = atom_getfloatarg(0, argc, argv);
! t_float value = atom_getfloatarg(1, argc, argv);
! t_float channel = atom_getfloatarg(2, argc, argv);
if (x->ctlno >= 0 && x->ctlno != ctlnumber) return;
if (x->ch > 0 && x->ch != channel) return;
--- 2033,2038 ----
static void ctlin_list(t_ctlin *x, t_symbol *s, int argc, t_atom *argv) {
t_float ctlnumber = atom_getfloatarg(0, argc, argv);
! t_float value = atom_getfloatarg(1, argc, argv);
! t_float channel = atom_getfloatarg(2, argc, argv);
if (x->ctlno >= 0 && x->ctlno != ctlnumber) return;
if (x->ch > 0 && x->ch != channel) return;
***************
*** 2159,2163 ****
}
static void midi2_list(t_midi2 *x, t_symbol *s, int argc, t_atom *argv) {
! float value = atom_getfloatarg(0, argc, argv);
float channel = atom_getfloatarg(1, argc, argv);
if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out(1), channel);
--- 2067,2071 ----
}
static void midi2_list(t_midi2 *x, t_symbol *s, int argc, t_atom *argv) {
! float value = atom_getfloatarg(0, argc, argv);
float channel = atom_getfloatarg(1, argc, argv);
if (x->ch) {if (channel != x->ch) return;} else outlet_float(x->out(1), channel);
***************
*** 2194,2211 ****
void inmidi_programchange(int portno, int channel, int value) {
if (pgmin_sym->thing) {
! t_atom at[2]; SETFLOAT(at, value+1); SETFLOAT(at+1, (channel + (portno<<4) + 1));
! pd_list(pgmin_sym->thing, &s_list, 2, at);
}
}
void inmidi_pitchbend(int portno, int channel, int value) {
if (bendin_sym->thing) {
! t_atom at[2]; SETFLOAT(at, value); SETFLOAT(at+1, (channel + (portno<<4) + 1));
! pd_list(bendin_sym->thing, &s_list, 2, at);
}
}
void inmidi_aftertouch(int portno, int channel, int value) {
if (touchin_sym->thing) {
! t_atom at[2]; SETFLOAT(at, value); SETFLOAT(at+1, (channel + (portno<<4) + 1));
! pd_list(touchin_sym->thing, &s_list, 2, at);
}
}
--- 2102,2116 ----
void inmidi_programchange(int portno, int channel, int value) {
if (pgmin_sym->thing) {
! t_atom at[2]; SETFLOAT(at,value+1); SETFLOAT(at+1, channel+(portno<<4)+1); pd_list( pgmin_sym->thing, &s_list, 2, at);
}
}
void inmidi_pitchbend(int portno, int channel, int value) {
if (bendin_sym->thing) {
! t_atom at[2]; SETFLOAT(at,value); SETFLOAT(at+1, channel+(portno<<4)+1); pd_list( bendin_sym->thing, &s_list, 2, at);
}
}
void inmidi_aftertouch(int portno, int channel, int value) {
if (touchin_sym->thing) {
! t_atom at[2]; SETFLOAT(at,value); SETFLOAT(at+1, channel+(portno<<4)+1); pd_list(touchin_sym->thing, &s_list, 2, at);
}
}
***************
*** 2732,2741 ****
}
static void delay_setup() {
! delay_class = class_new2("delay",delay_new,delay_free,sizeof(t_delay),0,"F");
class_addcreator2("del",delay_new,"F");
! class_addbang(delay_class, delay_bang);
! class_addmethod2(delay_class,delay_stop,"stop","");
! class_addmethod2(delay_class,delay_ft1,"ft1","f");
! class_addfloat(delay_class, delay_float);
}
--- 2637,2646 ----
}
static void delay_setup() {
! t_class *c = delay_class = class_new2("delay",delay_new,delay_free,sizeof(t_delay),0,"F");
class_addcreator2("del",delay_new,"F");
! class_addbang(c, delay_bang);
! class_addmethod2(c,delay_stop,"stop","");
! class_addmethod2(c,delay_ft1,"ft1","f");
! class_addfloat(c, delay_float);
}
***************
*** 2769,2777 ****
}
static void metro_setup() {
! metro_class = class_new2("metro",metro_new,metro_free,sizeof(t_metro),0,"F");
! class_addbang(metro_class, metro_bang);
! class_addmethod2(metro_class,metro_stop,"stop","");
! class_addmethod2(metro_class,metro_ft1,"ft1","f");
! class_addfloat(metro_class, metro_float);
}
--- 2674,2682 ----
}
static void metro_setup() {
! t_class *c = metro_class = class_new2("metro",metro_new,metro_free,sizeof(t_metro),0,"F");
! class_addbang(c, metro_bang);
! class_addmethod2(c,metro_stop,"stop","");
! class_addmethod2(c,metro_ft1,"ft1","f");
! class_addfloat(c, metro_float);
}
***************
*** 2935,2939 ****
} else if (c == 'p') {
vp->a_type = A_POINTER;
! vp->a_w.w_gpointer = gp;
gpointer_init(gp);
outlet_new(x, &s_pointer);
--- 2840,2844 ----
} else if (c == 'p') {
vp->a_type = A_POINTER;
! vp->a_pointer = gp;
gpointer_init(gp);
outlet_new(x, &s_pointer);
***************
*** 3003,3007 ****
if (ap->a_type != A_POINTER) post("pipe: bad pointer");
else {
! *gp = *(ap->a_w.w_gpointer);
if (gp->o) gp->o->refcount++;
}
--- 2908,2912 ----
if (ap->a_type != A_POINTER) post("pipe: bad pointer");
else {
! *gp = *(ap->a_pointer);
if (gp->o) gp->o->refcount++;
}