[PD-cvs] pd/src desire.c,1.1.2.198,1.1.2.199

Mathieu Bouchard matju at users.sourceforge.net
Thu Nov 23 07:44:58 CET 2006


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16866

Modified Files:
      Tag: devel_0_39
	desire.c 
Log Message:
more c++


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.198
retrieving revision 1.1.2.199
diff -C2 -d -r1.1.2.198 -r1.1.2.199
*** desire.c	23 Nov 2006 05:51:31 -0000	1.1.2.198
--- desire.c	23 Nov 2006 06:44:54 -0000	1.1.2.199
***************
*** 4059,4066 ****
  
  int template_find_field(t_template *x, t_symbol *name, int *p_onset, int *p_type, t_symbol **p_arraytype) {
-     int i, n;
      if (!x) {bug("template_find_field"); return 0;}
!     n = x->n;
!     for (i = 0; i < n; i++) if (x->vec[i].name == name) {
          *p_onset = i*sizeof(t_word);
          *p_type      = x->vec[i].type;
--- 4059,4064 ----
  
  int template_find_field(t_template *x, t_symbol *name, int *p_onset, int *p_type, t_symbol **p_arraytype) {
      if (!x) {bug("template_find_field"); return 0;}
!     for (int i = 0; i<x->n; i++) if (x->vec[i].name == name) {
          *p_onset = i*sizeof(t_word);
          *p_type      = x->vec[i].type;
***************
*** 4104,4115 ****
  arrays or lists.  This is used for reading in "data files". */
  static int template_match(t_template *x1, t_template *x2) {
-     int i;
      if (x1->n < x2->n) return 0;
!     for (i = x2->n; i < x1->n; i++)
          if (x1->vec[i].type == DT_ARRAY ||
              x1->vec[i].type == DT_LIST)
                  return 0;
      if (x2->n > x1->n) post("add elements...");
!     for (i = 0; i < x2->n; i++) if (!dataslot_matches(&x1->vec[i], &x2->vec[i], 1)) return 0;
      return 1;
  }
--- 4102,4112 ----
  arrays or lists.  This is used for reading in "data files". */
  static int template_match(t_template *x1, t_template *x2) {
      if (x1->n < x2->n) return 0;
!     for (int i=x2->n; i < x1->n; i++)
          if (x1->vec[i].type == DT_ARRAY ||
              x1->vec[i].type == DT_LIST)
                  return 0;
      if (x2->n > x1->n) post("add elements...");
!     for (int i=0; i < x2->n; i++) if (!dataslot_matches(&x1->vec[i], &x2->vec[i], 1)) return 0;
      return 1;
  }
***************
*** 4127,4132 ****
  static void template_conformwords(t_template *tfrom, t_template *tto,
  int *conformaction, t_word *wfrom, t_word *wto) {
!     int nto = tto->n, i;
!     for (i = 0; i < nto; i++) {
          if (conformaction[i] >= 0) {
              /* we swap the two, in case it's an array or list, so that
--- 4124,4128 ----
  static void template_conformwords(t_template *tfrom, t_template *tto,
  int *conformaction, t_word *wfrom, t_word *wto) {
!     for (int i=0; i<tto->n; i++) {
          if (conformaction[i] >= 0) {
              /* we swap the two, in case it's an array or list, so that
***************
*** 4142,4146 ****
  static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto,
  int *conformaction, t_canvas *canvas, t_scalar *scfrom) {
-     int i;
      t_scalar *x;
      t_gpointer gp;
--- 4138,4141 ----
***************
*** 4163,4168 ****
              x->sc_gobj.g_next = scfrom->sc_gobj.g_next;
          } else {
!             t_gobj *y, *y2;
!             for (y = canvas->list; (y2 = y->g_next); y = y2) if (y2 == (t_gobj *)scfrom) {
                  x->sc_gobj.g_next = y2->g_next;
                  y->g_next = (t_gobj *)x;
--- 4158,4162 ----
              x->sc_gobj.g_next = scfrom->sc_gobj.g_next;
          } else {
!             for (t_gobj *y2, *y = canvas->list; (y2 = y->g_next); y = y2) if (y2 == (t_gobj *)scfrom) {
                  x->sc_gobj.g_next = y2->g_next;
                  y->g_next = (t_gobj *)x;
***************
*** 4179,4183 ****
      }
      /* convert all array elements and sublists */
!     for (i = 0; i < scalartemplate->n; i++) {
          t_dataslot *ds = scalartemplate->vec + i;
          if (ds->type == DT_LIST) template_conformcanvas(tfrom, tto, conformaction, x->sc_vec[i].w_list);
--- 4173,4177 ----
      }
      /* convert all array elements and sublists */
!     for (int i=0; i < scalartemplate->n; i++) {
          t_dataslot *ds = scalartemplate->vec + i;
          if (ds->type == DT_LIST) template_conformcanvas(tfrom, tto, conformaction, x->sc_vec[i].w_list);
***************
*** 4189,4193 ****
  /* conform an array, recursively conforming sublists and arrays  */
  static void template_conformarray(t_template *tfrom, t_template *tto, int *conformaction, t_array *a) {
-     int i, j;
      t_template *scalartemplate = 0;
      if (a->templatesym == tfrom->sym) {
--- 4183,4186 ----
***************
*** 4198,4202 ****
          char *oldarray = a->vec;
          if (a->elemsize != oldelemsize) bug("template_conformarray");
!         for (i = 0; i < a->n; i++) {
              t_word *wp = (t_word *)(newarray + newelemsize*i);
              word_init(wp, tto, &a->gp);
--- 4191,4195 ----
          char *oldarray = a->vec;
          if (a->elemsize != oldelemsize) bug("template_conformarray");
!         for (int i=0; i<a->n; i++) {
              t_word *wp = (t_word *)(newarray + newelemsize*i);
              word_init(wp, tto, &a->gp);
***************
*** 4209,4215 ****
      } else scalartemplate = template_findbyname(a->templatesym);
      /* convert all arrays and sublist fields in each element of the array */
!     for (i = 0; i < a->n; i++) {
          t_word *wp = (t_word *)(a->vec + sizeof(t_word) * a->n * i);
!         for (j = 0; j < scalartemplate->n; j++) {
              t_dataslot *ds = scalartemplate->vec + j;
              if (ds->type == DT_LIST)  template_conformcanvas(tfrom, tto, conformaction, wp[j].w_list);
--- 4202,4208 ----
      } else scalartemplate = template_findbyname(a->templatesym);
      /* convert all arrays and sublist fields in each element of the array */
!     for (int i=0; i<a->n; i++) {
          t_word *wp = (t_word *)(a->vec + sizeof(t_word) * a->n * i);
!         for (int j=0; j < scalartemplate->n; j++) {
              t_dataslot *ds = scalartemplate->vec + j;
              if (ds->type == DT_LIST)  template_conformcanvas(tfrom, tto, conformaction, wp[j].w_list);
***************
*** 4237,4248 ****
  /* globally conform all scalars from one template to another */
  void template_conform(t_template *tfrom, t_template *tto) {
!     int nto = tto->n, nfrom = tfrom->n, i, j, doit = 0;
      int *conformaction = (int *)getbytes(sizeof(int) * nto);
      int *conformedfrom = (int *)getbytes(sizeof(int) * nfrom);
!     for (i=0; i<  nto; i++) conformaction[i] = -1;
!     for (i=0; i<nfrom; i++) conformedfrom[i] = 0;
!     for (i = 0; i < nto; i++) {
          t_dataslot *dataslot = &tto->vec[i];
!         for (j = 0; j < nfrom; j++) {
              t_dataslot *dataslot2 = &tfrom->vec[j];
              if (dataslot_matches(dataslot, dataslot2, 1)) {
--- 4230,4241 ----
  /* globally conform all scalars from one template to another */
  void template_conform(t_template *tfrom, t_template *tto) {
!     int nto = tto->n, nfrom = tfrom->n, doit = 0;
      int *conformaction = (int *)getbytes(sizeof(int) * nto);
      int *conformedfrom = (int *)getbytes(sizeof(int) * nfrom);
!     for (int i=0; i<  nto; i++) conformaction[i] = -1;
!     for (int i=0; i<nfrom; i++) conformedfrom[i] = 0;
!     for (int i=0; i < nto; i++) {
          t_dataslot *dataslot = &tto->vec[i];
!         for (int j=0; j<nfrom; j++) {
              t_dataslot *dataslot2 = &tfrom->vec[j];
              if (dataslot_matches(dataslot, dataslot2, 1)) {
***************
*** 4252,4258 ****
          }
      }
!     for (i = 0; i < nto; i++) if (conformaction[i] < 0) {
          t_dataslot *dataslot = &tto->vec[i];
!         for (j = 0; j < nfrom; j++)
            if (!conformedfrom[j] && dataslot_matches(dataslot, &tfrom->vec[j], 0)) {
              conformaction[i] = j;
--- 4245,4251 ----
          }
      }
!     for (int i=0; i<nto; i++) if (conformaction[i] < 0) {
          t_dataslot *dataslot = &tto->vec[i];
!         for (int j=0; j<nfrom; j++)
            if (!conformedfrom[j] && dataslot_matches(dataslot, &tfrom->vec[j], 0)) {
              conformaction[i] = j;
***************
*** 4261,4268 ****
      }
      if (nto != nfrom) doit = 1;
!     else for (i = 0; i < nto; i++) if (conformaction[i] != i) doit = 1;
      if (doit) {
          post("conforming template '%s' to new structure", tfrom->sym->s_name);
!         for (i = 0; i < nto; i++) post("... %d", conformaction[i]);
          canvases_each(gl) template_conformcanvas(tfrom, tto, conformaction, gl);
      }
--- 4254,4261 ----
      }
      if (nto != nfrom) doit = 1;
!     else for (int i=0; i<nto; i++) if (conformaction[i] != i) doit = 1;
      if (doit) {
          post("conforming template '%s' to new structure", tfrom->sym->s_name);
!         for (int i=0; i<nto; i++) post("... %d", conformaction[i]);
          canvases_each(gl) template_conformcanvas(tfrom, tto, conformaction, gl);
      }
***************
*** 4347,4351 ****
      t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class);
      t_template *t = template_findbyname(sym);
-     int i;
      x->owner = canvas_getcurrent();
      x->x_next = 0;
--- 4340,4343 ----
***************
*** 4353,4357 ****
      x->argc = argc;
      x->argv = (t_atom *)getbytes(argc * sizeof(t_atom));
!     for (i = 0; i < argc; i++) x->argv[i] = argv[i];
  
      /* already have a template by this name? */
--- 4345,4349 ----
      x->argc = argc;
      x->argv = (t_atom *)getbytes(argc * sizeof(t_atom));
!     for (int i=0; i<argc; i++) x->argv[i] = argv[i];
  
      /* already have a template by this name? */
***************
*** 4639,4643 ****
  float basex, float basey, int *xp1, int *yp1, int *xp2, int *yp2) {
      t_curve *x = (t_curve *)z;
!     int i, n = x->npoints;
      t_slot *f = x->vec;
      int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff;
--- 4631,4635 ----
  float basex, float basey, int *xp1, int *yp1, int *xp2, int *yp2) {
      t_curve *x = (t_curve *)z;
!     int n = x->npoints;
      t_slot *f = x->vec;
      int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff;
***************
*** 4647,4651 ****
          return;
      }
!     for (i = 0, f = x->vec; i < n; i++, f += 2) {
          int xloc = canvas_xtopixels(canvas, basex + slot_getcoord(f  , t, data, 0));
          int yloc = canvas_ytopixels(canvas, basey + slot_getcoord(f+1, t, data, 0));
--- 4639,4643 ----
          return;
      }
!     for (int i=0; i<n; i++, f += 2) {
          int xloc = canvas_xtopixels(canvas, basex + slot_getcoord(f  , t, data, 0));
          int yloc = canvas_ytopixels(canvas, basey + slot_getcoord(f+1, t, data, 0));
***************
*** 4669,4673 ****
  float basex, float basey, int vis) {
      t_curve *x = (t_curve *)z;
!     int i, n = x->npoints;
      t_slot *f = x->vec;
      if (!slot_getfloat(&x->vis, t, data, 0)) return;
--- 4661,4665 ----
  float basex, float basey, int vis) {
      t_curve *x = (t_curve *)z;
!     int n = x->npoints;
      t_slot *f = x->vec;
      if (!slot_getfloat(&x->vis, t, data, 0)) return;
***************
*** 4681,4685 ****
  	       "error" printout won't be interspersed with it.  Only show up to 100 points so we don't
                 have to allocate memory here. */
!             for (i = 0, f = x->vec; i < n; i++, f += 2) {
                  pix[2*i  ] = canvas_xtopixels(canvas, basex + slot_getcoord(f, t, data, 1));
                  pix[2*i+1] = canvas_ytopixels(canvas, basey + slot_getcoord(f+1, t, data, 1));
--- 4673,4677 ----
  	       "error" printout won't be interspersed with it.  Only show up to 100 points so we don't
                 have to allocate memory here. */
!             for (int i=0; i<n; i++, f += 2) {
                  pix[2*i  ] = canvas_xtopixels(canvas, basex + slot_getcoord(f, t, data, 1));
                  pix[2*i+1] = canvas_ytopixels(canvas, basey + slot_getcoord(f+1, t, data, 1));
***************
*** 4690,4694 ****
                  //sys_vgui(".x%lx.c create polygon\\\n", (long)canvas_getcanvas(canvas));
              } else sys_vgui(".x%lx.c create line\\\n", (long)canvas_getcanvas(canvas));
!             for (i = 0; i < n; i++) sys_vgui("%d %d\\\n", pix[2*i], pix[2*i+1]);
              sys_vgui("-width %f\\\n", MAX(slot_getfloat(&x->width, t, data, 1),1.0f));
              if (flags & CLOSED) sys_vgui("-fill %s -outline %s\\\n", fill, outline);
--- 4682,4686 ----
                  //sys_vgui(".x%lx.c create polygon\\\n", (long)canvas_getcanvas(canvas));
              } else sys_vgui(".x%lx.c create line\\\n", (long)canvas_getcanvas(canvas));
!             for (int i=0; i<n; i++) sys_vgui("%d %d\\\n", pix[2*i], pix[2*i+1]);
              sys_vgui("-width %f\\\n", MAX(slot_getfloat(&x->width, t, data, 1),1.0f));
              if (flags & CLOSED) sys_vgui("-fill %s -outline %s\\\n", fill, outline);
***************
*** 4734,4743 ****
  t_array *ap, float basex, float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit) {
      t_curve *x = (t_curve *)z;
!     int i, n = x->npoints;
      int bestn = -1;
      int besterror = 0x7fffffff;
!     t_slot *f;
      if (!slot_getfloat(&x->vis, t, data, 0)) return 0;
!     for (i = 0, f = x->vec; i < n; i++, f += 2) {
          int xval = (int)slot_getcoord(f  , t, data, 0), xloc = canvas_xtopixels(canvas, basex + xval);
          int yval = (int)slot_getcoord(f+1, t, data, 0), yloc = canvas_ytopixels(canvas, basey + yval);
--- 4726,4735 ----
  t_array *ap, float basex, float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit) {
      t_curve *x = (t_curve *)z;
!     int n = x->npoints;
      int bestn = -1;
      int besterror = 0x7fffffff;
!     t_slot *f = x->vec;
      if (!slot_getfloat(&x->vis, t, data, 0)) return 0;
!     for (int i=0; i<n; i++, f += 2) {
          int xval = (int)slot_getcoord(f  , t, data, 0), xloc = canvas_xtopixels(canvas, basex + xval);
          int yval = (int)slot_getcoord(f+1, t, data, 0), yloc = canvas_ytopixels(canvas, basey + yval);
***************
*** 4900,4907 ****
      t_template *elemtemplate;
      t_symbol *elemtemplatesym;
!     float linewidth, xloc, xinc, yloc, style, xsum, yval, vis, scalarvis;
      t_array *array;
      int x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff;
!     int i, incr;
      float xpix, ypix, wpix;
      t_slot *xslot, *yslot, *wslot;
--- 4892,4899 ----
      t_template *elemtemplate;
      t_symbol *elemtemplatesym;
!     float linewidth, xloc, xinc, yloc, style, xsum=0, yval, vis, scalarvis;
      t_array *array;
      int x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff;
!     int incr;
      float xpix, ypix, wpix;
      t_slot *xslot, *yslot, *wslot;
***************
*** 4917,4921 ****
      /* if it has more than 2000 points, just check 1000 of them. */
      incr = (array->n <= 2000 ? 1 : array->n / 1000);
!     for (i = 0, xsum = 0; i < array->n; i += incr) {
  	float usexloc, useyloc;
  	/* get the coords of the point proper */
--- 4909,4913 ----
      /* if it has more than 2000 points, just check 1000 of them. */
      incr = (array->n <= 2000 ? 1 : array->n / 1000);
!     for (int i=0; i<array->n; i += incr) {
  	float usexloc, useyloc;
  	/* get the coords of the point proper */
***************
*** 5030,5034 ****
                  }
                  lastpixel = -1;
!                 for (i = nelem-1; i >= 0; i--) {
                      float usexloc;
                      if (xonset >= 0) usexloc = xloc + *(float *)(elem+elemsize*i+xonset);
--- 5022,5026 ----
                  }
                  lastpixel = -1;
!                 for (int i=nelem-1; i>=0; i--) {
                      float usexloc;
                      if (xonset >= 0) usexloc = xloc + *(float *)(elem+elemsize*i+xonset);
***************
*** 5090,5094 ****
          if (scalarvis != 0) {
  	    int xsum = (int)xloc;
!             for (i = 0; i < nelem; i++) {
                  float usexloc, useyloc;
                  if (xonset >= 0)
--- 5082,5086 ----
          if (scalarvis != 0) {
  	    int xsum = (int)xloc;
!             for (int i=0; i<nelem; i++) {
                  float usexloc, useyloc;
                  if (xonset >= 0)
***************
*** 5106,5110 ****
  	/* un-draw the individual points */
          if (scalarvis != 0) {
!             for (int i = 0; i < nelem; i++) {
                  canvas_each(y,elemtemplatecanvas) {
                      t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
--- 5098,5102 ----
  	/* un-draw the individual points */
          if (scalarvis != 0) {
!             for (int i=0; i<nelem; i++) {
                  canvas_each(y,elemtemplatecanvas) {
                      t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
***************
*** 5420,5428 ****
      t_ptrobj *x = (t_ptrobj *)pd_new(ptrobj_class);
      t_typedout *to;
-     int n;
      gpointer_init(&x->gp);
      x->typedout = to = (t_typedout *)getbytes(argc * sizeof (*to));
!     x->ntypedout = n = argc;
!     for (; n--; to++) {
          to->outlet = outlet_new(x,&s_pointer);
          to->type = canvas_makebindsym(atom_getsymbol(argv++));
--- 5412,5419 ----
      t_ptrobj *x = (t_ptrobj *)pd_new(ptrobj_class);
      t_typedout *to;
      gpointer_init(&x->gp);
      x->typedout = to = (t_typedout *)getbytes(argc * sizeof (*to));
!     x->ntypedout = argc;
!     for (int n=argc; n--; to++) {
          to->outlet = outlet_new(x,&s_pointer);
          to->type = canvas_makebindsym(atom_getsymbol(argv++));
***************
*** 5457,5465 ****
      while (gobj && (pd_class(&gobj->g_pd) != scalar_class || wantselected)) gobj = gobj->g_next;
      if (gobj) {
!         t_typedout *to;
!         int n;
          t_scalar *sc = (t_scalar *)gobj;
          gp->gp_un.gp_scalar = sc;
!         for (n = x->ntypedout, to = x->typedout; n--; to++)
              if (to->type == sc->sc_template) {outlet_pointer(to->outlet, &x->gp); return;}
          outlet_pointer(x->otherout, &x->gp);
--- 5448,5455 ----
      while (gobj && (pd_class(&gobj->g_pd) != scalar_class || wantselected)) gobj = gobj->g_next;
      if (gobj) {
!         t_typedout *to = x->typedout;
          t_scalar *sc = (t_scalar *)gobj;
          gp->gp_un.gp_scalar = sc;
!         for (int n = x->ntypedout; n--; to++)
              if (to->type == sc->sc_template) {outlet_pointer(to->outlet, &x->gp); return;}
          outlet_pointer(x->otherout, &x->gp);
***************
*** 5490,5498 ****
  
  static void ptrobj_bang(t_ptrobj *x) {
!     int n;
!     t_typedout *to;
      if (!gpointer_check(&x->gp, 1)) {pd_error(x, "bang: empty pointer"); return;}
      t_symbol *templatesym = gpointer_gettemplatesym(&x->gp);
!     for (n = x->ntypedout, to = x->typedout; n--; to++)
          if (to->type == templatesym) {outlet_pointer(to->outlet, &x->gp); return;}
      outlet_pointer(x->otherout, &x->gp);
--- 5480,5487 ----
  
  static void ptrobj_bang(t_ptrobj *x) {
!     t_typedout *to = x->typedout;
      if (!gpointer_check(&x->gp, 1)) {pd_error(x, "bang: empty pointer"); return;}
      t_symbol *templatesym = gpointer_gettemplatesym(&x->gp);
!     for (int n = x->ntypedout; n--; to++)
          if (to->type == templatesym) {outlet_pointer(to->outlet, &x->gp); return;}
      outlet_pointer(x->otherout, &x->gp);
***************
*** 5538,5548 ****
  static void *get_new(t_symbol *why, int argc, t_atom *argv) {
      t_get *x = (t_get *)pd_new(get_class);
-     int i;
-     t_getvariable *sp;
      x->templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
      if (argc) argc--, argv++;
!     x->variables = (t_getvariable *)getbytes(argc * sizeof (*x->variables));
      x->nout = argc;
!     for (i = 0, sp = x->variables; i < argc; i++, sp++) {
          sp->sym = atom_getsymbolarg(i, argc, argv);
          sp->outlet = outlet_new(x,0);
--- 5527,5535 ----
  static void *get_new(t_symbol *why, int argc, t_atom *argv) {
      t_get *x = (t_get *)pd_new(get_class);
      x->templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
      if (argc) argc--, argv++;
!     t_getvariable *sp = x->variables = (t_getvariable *)getbytes(argc * sizeof (*x->variables));
      x->nout = argc;
!     for (int i=0; i < argc; i++, sp++) {
          sp->sym = atom_getsymbolarg(i, argc, argv);
          sp->outlet = outlet_new(x,0);
***************
*** 5598,5603 ****
  static void *set_new(t_symbol *why, int argc, t_atom *argv) {
      t_set *x = (t_set *)pd_new(set_class);
-     int i;
-     t_setvariable *sp;
      if (argc && (argv[0].a_type == A_SYMBOL) && !strcmp(argv[0].a_w.w_symbol->s_name, "-symbol")) {
          x->issymbol = 1;
--- 5585,5588 ----
***************
*** 5608,5615 ****
      x->templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
      if (argc) argc--, argv++;
!     x->variables = (t_setvariable *)getbytes(argc * sizeof (*x->variables));
      x->nin = argc;
      if (argc) {
!         for (i = 0, sp = x->variables; i < argc; i++, sp++) {
              sp->sym = atom_getsymbolarg(i, argc, argv);
              if (x->issymbol) sp->w.w_symbol = &s_;
--- 5593,5600 ----
      x->templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
      if (argc) argc--, argv++;
!     t_setvariable *sp = x->variables = (t_setvariable *)getbytes(argc * sizeof (*x->variables));
      x->nin = argc;
      if (argc) {
!         for (int i=0; i<argc; i++, sp++) {
              sp->sym = atom_getsymbolarg(i, argc, argv);
              if (x->issymbol) sp->w.w_symbol = &s_;
***************
*** 5627,5631 ****
  
  static void set_bang(t_set *x) {
!     int nitems = x->nin, i;
      t_template *t = template_findbyname(x->templatesym);
      t_setvariable *vp;
--- 5612,5616 ----
  
  static void set_bang(t_set *x) {
!     int nitems = x->nin;
      t_template *t = template_findbyname(x->templatesym);
      t_setvariable *vp;
***************
*** 5641,5649 ****
      if (!nitems) return;
      vec = gs->gs_which == GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
      if (x->issymbol)
!          for (i=0, vp=x->variables; i<nitems; i++,vp++)
!             template_setsymbol(t, vp->sym, vec, vp->w.w_symbol, 1);
!     else for (i=0, vp=x->variables; i<nitems; i++,vp++)
!             template_setfloat(t, vp->sym, vec, vp->w.w_float, 1);
      if (gs->gs_which == GP_GLIST) scalar_redraw(gp->gp_un.gp_scalar, gs->gs_un.gs_glist);
      else {
--- 5626,5633 ----
      if (!nitems) return;
      vec = gs->gs_which == GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
+     vp=x->variables;
      if (x->issymbol)
!          for (int i=0; i<nitems; i++,vp++) template_setsymbol(t, vp->sym, vec, vp->w.w_symbol, 1);
!     else for (int i=0; i<nitems; i++,vp++) template_setfloat(t, vp->sym, vec, vp->w.w_float, 1);
      if (gs->gs_which == GP_GLIST) scalar_redraw(gp->gp_un.gp_scalar, gs->gs_un.gs_glist);
      else {
***************
*** 5878,5883 ****
  static void *append_new(t_symbol *why, int argc, t_atom *argv) {
      t_append *x = (t_append *)pd_new(append_class);
-     int i;
-     t_appendvariable *sp;
      x->templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
      if (argc) argc--, argv++;
--- 5862,5865 ----
***************
*** 5885,5889 ****
      x->nin = argc;
      if (argc) {
!         for (i = 0, sp = x->variables; i < argc; i++, sp++) {
              sp->sym = atom_getsymbolarg(i, argc, argv);
              sp->f = 0;
--- 5867,5872 ----
      x->nin = argc;
      if (argc) {
!         t_appendvariable *sp = x->variables;
!         for (int i=0; i<argc; i++, sp++) {
              sp->sym = atom_getsymbolarg(i, argc, argv);
              sp->f = 0;
***************
*** 5898,5902 ****
  
  static void append_float(t_append *x, t_float f) {
!     int nitems = x->nin, i;
      t_template *t = template_findbyname(x->templatesym);
      t_appendvariable *vp;
--- 5881,5885 ----
  
  static void append_float(t_append *x, t_float f) {
!     int nitems = x->nin;
      t_template *t = template_findbyname(x->templatesym);
      t_appendvariable *vp;
***************
*** 5921,5925 ****
      gp->gp_un.gp_scalar = sc;
      vec = sc->sc_vec;
!     for (i=0, vp=x->variables; i<nitems; i++,vp++) template_setfloat(t, vp->sym, vec, vp->f, 1);
      scalar_redraw(sc, canvas);
      outlet_pointer(x->ob_outlet, gp);
--- 5904,5909 ----
      gp->gp_un.gp_scalar = sc;
      vec = sc->sc_vec;
!     vp=x->variables;
!     for (int i=0; i<nitems; i++,vp++) template_setfloat(t, vp->sym, vec, vp->f, 1);
      scalar_redraw(sc, canvas);
      outlet_pointer(x->ob_outlet, gp);
***************
*** 6437,6444 ****
  	char str[666];
  	t_text *o;
- 	int i;
  	t_symbol *name = atom_getsymbol(argv);
  	if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
! 	for (i=0; i<argc-1; i++) str[i] = atom_getint(argv+i+1);
  	str[argc-1]=0;
  	text_setto(o,x,str,argc-1);
--- 6421,6427 ----
  	char str[666];
  	t_text *o;
  	t_symbol *name = atom_getsymbol(argv);
  	if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
! 	for (int i=0; i<argc-1; i++) str[i] = atom_getint(argv+i+1);
  	str[argc-1]=0;
  	text_setto(o,x,str,argc-1);





More information about the Pd-cvs mailing list