Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16127
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.34 retrieving revision 1.1.2.35 diff -C2 -d -r1.1.2.34 -r1.1.2.35 *** builtins.c 19 Jul 2007 05:14:02 -0000 1.1.2.34 --- builtins.c 19 Jul 2007 15:38:48 -0000 1.1.2.35 *************** *** 620,624 **** list append - append a list to another list prepend - prepend a list to another ! list split - first n elements to first outlet, rest to second outlet list trim - trim off "list" selector list length - output number of items in list --- 620,624 ---- list append - append a list to another list prepend - prepend a list to another ! list split - first n elements to first outlet, rest to second outlet list trim - trim off "list" selector list length - output number of items in list *************** *** 2904,2911 **** struct t_pipe *owner; t_gpointer *gp; ! union word vec[1]; /* not the actual number. */ ! }; ! struct t_pipeout { ! t_atom a; }; struct t_pipe : t_object { --- 2904,2908 ---- struct t_pipe *owner; t_gpointer *gp; ! union word vec[0]; /* not the actual number of elements */ }; struct t_pipe : t_object { *************** *** 2913,2917 **** int nptr; float deltime; ! t_pipeout *vec; t_gpointer *gp; t_hang2 *hang; --- 2910,2914 ---- int nptr; float deltime; ! t_atom *vec; t_gpointer *gp; t_hang2 *hang; *************** *** 2920,2924 **** t_pipe *x = (t_pipe *)pd_new(pipe_class); t_atom defarg, *ap; ! t_pipeout *vec, *vp; t_gpointer *gp; int nptr = 0; --- 2917,2921 ---- t_pipe *x = (t_pipe *)pd_new(pipe_class); t_atom defarg, *ap; ! t_atom *vec, *vp; t_gpointer *gp; int nptr = 0; *************** *** 2941,2964 **** } x->n = argc; ! vec = x->vec = (t_pipeout *)getbytes(argc * sizeof(*x->vec)); ! for (i = argc, ap = argv; i--; ap++) ! if (ap->a_type == A_SYMBOL && *ap->a_symbol->name == 'p') ! nptr++; ! gp = x->gp = (t_gpointer *)t_getbytes(nptr * sizeof (*gp)); x->nptr = nptr; for (i = 0, vp = vec, ap = argv; i < argc; i++, ap++, vp++) { if (ap->a_type == A_FLOAT) { ! vp->a = *ap; outlet_new(x, &s_float); ! if (i) floatinlet_new(x, &vp->a.a_float); } else if (ap->a_type == A_SYMBOL) { char c = *ap->a_symbol->name; if (c == 's') { ! SETSYMBOL(&vp->a, &s_symbol); outlet_new(x, &s_symbol); ! if (i) symbolinlet_new(x, &vp->a.a_symbol); } else if (c == 'p') { ! vp->a.a_type = A_POINTER; ! vp->a.a_w.w_gpointer = gp; gpointer_init(gp); outlet_new(x, &s_pointer); --- 2938,2959 ---- } x->n = argc; ! vec = x->vec = (t_atom *)getbytes(argc * sizeof(*x->vec)); ! for (i = argc, ap = argv; i--; ap++) if (ap->a_type == A_SYMBOL && *ap->a_symbol->name == 'p') nptr++; ! gp = x->gp = (t_gpointer *)t_getbytes(nptr * sizeof(*gp)); x->nptr = nptr; for (i = 0, vp = vec, ap = argv; i < argc; i++, ap++, vp++) { if (ap->a_type == A_FLOAT) { ! *vp = *ap; outlet_new(x, &s_float); ! if (i) floatinlet_new(x, &vp->a_float); } else if (ap->a_type == A_SYMBOL) { char c = *ap->a_symbol->name; if (c == 's') { ! SETSYMBOL(vp, &s_symbol); outlet_new(x, &s_symbol); ! if (i) symbolinlet_new(x, &vp->a_symbol); } else if (c == 'p') { ! vp->a_type = A_POINTER; ! vp->a_w.w_gpointer = gp; gpointer_init(gp); outlet_new(x, &s_pointer); *************** *** 2967,2973 **** } else { if (c != 'f') error("pack: %s: bad type", ap->a_symbol->name); ! SETFLOAT(&vp->a, 0); outlet_new(x, &s_float); ! if (i) floatinlet_new(x, &vp->a.a_float); } } --- 2962,2968 ---- } else { if (c != 'f') error("pack: %s: bad type", ap->a_symbol->name); ! SETFLOAT(vp,0); outlet_new(x, &s_float); ! if (i) floatinlet_new(x, &vp->a_float); } } *************** *** 2996,3003 **** } } ! t_pipeout *p = x->vec + (x->n - 1); union word *w = h->vec + (x->n - 1); for (int i = x->n; i--; p--, w--) { ! switch (p->a.a_type) { case A_FLOAT: outlet_float( x->out(i),w->w_float); break; case A_SYMBOL: outlet_symbol(x->out(i),w->w_symbol); break; --- 2991,2998 ---- } } ! t_atom *p = x->vec + (x->n - 1); union word *w = h->vec + (x->n - 1); for (int i = x->n; i--; p--, w--) { ! switch (p->a_type) { case A_FLOAT: outlet_float( x->out(i),w->w_float); break; case A_SYMBOL: outlet_symbol(x->out(i),w->w_symbol); break; *************** *** 3013,3027 **** static void pipe_list(t_pipe *x, t_symbol *s, int ac, t_atom *av) { t_hang2 *h = (t_hang2 *)getbytes(sizeof(*h) + (x->n - 1) * sizeof(*h->vec)); ! t_gpointer *gp, *gp2; ! t_pipeout *p; ! int i, n = x->n; ! t_atom *ap; ! t_word *w; h->gp = (t_gpointer *)getbytes(x->nptr * sizeof(t_gpointer)); if (ac > n) ac = n; ! for (i = 0, gp = x->gp, p = x->vec, ap = av; i < ac; i++, p++, ap++) { ! switch (p->a.a_type) { ! case A_FLOAT: p->a.a_float = atom_getfloat(ap); break; ! case A_SYMBOL: p->a.a_symbol = atom_getsymbol(ap); break; case A_POINTER: gpointer_unset(gp); --- 3008,3022 ---- static void pipe_list(t_pipe *x, t_symbol *s, int ac, t_atom *av) { t_hang2 *h = (t_hang2 *)getbytes(sizeof(*h) + (x->n - 1) * sizeof(*h->vec)); ! t_gpointer *gp2; ! int n = x->n; h->gp = (t_gpointer *)getbytes(x->nptr * sizeof(t_gpointer)); if (ac > n) ac = n; ! t_atom *p = x->vec; ! t_atom *ap = av; ! t_gpointer *gp = x->gp; ! for (int i=0; i<ac; i++, p++, ap++) { ! switch (p->a_type) { ! case A_FLOAT: p->a_float = atom_getfloat(ap); break; ! case A_SYMBOL: p->a_symbol = atom_getsymbol(ap); break; case A_POINTER: gpointer_unset(gp); *************** *** 3035,3044 **** } } ! for (i = 0, gp = x->gp, gp2 = h->gp, p = x->vec, w = h->vec; i < n; i++, p++, w++) { ! if (p->a.a_type == A_POINTER) { if (gp->o) gp->o->refcount++; w->w_gpointer = gp2; *gp2++ = *gp++; ! } else *w = p->a.a_w; } h->next = x->hang; --- 3030,3043 ---- } } ! t_word *w = h->vec; ! gp = x->gp; ! gp2 = h->gp; ! p = x->vec; ! for (int i=0; i<n; i++, p++, w++) { ! if (p->a_type == A_POINTER) { if (gp->o) gp->o->refcount++; w->w_gpointer = gp2; *gp2++ = *gp++; ! } else *w = p->a_w; } h->next = x->hang;