[PD-cvs] pd/src desire.c,1.1.2.217.2.146,1.1.2.217.2.147

Mathieu Bouchard matju at users.sourceforge.net
Tue Jul 10 19:45:52 CEST 2007


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

Modified Files:
      Tag: desiredata
	desire.c 
Log Message:
cleanup


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.146
retrieving revision 1.1.2.217.2.147
diff -C2 -d -r1.1.2.217.2.146 -r1.1.2.217.2.147
*** desire.c	9 Jul 2007 19:56:29 -0000	1.1.2.217.2.146
--- desire.c	10 Jul 2007 17:45:47 -0000	1.1.2.217.2.147
***************
*** 562,567 ****
         abstraction inside another patch.  A separate mechanism prevents
         the toplevel abstraction from showing up. */
!     if (vis && gensym("#X")->s_thing && gensym("#X")->s_thing->_class == canvas_class) {
!         t_canvas *z = (t_canvas *)(gensym("#X")->s_thing);
          while (z && !z->env) z = z->owner;
          if (z && canvas_isabstraction(z) && z->owner) vis = 0;
--- 562,567 ----
         abstraction inside another patch.  A separate mechanism prevents
         the toplevel abstraction from showing up. */
!     if (vis && gensym("#X")->thing && gensym("#X")->thing->_class == canvas_class) {
!         t_canvas *z = (t_canvas *)(gensym("#X")->thing);
          while (z && !z->env) z = z->owner;
          if (z && canvas_isabstraction(z) && z->owner) vis = 0;
***************
*** 592,597 ****
  /* make a new canvas and add it to this canvas.  It will appear as a "graph", not a text object.  */
  static t_canvas *canvas_addcanvas(t_canvas *g, t_symbol *sym,
!     float  x1, float  y1, float  x2, float  y2,
!     float px1, float py1, float px2, float py2) {
      static int gcount = 0;
      int zz;
--- 592,597 ----
  /* make a new canvas and add it to this canvas.  It will appear as a "graph", not a text object.  */
  static t_canvas *canvas_addcanvas(t_canvas *g, t_symbol *sym,
! float  x1, float  y1, float  x2, float  y2,
! float px1, float py1, float px2, float py2) {
      static int gcount = 0;
      int zz;
***************
*** 791,801 ****
      }
      canvas_pop(x, x->willvis);
!     t_pd *z = gensym("#X")->s_thing;
      if (!z) pd_error(x,"canvas_restore: out of context");
      else if (z->_class != canvas_class) pd_error(x,"canvas_restore: wasn't a canvas");
      else {
!         t_canvas *x2 = (t_canvas *)z;
!         x->owner = x2;
!         canvas_objfor(x2, x, argc, argv);
      }
  }
--- 791,800 ----
      }
      canvas_pop(x, x->willvis);
!     t_pd *z = gensym("#X")->thing;
      if (!z) pd_error(x,"canvas_restore: out of context");
      else if (z->_class != canvas_class) pd_error(x,"canvas_restore: wasn't a canvas");
      else {
!         x->owner = (t_canvas *)z;
!         canvas_objfor((t_canvas *)z, x, argc, argv);
      }
  }
***************
*** 870,875 ****
          canvas_rename(x, binbuf_realizedollsym(av->a_symbol, e->argc, e->argv, 1), 0);
          pd_popsym(x);
!     }
!     else canvas_rename(x, gensym("Pd"), 0);
  }
  
--- 869,873 ----
          canvas_rename(x, binbuf_realizedollsym(av->a_symbol, e->argc, e->argv, 1), 0);
          pd_popsym(x);
!     } else canvas_rename(x, gensym("Pd"), 0);
  }
  
***************
*** 1090,1098 ****
  static t_gobj *canvas_remove_nth(t_canvas *x, int n) {
      t_gobj **y;
-     t_gobj *z;
      canvas_each2(y,x) {
        fprintf(stderr,"n=%i *y=%p\n",n,*y);
        if (!n) {
! 	z = *y;
  	*y = z->g_next;
  	z->g_next = 0;
--- 1088,1095 ----
  static t_gobj *canvas_remove_nth(t_canvas *x, int n) {
      t_gobj **y;
      canvas_each2(y,x) {
        fprintf(stderr,"n=%i *y=%p\n",n,*y);
        if (!n) {
!         t_gobj *z = *y;
  	*y = z->g_next;
  	z->g_next = 0;
***************
*** 1107,1113 ****
  static void canvas_insert_nth(t_canvas *x, int n, t_gobj *nu) {
      t_gobj **y;
-     t_gobj *z;
      canvas_each2(y,x) if (!n) {
! 	z = *y;
  	*y = nu;
  	nu->g_next = z;
--- 1104,1109 ----
  static void canvas_insert_nth(t_canvas *x, int n, t_gobj *nu) {
      t_gobj **y;
      canvas_each2(y,x) if (!n) {
!         t_gobj *z = *y;
  	*y = nu;
  	nu->g_next = z;
***************
*** 1225,1229 ****
  
  static void canvas_find(t_canvas *x, t_symbol *s, int ac, t_atom *av) {
-     int myindex1 = 0;
      for (int i = 0; i < ac; i++) {
          if (av[i].a_type == A_SYMBOL) {
--- 1221,1224 ----
***************
*** 1238,1241 ****
--- 1233,1237 ----
      canvas_find_index2 = -1;
      canvas_whichfind = x;
+     int myindex1;
      if (!canvas_dofind(x, &myindex1)) {
          binbuf_print(canvas_findbuf);
***************
*** 1245,1249 ****
  
  static void canvas_find_again(t_canvas *x) {
!     int myindex1 = 0;
      if (!canvas_findbuf || !canvas_whichfind) return;
      if (!canvas_dofind(canvas_whichfind, &myindex1)) {
--- 1241,1245 ----
  
  static void canvas_find_again(t_canvas *x) {
!     int myindex1;
      if (!canvas_findbuf || !canvas_whichfind) return;
      if (!canvas_dofind(canvas_whichfind, &myindex1)) {
***************
*** 1427,1437 ****
  	"#X obj 43 31 struct _float_array array z float float style float linewidth float color;\n"
  	"#X obj 43 70 plot z color linewidth 0 0 1 style;\n");
!     vmess(s__X.s_thing, gensym("pop"), "i", 0);
      glob_setfilename(0, gensym("_float_array"), gensym("."));
      pd_eval_text2(
  	"#N canvas 0 0 458 153 10;\n"
  	"#X obj 39 26 struct float float y;\n");
!     garray_arraytemplatecanvas = s__X.s_thing;
!     vmess(s__X.s_thing, gensym("pop"), "i", 0);
      glob_setfilename(0, &s_, &s_);
      binbuf_free(b);
--- 1423,1433 ----
  	"#X obj 43 31 struct _float_array array z float float style float linewidth float color;\n"
  	"#X obj 43 70 plot z color linewidth 0 0 1 style;\n");
!     vmess(s__X.thing, gensym("pop"), "i", 0);
      glob_setfilename(0, gensym("_float_array"), gensym("."));
      pd_eval_text2(
  	"#N canvas 0 0 458 153 10;\n"
  	"#X obj 39 26 struct float float y;\n");
!     garray_arraytemplatecanvas = s__X.thing;
!     vmess(s__X.thing, gensym("pop"), "i", 0);
      glob_setfilename(0, &s_, &s_);
      binbuf_free(b);
***************
*** 1510,1515 ****
      t_canvas *gl = x->canvas;
      if (gl->list == x && !x->g_next) {
!         vmess(gl,gensym("bounds"),"ffff",0.,gl->y1,
! 		(double)(style == PLOTSTYLE_POINTS || n == 1 ? n : n-1), gl->y2);
                  /* close any dialogs that might have the wrong info now... */
      }
--- 1506,1510 ----
      t_canvas *gl = x->canvas;
      if (gl->list == x && !x->g_next) {
!         vmess(gl,gensym("bounds"),"ffff",0.,gl->y1, double(style == PLOTSTYLE_POINTS || n == 1 ? n : n-1), gl->y2);
                  /* close any dialogs that might have the wrong info now... */
      }
***************
*** 1522,1527 ****
  by a more coherent (and general) invocation. */
  
! t_garray *graph_array(t_canvas *gl, t_symbol *s, t_symbol *templateargsym,
! t_floatarg fsize, t_floatarg fflags) {
      int n = (int)fsize, zonset, ztype, saveit;
      t_symbol *zarraytype;
--- 1517,1521 ----
  by a more coherent (and general) invocation. */
  
! t_garray *graph_array(t_canvas *gl, t_symbol *s, t_symbol *templateargsym, t_floatarg fsize, t_floatarg fflags) {
      int n = (int)fsize, zonset, ztype, saveit;
      t_symbol *zarraytype;
***************
*** 1572,1577 ****
  /* this is called back from the dialog window to create a garray. 
     The otherflag requests that we find an existing graph to put it in. */
! static void canvas_arraydialog(t_canvas *parent, t_symbol *name, t_floatarg size,
! t_floatarg fflags, t_floatarg otherflag) {
      t_canvas *gl;
      int flags = (int)fflags;
--- 1566,1570 ----
  /* this is called back from the dialog window to create a garray. 
     The otherflag requests that we find an existing graph to put it in. */
! static void canvas_arraydialog(t_canvas *parent, t_symbol *name, t_floatarg size, t_floatarg fflags, t_floatarg otherflag) {
      t_canvas *gl;
      int flags = (int)fflags;
***************
*** 1588,1593 ****
  
  /* this is called from the properties dialog window for an existing array */
! void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize,
! t_floatarg fflags, t_floatarg deleteit) {
      int flags = (int)fflags;
      int saveit = (flags&1)!=0;
--- 1581,1585 ----
  
  /* this is called from the properties dialog window for an existing array */
! void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, t_floatarg fflags, t_floatarg deleteit) {
      int flags = (int)fflags;
      int saveit = (flags&1)!=0;
***************
*** 1691,1696 ****
          /* found "w" field which controls linewidth. */
          float wval = *(float *)(elem + wonset);
!         wpix = canvas_ytopixels(canvas,
! 		basey + slot_cvttocoord(yslot,yval) + slot_cvttocoord(wslot,wval)) - ypix;
          if (wpix < 0) wpix = -wpix;
      } else wpix = 1;
--- 1683,1687 ----
          /* found "w" field which controls linewidth. */
          float wval = *(float *)(elem + wonset);
!         wpix = canvas_ytopixels(canvas, basey + slot_cvttocoord(yslot,yval) + slot_cvttocoord(wslot,wval)) - ypix;
          if (wpix < 0) wpix = -wpix;
      } else wpix = 1;
***************
*** 1739,1744 ****
          int increment, i, nchange;
          float newy = ammo.ycumulative;
! 	float oldy = slot_getcoord(ammo.yfield,
!                 ammo.t, (t_word *)(((char *)ammo.wp) + ammo.elemsize * ammo.lastx), 1);
          float ydiff = newy-oldy;
          CLAMP(thisx,0,1);
--- 1730,1734 ----
          int increment, i, nchange;
          float newy = ammo.ycumulative;
! 	float oldy = slot_getcoord(ammo.yfield, ammo.t, (t_word *)(((char *)ammo.wp) + ammo.elemsize * ammo.lastx), 1);
          float ydiff = newy-oldy;
          CLAMP(thisx,0,1);
***************
*** 1746,1751 ****
          nchange = 1 + increment * (ammo.lastx - thisx);
          for (i = 0, x2 = thisx; i < nchange; i++, x2 += increment) {
!             slot_setcoord(ammo.yfield,
!                 ammo.t, (t_word *)(((char *)ammo.wp) + ammo.elemsize * x2), newy, 1);
              if (nchange > 1) newy -= ydiff/(nchange-1);
           }
--- 1736,1740 ----
          nchange = 1 + increment * (ammo.lastx - thisx);
          for (i = 0, x2 = thisx; i < nchange; i++, x2 += increment) {
!             slot_setcoord(ammo.yfield, ammo.t, (t_word *)(((char *)ammo.wp) + ammo.elemsize * x2), newy, 1);
              if (nchange > 1) newy -= ydiff/(nchange-1);
           }
***************
*** 1757,1763 ****
  #endif
  
! int scalar_doclick(t_word *data, t_template *t, t_scalar *sc,
!     t_array *ap, t_canvas *owner, float xloc, float yloc, int xpix, int ypix,
!     int shift, int alt, int dbl, int doit);
  
  static int array_getfields(t_symbol *elemtemplatesym, t_canvas **elemtemplatecanvasp,
--- 1746,1751 ----
  #endif
  
! int scalar_doclick(t_word *data, t_template *t, t_scalar *sc, t_array *ap, t_canvas *owner, float xloc, float yloc,
! int xpix, int ypix, int shift, int alt, int dbl, int doit);
  
  static int array_getfields(t_symbol *elemtemplatesym, t_canvas **elemtemplatecanvasp,
***************
*** 1858,1863 ****
                      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;
--- 1846,1850 ----
                      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;
***************
*** 2638,2643 ****
                  array_resize(a, nitems + 1);
                  element = (t_word *)&a->vec[nitems*elemsize];
!                 canvas_readatoms(x, natoms, vec, p_nextmsg, arraytemplatesym,
!                     element, nline, vec + message);
                  nitems++;
              }
--- 2625,2629 ----
                  array_resize(a, nitems + 1);
                  element = (t_word *)&a->vec[nitems*elemsize];
!                 canvas_readatoms(x, natoms, vec, p_nextmsg, arraytemplatesym, element, nline, vec + message);
                  nitems++;
              }
***************
*** 2868,2873 ****
  static void canvas_addtemplatesforlist(t_gobj *y, int *p_ntemplates, t_symbol ***p_templatevec);
  
! static void canvas_addtemplatesforscalar(t_symbol *templatesym,
! t_word *w, int *p_ntemplates, t_symbol ***p_templatevec) {
      t_dataslot *ds;
      int i;
--- 2854,2858 ----
  static void canvas_addtemplatesforlist(t_gobj *y, int *p_ntemplates, t_symbol ***p_templatevec);
  
! static void canvas_addtemplatesforscalar(t_symbol *templatesym, t_word *w, int *p_ntemplates, t_symbol ***p_templatevec) {
      t_dataslot *ds;
      int i;
***************
*** 2882,2887 ****
              canvas_doaddtemplate(arraytemplatesym, p_ntemplates, p_templatevec);
              for (int 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);
--- 2867,2871 ----
              canvas_doaddtemplate(arraytemplatesym, p_ntemplates, p_templatevec);
              for (int 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);
***************
*** 2980,2985 ****
         that old versions of Pd can at least do something with it.
         otherwise write in 0.38-compatible form. */
!     binbuf_addv(b,"ttffffffi","#X","coords",
! 	x->x1, x->y1, x->x2, x->y2, (float)x->pixwidth, (float)x->pixheight,
  	x->isgraph?x->hidetext?2:1:0);
      if (x->goprect) binbuf_addv(b, "ff", (float)x->xmargin, (float)x->ymargin);
--- 2964,2968 ----
         that old versions of Pd can at least do something with it.
         otherwise write in 0.38-compatible form. */
!     binbuf_addv(b,"ttffffffi","#X","coords", x->x1, x->y1, x->x2, x->y2, (float)x->pixwidth, (float)x->pixheight,
  	x->isgraph?x->hidetext?2:1:0);
      if (x->goprect) binbuf_addv(b, "ff", (float)x->xmargin, (float)x->ymargin);
***************
*** 3000,3005 ****
  
  /* call this recursively to collect all the template names for a canvas or for the selection. */
! static void canvas_collecttemplatesfor(t_canvas *x, int *ntemplatesp,
! t_symbol ***templatevecp) {
      canvas_each(y,x) {
          if (y->_class==scalar_class) {
--- 2983,2987 ----
  
  /* call this recursively to collect all the template names for a canvas or for the selection. */
! static void canvas_collecttemplatesfor(t_canvas *x, int *ntemplatesp, t_symbol ***templatevecp) {
      canvas_each(y,x) {
          if (y->_class==scalar_class) {
***************
*** 3428,3433 ****
     If we aren't reblocking, there's nothing to do here.  */
  extern "C" void voutlet_dspepilog(t_voutlet *x, t_signal **parentsigs,
! int myvecsize, int calcsize, int phase, int period, int frequency, int downsample,
! int upsample, int reblock, int switched) {
      if (!x->buf) return;  /* this shouldn't be necesssary... */
      x->updown.downsample=downsample;
--- 3410,3414 ----
     If we aren't reblocking, there's nothing to do here.  */
  extern "C" void voutlet_dspepilog(t_voutlet *x, t_signal **parentsigs,
! int myvecsize, int calcsize, int phase, int period, int frequency, int downsample, int upsample, int reblock, int switched) {
      if (!x->buf) return;  /* this shouldn't be necesssary... */
      x->updown.downsample=downsample;
***************
*** 3581,3585 ****
      for (int i=0; i<t->n; i++, dt++) {
          if      (dt->type == DT_ARRAY) pd_free(wp[i].w_array);
!         else if (dt->type == DT_LIST)  canvas_free(wp[i].w_list);
      }
  }
--- 3562,3566 ----
      for (int i=0; i<t->n; i++, dt++) {
          if      (dt->type == DT_ARRAY) pd_free(wp[i].w_array);
!         else if (dt->type == DT_LIST)  pd_free(wp[i].w_list);
      }
  }
***************
*** 3626,3640 ****
  static void canvas_scalar(t_canvas *canvas, t_symbol *classname, t_int argc, t_atom *argv) {
      t_symbol *templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
-     int natoms, nextmsg = 0;
-     t_atom *vec;
      if (!template_findbyname(templatesym)) {
          pd_error(canvas, "%s: no such template", atom_getsymbolarg(0, argc, argv)->name);
          return;
      }
      t_binbuf *b = binbuf_new();
      binbuf_restore(b, argc, argv);
!     natoms = binbuf_getnatom(b);
!     vec = binbuf_getvec(b);
!     canvas_readscalar(canvas, natoms, vec, &nextmsg, 0);
      binbuf_free(b);
  }
--- 3607,3618 ----
  static void canvas_scalar(t_canvas *canvas, t_symbol *classname, t_int argc, t_atom *argv) {
      t_symbol *templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
      if (!template_findbyname(templatesym)) {
          pd_error(canvas, "%s: no such template", atom_getsymbolarg(0, argc, argv)->name);
          return;
      }
+     int nextmsg;
      t_binbuf *b = binbuf_new();
      binbuf_restore(b, argc, argv);
!     canvas_readscalar(canvas, binbuf_getnatom(b), binbuf_getvec(b), &nextmsg, 0);
      binbuf_free(b);
  }
***************
*** 3709,3714 ****
  #endif
  
! static int scalar_click(t_gobj *z, t_canvas *owner,
! int xpix, int ypix, int shift, int alt, int dbl, int doit) {
      t_scalar *x = (t_scalar *)z;
      t_template *t = template_findbyname(x->t);
--- 3687,3691 ----
  #endif
  
! static int scalar_click(t_gobj *z, t_canvas *owner, int xpix, int ypix, int shift, int alt, int dbl, int doit) {
      t_scalar *x = (t_scalar *)z;
      t_template *t = template_findbyname(x->t);
***************
*** 3747,3756 ****
  
  static void scalar_free(t_scalar *x) {
!     t_symbol *templatesym = x->t;
!     t_template *t = template_findbyname(templatesym);
!     TEMPLATE_CHECK(x,templatesym,)
      word_free(x->v, t);
!     /* the "size" field in the class is zero, so Pd doesn't try to free
!        us automatically (see pd_free()) */
      free(x);
  }
--- 3724,3731 ----
  
  static void scalar_free(t_scalar *x) {
!     t_template *t = template_findbyname(x->t);
!     TEMPLATE_CHECK(x,x->t,)
      word_free(x->v, t);
!     /* the "size" field in the class is zero, so Pd doesn't try to free us automatically (see pd_free()) */
      free(x);
  }
***************
*** 3769,3775 ****
  */
  
!     /* the structure of a "struct" object (also the obsolete "gtemplate"
!     you get when using the name "template" in a box.) */
! 
  struct t_gtemplate : t_object {
      t_template *t;
--- 3744,3749 ----
  */
  
! /* the structure of a "struct" object (also the obsolete "gtemplate"
!    you get when using the name "template" in a box.) */
  struct t_gtemplate : t_object {
      t_template *t;
***************
*** 3781,3796 ****
  };
  
- /* ---------------- forward definitions ---------------- */
- 
  static void template_conformarray(t_template *tfrom, t_template *tto, int *conformaction, t_array *a);
  static void template_conformcanvas(t_template *tfrom, t_template *tto, int *conformaction, t_canvas *canvas);
- 
- /* ---------------------- storage ------------------------- */
- 
  static t_class *gtemplate_class;
  static t_class *template_class;
  
! /* there's a pre-defined "float" template.  LATER should we bind this
! to a symbol such as "pd-float"??? */
  
      /* return true if two dataslot definitions match */
--- 3755,3764 ----
  };
  
  static void template_conformarray(t_template *tfrom, t_template *tto, int *conformaction, t_array *a);
  static void template_conformcanvas(t_template *tfrom, t_template *tto, int *conformaction, t_canvas *canvas);
  static t_class *gtemplate_class;
  static t_class *template_class;
  
! /* there's a pre-defined "float" template.  LATER should we bind this to a symbol such as "pd-float"??? */
  
      /* return true if two dataslot definitions match */
***************
*** 3839,3847 ****
          argc -= 2; argv += 2;
      }
!     if (templatesym->name) {
!         x->sym = templatesym;
!         pd_bind(x,x->sym);
!     }
!     else x->sym = templatesym;
      return x;
  }
--- 3807,3812 ----
          argc -= 2; argv += 2;
      }
!     x->sym = templatesym;
!     if (templatesym->name) pd_bind(x,x->sym);
      return x;
  }
***************
*** 3913,3918 ****
  
  /* conform the word vector of a scalar to the new template */    
! 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) {
--- 3878,3882 ----
  
  /* conform the word vector of a scalar to the new template */    
! 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) {
***************
*** 3927,3937 ****
  
  /* conform a scalar, recursively conforming sublists and arrays  */
! static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto,
! int *conformaction, t_canvas *canvas, t_scalar *scfrom) {
      t_scalar *x;
-     t_gpointer gp;
      t_template *scalartemplate;
      /* possibly replace the scalar */
      if (scfrom->t == tfrom->sym) {
          /* see scalar_new() for comment about the gpointer. */
          gpointer_init(&gp);
--- 3891,3900 ----
  
  /* conform a scalar, recursively conforming sublists and arrays  */
! static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto, int *conformaction, t_canvas *canvas, t_scalar *scfrom) {
      t_scalar *x;
      t_template *scalartemplate;
      /* possibly replace the scalar */
      if (scfrom->t == tfrom->sym) {
+         t_gpointer gp;
          /* see scalar_new() for comment about the gpointer. */
          gpointer_init(&gp);
***************
*** 4071,4076 ****
  /* bash the first of (argv) with a pointer to a scalar, and send on
     to template as a notification message */
! static void template_notifyforscalar(t_template *t, t_canvas *owner,
! t_scalar *sc, t_symbol *s, int argc, t_atom *argv) {
      t_gpointer gp;
      gpointer_init(&gp);
--- 4034,4038 ----
  /* bash the first of (argv) with a pointer to a scalar, and send on
     to template as a notification message */
! static void template_notifyforscalar(t_template *t, t_canvas *owner, t_scalar *sc, t_symbol *s, int argc, t_atom *argv) {
      t_gpointer gp;
      gpointer_init(&gp);
***************
*** 4120,4129 ****
  /* ---------------- gtemplates.  One per canvas. ----------- */
  
! /* "Struct": an object that searches for, and if necessary creates, 
  a template (above).  Other objects in the canvas then can give drawing
  instructions for the template.  The template doesn't go away when the
! "struct" is deleted, so that you can replace it with
! another one to add new fields, for example. */
! 
  static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv) {
      t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class);
--- 4082,4089 ----
  /* ---------------- gtemplates.  One per canvas. ----------- */
  
! /* "Struct": an object that searches for, and if necessary creates,
  a template (above).  Other objects in the canvas then can give drawing
  instructions for the template.  The template doesn't go away when the
! "struct" is deleted, so that you can replace it with another one to add new fields, for example. */
  static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv) {
      t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class);
***************
*** 4135,4139 ****
      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? */
      if (t) {
--- 4095,4098 ----
***************
*** 4429,4434 ****
  }
  
! static void curve_vis(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t,
! float basex, float basey, int vis) {
      t_curve *x = (t_curve *)z;
      int n = x->npoints;
--- 4388,4392 ----
  }
  
! static void curve_vis(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, float basex, float basey, int vis) {
      t_curve *x = (t_curve *)z;
      int n = x->npoints;
***************
*** 4661,4666 ****
  }
  
! static void plot_vis(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t,
! float basex, float basey, int tovis) {
      t_plot *x = (t_plot *)z;
      int elemsize, yonset, wonset, xonset, i;
--- 4619,4623 ----
  }
  
! static void plot_vis(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, float basex, float basey, int tovis) {
      t_plot *x = (t_plot *)z;
      int elemsize, yonset, wonset, xonset, i;
***************
*** 4672,4677 ****
      int nelem;
      char *elem;
!     if (plot_readownertemplate(x, data, t, &elemtemplatesym, &array, &linewidth, &xloc, &xinc,
! 	&yloc, &style, &vis, &scalarvis)) return;
      t_slot *xslot = &x->xpoints, *yslot = &x->ypoints, *wslot = &x->wpoints;
      if (!vis) return;
--- 4629,4633 ----
      int nelem;
      char *elem;
!     if (plot_readownertemplate(x, data, t, &elemtemplatesym, &array, &linewidth, &xloc, &xinc, &yloc, &style, &vis, &scalarvis)) return;
      t_slot *xslot = &x->xpoints, *yslot = &x->ypoints, *wslot = &x->wpoints;
      if (!vis) return;
***************
*** 4962,4967 ****
          /* key entry for a symbol field */
          if (dn.firstkey) sbuf[0] = 0;
!         else strncpy(sbuf, template_getsymbol(dn.t,
!             f->u.varsym, dn.wp, 1)->name, MAXPDSTRING);
          sbuf[MAXPDSTRING-1] = 0;
          if (key == '\b') {
--- 4918,4922 ----
          /* key entry for a symbol field */
          if (dn.firstkey) sbuf[0] = 0;
!         else strncpy(sbuf, template_getsymbol(dn.t, f->u.varsym, dn.wp, 1)->name, MAXPDSTRING);
          sbuf[MAXPDSTRING-1] = 0;
          if (key == '\b') {
***************
*** 5363,5368 ****
      if (!gpointer_check(gparent, 0)) {pd_error(x, "empty pointer"); return;}
      if (gpointer_gettemplatesym(gparent) != x->templatesym) {
!         pd_error(x, "%s: got wrong template (%s)",
!             x->templatesym->name, gpointer_gettemplatesym(gparent)->name);
          return;
      }
--- 5318,5322 ----
      if (!gpointer_check(gparent, 0)) {pd_error(x, "empty pointer"); return;}
      if (gpointer_gettemplatesym(gparent) != x->templatesym) {
!         pd_error(x, "%s: got wrong template (%s)", x->templatesym->name, gpointer_gettemplatesym(gparent)->name);
          return;
      }
***************
*** 5421,5426 ****
      if (!gpointer_check(gp, 0)) {pd_error(x, "stale or empty pointer"); return;}
      if (gpointer_gettemplatesym(gp) != x->templatesym) {
!         pd_error(x, "%s: got wrong template (%s)",
!             x->templatesym->name, gpointer_gettemplatesym(gp)->name);
          return;
      }
--- 5375,5379 ----
      if (!gpointer_check(gp, 0)) {pd_error(x, "stale or empty pointer"); return;}
      if (gpointer_gettemplatesym(gp) != x->templatesym) {
!         pd_error(x, "%s: got wrong template (%s)", x->templatesym->name, gpointer_gettemplatesym(gp)->name);
          return;
      }
***************
*** 5891,5903 ****
      if (x->atom.a_type == A_FLOAT) {
      	if (o) outlet_float(o, x->atom.a_float);
! 	if (*s->name && s->s_thing) {
  	    if (x->snd == x->rcv) goto err;
! 	    pd_float(s->s_thing, x->atom.a_float);
      	}
      } else if (x->atom.a_type == A_SYMBOL) {
      	if (o) outlet_symbol(o, x->atom.a_symbol);
! 	if (*s->name && s->s_thing) {
  	    if (x->snd == x->rcv) goto err;
! 	    pd_symbol(s->s_thing, x->atom.a_symbol);
      	}
      }
--- 5844,5856 ----
      if (x->atom.a_type == A_FLOAT) {
      	if (o) outlet_float(o, x->atom.a_float);
! 	if (*s->name && s->thing) {
  	    if (x->snd == x->rcv) goto err;
! 	    pd_float(s->thing, x->atom.a_float);
      	}
      } else if (x->atom.a_type == A_SYMBOL) {
      	if (o) outlet_symbol(o, x->atom.a_symbol);
! 	if (*s->name && s->thing) {
  	    if (x->snd == x->rcv) goto err;
! 	    pd_symbol(s->thing, x->atom.a_symbol);
      	}
      }
***************
*** 6525,6529 ****
  static void bng_bout2(t_bng *x) {
      outlet_bang(x->ob_outlet);
!     if(x->snd && x->snd->s_thing) pd_bang(x->snd->s_thing);
  }
  
--- 6478,6482 ----
  static void bng_bout2(t_bng *x) {
      outlet_bang(x->ob_outlet);
!     if(x->snd && x->snd->thing) pd_bang(x->snd->thing);
  }
  
***************
*** 6531,6535 ****
      bng_set(x);
      outlet_bang(x->ob_outlet);
!     if(x->snd && x->snd->s_thing && iemgui_forward(x)) pd_bang(x->snd->s_thing);
  }
  static void bng_bang2   (t_bng *x) {                       {bng_set(x); bng_bout2(x);}}
--- 6484,6488 ----
      bng_set(x);
      outlet_bang(x->ob_outlet);
!     if(x->snd && x->snd->thing && iemgui_forward(x)) pd_bang(x->snd->thing);
  }
  static void bng_bang2   (t_bng *x) {                       {bng_set(x); bng_bout2(x);}}
***************
*** 6586,6590 ****
  static void toggle_action(t_toggle *x) {
      outlet_float(x->ob_outlet, x->on);
!     if(x->snd && x->snd->s_thing) pd_float(x->snd->s_thing, x->on);
  }
  
--- 6539,6543 ----
  static void toggle_action(t_toggle *x) {
      outlet_float(x->ob_outlet, x->on);
!     if(x->snd && x->snd->thing) pd_float(x->snd->thing, x->on);
  }
  
***************
*** 6645,6654 ****
  	SETFLOAT(x->at+1,b);
  	outlet_list(x->ob_outlet, &s_list, 2, x->at);
! 	if(x->snd && x->snd->s_thing) pd_list(x->snd->s_thing, &s_list, 2, x->at);
  }
  
  static void radio_send(t_radio *x, float a) {
      	outlet_float(x->ob_outlet,a);
! 	if(x->snd && x->snd->s_thing) pd_float(x->snd->s_thing,a);
  }
  
--- 6598,6607 ----
  	SETFLOAT(x->at+1,b);
  	outlet_list(x->ob_outlet, &s_list, 2, x->at);
! 	if(x->snd && x->snd->thing) pd_list(x->snd->thing, &s_list, 2, x->at);
  }
  
  static void radio_send(t_radio *x, float a) {
      	outlet_float(x->ob_outlet,a);
! 	if(x->snd && x->snd->thing) pd_float(x->snd->thing,a);
  }
  
***************
*** 6785,6789 ****
      if (fabs(out) < 1.0e-10) out = 0.0;
      outlet_float(x->ob_outlet, out);
!     if(x->snd && x->snd->s_thing) pd_float(x->snd->s_thing, out);
  }
  
--- 6738,6742 ----
      if (fabs(out) < 1.0e-10) out = 0.0;
      outlet_float(x->ob_outlet, out);
!     if(x->snd && x->snd->thing) pd_float(x->snd->thing, out);
  }
  
***************
*** 6868,6872 ****
  static void nbx_bang(t_nbx *x) {
      outlet_float(x->ob_outlet, x->val);
!     if(x->snd && x->snd->s_thing) pd_float(x->snd->s_thing, x->val);
  }
  
--- 6821,6825 ----
  static void nbx_bang(t_nbx *x) {
      outlet_float(x->ob_outlet, x->val);
!     if(x->snd && x->snd->thing) pd_float(x->snd->thing, x->val);
  }
  
***************
*** 6989,6994 ****
  
  static int vu_pickle(t_vu *x, t_foo *foo) {
!     return pd_pickle(foo,"iiaaiiiiccb;i",
! 	&x->w,&x->h,&x->rcv,&x->lab,&x->ldx,&x->ldy,&x->font_style,
  	&x->fontsize,&x->bcol,&x->lcol,&x->scale,&x->isa);
  }
--- 6942,6946 ----
  
  static int vu_pickle(t_vu *x, t_foo *foo) {
!     return pd_pickle(foo,"iiaaiiiiccb;i",&x->w,&x->h,&x->rcv,&x->lab,&x->ldx,&x->ldy,&x->font_style,
  	&x->fontsize,&x->bcol,&x->lcol,&x->scale,&x->isa);
  }
***************
*** 7030,7037 ****
  
  static void cnv_get_pos(t_cnv *x) {
!     if(x->snd && x->snd->s_thing) {
  	x->at[0].a_float = text_xpix(x, x->canvas);
  	x->at[1].a_float = text_ypix(x, x->canvas);
! 	pd_list(x->snd->s_thing, &s_list, 2, x->at);
      }
  }
--- 6982,6989 ----
  
  static void cnv_get_pos(t_cnv *x) {
!     if(x->snd && x->snd->thing) {
  	x->at[0].a_float = text_xpix(x, x->canvas);
  	x->at[1].a_float = text_ypix(x, x->canvas);
! 	pd_list(x->snd->thing, &s_list, 2, x->at);
      }
  }
***************
*** 7090,7094 ****
  static void dropper_bang(t_dropper *x) {
      outlet_symbol(x->ob_outlet, x->ds);
!     if(x->snd && x->snd->s_thing) pd_symbol(x->snd->s_thing, x->ds);
  }
  
--- 7042,7046 ----
  static void dropper_bang(t_dropper *x) {
      outlet_symbol(x->ob_outlet, x->ds);
!     if(x->snd && x->snd->thing) pd_symbol(x->snd->thing, x->ds);
  }
  





More information about the Pd-cvs mailing list