[PD-cvs] pd/src builtins.c,1.1.2.64,1.1.2.65
chunlee
chunlee at users.sourceforge.net
Wed Sep 5 02:07:28 CEST 2007
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3320
Modified Files:
Tag: desiredata
builtins.c
Log Message:
[any] clone, still has a few minor bugs to sort out
Index: builtins.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v
retrieving revision 1.1.2.64
retrieving revision 1.1.2.65
diff -C2 -d -r1.1.2.64 -r1.1.2.65
*** builtins.c 4 Sep 2007 12:09:42 -0000 1.1.2.64
--- builtins.c 5 Sep 2007 00:07:25 -0000 1.1.2.65
***************
*** 1069,1072 ****
--- 1069,1115 ----
}
+ /*---- Any ----*/
+ static t_class *any_class;
+ struct t_any : t_object {t_binbuf *alist;};
+
+ static void *any_new(t_symbol *s,int argc, t_atom *argv) {
+ t_any *x = (t_any *)pd_new(any_class);
+ x->alist = binbuf_new();
+ if (argc) {
+ if (argv[0].a_type == A_FLOAT) {alist_list(x->alist, 0, argc, argv);}
+ if (argv[0].a_type == A_SYMBOL) {alist_anything(x->alist, argv[0].a_symbol, argc-1, argv+1);}
+ }
+ outlet_new(x, &s_anything);
+ inlet_new(x,x->alist, 0, 0);
+ return x;
+ }
+
+ static void any_anything(t_any *x, t_symbol *s, int argc, t_atom *argv) {
+ t_atom *outv; int outc = x->alist->n+argc+1; ATOMS_ALLOCA(outv, outc);
+ if (argv[0].a_type == A_FLOAT) {
+ alist_list(x->alist, 0, argc, argv); outlet_anything(x->outlet, &s_float, argc, argv);
+ }
+ if (argv[0].a_type == A_SYMBOL) {
+ alist_anything(x->alist, s, argc, argv); outlet_anything(x->outlet, s, argc, argv);
+ }
+ }
+
+ static void any_bang(t_any *x) {
+ t_atom *outv; int outc = x->alist->n;
+ ATOMS_ALLOCA(outv, outc);
+ alist_toatoms(x->alist, outv);
+ if (!binbuf_getnatom(x->alist)) {outlet_bang(x->outlet);return;}
+ if (outv[0].a_type == A_FLOAT) {outlet_float(x->outlet, outv[0].a_float);}
+ if (outv[0].a_type == A_SYMBOL) {outlet_anything(x->outlet, outv[0].a_symbol, outc-1, outv+1);}
+ ATOMS_FREEA(outv, outc);
+ }
+
+ static void any_setup() {
+ post("DesireData iemlib2 [any] clone");
+ t_class *c = any_class = class_new2("any",any_new,0,sizeof(t_any),0,"*");
+ class_addanything(c, any_anything);
+ class_addbang(c, any_bang);
+ }
+
/* MSW and OSX don't appear to have single-precision ANSI math */
#if defined(MSW) || defined(__APPLE__)
***************
*** 2954,2958 ****
macro_setup();
display_setup();
! any2_setup();
clipboard_setup();
delay_setup();
--- 2997,3001 ----
macro_setup();
display_setup();
! any_setup();
clipboard_setup();
delay_setup();
More information about the Pd-cvs
mailing list