Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4883
Modified Files:
Tag: devel_0_39
desire.c
Log Message:
fixed bad bug in pd_scanargs.
removed most unused variables.
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -C2 -d -r1.1.2.21 -r1.1.2.22
*** desire.c 19 Sep 2005 02:56:07 -0000 1.1.2.21
--- desire.c 20 Sep 2005 09:34:59 -0000 1.1.2.22
***************
*** 1021,1025 ****
{
t_gobj *y;
- t_symbol *s = gensym("loadbang");
for (y = x->gl_list; y; y = y->g_next)
if (pd_class(&y->g_pd) == canvas_class)
--- 1021,1024 ----
***************
*** 1853,1857 ****
{
t_undo_cut *buf;
- t_gobj *y;
t_linetraverser t;
t_outconnect *oc;
--- 1852,1855 ----
***************
*** 3538,3542 ****
static void canvas_dopaste(t_canvas *x, t_binbuf *b)
{
! t_gobj *newgobj, *last, *g2;
int dspstate = canvas_suspend_dsp(), nbox, count;
--- 3536,3540 ----
static void canvas_dopaste(t_canvas *x, t_binbuf *b)
{
! t_gobj *g2;
int dspstate = canvas_suspend_dsp(), nbox, count;
***************
*** 3672,3676 ****
static void canvas_tidy(t_canvas *x)
{
! t_gobj *y, *y2, *y3;
int ax1, ay1, ax2, ay2, bx1, by1, bx2, by2;
int histogram[NHIST], *ip, i, besthist, bestdist;
--- 3670,3674 ----
static void canvas_tidy(t_canvas *x)
{
! t_gobj *y, *y2;
int ax1, ay1, ax2, ay2, bx1, by1, bx2, by2;
int histogram[NHIST], *ip, i, besthist, bestdist;
***************
*** 3904,3908 ****
t_array *x = (t_array *)getbytes(sizeof (*x));
t_template *template;
- t_gpointer *gp;
template = template_findbyname(templatesym);
x->a_templatesym = templatesym;
--- 3902,3905 ----
***************
*** 3925,3929 ****
{
int elemsize, oldn;
- t_gpointer *gp;
t_template *template = template_findbyname(x->a_templatesym);
if (n < 1)
--- 3922,3925 ----
***************
*** 4029,4038 ****
int saveit)
{
- int i, zz;
t_garray *x;
- t_pd *x2;
- t_template *template;
- char *str;
- t_gpointer gp;
if (!template_findbyname(templatesym))
return (0);
--- 4025,4029 ----
***************
*** 4053,4057 ****
t_array *garray_getarray(t_garray *x)
{
! int nwords, zonset, ztype;
t_symbol *zarraytype;
t_scalar *sc = x->x_scalar;
--- 4044,4048 ----
t_array *garray_getarray(t_garray *x)
{
! int zonset, ztype;
t_symbol *zarraytype;
t_scalar *sc = x->x_scalar;
***************
*** 4132,4136 ****
t_floatarg fsize, t_floatarg fflags)
{
! int n = fsize, i, zz, nwords, zonset, ztype, saveit;
t_symbol *zarraytype;
t_garray *x;
--- 4123,4127 ----
t_floatarg fsize, t_floatarg fflags)
{
! int n = fsize, zonset, ztype, saveit;
t_symbol *zarraytype;
t_garray *x;
***************
*** 4138,4144 ****
t_template *template, *ztemplate;
t_symbol *templatesym;
- char *str;
int flags = fflags;
- t_gpointer gp;
int filestyle = ((flags & 6) >> 1);
int style = (filestyle == 0 ? PLOTSTYLE_POLY :
--- 4129,4133 ----
***************
*** 4256,4261 ****
{
int size;
- int styleonset, styletype;
- t_symbol *stylearraytype;
t_symbol *argname = sharptodollar(name);
t_array *a = garray_getarray(x);
--- 4245,4248 ----
***************
*** 4311,4318 ****
void garray_arrayviewlist_new(t_garray *x)
{
! int i, xonset=0, yonset=0, type=0, elemsize=0;
float yval;
char cmdbuf[200];
- t_symbol *arraytype;
t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
--- 4298,4304 ----
void garray_arrayviewlist_new(t_garray *x)
{
! int i, yonset=0, elemsize=0;
float yval;
char cmdbuf[200];
t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
***************
*** 4343,4350 ****
t_float page)
{
! int i, xonset=0, yonset=0, type=0, elemsize=0;
float yval;
- char cmdbuf[200];
- t_symbol *arraytype;
t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
--- 4329,4334 ----
t_float page)
{
! int i, yonset=0, elemsize=0;
float yval;
t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
***************
*** 4790,4794 ****
for (i = 0; i < array->a_n; i += incr)
{
! float pxpix, pypix, pwpix, dx, dy;
array_getcoordinate(glist, (char *)(array->a_vec) +
i * elemsize,
--- 4774,4778 ----
for (i = 0; i < array->a_n; i += incr)
{
! float pxpix, pypix, pwpix;
array_getcoordinate(glist, (char *)(array->a_vec) +
i * elemsize,
***************
*** 4830,4835 ****
static void garray_select(t_gobj *z, t_glist *glist, int state)
{
! t_garray *x = (t_garray *)z;
! /* fill in later */
}
--- 4814,4819 ----
static void garray_select(t_gobj *z, t_glist *glist, int state)
{
! /* t_garray *x = (t_garray *)z;
! fill in later */
}
***************
*** 4984,4988 ****
int garray_getfloatarray(t_garray *x, int *size, t_float **vec)
{
! int yonset, type, elemsize;
t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
if (!a)
--- 4968,4972 ----
int garray_getfloatarray(t_garray *x, int *size, t_float **vec)
{
! int yonset, elemsize;
t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
if (!a)
***************
*** 5105,5109 ****
static void garray_normalize(t_garray *x, t_float f)
{
! int type, npoints, i;
double maxv, renormer;
int yonset, elemsize;
--- 5089,5093 ----
static void garray_normalize(t_garray *x, t_float f)
{
! int i;
double maxv, renormer;
int yonset, elemsize;
***************
*** 5299,5303 ****
{
t_array *array = garray_getarray(x);
- t_glist *gl = x->x_glist;
int n = (f < 1 ? 1 : f);
garray_fittograph(x, n, template_getfloat(
--- 5283,5286 ----
***************
*** 5478,5482 ****
void glist_clear(t_glist *x)
{
! t_gobj *y, *y2;
int dspstate = 0, suspended = 0;
t_symbol *dspsym = gensym("dsp");
--- 5461,5465 ----
void glist_clear(t_glist *x)
{
! t_gobj *y;
int dspstate = 0, suspended = 0;
t_symbol *dspsym = gensym("dsp");
***************
*** 5499,5503 ****
void glist_retext(t_glist *glist, t_text *y)
{
- t_canvas *c = glist_getcanvas(glist);
/* check that we have built rtexts yet. LATER need a better test. */
if (glist->gl_editor && glist->gl_editor->e_rtext)
--- 5482,5485 ----
***************
*** 6073,6077 ****
float f;
t_gobj *g;
- t_symbol *arrayname;
/* draw a rectangle around the graph */
sys_vgui(".x%lx.c create line\
--- 6055,6058 ----
***************
*** 6585,6589 ****
if (template->t_vec[i].ds_type == DT_ARRAY)
{
- int j;
t_array *a = w[i].w_array;
int elemsize = a->a_elemsize, nitems = 0;
--- 6566,6569 ----
***************
*** 6625,6629 ****
int *p_nextmsg, int selectit)
{
! int message, i, j, nline;
t_template *template;
t_symbol *templatesym;
--- 6605,6609 ----
int *p_nextmsg, int selectit)
{
! int message, nline;
t_template *template;
t_symbol *templatesym;
***************
*** 6680,6692 ****
void glist_readfrombinbuf(t_glist *x, t_binbuf *b, char *filename, int selectem)
{
! t_canvas *canvas = glist_getcanvas(x);
! int cr = 0, natoms, nline, message, nextmsg = 0, i, j, nitems;
t_atom *vec;
- t_gobj *gobj;
-
natoms = binbuf_getnatom(b);
vec = binbuf_getvec(b);
-
-
/* check for file type */
nline = canvas_scanbinbuf(natoms, vec, &message, &nextmsg);
--- 6660,6667 ----
void glist_readfrombinbuf(t_glist *x, t_binbuf *b, char *filename, int selectem)
{
! int natoms, nline, message, nextmsg = 0;
t_atom *vec;
natoms = binbuf_getnatom(b);
vec = binbuf_getvec(b);
/* check for file type */
nline = canvas_scanbinbuf(natoms, vec, &message, &nextmsg);
***************
*** 6765,6770 ****
t_canvas *canvas = glist_getcanvas(x);
int wasvis = glist_isvisible(canvas);
! int cr = 0, natoms, nline, message, nextmsg = 0, i, j;
! t_atom *vec;
if (!strcmp(format->s_name, "cr"))
--- 6740,6744 ----
t_canvas *canvas = glist_getcanvas(x);
int wasvis = glist_isvisible(canvas);
! int cr = 0;
if (!strcmp(format->s_name, "cr"))
***************
*** 6881,6885 ****
int amarrayelement)
{
- t_dataslot *ds;
t_template *template = template_findbyname(templatesym);
t_atom *a = (t_atom *)t_getbytes(0);
--- 6855,6858 ----
***************
*** 7053,7062 ****
static void glist_write(t_glist *x, t_symbol *filename, t_symbol *format)
{
! int cr = 0, i;
t_binbuf *b;
char buf[MAXPDSTRING];
- t_symbol **templatevec = getbytes(0);
- int ntemplates = 0;
- t_gobj *y;
t_canvas *canvas = glist_getcanvas(x);
canvas_makefilename(canvas, filename->s_name, buf, MAXPDSTRING);
--- 7026,7032 ----
static void glist_write(t_glist *x, t_symbol *filename, t_symbol *format)
{
! int cr = 0;
t_binbuf *b;
char buf[MAXPDSTRING];
t_canvas *canvas = glist_getcanvas(x);
canvas_makefilename(canvas, filename->s_name, buf, MAXPDSTRING);
***************
*** 7166,7170 ****
t_symbol **templatevec = getbytes(0);
int i, ntemplates = 0;
- t_gobj *y;
canvas_collecttemplatesfor(x, &ntemplates, &templatevec, wholething);
for (i = 0; i < ntemplates; i++)
--- 7136,7139 ----
***************
*** 7437,7441 ****
int switched)
{
! t_signal *insig, *outsig;
x->x_updown.downsample = downsample;
x->x_updown.upsample = upsample;
--- 7406,7410 ----
int switched)
{
! t_signal *insig;
x->x_updown.downsample = downsample;
x->x_updown.upsample = upsample;
***************
*** 7741,7745 ****
if (reblock)
{
! t_signal *insig, *outsig;
int parentvecsize, bufsize, oldbufsize;
int re_parentvecsize; /* IOhannes */
--- 7710,7714 ----
if (reblock)
{
! t_signal *outsig;
int parentvecsize, bufsize, oldbufsize;
int re_parentvecsize; /* IOhannes */
***************
*** 8223,8228 ****
t_scalar *x = (t_scalar *)z;
t_binbuf *b2 = binbuf_new();
- t_atom a, *argv;
- int i, argc;
canvas_writescalar(x->sc_template, x->sc_vec, b2, 0);
binbuf_addv(b, "ss", &s__X, gensym("scalar"));
--- 8192,8195 ----
***************
*** 8265,8270 ****
static void scalar_free(t_scalar *x)
{
- int i;
- t_dataslot *datatypes, *dt;
t_symbol *templatesym = x->sc_template;
t_template *template = template_findbyname(templatesym);
--- 8232,8235 ----
***************
*** 8409,8413 ****
int *p_type, t_symbol **p_arraytype)
{
- t_template *t;
int i, n;
if (!x)
--- 8374,8377 ----
***************
*** 8531,8535 ****
int *conformaction, t_word *wfrom, t_word *wto)
{
! int nfrom = tfrom->t_n, nto = tto->t_n, i;
for (i = 0; i < nto; i++)
{
--- 8495,8499 ----
int *conformaction, t_word *wfrom, t_word *wto)
{
! int nto = tto->t_n, i;
for (i = 0; i < nto; i++)
{
***************
*** 8549,8555 ****
int *conformaction, t_glist *glist, t_scalar *scfrom)
{
t_scalar *x;
t_gpointer gp;
- int nto = tto->t_n, nfrom = tfrom->t_n, i;
t_template *scalartemplate;
/* post("conform scalar"); */
--- 8513,8519 ----
int *conformaction, t_glist *glist, t_scalar *scfrom)
{
+ int i;
t_scalar *x;
t_gpointer gp;
t_template *scalartemplate;
/* post("conform scalar"); */
***************
*** 8859,8863 ****
t_template *t = template_findbyname(sym);
int i;
- t_symbol *sx = gensym("x");
x->x_owner = canvas_getcurrent();
x->x_next = 0;
--- 8823,8826 ----
***************
*** 9032,9036 ****
{
char *s1, *s2, *s3, strbuf[MAXPDSTRING];
- int i;
fd->fd_type = A_FLOAT;
fd->fd_var = 1;
--- 8995,8998 ----
***************
*** 9135,9139 ****
t_float fielddesc_cvttocoord(t_fielddesc *f, float val)
{
! float coord, pix, extreme, div;
if (f->fd_v2 == f->fd_v1)
return (val);
--- 9097,9101 ----
t_float fielddesc_cvttocoord(t_fielddesc *f, float val)
{
! float coord, extreme, div;
if (f->fd_v2 == f->fd_v1)
return (val);
***************
*** 9401,9405 ****
if (n > 1)
{
! int flags = x->x_flags, closed = (flags & CLOSED);
float width = fielddesc_getfloat(&x->x_width, template, data, 1);
char outline[20], fill[20];
--- 9363,9367 ----
if (n > 1)
{
! int flags = x->x_flags;
float width = fielddesc_getfloat(&x->x_width, template, data, 1);
char outline[20], fill[20];
***************
*** 9736,9740 ****
int *xonsetp, int *yonsetp, int *wonsetp)
{
! int arrayonset, elemsize, yonset, wonset, xonset, type;
t_template *elemtemplate;
t_symbol *dummy, *varname;
--- 9698,9702 ----
int *xonsetp, int *yonsetp, int *wonsetp)
{
! int elemsize, yonset, wonset, xonset, type;
t_template *elemtemplate;
t_symbol *dummy, *varname;
***************
*** 9926,9930 ****
for (xsum = basex + xloc, i = 0; i < nelem; i++)
{
! float yval, xpix, ypix, nextxloc;
int ixpix, inextx;
--- 9888,9892 ----
for (xsum = basex + xloc, i = 0; i < nelem; i++)
{
! float yval;
int ixpix, inextx;
***************
*** 10744,10751 ****
static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv)
{
- t_scalar *sc;
- t_symbol *templatesym;
- int n;
- t_typedout *to;
t_glist *glist;
t_pd *canvas;
--- 10706,10709 ----
***************
*** 10805,10814 ****
static void ptrobj_rewind(t_ptrobj *x)
{
- t_scalar *sc;
- t_symbol *templatesym;
- int n;
- t_typedout *to;
t_glist *glist;
- t_pd *canvas;
t_gstub *gs;
if (!gpointer_check(&x->x_gp, 1))
--- 10763,10767 ----
***************
*** 11204,11208 ****
static void getsize_pointer(t_getsize *x, t_gpointer *gp)
{
! int nitems, onset, type;
t_symbol *templatesym = x->x_templatesym, *fieldsym = x->x_fieldsym,
*elemtemplatesym;
--- 11157,11161 ----
static void getsize_pointer(t_getsize *x, t_gpointer *gp)
{
! int onset, type;
t_symbol *templatesym = x->x_templatesym, *fieldsym = x->x_fieldsym,
*elemtemplatesym;
***************
*** 11210,11214 ****
t_word *w;
t_array *array;
- int elemsize;
t_gstub *gs = gp->gp_stub;
if (!template)
--- 11163,11166 ----
***************
*** 11285,11289 ****
t_template *elemtemplate;
t_word *w;
- t_atom at;
t_array *array;
int elemsize;
--- 11237,11240 ----
***************
*** 11368,11373 ****
{
char *newelem = ((char *)array->a_vec) + nitems * elemsize;
! int i = 0, nnew = newsize - nitems;
!
while (nnew--)
{
--- 11319,11323 ----
{
char *newelem = ((char *)array->a_vec) + nitems * elemsize;
! int nnew = newsize - nitems;
while (nnew--)
{
***************
*** 11561,11566 ****
t_template *template = template_findbyname(templatesym);
t_gstub *gs = gp->gp_stub;
- t_word *vec;
- t_getvariable *vp;
int onset, type;
t_word *w;
--- 11511,11514 ----
***************
*** 11636,11640 ****
t_object obj; \
t_glist *glist; /* why? */ \
- t_iemfunptr draw; /* this will die soon */ \
int h,w; \
int ldx,ldy; \
--- 11584,11587 ----
***************
*** 12499,12507 ****
}
! static int pd_scanargs(int argc, t_atom *argv, char *fmt, ...) {
int i=0;
int optional=0;
- va_list val;
- va_start(val,fmt);
for (i=0; i<argc; i++) {
switch (fmt[i]) {
--- 12446,12453 ----
}
! #define NEXT p=va_arg(val,void*); fprintf(stderr,"p=%p\n",p);
! static int pd_scanargs(int argc, t_atom *argv, char *fmt, va_list val) {
int i=0;
int optional=0;
for (i=0; i<argc; i++) {
switch (fmt[i]) {
***************
*** 12519,12542 ****
break1:
for (i=0; i<argc; i++) {
switch (fmt[i]) {
case '*': case ';': goto break2;
case '?': case 'F': case 'S': break; /* skip */
! case 'd': *(va_arg(val,double*)) = atom_getfloatarg(i,argc,argv); break;
! case 'f': *(va_arg(val,float*)) = atom_getfloatarg(i,argc,argv); break;
! case 'i': *(va_arg(val, int*)) = atom_getintarg(i,argc,argv); break;
! case 'b': *(va_arg(val, int*)) = !!atom_getintarg(i,argc,argv); break; /* 0 or 1 */
case 'c': { /* colour, from IEM format to RGB 8:8:8 format */
! *(va_arg(val, int*)) = convert_color(atom_getintarg(i,argc,argv));
} break;
! case 's': *(va_arg(val,t_symbol**))=atom_getsymbolarg(i,argc,argv); break;
case 'a': {
! t_symbol **p = va_arg(val,t_symbol**);
if (IS_A_SYMBOL(argv,i))
! *p = atom_getsymbolarg(i,argc,argv);
else if (IS_A_FLOAT(argv,i)) {
char str[80];
sprintf(str, "%d", (int)atom_getintarg(i,argc,argv));
! *p = gensym(str);
! } else *p = gensym("empty");
} break;
default: post("WARNING: bug using pd_scanargs()"); goto err; /* WHAT? */
--- 12465,12495 ----
break1:
for (i=0; i<argc; i++) {
+ fprintf(stderr,"%d: %d, %p\n", i, argv[i].a_type, argv[i].a_w.w_gpointer);
+ }
+ for (i=0; i<argc; i++) {
+ void *p;
+ char bof[666];
+ atom_string(argv+i,bof,666);
+ fprintf(stderr,"%d: %s\n",i,bof);
switch (fmt[i]) {
case '*': case ';': goto break2;
case '?': case 'F': case 'S': break; /* skip */
! case 'd': NEXT; *(double*)p = atom_getfloatarg(i,argc,argv); break;
! case 'f': NEXT; *(float*)p = atom_getfloatarg(i,argc,argv); break;
! case 'i': NEXT; *(int*)p = atom_getintarg(i,argc,argv); break;
! case 'b': NEXT; *(int*)p = !!atom_getintarg(i,argc,argv); break; /* 0 or 1 */
case 'c': { /* colour, from IEM format to RGB 8:8:8 format */
! NEXT; *(int*)p = convert_color(atom_getintarg(i,argc,argv));
} break;
! case 's': NEXT; *(t_symbol**)p=atom_getsymbolarg(i,argc,argv); break;
case 'a': {
! NEXT;
if (IS_A_SYMBOL(argv,i))
! *(t_symbol**)p = atom_getsymbolarg(i,argc,argv);
else if (IS_A_FLOAT(argv,i)) {
char str[80];
sprintf(str, "%d", (int)atom_getintarg(i,argc,argv));
! *(t_symbol**)p = gensym(str);
! } else *(t_symbol**)p = gensym("empty");
} break;
default: post("WARNING: bug using pd_scanargs()"); goto err; /* WHAT? */
***************
*** 12544,12548 ****
}
break2:
- va_end(val);
return 1;
err:
--- 12497,12500 ----
***************
*** 12560,12565 ****
int i=0;
t_atom a;
- // va_list val;
- // va_start(val,fmt);
for (i=0; ; i++) {
switch (fmt[i]) {
--- 12512,12515 ----
***************
*** 12581,12585 ****
}
break2:
- // va_end(val);
return 1;
err:
--- 12531,12534 ----