[PD-cvs] pd/src desire.c,1.1.2.175,1.1.2.176
Mathieu Bouchard
matju at users.sourceforge.net
Mon Sep 11 07:00:45 CEST 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16336
Modified Files:
Tag: devel_0_39
desire.c
Log Message:
clean clean.
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.175
retrieving revision 1.1.2.176
diff -C2 -d -r1.1.2.175 -r1.1.2.176
*** desire.c 9 Sep 2006 02:36:45 -0000 1.1.2.175
--- desire.c 11 Sep 2006 05:00:42 -0000 1.1.2.176
***************
*** 402,408 ****
static void canvas_rename(t_canvas *x, t_symbol *s, t_symbol *dir) {
! if (strcmp(x->name->s_name, "Pd")) pd_unbind((t_pd *)x, canvas_makebindsym(x->name));
x->name = s;
! if (strcmp(x->name->s_name, "Pd")) pd_bind((t_pd *)x, canvas_makebindsym(x->name));
if (dir && dir != &s_) canvas_getenv(x)->dir = dir;
gobj_changed(x,0);
--- 402,410 ----
static void canvas_rename(t_canvas *x, t_symbol *s, t_symbol *dir) {
! t_symbol *bs = canvas_makebindsym(x->name);
! t_symbol *Pd = gensym("Pd");
! if (x->name==Pd) pd_unbind((t_pd *)x, bs);
x->name = s;
! if (x->name==Pd) pd_bind((t_pd *)x, bs);
if (dir && dir != &s_) canvas_getenv(x)->dir = dir;
gobj_changed(x,0);
***************
*** 939,943 ****
t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp, int ninlets, int noutlets);
void ugen_add(t_dspcontext *dc, t_object *x);
! void ugen_connect(t_dspcontext *dc, t_object *x1, int outno, t_object *x2, int inno);
void ugen_done_graph(t_dspcontext *dc);
--- 941,945 ----
t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp, int ninlets, int noutlets);
void ugen_add(t_dspcontext *dc, t_object *x);
! void ugen_connect(t_dspcontext *dc, t_object *from, int outlet, t_object *to, int inlet);
void ugen_done_graph(t_dspcontext *dc);
***************
*** 1379,1385 ****
}
- static int paste_onset;
- static t_canvas *paste_canvas;
-
extern t_class *text_class;
--- 1381,1384 ----
***************
*** 1387,1413 ****
return pd_class((t_pd *)x)==text_class && x->te_type==T_OBJECT;}
! void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno, t_floatarg fwhoin, t_floatarg finno) {
! int whoout = fwhoout, outno = foutno, whoin = fwhoin, inno = finno;
! t_gobj *src = 0, *sink = 0;
t_object *from, *to;
t_outconnect *oc;
! int nin = whoin, nout = whoout;
! if (paste_canvas == x) whoout += paste_onset, whoin += paste_onset;
! for (src = x->list; whoout; src = src->g_next, whoout--) if (! src->g_next) goto bad;
! for (sink = x->list; whoin; sink = sink->g_next, whoin--) if (!sink->g_next) goto bad;
! from = pd_checkobject(&src->g_pd);
! to = pd_checkobject(&sink->g_pd);
if (!from || !to) goto bad;
/* if object creation failed, make dummy inlets or outlets as needed */
! if (is_dummy(from)) while (outno >= obj_noutlets(from)) outlet_new(from, &s_);
! if (is_dummy(to)) while ( inno >= obj_ninlets(to)) inlet_new(to, &to->ob_pd, &s_, &s_);
gobj_changed(x,0);
! if (!(oc = obj_connect(from, outno, to, inno))) goto bad;
newest = (t_pd *)oc;
return;
bad:
! post("%s %d %d %d %d (%s->%s) connection failed", x->name->s_name, nout, outno, nin, inno,
! (src ? class_getname(pd_class(&src->g_pd)) : "???"),
! (sink? class_getname(pd_class(&sink->g_pd)) : "???"));
}
--- 1386,1410 ----
return pd_class((t_pd *)x)==text_class && x->te_type==T_OBJECT;}
! void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutlet, t_floatarg fwhoin,t_floatarg finlet) {
! int i, ifrom=fwhoout, outlet=foutlet, ito=fwhoin, inlet=finlet;
! t_gobj *gfrom=0, *gto=0;
t_object *from, *to;
t_outconnect *oc;
! for (i=ifrom, gfrom=x->list; i; gfrom=gfrom->g_next, i--) if (!gfrom->g_next) goto bad;
! for (i=ito, gto =x->list; i; gto =gto ->g_next, i--) if (!gto ->g_next) goto bad;
! from = pd_checkobject((t_pd *)gfrom);
! to = pd_checkobject( (t_pd *)gto);
if (!from || !to) goto bad;
/* if object creation failed, make dummy inlets or outlets as needed */
! if (is_dummy(from)) while (outlet >= obj_noutlets(from)) outlet_new(from, &s_);
! if (is_dummy(to)) while ( inlet >= obj_ninlets(to)) inlet_new(to, &to->ob_pd, &s_, &s_);
gobj_changed(x,0);
! if (!(oc = obj_connect(from,outlet,to,inlet))) goto bad;
newest = (t_pd *)oc;
return;
bad:
! post("%s %d %d %d %d (%s->%s) connection failed", x->name->s_name, from,outlet,to,inlet,
! from ? class_getname(pd_class((t_pd *)from)) : "???",
! to ? class_getname(pd_class((t_pd *)to )) : "???");
}
***************
*** 1444,1448 ****
x->gp = *parent;
x->stub = gstub_new(0, x);
! word_init((t_word *)(x->vec), template, parent);
return x;
}
--- 1441,1445 ----
x->gp = *parent;
x->stub = gstub_new(0, x);
! word_init((t_word *)x->vec, template, parent);
return x;
}
***************
*** 1883,1893 ****
for (i = 0, xsum = 0; i < array->n; i += incr) {
float usexloc, useyloc;
! if (xonset >= 0)
! usexloc = xloc + slot_cvttocoord(xfield,
! *(float *)(((char *)(array->vec) + elemsize*i) + xonset));
else usexloc = xloc + xsum, xsum += xinc;
! useyloc = yloc + (yonset >= 0 ? slot_cvttocoord(yfield,
! *(float *)(((char *)(array->vec) + elemsize*i) + yonset)) : 0);
! hit = scalar_doclick((t_word *)((char *)(array->vec) + elemsize*i),
elemtemplate, 0, array, canvas, usexloc, useyloc, xpix, ypix, shift, alt, dbl, doit);
if (hit) return hit;
--- 1880,1887 ----
for (i = 0, xsum = 0; i < array->n; i += incr) {
float usexloc, useyloc;
! if (xonset>=0) usexloc = xloc + slot_cvttocoord(xfield, *(float *)&array->vec[elemsize*i+xonset]);
else usexloc = xloc + xsum, xsum += xinc;
! useyloc = yloc + (yonset>=0 ? slot_cvttocoord(yfield, *(float *)&array->vec[elemsize*i+yonset]):0);
! hit = scalar_doclick((t_word *)&array->vec[elemsize*i],
elemtemplate, 0, array, canvas, usexloc, useyloc, xpix, ypix, shift, alt, dbl, doit);
if (hit) return hit;
***************
*** 1924,1930 ****
for (i = 0; i < array->n; i += incr) {
float pxpix, pypix, pwpix, dx, dy;
! array_getcoordinate(canvas, (char *)(array->vec) + elemsize*i,
! xonset, yonset, wonset, i, xloc, yloc, xinc,
! xfield, yfield, wfield, &pxpix, &pypix, &pwpix);
if (pwpix < 4) pwpix = 4;
dx = pxpix-xpix; if (dx<0) dx=-dx; else if (dx>8) continue;
--- 1918,1923 ----
for (i = 0; i < array->n; i += incr) {
float pxpix, pypix, pwpix, dx, dy;
! array_getcoordinate(canvas, array->vec + elemsize*i, xonset, yonset, wonset, i,
! xloc, yloc, xinc, xfield, yfield, wfield, &pxpix, &pypix, &pwpix);
if (pwpix < 4) pwpix = 4;
dx = pxpix-xpix; if (dx<0) dx=-dx; else if (dx>8) continue;
***************
*** 1946,1951 ****
for (i = 0; i < array->n; i += incr) {
float pxpix, pypix, pwpix, dx, dy, dy2, dy3;
! array_getcoordinate(canvas, (char *)(array->vec) + elemsize*i,
! xonset, yonset, wonset, i, xloc, yloc, xinc, xfield, yfield, wfield, &pxpix, &pypix, &pwpix);
if (pwpix < 4) pwpix = 4;
dx = pxpix-xpix; if (dx<0) dx=-dx;
--- 1939,1944 ----
for (i = 0; i < array->n; i += incr) {
float pxpix, pypix, pwpix, dx, dy, dy2, dy3;
! array_getcoordinate(canvas, &array->vec[elemsize*i], xonset, yonset, wonset, i,
! xloc, yloc, xinc, xfield, yfield, wfield, &pxpix, &pypix, &pwpix);
if (pwpix < 4) pwpix = 4;
dx = pxpix-xpix; if (dx<0) dx=-dx;
***************
*** 1971,1976 ****
if (alt && xpix < pxpix) { /* delete a point */
if (array->n <= 1) return 0;
! memmove((char *)(array->vec) + elemsize*i,
! (char *)(array->vec) + elemsize*(i+1), (array->n-1-i) * elemsize);
array_resize_and_redraw(array, array->n - 1);
return 0;
--- 1964,1969 ----
if (alt && xpix < pxpix) { /* delete a point */
if (array->n <= 1) return 0;
! memmove(&array->vec[elemsize*i],
! &array->vec[elemsize*(i+1)], (array->n-1-i) * elemsize);
array_resize_and_redraw(array, array->n - 1);
return 0;
***************
*** 2047,2051 ****
chunk = ARRAYWRITECHUNKSIZE;
binbuf_addv(b, "si", gensym("#A"), n2);
! for (i = 0; i < chunk; i++) binbuf_addv(b, "f", ((float *)(array->vec))[n2+i]);
binbuf_addv(b, ";");
n2 += chunk;
--- 2040,2044 ----
chunk = ARRAYWRITECHUNKSIZE;
binbuf_addv(b, "si", gensym("#A"), n2);
! for (i = 0; i < chunk; i++) binbuf_addv(b, "f", ((float *)array->vec)[n2+i]);
binbuf_addv(b, ";");
n2 += chunk;
***************
*** 2059,2064 ****
/* those three required by d_array.c */
void garray_usedindsp(t_garray *x) {x->usedindsp = 1;}
! int garray_npoints(t_garray *x) {return garray_getarray(x)->n;} /* get the length */
! char *garray_vec(t_garray *x) {return (char *)(garray_getarray(x)->vec);} /* get the contents */
/* routine that checks if we're just an array of floats and if so returns the goods */
--- 2052,2057 ----
/* those three required by d_array.c */
void garray_usedindsp(t_garray *x) {x->usedindsp = 1;}
! int garray_npoints(t_garray *x) {return garray_getarray(x)->n;} /* get the length */
! char *garray_vec(t_garray *x) {return (char *)garray_getarray(x)->vec;} /* get the contents */
/* routine that checks if we're just an array of floats and if so returns the goods */
***************
*** 2871,2875 ****
if (!nline) break;
array_resize(a, nitems + 1);
! element = (t_word *)(((char *)a->vec) + nitems * elemsize);
canvas_readatoms(x, natoms, vec, p_nextmsg, arraytemplatesym,
element, nline, vec + message);
--- 2864,2868 ----
if (!nline) break;
array_resize(a, nitems + 1);
! element = (t_word *)&a->vec[nitems*elemsize];
canvas_readatoms(x, natoms, vec, p_nextmsg, arraytemplatesym,
element, nline, vec + message);
***************
*** 3097,3101 ****
t_symbol *arraytemplatesym = template->vec[i].arraytemplate;
for (j = 0; j < nitems; j++)
! canvas_writescalar(arraytemplatesym, (t_word *)(((char *)a->vec) + elemsize*j), b, 1);
binbuf_addsemi(b);
} else if (template->vec[i].type == DT_LIST) {
--- 3090,3094 ----
t_symbol *arraytemplatesym = template->vec[i].arraytemplate;
for (j = 0; j < nitems; j++)
! canvas_writescalar(arraytemplatesym, (t_word *)&a->vec[elemsize*j], b, 1);
binbuf_addsemi(b);
} else if (template->vec[i].type == DT_LIST) {
***************
*** 3130,3134 ****
for (j = 0; j < nitems; j++)
canvas_addtemplatesforscalar(arraytemplatesym,
! (t_word *)(((char *)a->vec) + elemsize * j), p_ntemplates, p_templatevec);
} else if (ds->type == DT_LIST)
canvas_addtemplatesforlist(w->w_list->list, p_ntemplates, p_templatevec);
--- 3123,3127 ----
for (j = 0; j < nitems; j++)
canvas_addtemplatesforscalar(arraytemplatesym,
! (t_word *)&a->vec[elemsize*j], p_ntemplates, p_templatevec);
} else if (ds->type == DT_LIST)
canvas_addtemplatesforlist(w->w_list->list, p_ntemplates, p_templatevec);
***************
*** 5064,5068 ****
t_gobj *y;
/* get the coords of the point proper */
! array_getcoordinate(canvas, (char *)(array->vec) + i*elemsize, xonset, yonset, wonset,
i, basex + xloc, basey + yloc, xinc, xslot, yslot, wslot, &xpix, &ypix, &wpix);
if (xpix < x1) x1 = xpix;
--- 5057,5061 ----
t_gobj *y;
/* get the coords of the point proper */
! array_getcoordinate(canvas, &array->vec[i*elemsize], xonset, yonset, wonset,
i, basex + xloc, basey + yloc, xinc, xslot, yslot, wslot, &xpix, &ypix, &wpix);
if (xpix < x1) x1 = xpix;
***************
*** 5073,5080 ****
/* check also the drawing instructions for the scalar */
if (xonset >= 0)
! usexloc = basex + xloc + slot_cvttocoord(xslot,
! *(float *)(((char *)(array->vec) + elemsize*i) + xonset));
else usexloc = basex + xsum, xsum += xinc;
! yval = yonset>=0 ? *(float *)(((char *)(array->vec) + elemsize*i) + yonset) : 0;
useyloc = basey + yloc + slot_cvttocoord(yslot, yval);
canvas_each(y,elemtemplatecanvas) {
--- 5066,5072 ----
/* check also the drawing instructions for the scalar */
if (xonset >= 0)
! usexloc = basex + xloc + slot_cvttocoord(xslot, *(float *)&array->vec[elemsize*i+xonset]);
else usexloc = basex + xsum, xsum += xinc;
! yval = yonset>=0 ? *(float *)&array->vec[elemsize*i+yonset] : 0;
useyloc = basey + yloc + slot_cvttocoord(yslot, yval);
canvas_each(y,elemtemplatecanvas) {
***************
*** 5884,5888 ****
if (indx < 0) indx = 0;
if (indx >= nitems) indx = nitems-1;
! gpointer_setarray(&x->gp, array, (t_word *)((char *)(array->vec) + indx * elemsize));
outlet_pointer(x->o.ob_outlet, &x->gp);
}
--- 5876,5880 ----
if (indx < 0) indx = 0;
if (indx >= nitems) indx = nitems-1;
! gpointer_setarray(&x->gp, array, (t_word *)&array->vec[indx*elemsize]);
outlet_pointer(x->o.ob_outlet, &x->gp);
}
***************
*** 6005,6009 ****
array->n = newsize;
if (newsize > nitems) {
! char *newelem = ((char *)array->vec) + nitems * elemsize;
int nnew = newsize - nitems;
while (nnew--) {
--- 5997,6001 ----
array->n = newsize;
if (newsize > nitems) {
! char *newelem = &array->vec[nitems*elemsize];
int nnew = newsize - nitems;
while (nnew--) {
More information about the Pd-cvs
mailing list