static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av) { int natoms, nsegs, odd; t_atom *ap; t_lineseg *segp; for (natoms = 0, ap = av; natoms < ac; natoms++, ap++) { if (ap->a_type != A_FLOAT) { loud_messarg((t_pd *)x, &s_list); /* CHECKED */ return; /* CHECKED */ } } if (!natoms) return; /* CHECKED */ odd = natoms % 2; nsegs = natoms / 2; if (odd) nsegs++; if (nsegs > LINE_MAXSIZE) nsegs = LINE_MAXSIZE; { int ns = nsegs; x->x_segs = grow_nodata(&ns, &x->x_size, x->x_segs, LINE_MAXSIZE, x->x_segini, sizeof(*x->x_segs)); if (ns < nsegs) { natoms = ns * 2; nsegs = ns; odd = 0; } } x->x_nsegs = nsegs; /* #ifdef LINE_DEBUG loudbug_post("%d segments:", x->x_nsegs); #endif */ segp = x->x_segs; if (odd) nsegs--; while (nsegs--) { segp->s_target = av++->a_w.w_float; segp->s_delta = av++->a_w.w_float; /* #ifdef LINE_DEBUG loudbug_post("%g %g", segp->s_target, segp->s_delta); #endif */ segp++; } if (odd) { segp->s_target = av->a_w.w_float; segp->s_delta = 0; /* #ifdef LINE_DEBUG loudbug_post("%g %g", segp->s_target, segp->s_delta); #endif */ } x->x_deltaset = 0; x->x_target = x->x_segs->s_target; x->x_curseg = x->x_segs; x->x_retarget = 1; x->x_pause = 0; }
static void curve_list(t_curve *x, t_symbol *s, int ac, t_atom *av) { int natoms, nsegs, odd; t_atom *ap; t_curveseg *segp; for (natoms = 0, ap = av; natoms < ac; natoms++, ap++) { if (ap->a_type != A_FLOAT) { loud_messarg((t_pd *)x, &s_list); /* CHECKED */ return; /* CHECKED */ } } if (!natoms) return; /* CHECKED */ odd = natoms % 3; nsegs = natoms / 3; if (odd) nsegs++; if (nsegs > x->x_size) { int ns = nsegs; x->x_segs = grow_nodata(&ns, &x->x_size, x->x_segs, CURVE_INISIZE, x->x_segini, sizeof(*x->x_segs)); if (ns < nsegs) { natoms = ns * 3; nsegs = ns; odd = 0; } } x->x_nsegs = nsegs; #ifdef CURVE_DEBUG loudbug_post("%d segments:", x->x_nsegs); #endif segp = x->x_segs; if (odd) nsegs--; while (nsegs--) { segp->s_target = av++->a_w.w_float; segp->s_delta = av++->a_w.w_float; curve_cc(x, segp, av++->a_w.w_float); segp++; } if (odd) { segp->s_target = av->a_w.w_float; if (odd > 1) segp->s_delta = av[1].a_w.w_float; else segp->s_delta = 0; curve_cc(x, segp, 0.); } x->x_deltaset = 0; x->x_target = x->x_segs->s_target; x->x_curseg = x->x_segs; x->x_retarget = 1; }
static void funbuff_delete(t_funbuff *x, t_symbol *s, int ac, t_atom *av) { if (ac && av->a_type == A_FLOAT && (ac == 1 || (ac == 2 && av[1].a_type == A_FLOAT))) { /* CHECKED float is silently truncated */ int ndx = (int)av->a_w.w_float; t_hammernode *np; if ((np = hammertree_search(&x->x_tree, ndx)) && (ac == 1 || HAMMERNODE_GETFLOAT(np) == av[1].a_w.w_float)) { if (np == x->x_pointer) x->x_pointer = 0; /* CHECKED corrupt pointer left here... */ hammertree_delete(&x->x_tree, np); /* FIXME */ } /* CHECKED mismatch silently ignored */ } else loud_messarg((t_pd *)x, s); /* CHECKED */ }