[PD-cvs] pd/src m_pd.h, 1.4.4.11.2.29, 1.4.4.11.2.30 desire.c, 1.1.2.204, 1.1.2.205

Mathieu Bouchard matju at users.sourceforge.net
Tue Nov 28 01:44:58 CET 2006


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

Modified Files:
      Tag: devel_0_39
	m_pd.h desire.c 
Log Message:
g_pd becomes _class


Index: m_pd.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v
retrieving revision 1.4.4.11.2.29
retrieving revision 1.4.4.11.2.30
diff -C2 -d -r1.4.4.11.2.29 -r1.4.4.11.2.30
*** m_pd.h	27 Nov 2006 23:44:46 -0000	1.4.4.11.2.29
--- m_pd.h	28 Nov 2006 00:44:54 -0000	1.4.4.11.2.30
***************
*** 211,215 ****
--- 211,220 ----
  typedef struct _gobj        /* a graphical object */
  {
+ #ifdef PD_PLUSPLUS_FACE
+ #define g_pd _class
+     t_pd _class;              /* pure datum header (class) */
+ #else
      t_pd g_pd;              /* pure datum header (class) */
+ #endif
  #ifdef DESIRE
  /* g_next is moved out to keep ABI compat */

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.204
retrieving revision 1.1.2.205
diff -C2 -d -r1.1.2.204 -r1.1.2.205
*** desire.c	27 Nov 2006 23:44:46 -0000	1.1.2.204
--- desire.c	28 Nov 2006 00:44:54 -0000	1.1.2.205
***************
*** 45,49 ****
  #define L printf("%s:%d\n",__FILE__,__LINE__);
  #define LS printf("%s:%d (self=%lx\n",__FILE__,__LINE__,(long)self);\
! 	printf("class=%s)\n",((t_gobj *)self)->g_pd->c_name->s_name);
  */
  /* no sys_vgui logging for MSVC... we have no vararg macros */
--- 45,49 ----
  #define L printf("%s:%d\n",__FILE__,__LINE__);
  #define LS printf("%s:%d (self=%lx\n",__FILE__,__LINE__,(long)self);\
! 	printf("class=%s)\n",((t_gobj *)self)->_class->c_name->s_name);
  */
  /* no sys_vgui logging for MSVC... we have no vararg macros */
***************
*** 52,56 ****
  #define L printf("%s:%d in %s\n",__FILE__,__LINE__,__PRETTY_FUNCTION__);
  #define LS printf("%s:%d in %s (self=%lx\n",__FILE__,__LINE__,__PRETTY_FUNCTION__,(long)self);\
! 	printf("class=%s)\n",((t_gobj *)self)->g_pd->c_name->s_name);
  
  /*
--- 52,56 ----
  #define L printf("%s:%d in %s\n",__FILE__,__LINE__,__PRETTY_FUNCTION__);
  #define LS printf("%s:%d in %s (self=%lx\n",__FILE__,__LINE__,__PRETTY_FUNCTION__,(long)self);\
! 	printf("class=%s)\n",((t_gobj *)self)->_class->c_name->s_name);
  
  /*
***************
*** 161,165 ****
  void gobj_changed (void *self_, const char *k) {
  	t_gobj *self = (t_gobj *)self_;
! 	int dirty = k ? (1<<class_getfieldindex(self->g_pd,k)) : -1;
  	t_atom argv[1];
  	SETFLOAT(argv,(float)dirty);
--- 161,165 ----
  void gobj_changed (void *self_, const char *k) {
  	t_gobj *self = (t_gobj *)self_;
! 	int dirty = k ? (1<<class_getfieldindex(self->_class,k)) : -1;
  	t_atom argv[1];
  	SETFLOAT(argv,(float)dirty);
***************
*** 181,187 ****
  	for (int i=0; i<d->nobs; i++) {
  		t_gobj *obs = d->obs[i];
! 		t_notice ice = obs->g_pd->c_notice;
  		if (ice) ice(obs,origin,argc,argv);
! 		else post("null func ptr for class %s",self->g_pd->c_name->s_name);
  	}
  }
--- 181,187 ----
  	for (int i=0; i<d->nobs; i++) {
  		t_gobj *obs = d->obs[i];
! 		t_notice ice = obs->_class->c_notice;
  		if (ice) ice(obs,origin,argc,argv);
! 		else post("null func ptr for class %s",self->_class->c_name->s_name);
  	}
  }
***************
*** 275,279 ****
  		if (!o) continue; /* cancelled notice */
  		if (!o->g_adix->dirtyc) continue;
! 		/*post("UPLOADING a %s",o->g_pd->c_name->s_name);*/
  		pd_upload(o);
  		o->g_adix->dirtyc = 0;
--- 275,279 ----
  		if (!o) continue; /* cancelled notice */
  		if (!o->g_adix->dirtyc) continue;
! 		/*post("UPLOADING a %s",o->_class->c_name->s_name);*/
  		pd_upload(o);
  		o->g_adix->dirtyc = 0;
***************
*** 457,461 ****
              t_object *ob = 0;
              t_gobj *y = t->from ? t->from->g_next : t->canvas->list;
!             for (; y; y = y->g_next) if ((ob = pd_checkobject(&y->g_pd))) break;
              if (!ob) return 0;
              t->from = ob;
--- 457,461 ----
              t_object *ob = 0;
              t_gobj *y = t->from ? t->from->g_next : t->canvas->list;
!             for (; y; y = y->g_next) if ((ob = pd_checkobject(&y->_class))) break;
              if (!ob) return 0;
              t->from = ob;
***************
*** 808,812 ****
  
  static void canvas_loadbangabstractions(t_canvas *x) {
!     canvas_each(y,x) if (pd_class(&y->g_pd) == canvas_class) {
          if (canvas_isabstraction((t_canvas *)y))
              canvas_loadbang((t_canvas *)y);
--- 808,812 ----
  
  static void canvas_loadbangabstractions(t_canvas *x) {
!     canvas_each(y,x) if (pd_class(&y->_class) == canvas_class) {
          if (canvas_isabstraction((t_canvas *)y))
              canvas_loadbang((t_canvas *)y);
***************
*** 818,827 ****
  void canvas_loadbangsubpatches(t_canvas *x) {
      t_symbol *s = gensym("loadbang");
!     canvas_each(y,x) if (pd_class(&y->g_pd) == canvas_class)
          if (!canvas_isabstraction((t_canvas *)y))
              canvas_loadbangsubpatches((t_canvas *)y);
      canvas_each(y,x)
!         if ((pd_class(&y->g_pd) != canvas_class) && zgetfn(&y->g_pd, s))
!                 pd_vmess(&y->g_pd, s, "");
  }
  
--- 818,827 ----
  void canvas_loadbangsubpatches(t_canvas *x) {
      t_symbol *s = gensym("loadbang");
!     canvas_each(y,x) if (pd_class(&y->_class) == canvas_class)
          if (!canvas_isabstraction((t_canvas *)y))
              canvas_loadbangsubpatches((t_canvas *)y);
      canvas_each(y,x)
!         if ((pd_class(&y->_class) != canvas_class) && zgetfn(&y->_class, s))
!                 pd_vmess(&y->_class, s, "");
  }
  
***************
*** 974,978 ****
  
      /* find all the "dsp" boxes and add them to the graph */
!     canvas_each(y,x) if ((ob = pd_checkobject(&y->g_pd)) && zgetfn(&y->g_pd, dspsym)) ugen_add(dc, ob);
  
      /* ... and all dsp interconnections */
--- 974,978 ----
  
      /* find all the "dsp" boxes and add them to the graph */
!     canvas_each(y,x) if ((ob = pd_checkobject(&y->_class)) && zgetfn(&y->_class, dspsym)) ugen_add(dc, ob);
  
      /* ... and all dsp interconnections */
***************
*** 1041,1045 ****
      t_canvas *canvas = *canvasp;
      void *ret = 0;
!     canvas_each(g,canvas) if (g->g_pd == blockclass) ret = g;
      *canvasp = canvas->owner;
      return ret;
--- 1041,1045 ----
      t_canvas *canvas = *canvasp;
      void *ret = 0;
!     canvas_each(g,canvas) if (g->_class == blockclass) ret = g;
      *canvasp = canvas->owner;
      return ret;
***************
*** 1072,1080 ****
      int vis = canvas_isvisible(gl);
      canvas_each(g,gl) {
!         if (vis && g->g_pd == scalar_class) {
              if      (action == 1) {/*if (canvas_isvisible(gl)) gobj_vis(g, gl, 1);*/}
              else if (action == 2) {/*if (canvas_isvisible(gl)) gobj_vis(g, gl, 0);*/}
              else scalar_redraw((t_scalar *)g, gl);
!         } else if (g->g_pd == canvas_class) canvas_redrawall((t_canvas *)g, action);
      }
  }
--- 1072,1080 ----
      int vis = canvas_isvisible(gl);
      canvas_each(g,gl) {
!         if (vis && g->_class == scalar_class) {
              if      (action == 1) {/*if (canvas_isvisible(gl)) gobj_vis(g, gl, 1);*/}
              else if (action == 2) {/*if (canvas_isvisible(gl)) gobj_vis(g, gl, 0);*/}
              else scalar_redraw((t_scalar *)g, gl);
!         } else if (g->_class == canvas_class) canvas_redrawall((t_canvas *)g, action);
      }
  }
***************
*** 1090,1094 ****
      t_symbol *s1 = gensym("struct");
      canvas_each(g,x) {
!         t_object *ob = pd_checkobject(&g->g_pd);
          t_atom *argv;
          if (!ob || ob->te_type != T_OBJECT || binbuf_getnatom(ob->te_binbuf) < 2) continue;
--- 1090,1094 ----
      t_symbol *s1 = gensym("struct");
      canvas_each(g,x) {
!         t_object *ob = pd_checkobject(&g->_class);
          t_atom *argv;
          if (!ob || ob->te_type != T_OBJECT || binbuf_getnatom(ob->te_binbuf) < 2) continue;
***************
*** 1161,1165 ****
      int i=0, nobj = canvas_getindex(gl, 0);  /* number of objects */
      for (t_gobj *g = gl->list; g && i < nobj; i++) {
!         if (g != except && pd_class(&g->g_pd) == canvas_class &&
              canvas_isabstraction((t_canvas *)g) &&
                  ((t_canvas *)g)->name == name &&
--- 1161,1165 ----
      int i=0, nobj = canvas_getindex(gl, 0);  /* number of objects */
      for (t_gobj *g = gl->list; g && i < nobj; i++) {
!         if (g != except && pd_class(&g->_class) == canvas_class &&
              canvas_isabstraction((t_canvas *)g) &&
                  ((t_canvas *)g)->name == name &&
***************
*** 1175,1179 ****
              if (!hadwindow) canvas_vis(canvas_getcanvas(gl), 0);
          } else {
!             if (g != except && pd_class(&g->g_pd) == canvas_class)
                  canvas_doreload((t_canvas *)g, name, dir, except);
               g = g->g_next;
--- 1175,1179 ----
              if (!hadwindow) canvas_vis(canvas_getcanvas(gl), 0);
          } else {
!             if (g != except && pd_class(&g->_class) == canvas_class)
                  canvas_doreload((t_canvas *)g, name, dir, except);
               g = g->g_next;
***************
*** 1211,1215 ****
          x->isgraph = 1;
          if (!nogoprect && !x->goprect) {
!             canvas_each(g,x) if (pd_checkobject(&g->g_pd)) {x->goprect = 1; break;}
          }
          if (canvas_isvisible(x) && x->goprect) canvas_redraw(x);
--- 1211,1215 ----
          x->isgraph = 1;
          if (!nogoprect && !x->goprect) {
!             canvas_each(g,x) if (pd_checkobject(&g->_class)) {x->goprect = 1; break;}
          }
          if (canvas_isvisible(x) && x->goprect) canvas_redraw(x);
***************
*** 1270,1274 ****
      if (myindex1 >= canvas_find_index1) {
          canvas_each(y,x) {
!             t_object *ob = pd_checkobject(&y->g_pd);
  	    if (ob && binbuf_match(ob->ob_binbuf, canvas_findbuf)) {
                      if (myindex1 > canvas_find_index1 ||
--- 1270,1274 ----
      if (myindex1 >= canvas_find_index1) {
          canvas_each(y,x) {
!             t_object *ob = pd_checkobject(&y->_class);
  	    if (ob && binbuf_match(ob->ob_binbuf, canvas_findbuf)) {
                      if (myindex1 > canvas_find_index1 ||
***************
*** 1285,1289 ****
      myindex2=0;
      canvas_each(y,x) {
!         if (pd_class(&y->g_pd) == canvas_class) {
              (*myindex1p)++;
              if (canvas_dofind((t_canvas *)y, myindex1p)) return 1;
--- 1285,1289 ----
      myindex2=0;
      canvas_each(y,x) {
!         if (pd_class(&y->_class) == canvas_class) {
              (*myindex1p)++;
              if (canvas_dofind((t_canvas *)y, myindex1p)) return 1;
***************
*** 1334,1338 ****
              return 1;
          }
!         else if (g->g_pd == canvas_class) {
              if (canvas_dofinderror((t_canvas *)g, error_object)) return 1;
          }
--- 1334,1338 ----
              return 1;
          }
!         else if (g->_class == canvas_class) {
              if (canvas_dofinderror((t_canvas *)g, error_object)) return 1;
          }
***************
*** 1643,1647 ****
  static t_canvas *canvas_findgraph(t_canvas *x) {
      t_gobj *y = 0;
!     canvas_each(z,x) if (pd_class(&z->g_pd) == canvas_class && ((t_canvas *)z)->isgraph) y = z;
      return (t_canvas *)y;
  }
--- 1643,1647 ----
  static t_canvas *canvas_findgraph(t_canvas *x) {
      t_gobj *y = 0;
!     canvas_each(z,x) if (pd_class(&z->_class) == canvas_class && ((t_canvas *)z)->isgraph) y = z;
      return (t_canvas *)y;
  }
***************
*** 1712,1716 ****
      x->listviewing = 1;
      sprintf(cmdbuf, "pdtk_array_listview_new %%s %s %d\n", x->realname->s_name, 0);
!     gfxstub_new(&x->x_gobj.g_pd, x, cmdbuf);
      for (int i=0; i < ARRAYPAGESIZE && i < a->n; i++) {
          yval = *(float *)(a->vec + elemsize*i + yonset);
--- 1712,1716 ----
      x->listviewing = 1;
      sprintf(cmdbuf, "pdtk_array_listview_new %%s %s %d\n", x->realname->s_name, 0);
!     gfxstub_new(&x->x_gobj._class, x, cmdbuf);
      for (int i=0; i < ARRAYPAGESIZE && i < a->n; i++) {
          yval = *(float *)(a->vec + elemsize*i + yonset);
***************
*** 2254,2259 ****
  void canvas_add(t_canvas *x, t_gobj *y) {
  #ifdef DEBUG_CANVAS_ADD
!     if (!y->g_pd->c_patchable) {
! 	printf("canvas_add %p %p class=%s (non-t_text)\n",x,y,y->g_pd->c_name->s_name);
      } else {
          char *buf; int bufn;
--- 2254,2259 ----
  void canvas_add(t_canvas *x, t_gobj *y) {
  #ifdef DEBUG_CANVAS_ADD
!     if (!y->_class->c_patchable) {
! 	printf("canvas_add %p %p class=%s (non-t_text)\n",x,y,y->_class->c_name->s_name);
      } else {
          char *buf; int bufn;
***************
*** 2264,2268 ****
  	    free(buf);
  	} else {
! 	    printf("canvas_add %p %p class=%s (binbuf without b_vec !)\n",x,y,y->g_pd->c_name->s_name);
  	}
      }
--- 2264,2268 ----
  	    free(buf);
  	} else {
! 	    printf("canvas_add %p %p class=%s (binbuf without b_vec !)\n",x,y,y->_class->c_name->s_name);
  	}
      }
***************
*** 2294,2302 ****
      }
      gobj_changed(x,0);
!     if (x->isgraph && !x->goprect && pd_checkobject(&y->g_pd)) {
          x->goprect = 1;
          canvas_drawredrect(x, 1);
      }
!     if (class_isdrawcommand(y->g_pd))
          canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(canvas_getcanvas(x)->name)), 0);
  }
--- 2294,2302 ----
      }
      gobj_changed(x,0);
!     if (x->isgraph && !x->goprect && pd_checkobject(&y->_class)) {
          x->goprect = 1;
          canvas_drawredrect(x, 1);
      }
!     if (class_isdrawcommand(y->_class))
          canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(canvas_getcanvas(x)->name)), 0);
  }
***************
*** 2304,2309 ****
  /* delete an object from a canvas and free it */
  void canvas_delete(t_canvas *x, t_gobj *y) {
!     t_gotfn chkdsp = zgetfn(&y->g_pd, gensym("dsp"));
!     int drawcommand = class_isdrawcommand(y->g_pd);
  
      /* if we're a drawing command, erase all scalars now, before deleting
--- 2304,2309 ----
  /* delete an object from a canvas and free it */
  void canvas_delete(t_canvas *x, t_gobj *y) {
!     t_gotfn chkdsp = zgetfn(&y->_class, gensym("dsp"));
!     int drawcommand = class_isdrawcommand(y->_class);
  
      /* if we're a drawing command, erase all scalars now, before deleting
***************
*** 2333,2337 ****
      while ((y = x->list)) {
          /* to avoid unnecessary DSP resorting, we suspend DSP only if we find a DSP object. */
!         if (!suspended && pd_checkobject(&y->g_pd) && zgetfn(&y->g_pd, dspsym)) {
              dspstate = canvas_suspend_dsp();
              suspended = 1;
--- 2333,2337 ----
      while ((y = x->list)) {
          /* to avoid unnecessary DSP resorting, we suspend DSP only if we find a DSP object. */
!         if (!suspended && pd_checkobject(&y->_class) && zgetfn(&y->_class, dspsym)) {
              dspstate = canvas_suspend_dsp();
              suspended = 1;
***************
*** 2350,2354 ****
  
  static float gobj_getxforsort(t_gobj *g) {
!     if (pd_class(&g->g_pd) == scalar_class) {
          float x1, y1;
          scalar_getbasexy((t_scalar *)g, &x1, &y1);
--- 2350,2354 ----
  
  static float gobj_getxforsort(t_gobj *g) {
!     if (pd_class(&g->_class) == scalar_class) {
          float x1, y1;
          scalar_getbasexy((t_scalar *)g, &x1, &y1);
***************
*** 2432,2439 ****
      int n=0, j, xmax, x1;
      t_gobj *y, **vec, **vp, **maxp;
!     canvas_each(y,x) if (pd_class(&y->g_pd) == vinlet_class) n++;
      if (n<2) return;
      vp = vec = (t_gobj **)getbytes(n*sizeof(*vec));
!     canvas_each(y,x) if (pd_class(&y->g_pd) == vinlet_class) *vp++ = y;
      for (int i=n; i--;) {
          t_inlet *ip;
--- 2432,2439 ----
      int n=0, j, xmax, x1;
      t_gobj *y, **vec, **vp, **maxp;
!     canvas_each(y,x) if (pd_class(&y->_class) == vinlet_class) n++;
      if (n<2) return;
      vp = vec = (t_gobj **)getbytes(n*sizeof(*vec));
!     canvas_each(y,x) if (pd_class(&y->_class) == vinlet_class) *vp++ = y;
      for (int i=n; i--;) {
          t_inlet *ip;
***************
*** 2445,2449 ****
          if (!maxp) break;
          y = *maxp; *maxp = 0;
!         ip = vinlet_getit(&y->g_pd);
          obj_moveinletfirst(&x->gl_obj, ip);
      }
--- 2445,2449 ----
          if (!maxp) break;
          y = *maxp; *maxp = 0;
!         ip = vinlet_getit(&y->_class);
          obj_moveinletfirst(&x->gl_obj, ip);
      }
***************
*** 2453,2460 ****
      int n=0, j, xmax, x1;
      t_gobj *y, **vec, **vp, **maxp;
!     canvas_each(y,x) if (pd_class(&y->g_pd) == voutlet_class) n++;
      if (n<2) return;
      vp = vec = (t_gobj **)getbytes(n*sizeof(*vec));
!     canvas_each(y,x) if (pd_class(&y->g_pd) == voutlet_class) *vp++ = y;
      for (int i=n; i--;) {
          t_outlet *ip;
--- 2453,2460 ----
      int n=0, j, xmax, x1;
      t_gobj *y, **vec, **vp, **maxp;
!     canvas_each(y,x) if (pd_class(&y->_class) == voutlet_class) n++;
      if (n<2) return;
      vp = vec = (t_gobj **)getbytes(n*sizeof(*vec));
!     canvas_each(y,x) if (pd_class(&y->_class) == voutlet_class) *vp++ = y;
      for (int i=n; i--;) {
          t_outlet *ip;
***************
*** 2466,2470 ****
          if (!maxp) break;
          y = *maxp; *maxp = 0;
!         ip = voutlet_getit(&y->g_pd);
          obj_moveoutletfirst(&x->gl_obj, ip);
      }
--- 2466,2470 ----
          if (!maxp) break;
          y = *maxp; *maxp = 0;
!         ip = voutlet_getit(&y->_class);
          obj_moveoutletfirst(&x->gl_obj, ip);
      }
***************
*** 2598,2602 ****
  	/* if there's just one "garray" in the graph, write its name along the top */
          g = x->list;
! 	if (g && !g->g_next && g->g_pd == garray_class) {
              int ymin = y1<y2 ? y1 : y2;
              t_symbol *s = garray_getname((t_garray *)g);
--- 2598,2602 ----
  	/* if there's just one "garray" in the graph, write its name along the top */
          g = x->list;
! 	if (g && !g->g_next && g->_class == garray_class) {
              int ymin = y1<y2 ? y1 : y2;
              t_symbol *s = garray_getname((t_garray *)g);
***************
*** 3052,3056 ****
  static void canvas_writelist(t_gobj *y, t_binbuf *b) {
      for (; y; y = y->g_next)
!         if (pd_class(&y->g_pd) == scalar_class)
              canvas_writescalar(((t_scalar *)y)->sc_template, ((t_scalar *)y)->sc_vec, b, 0);
  }
--- 3052,3056 ----
  static void canvas_writelist(t_gobj *y, t_binbuf *b) {
      for (; y; y = y->g_next)
!         if (pd_class(&y->_class) == scalar_class)
              canvas_writescalar(((t_scalar *)y)->sc_template, ((t_scalar *)y)->sc_vec, b, 0);
  }
***************
*** 3081,3085 ****
  static void canvas_addtemplatesforlist(t_gobj *y, int *p_ntemplates, t_symbol ***p_templatevec) {
      for (; y; y = y->g_next)
!         if (pd_class(&y->g_pd) == scalar_class)
              canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
                  ((t_scalar *)y)->sc_vec, p_ntemplates, p_templatevec);
--- 3081,3085 ----
  static void canvas_addtemplatesforlist(t_gobj *y, int *p_ntemplates, t_symbol ***p_templatevec) {
      for (; y; y = y->g_next)
!         if (pd_class(&y->_class) == scalar_class)
              canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
                  ((t_scalar *)y)->sc_vec, p_ntemplates, p_templatevec);
***************
*** 3090,3094 ****
      int ntemplates = 0;
      t_binbuf *b = binbuf_new();
!     canvas_each(y,x) if ((pd_class(&y->g_pd) == scalar_class) && wholething) {
  	t_scalar *s = (t_scalar *)y;
  	canvas_addtemplatesforscalar(s->sc_template, s->sc_vec, &ntemplates, &templatevec);
--- 3090,3094 ----
      int ntemplates = 0;
      t_binbuf *b = binbuf_new();
!     canvas_each(y,x) if ((pd_class(&y->_class) == scalar_class) && wholething) {
  	t_scalar *s = (t_scalar *)y;
  	canvas_addtemplatesforscalar(s->sc_template, s->sc_vec, &ntemplates, &templatevec);
***************
*** 3118,3122 ****
      /* now write out the objects themselves */
      canvas_each(y,x)
!         if (pd_class(&y->g_pd) == scalar_class && wholething)
              canvas_writescalar(((t_scalar *)y)->sc_template, ((t_scalar *)y)->sc_vec,  b, 0);
      return b;
--- 3118,3122 ----
      /* now write out the objects themselves */
      canvas_each(y,x)
!         if (pd_class(&y->_class) == scalar_class && wholething)
              canvas_writescalar(((t_scalar *)y)->sc_template, ((t_scalar *)y)->sc_vec,  b, 0);
      return b;
***************
*** 3183,3190 ****
  t_symbol ***templatevecp, int wholething) {
      canvas_each(y,x) {
!         if (pd_class(&y->g_pd) == scalar_class && wholething)
                  canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
                      ((t_scalar *)y)->sc_vec,  ntemplatesp, templatevecp);
!         else if (pd_class(&y->g_pd) == canvas_class && wholething)
                  canvas_collecttemplatesfor((t_canvas *)y, ntemplatesp, templatevecp, 1);
      }
--- 3183,3190 ----
  t_symbol ***templatevecp, int wholething) {
      canvas_each(y,x) {
!         if (pd_class(&y->_class) == scalar_class && wholething)
                  canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
                      ((t_scalar *)y)->sc_vec,  ntemplatesp, templatevecp);
!         else if (pd_class(&y->_class) == canvas_class && wholething)
                  canvas_collecttemplatesfor((t_canvas *)y, ntemplatesp, templatevecp, 1);
      }
***************
*** 3803,3807 ****
      TEMPLATE_CHECK(owner,templatesym,0)
      t_scalar *x = (t_scalar *)getbytes(sizeof(t_scalar) + (t->n - 1) * sizeof(*x->sc_vec));
!     x->sc_gobj.g_pd = scalar_class;
      x->sc_template = templatesym;
      gpointer_setcanvas(&gp, owner, x);
--- 3803,3807 ----
      TEMPLATE_CHECK(owner,templatesym,0)
      t_scalar *x = (t_scalar *)getbytes(sizeof(t_scalar) + (t->n - 1) * sizeof(*x->sc_vec));
!     x->sc_gobj._class = scalar_class;
      x->sc_template = templatesym;
      gpointer_setcanvas(&gp, owner, x);
***************
*** 3870,3874 ****
      }
      canvas_each(y,templatecanvas) {
!         t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
          if (wb) wb->w_parentvisfn(y, owner, x->sc_vec, t, basex, basey, vis);
      }
--- 3870,3874 ----
      }
      canvas_each(y,templatecanvas) {
!         t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
          if (wb) wb->w_parentvisfn(y, owner, x->sc_vec, t, basex, basey, vis);
      }
***************
*** 3892,3896 ****
      float basey = template_getfloat(t, gensym("y"), data, 0);
      canvas_each(y,templatecanvas) {
!         t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
          if (!wb) continue;
          hit = wb->w_parentclickfn(y, owner, data, t, sc, ap, basex+xloc, basey+yloc,
--- 3892,3896 ----
      float basey = template_getfloat(t, gensym("y"), data, 0);
      canvas_each(y,templatecanvas) {
!         t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
          if (!wb) continue;
          hit = wb->w_parentclickfn(y, owner, data, t, sc, ap, basex+xloc, basey+yloc,
***************
*** 4131,4135 ****
          gpointer_init(&gp);
          x = (t_scalar *)getbytes(sizeof(t_scalar) + (tto->n - 1) * sizeof(*x->sc_vec));
!         x->sc_gobj.g_pd = scalar_class;
          x->sc_template = tfrom->sym;
          gpointer_setcanvas(&gp, canvas, x);
--- 4131,4135 ----
          gpointer_init(&gp);
          x = (t_scalar *)getbytes(sizeof(t_scalar) + (tto->n - 1) * sizeof(*x->sc_vec));
!         x->sc_gobj._class = scalar_class;
          x->sc_template = tfrom->sym;
          gpointer_setcanvas(&gp, canvas, x);
***************
*** 4203,4207 ****
  static void template_conformcanvas(t_template *tfrom, t_template *tto, int *conformaction, t_canvas *canvas) {
      canvas_each(g,canvas) {
! 	t_class *c = pd_class(&g->g_pd);
          if (c==scalar_class)
              g = (t_gobj *)template_conformscalar(tfrom, tto, conformaction, canvas, (t_scalar *)g);
--- 4203,4207 ----
  static void template_conformcanvas(t_template *tfrom, t_template *tto, int *conformaction, t_canvas *canvas) {
      canvas_each(g,canvas) {
! 	t_class *c = pd_class(&g->_class);
          if (c==scalar_class)
              g = (t_gobj *)template_conformscalar(tfrom, tto, conformaction, canvas, (t_scalar *)g);
***************
*** 4910,4914 ****
  	    canvas_each(y,elemtemplatecanvas) {
  		int xx1, xx2, yy1, yy2;
! 		t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
  		if (!wb) continue;
  		wb->w_parentgetrectfn(y, canvas, (t_word *)((char *)array->vec + elemsize*i),
--- 4910,4914 ----
  	    canvas_each(y,elemtemplatecanvas) {
  		int xx1, xx2, yy1, yy2;
! 		t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
  		if (!wb) continue;
  		wb->w_parentgetrectfn(y, canvas, (t_word *)((char *)array->vec + elemsize*i),
***************
*** 5071,5075 ****
                  useyloc = basey + yloc + slot_cvttocoord(yslot, yval);
                  canvas_each(y,elemtemplatecanvas) {
!                     t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
                      if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i),
  			elemtemplate, usexloc, useyloc, tovis);
--- 5071,5075 ----
                  useyloc = basey + yloc + slot_cvttocoord(yslot, yval);
                  canvas_each(y,elemtemplatecanvas) {
!                     t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
                      if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i),
  			elemtemplate, usexloc, useyloc, tovis);
***************
*** 5082,5086 ****
              for (int i=0; i<nelem; i++) {
                  canvas_each(y,elemtemplatecanvas) {
!                     t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
                      if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i), elemtemplate,0,0,0);
                  }
--- 5082,5086 ----
              for (int i=0; i<nelem; i++) {
                  canvas_each(y,elemtemplatecanvas) {
!                     t_parentwidgetbehavior *wb = pd_getparentwidget(&y->_class);
                      if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i), elemtemplate,0,0,0);
                  }
***************
*** 5428,5432 ****
      if (!gobj) gobj = canvas->list;
      else gobj = gobj->g_next;
!     while (gobj && (pd_class(&gobj->g_pd) != scalar_class || wantselected)) gobj = gobj->g_next;
      if (gobj) {
          t_typedout *to = x->typedout;
--- 5428,5432 ----
      if (!gobj) gobj = canvas->list;
      else gobj = gobj->g_next;
!     while (gobj && (pd_class(&gobj->_class) != scalar_class || wantselected)) gobj = gobj->g_next;
      if (gobj) {
          t_typedout *to = x->typedout;
***************
*** 6680,6684 ****
  void pd_upload(t_gobj *self) {
  	t_binbuf *b = binbuf_new();
! 	t_class *c = self->g_pd;
  	int n;
  	char *s;
--- 6680,6684 ----
  void pd_upload(t_gobj *self) {
  	t_binbuf *b = binbuf_new();
! 	t_class *c = self->_class;
  	int n;
  	char *s;





More information about the Pd-cvs mailing list