[PD-cvs] pd/src desire.c, 1.1.2.152, 1.1.2.153 desire.h, 1.1.2.25, 1.1.2.26

Mathieu Bouchard matju at users.sourceforge.net
Thu Sep 7 02:28:24 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.c desire.h 
Log Message:
removed more gl_ prefixes and converted more for-loops to glist_each-loops


Index: desire.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.h,v
retrieving revision 1.1.2.25
retrieving revision 1.1.2.26
diff -C2 -d -r1.1.2.25 -r1.1.2.26
*** desire.h	7 Sep 2006 00:13:08 -0000	1.1.2.25
--- desire.h	7 Sep 2006 00:28:22 -0000	1.1.2.26
***************
*** 86,90 ****
  struct _glist {
      t_object gl_obj;            /* header in case we're a glist */
!     t_gobj *gl_list;            /* the actual data */
      struct _gstub *stub;     /* safe pointer handler */
      int valid;               /* incremented when pointers might be stale */
--- 86,90 ----
  struct _glist {
      t_object gl_obj;            /* header in case we're a glist */
!     t_gobj *list;            /* the actual data */
      struct _gstub *stub;     /* safe pointer handler */
      int valid;               /* incremented when pointers might be stale */
***************
*** 114,118 ****
      unsigned int goprect:1;      /* draw rectangle for graph-on-parent */
      unsigned int isgraph:1;      /* show as graph on parent */
!     long gl_next_add;               /* insertion point for next call to glist_add (for future use!?) */
  };
  
--- 114,118 ----
      unsigned int goprect:1;      /* draw rectangle for graph-on-parent */
      unsigned int isgraph:1;      /* show as graph on parent */
!     long next_add;               /* insertion point for next call to glist_add (for future use!?) */
  };
  

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.152
retrieving revision 1.1.2.153
diff -C2 -d -r1.1.2.152 -r1.1.2.153
*** desire.c	7 Sep 2006 00:13:06 -0000	1.1.2.152
--- desire.c	7 Sep 2006 00:28:21 -0000	1.1.2.153
***************
*** 49,53 ****
  
  #define class_addmethod3(_cl,_ptr,_str,_sig) class_addmethod2(_cl,(t_method)_ptr,gensym(_str),_sig)
! #define glist_each(CHILD,GLIST)   for(CHILD=(GLIST)->gl_list; CHILD; CHILD=CHILD->g_next)
  #define glists_each(GLIST,GLISTS) for(GLIST=GLISTS; GLIST; GLIST=GLIST->gl_next)
  #define glist_wire_each(WIRE,TRAV,GLIST) \
--- 49,53 ----
  
  #define class_addmethod3(_cl,_ptr,_str,_sig) class_addmethod2(_cl,(t_method)_ptr,gensym(_str),_sig)
! #define glist_each(CHILD,GLIST)   for(CHILD=(GLIST)->list; CHILD; CHILD=CHILD->g_next)
  #define glists_each(GLIST,GLISTS) for(GLIST=GLISTS; GLIST; GLIST=GLIST->gl_next)
  #define glist_wire_each(WIRE,TRAV,GLIST) \
***************
*** 425,429 ****
              t_gobj *y;
              t_object *ob = 0;
!             if (!t->tr_ob) y = t->tr_x->gl_list;
              else y = t->tr_ob->ob_g.g_next;
              for (; y; y = y->g_next) if ((ob = pd_checkobject(&y->g_pd))) break;
--- 425,429 ----
              t_gobj *y;
              t_object *ob = 0;
!             if (!t->tr_ob) y = t->tr_x->list;
              else y = t->tr_ob->ob_g.g_next;
              for (; y; y = y->g_next) if ((ob = pd_checkobject(&y->g_pd))) break;
***************
*** 490,500 ****
          canvas_newargc = 0;
          canvas_newargv = 0;
!     }
!     else x->env = 0;
  
!     if (yloc < GLIST_DEFCANVASYLOC)
!         yloc = GLIST_DEFCANVASYLOC;
!     if (xloc < 0)
!         xloc = 0;
      x->gl_x1 = 0;
      x->gl_y1 = 0;
--- 490,497 ----
          canvas_newargc = 0;
          canvas_newargv = 0;
!     } else x->env = 0;
  
!     if (yloc < GLIST_DEFCANVASYLOC) yloc = GLIST_DEFCANVASYLOC;
!     if (xloc < 0) xloc = 0;
      x->gl_x1 = 0;
      x->gl_y1 = 0;
***************
*** 508,515 ****
          pd_bind((t_pd *)x, canvas_makebindsym(x->name));
      x->loading = 1;
!     x->goprect = 0;      /* no GOP rectangle unless it's turned on later */
!         /* cancel "vis" flag if we're a subpatch of an
!          abstraction inside another patch.  A separate mechanism prevents
!          the toplevel abstraction from showing up. */
      if (vis && gensym("#X")->s_thing && *gensym("#X")->s_thing == canvas_class) {
          t_canvas *zzz = (t_canvas *)(gensym("#X")->s_thing);
--- 505,512 ----
          pd_bind((t_pd *)x, canvas_makebindsym(x->name));
      x->loading = 1;
!     x->goprect = 0; /* no GOP rectangle unless it's turned on later */
!     /* cancel "vis" flag if we're a subpatch of an
!        abstraction inside another patch.  A separate mechanism prevents
!        the toplevel abstraction from showing up. */
      if (vis && gensym("#X")->s_thing && *gensym("#X")->s_thing == canvas_class) {
          t_canvas *zzz = (t_canvas *)(gensym("#X")->s_thing);
***************
*** 520,524 ****
      x->font = sys_nearestfontsize(font);
      pd_pushsym((t_pd *)x);
!     x->gl_next_add = -1;
      return x;
  }
--- 517,521 ----
      x->font = sys_nearestfontsize(font);
      pd_pushsym((t_pd *)x);
!     x->next_add = -1;
      return x;
  }
***************
*** 761,765 ****
      int dspstate = canvas_suspend_dsp();
      if (canvas_whichfind == x) canvas_whichfind = 0;
!     while ((y = x->gl_list)) glist_delete(x, y);
      canvas_vis(x, 0);
      sys_mgui(x,"delete","");
--- 758,762 ----
      int dspstate = canvas_suspend_dsp();
      if (canvas_whichfind == x) canvas_whichfind = 0;
!     while ((y = x->list)) glist_delete(x, y);
      canvas_vis(x, 0);
      sys_mgui(x,"delete","");
***************
*** 1033,1039 ****
  
      /* find all the "dsp" boxes and add them to the graph */
!     for (y = x->gl_list; y; y = y->g_next)
!         if ((ob = pd_checkobject(&y->g_pd)) && zgetfn(&y->g_pd, dspsym))
!             ugen_add(dc, ob);
  
      /* ... and all dsp interconnections */
--- 1030,1034 ----
  
      /* find all the "dsp" boxes and add them to the graph */
!     glist_each(y,x) if ((ob = pd_checkobject(&y->g_pd)) && zgetfn(&y->g_pd, dspsym)) ugen_add(dc, ob);
  
      /* ... and all dsp interconnections */
***************
*** 1103,1107 ****
      t_gobj *g;
      void *ret = 0;
!     for (g = canvas->gl_list; g; g = g->g_next) if (g->g_pd == blockclass) ret = g;
      *canvasp = canvas->owner;
      return ret;
--- 1098,1102 ----
      t_gobj *g;
      void *ret = 0;
!     glist_each(g,canvas) if (g->g_pd == blockclass) ret = g;
      *canvasp = canvas->owner;
      return ret;
***************
*** 1118,1122 ****
      t_gobj *g;
      int vis = glist_isvisible(gl);
!     for (g = gl->gl_list; g; g = g->g_next) {
          if (vis && g->g_pd == scalar_class) {
              if      (action == 1) {/*if (glist_isvisible(gl)) gobj_vis(g, gl, 1);*/}
--- 1113,1117 ----
      t_gobj *g;
      int vis = glist_isvisible(gl);
!     glist_each(g,gl) {
          if (vis && g->g_pd == scalar_class) {
              if      (action == 1) {/*if (glist_isvisible(gl)) gobj_vis(g, gl, 1);*/}
***************
*** 1140,1144 ****
      t_template *tmpl;
      t_symbol *s1 = gensym("struct");
!     for (g = x->gl_list; g; g = g->g_next) {
          t_object *ob = pd_checkobject(&g->g_pd);
          t_atom *argv;
--- 1135,1139 ----
      t_template *tmpl;
      t_symbol *s1 = gensym("struct");
!     glist_each(g,x) {
          t_object *ob = pd_checkobject(&g->g_pd);
          t_atom *argv;
***************
*** 1174,1178 ****
  }
  
! #define glist_each2(CHILD,GLIST) for(CHILD=&(GLIST)->gl_list; *CHILD; CHILD=&(*CHILD)->g_next)
  /* just a raw remove, no other business */
  /* doesn't work (why?) */
--- 1169,1173 ----
  }
  
! #define glist_each2(CHILD,GLIST) for(CHILD=&(GLIST)->list; *CHILD; CHILD=&(*CHILD)->g_next)
  /* just a raw remove, no other business */
  /* doesn't work (why?) */
***************
*** 1226,1231 ****
  static void glist_doreload(t_glist *gl, t_symbol *name, t_symbol *dir, t_gobj *except) {
      t_gobj *g;
!     int i, nobj = glist_getindex(gl, 0);  /* number of objects */
!     for (g = gl->gl_list, i = 0; g && i < nobj; i++) {
          if (g != except && pd_class(&g->g_pd) == canvas_class &&
              canvas_isabstraction((t_canvas *)g) &&
--- 1221,1226 ----
  static void glist_doreload(t_glist *gl, t_symbol *name, t_symbol *dir, t_gobj *except) {
      t_gobj *g;
!     int i=0, nobj = glist_getindex(gl, 0);  /* number of objects */
!     for (g = gl->list; g && i < nobj; i++) {
          if (g != except && pd_class(&g->g_pd) == canvas_class &&
              canvas_isabstraction((t_canvas *)g) &&
***************
*** 1233,1246 ****
                      canvas_getdir((t_canvas *)g) == dir)
          {
!                 /* we're going to remake the object, so "g" will go stale.
!                 Get its index here, and afterward restore g.  Also, the
!                 replacement will be at the end of the list, so we don't
!                 do g = g->g_next in this case. */
              int j = glist_getindex(gl, g);
              int hadwindow = gl->havewindow;
              if (!hadwindow) canvas_vis(glist_getcanvas(gl), 1);
              g = glist_nth(gl, j);
!             if (!hadwindow)
!                 canvas_vis(glist_getcanvas(gl), 0);
          } else {
              if (g != except && pd_class(&g->g_pd) == canvas_class)
--- 1228,1239 ----
                      canvas_getdir((t_canvas *)g) == dir)
          {
!             /* we're going to remake the object, so "g" will go stale. Get its index here,
!                and afterward restore g.  Also, the replacement will be at the end of the list,
!                so we don't do g = g->g_next in this case. */
              int j = glist_getindex(gl, g);
              int hadwindow = gl->havewindow;
              if (!hadwindow) canvas_vis(glist_getcanvas(gl), 1);
              g = glist_nth(gl, j);
!             if (!hadwindow) canvas_vis(glist_getcanvas(gl), 0);
          } else {
              if (g != except && pd_class(&g->g_pd) == canvas_class)
***************
*** 1367,1373 ****
  static int canvas_dofind(t_canvas *x, int *myindex1p) {
      t_gobj *y;
!     int myindex1 = *myindex1p, myindex2;
      if (myindex1 >= canvas_find_index1) {
!         for (y=x->gl_list, myindex2=0; y; y=y->g_next, myindex2++) {
              t_object *ob = pd_checkobject(&y->g_pd);
  	    if (ob && binbuf_match(ob->ob_binbuf, canvas_findbuf)) {
--- 1360,1366 ----
  static int canvas_dofind(t_canvas *x, int *myindex1p) {
      t_gobj *y;
!     int myindex1 = *myindex1p, myindex2=0;
      if (myindex1 >= canvas_find_index1) {
!         glist_each(y,x) {
              t_object *ob = pd_checkobject(&y->g_pd);
  	    if (ob && binbuf_match(ob->ob_binbuf, canvas_findbuf)) {
***************
*** 1380,1390 ****
                      }
              }
          }
      }
!     for (y = x->gl_list, myindex2 = 0; y; y = y->g_next, myindex2++) {
          if (pd_class(&y->g_pd) == canvas_class) {
              (*myindex1p)++;
              if (canvas_dofind((t_canvas *)y, myindex1p)) return 1;
          }
      }
      return 0;
--- 1373,1386 ----
                      }
              }
+ 	    myindex2++;
          }
      }
!     myindex2=0;
!     glist_each(y,x) {
          if (pd_class(&y->g_pd) == canvas_class) {
              (*myindex1p)++;
              if (canvas_dofind((t_canvas *)y, myindex1p)) return 1;
          }
+ 	myindex2++;
      }
      return 0;
***************
*** 1426,1430 ****
  static int glist_dofinderror(t_glist *gl, void *error_object) {
      t_gobj *g;
!     for (g = gl->gl_list; g; g = g->g_next) {
          if ((void *)g == error_object) {
              /* got it... now show it. */
--- 1422,1426 ----
  static int glist_dofinderror(t_glist *gl, void *error_object) {
      t_gobj *g;
!     glist_each(g,gl) {
          if ((void *)g == error_object) {
              /* got it... now show it. */
***************
*** 1456,1460 ****
  
      /* split list to "selected" and "unselected" parts */
!     for (y = x->gl_list; y; y = y2) {
          y2 = y->g_next;
          if (y==o) {
--- 1452,1456 ----
  
      /* split list to "selected" and "unselected" parts */
!     for (y = x->list; y; y = y2) {
          y2 = y->g_next;
          if (y==o) {
***************
*** 1467,1472 ****
      }
      /* move the selected part to the end */
!     if (!nonhead) x->gl_list = selhead;
!     else x->gl_list = nonhead, nontail->g_next = selhead;
      /* add connections to binbuf */
      binbuf_clear(b);
--- 1463,1468 ----
      }
      /* move the selected part to the end */
!     if (!nonhead) x->list = selhead;
!     else x->list = nonhead, nontail->g_next = selhead;
      /* add connections to binbuf */
      binbuf_clear(b);
***************
*** 1505,1511 ****
      int nin = whoin, nout = whoout;
      if (paste_canvas == x) whoout += paste_onset, whoin += paste_onset;
!     for (src = x->gl_list; whoout; src = src->g_next, whoout--)
          if (!src->g_next) goto bad; /* bug fix thanks to Hannes */
!     for (sink = x->gl_list; whoin; sink = sink->g_next, whoin--)
          if (!sink->g_next) goto bad;
      /* check they're both patchable objects */
--- 1501,1507 ----
      int nin = whoin, nout = whoout;
      if (paste_canvas == x) whoout += paste_onset, whoin += paste_onset;
!     for (src = x->list; whoout; src = src->g_next, whoout--)
          if (!src->g_next) goto bad; /* bug fix thanks to Hannes */
!     for (sink = x->list; whoin; sink = sink->g_next, whoin--)
          if (!sink->g_next) goto bad;
      /* check they're both patchable objects */
***************
*** 1746,1750 ****
      t_array *array = garray_getarray(x);
      t_glist *gl = x->x_glist;
!     if (gl->gl_list == &x->x_gobj && !x->x_gobj.g_next) {
          vmess((t_pd *)gl, gensym("bounds"), "ffff", 0., gl->gl_y1,
  		(double)(style == PLOTSTYLE_POINTS || n == 1 ? n : n-1), gl->gl_y2);
--- 1742,1746 ----
      t_array *array = garray_getarray(x);
      t_glist *gl = x->x_glist;
!     if (gl->list == &x->x_gobj && !x->x_gobj.g_next) {
          vmess((t_pd *)gl, gensym("bounds"), "ffff", 0., gl->gl_y1,
  		(double)(style == PLOTSTYLE_POINTS || n == 1 ? n : n-1), gl->gl_y2);
***************
*** 2556,2568 ****
  
      y->g_next = 0;
!     if (!x->gl_list) x->gl_list = y; else {
! 	if (x->gl_next_add<0) {
  		t_gobj *y2;
!         	for (y2 = x->gl_list; y2->g_next; y2=y2->g_next) {}
  	        y2->g_next = y;
  	} else {
  		int i=0;
  		t_gobj *y2;
!         	for (y2 = x->gl_list; y2->g_next; y2=y2->g_next, i++) if (i==x->gl_next_add) break;
  		y->g_next = y2->g_next;
  	        y2->g_next = y;
--- 2552,2564 ----
  
      y->g_next = 0;
!     if (!x->list) x->list = y; else {
! 	if (x->next_add<0) {
  		t_gobj *y2;
!         	for (y2 = x->list; y2->g_next; y2=y2->g_next) {}
  	        y2->g_next = y;
  	} else {
  		int i=0;
  		t_gobj *y2;
!         	for (y2 = x->list; y2->g_next; y2=y2->g_next, i++) if (i==x->next_add) break;
  		y->g_next = y2->g_next;
  	        y2->g_next = y;
***************
*** 2596,2601 ****
      sys_mgui(y,"delete","");
  
!     if (x->gl_list == y) {
! 	x->gl_list = y->g_next;
      } else {
  	glist_each(g,x) if (g->g_next == y) {g->g_next = y->g_next; break;}
--- 2592,2597 ----
      sys_mgui(y,"delete","");
  
!     if (x->list == y) {
! 	x->list = y->g_next;
      } else {
  	glist_each(g,x) if (g->g_next == y) {g->g_next = y->g_next; break;}
***************
*** 2612,2616 ****
      int dspstate = 0, suspended = 0;
      t_symbol *dspsym = gensym("dsp");
!     while ((y = x->gl_list)) {
          /* to avoid unnecessary DSP resorting, we suspend DSP
          only if we hit a patchable object. */
--- 2608,2612 ----
      int dspstate = 0, suspended = 0;
      t_symbol *dspsym = gensym("dsp");
!     while ((y = x->list)) {
          /* to avoid unnecessary DSP resorting, we suspend DSP
          only if we hit a patchable object. */
***************
*** 2679,2683 ****
      float lastx = -1e37;
      t_gobj *g;
!     for (g = x->gl_list; g; g = g->g_next) {
          float x1 = gobj_getxforsort(g);
          if (x1 < lastx) foo = 1;
--- 2675,2679 ----
      float lastx = -1e37;
      t_gobj *g;
!     glist_each(g,x) {
          float x1 = gobj_getxforsort(g);
          if (x1 < lastx) foo = 1;
***************
*** 2685,2689 ****
          nitems++;
      }
!     if (foo) x->gl_list = glist_dosort(x, x->gl_list, nitems);
  }
  
--- 2681,2685 ----
          nitems++;
      }
!     if (foo) x->list = glist_dosort(x, x->list, nitems);
  }
  
***************
*** 2711,2720 ****
      int ninlets = 0, i, j, xmax;
      t_gobj *y, **vec, **vp, **maxp;
!     for (ninlets = 0, y = x->gl_list; y; y = y->g_next)
!         if (pd_class(&y->g_pd) == vinlet_class) ninlets++;
      if (ninlets < 2) return;
!     vec = (t_gobj **)getbytes(ninlets * sizeof(*vec));
!     for (y = x->gl_list, vp = vec; y; y = y->g_next)
!         if (pd_class(&y->g_pd) == vinlet_class) *vp++ = y;
      for (i = ninlets; i--;) {
          t_inlet *ip;
--- 2707,2714 ----
      int ninlets = 0, i, j, xmax;
      t_gobj *y, **vec, **vp, **maxp;
!     glist_each(y,x) if (pd_class(&y->g_pd) == vinlet_class) ninlets++;
      if (ninlets < 2) return;
!     vp = vec = (t_gobj **)getbytes(ninlets * sizeof(*vec));
!     glist_each(y,x) if (pd_class(&y->g_pd) == vinlet_class) *vp++ = y;
      for (i = ninlets; i--;) {
          t_inlet *ip;
***************
*** 2755,2764 ****
      int noutlets = 0, i, j, xmax;
      t_gobj *y, **vec, **vp, **maxp;
!     for (noutlets = 0, y = x->gl_list; y; y = y->g_next)
!         if (pd_class(&y->g_pd) == voutlet_class) noutlets++;
      if (noutlets < 2) return;
!     vec = (t_gobj **)getbytes(noutlets * sizeof(*vec));
!     for (y = x->gl_list, vp = vec; y; y = y->g_next)
!         if (pd_class(&y->g_pd) == voutlet_class) *vp++ = y;
      for (i = noutlets; i--;) {
          t_outlet *ip;
--- 2749,2756 ----
      int noutlets = 0, i, j, xmax;
      t_gobj *y, **vec, **vp, **maxp;
!     glist_each(y,x) if (pd_class(&y->g_pd) == voutlet_class) noutlets++;
      if (noutlets < 2) return;
!     vp = vec = (t_gobj **)getbytes(noutlets * sizeof(*vec));
!     glist_each(y,x) if (pd_class(&y->g_pd) == voutlet_class) *vp++ = y;
      for (i = noutlets; i--;) {
          t_outlet *ip;
***************
*** 2954,2958 ****
              (long)c, x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag);
  	/* if there's just one "garray" in the graph, write its name along the top */
!         g = x->gl_list;
  	if (g && !g->g_next && g->g_pd == garray_class) {
              int ymin = (y1 < y2 ? y1 : y2);
--- 2946,2950 ----
              (long)c, x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag);
  	/* 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);
***************
*** 3037,3041 ****
      t_glist *x = (t_glist *)z;
      float newxpix = graph_lastxpix + dx, newypix = graph_lastypix + dy;
!     t_garray *a = (t_garray *)(x->gl_list);
      int oldx = 0.5 + glist_pixelstox(x, graph_lastxpix);
      int newx = 0.5 + glist_pixelstox(x, newxpix);
--- 3029,3033 ----
      t_glist *x = (t_glist *)z;
      float newxpix = graph_lastxpix + dx, newypix = graph_lastypix + dy;
!     t_garray *a = (t_garray *)x->list;
      int oldx = 0.5 + glist_pixelstox(x, graph_lastxpix);
      int newx = 0.5 + glist_pixelstox(x, newxpix);
***************
*** 3066,3072 ****
  t_glist *glist_findgraph(t_glist *x) {
      t_gobj *y = 0, *z;
!     for (z = x->gl_list; z; z = z->g_next)
!         if (pd_class(&z->g_pd) == canvas_class && ((t_glist *)z)->isgraph)
!             y = z;
      return (t_glist *)y;
  }
--- 3058,3062 ----
  t_glist *glist_findgraph(t_glist *x) {
      t_gobj *y = 0, *z;
!     glist_each(z,x) if (pd_class(&z->g_pd) == canvas_class && ((t_glist *)z)->isgraph) y = z;
      return (t_glist *)y;
  }
***************
*** 3344,3350 ****
     we delete the scalar and put the new thing in its place on the list. */
  void canvas_dataproperties(t_canvas *x, t_scalar *sc, t_binbuf *b) {
!     int ntotal, nnew, scindex;
      t_gobj *y, *y2 = 0, *newone, *oldone = 0;
!     for (y = x->gl_list, ntotal = 0, scindex = -1; y; y = y->g_next) {
          if (y == &sc->sc_gobj) {scindex = ntotal; oldone = y;}
          ntotal++;
--- 3334,3340 ----
     we delete the scalar and put the new thing in its place on the list. */
  void canvas_dataproperties(t_canvas *x, t_scalar *sc, t_binbuf *b) {
!     int ntotal=0, nnew, scindex=-1;
      t_gobj *y, *y2 = 0, *newone, *oldone = 0;
!     glist_each(y,x) {
          if (y == &sc->sc_gobj) {scindex = ntotal; oldone = y;}
          ntotal++;
***************
*** 3356,3365 ****
          /* take the new object off the list */
          if (ntotal) {
!             for (y = x->gl_list, nnew = 1; (y2 = y->g_next); y = y2, nnew++) if (nnew == ntotal) {
                  newone = y2;
                  y->g_next = y2->g_next;
                  break;
              }
!         } else newone = x->gl_list, x->gl_list = newone->g_next;
      }
      if (!newone)      error("couldn't update properties (perhaps a format problem?)");
--- 3346,3358 ----
          /* take the new object off the list */
          if (ntotal) {
!             for (y = x->list, nnew = 1; (y2 = y->g_next); y = y2, nnew++) if (nnew == ntotal) {
                  newone = y2;
                  y->g_next = y2->g_next;
                  break;
              }
!         } else {
! 	    newone = x->list;
! 	    x->list = newone->g_next;
! 	}
      }
      if (!newone)      error("couldn't update properties (perhaps a format problem?)");
***************
*** 3368,3372 ****
          glist_delete(x, oldone);
          if (scindex > 0) {
!             for (y = x->gl_list, nnew = 1; y; y = y->g_next, nnew++)
                if (nnew == scindex || !y->g_next) {
                  newone->g_next = y->g_next;
--- 3361,3366 ----
          glist_delete(x, oldone);
          if (scindex > 0) {
! 	    nnew = 1;
!             glist_each(y,x) {
                if (nnew == scindex || !y->g_next) {
                  newone->g_next = y->g_next;
***************
*** 3374,3379 ****
                  goto didit;
                }
              bug("data_properties: can't reinsert");
!         } else newone->g_next = x->gl_list, x->gl_list = newone;
      }
  didit:
--- 3368,3378 ----
                  goto didit;
                }
+ 	      nnew++;
+ 	    }
              bug("data_properties: can't reinsert");
!         } else {
! 	    newone->g_next = x->list;
! 	    x->list = newone;
! 	}
      }
  didit:
***************
*** 3436,3440 ****
              binbuf_addsemi(b);
          } else if (template->t_vec[i].ds_type == DT_LIST) {
!             glist_writelist(w->w_list->gl_list, b);
              binbuf_addsemi(b);
          }
--- 3435,3439 ----
              binbuf_addsemi(b);
          } else if (template->t_vec[i].ds_type == DT_LIST) {
!             glist_writelist(w->w_list->list, b);
              binbuf_addsemi(b);
          }
***************
*** 3461,3466 ****
      t_template *template = template_findbyname(templatesym);
      canvas_doaddtemplate(templatesym, p_ntemplates, p_templatevec);
!     if (!template)
!         bug("canvas_addtemplatesforscalar");
      else for (ds = template->t_vec, i = template->t_n; i--; ds++, w++) {
          if (ds->ds_type == DT_ARRAY) {
--- 3460,3464 ----
      t_template *template = template_findbyname(templatesym);
      canvas_doaddtemplate(templatesym, p_ntemplates, p_templatevec);
!     if (!template) bug("canvas_addtemplatesforscalar");
      else for (ds = template->t_vec, i = template->t_n; i--; ds++, w++) {
          if (ds->ds_type == DT_ARRAY) {
***************
*** 3472,3480 ****
              for (j = 0; j < nitems; j++)
                  canvas_addtemplatesforscalar(arraytemplatesym,
!                     (t_word *)(((char *)a->a_vec) + elemsize * j), 
!                         p_ntemplates, p_templatevec);
          } else if (ds->ds_type == DT_LIST)
!             canvas_addtemplatesforlist(w->w_list->gl_list,
!                 p_ntemplates, p_templatevec);
      }
  }
--- 3470,3476 ----
              for (j = 0; j < nitems; j++)
                  canvas_addtemplatesforscalar(arraytemplatesym,
!                     (t_word *)(((char *)a->a_vec) + elemsize * j), p_ntemplates, p_templatevec);
          } else if (ds->ds_type == DT_LIST)
!             canvas_addtemplatesforlist(w->w_list->list, p_ntemplates, p_templatevec);
      }
  }
***************
*** 3495,3499 ****
      t_binbuf *b = binbuf_new();
  
!     for (y = x->gl_list; y; y = y->g_next) {
          if ((pd_class(&y->g_pd) == scalar_class) && wholething) {
              canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
--- 3491,3495 ----
      t_binbuf *b = binbuf_new();
  
!     glist_each(y,x) {
          if ((pd_class(&y->g_pd) == scalar_class) && wholething) {
              canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
***************
*** 3526,3530 ****
      binbuf_addsemi(b);
      /* now write out the objects themselves */
!     for (y = x->gl_list; y; y = y->g_next)
          if (pd_class(&y->g_pd) == scalar_class && wholething)
              canvas_writescalar(((t_scalar *)y)->sc_template, ((t_scalar *)y)->sc_vec,  b, 0);
--- 3522,3526 ----
      binbuf_addsemi(b);
      /* now write out the objects themselves */
!     glist_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);
***************
*** 3600,3604 ****
  t_symbol ***templatevecp, int wholething) {
      t_gobj *y;
!     for (y = x->gl_list; y; y = y->g_next) {
          if (pd_class(&y->g_pd) == scalar_class && wholething)
                  canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
--- 3596,3600 ----
  t_symbol ***templatevecp, int wholething) {
      t_gobj *y;
!     glist_each(y,x) {
          if (pd_class(&y->g_pd) == scalar_class && wholething)
                  canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
***************
*** 4326,4333 ****
          return;
      }
!     for (y = templatecanvas->gl_list; y; y = y->g_next) {
          t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
          if (!wb) continue;
!         (*wb->w_parentvisfn)(y, owner, x->sc_vec, template, basex, basey, vis);
      }
      sys_unqueuegui(x);
--- 4322,4329 ----
          return;
      }
!     glist_each(y,templatecanvas) {
          t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
          if (!wb) continue;
!         wb->w_parentvisfn(y, owner, x->sc_vec, template, basex, basey, vis);
      }
      sys_unqueuegui(x);
***************
*** 4350,4354 ****
      float basex = template_getfloat(template, gensym("x"), data, 0);
      float basey = template_getfloat(template, gensym("y"), data, 0);
!     for (y = templatecanvas->gl_list; y; y = y->g_next) {
          t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
          if (!wb) continue;
--- 4346,4350 ----
      float basex = template_getfloat(template, gensym("x"), data, 0);
      float basey = template_getfloat(template, gensym("y"), data, 0);
!     glist_each(y,templatecanvas) {
          t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
          if (!wb) continue;
***************
*** 4631,4640 ****
          template_conformwords(tfrom, tto, conformaction, scfrom->sc_vec, x->sc_vec);
          /* replace the old one with the new one in the list */
!         if (glist->gl_list == &scfrom->sc_gobj) {
!             glist->gl_list = &x->sc_gobj;
              x->sc_gobj.g_next = scfrom->sc_gobj.g_next;
          } else {
              t_gobj *y, *y2;
!             for (y = glist->gl_list; (y2 = y->g_next); y = y2) if (y2 == &scfrom->sc_gobj) {
                  x->sc_gobj.g_next = y2->g_next;
                  y->g_next = &x->sc_gobj;
--- 4627,4636 ----
          template_conformwords(tfrom, tto, conformaction, scfrom->sc_vec, x->sc_vec);
          /* replace the old one with the new one in the list */
!         if (glist->list == &scfrom->sc_gobj) {
!             glist->list = &x->sc_gobj;
              x->sc_gobj.g_next = scfrom->sc_gobj.g_next;
          } else {
              t_gobj *y, *y2;
!             for (y = glist->list; (y2 = y->g_next); y = y2) if (y2 == &scfrom->sc_gobj) {
                  x->sc_gobj.g_next = y2->g_next;
                  y->g_next = &x->sc_gobj;
***************
*** 4710,4714 ****
      t_gobj *g;
      /* post("conform glist %s", glist->name->s_name); */
!     for (g = glist->gl_list; g; g = g->g_next) {
          if (pd_class(&g->g_pd) == scalar_class)
              g = &template_conformscalar(tfrom, tto, conformaction,
--- 4706,4710 ----
      t_gobj *g;
      /* post("conform glist %s", glist->name->s_name); */
!     glist_each(g,glist) {
          if (pd_class(&g->g_pd) == scalar_class)
              g = &template_conformscalar(tfrom, tto, conformaction,
***************
*** 5569,5573 ****
                  else yval = 0;
                  useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval);
!                 for (y = elemtemplatecanvas->gl_list; y; y = y->g_next) {
                      int xx1, xx2, yy1, yy2;
                      t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
--- 5565,5569 ----
                  else yval = 0;
                  useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval);
!                 glist_each(y,elemtemplatecanvas) {
                      int xx1, xx2, yy1, yy2;
                      t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
***************
*** 5737,5741 ****
                  if (yonset >= 0) yval = *(float *)((elem + elemsize * i) + yonset); else yval = 0;
                  useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval);
!                 for (y = elemtemplatecanvas->gl_list; y; y = y->g_next) {
                      t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
                      if (!wb) continue;
--- 5733,5737 ----
                  if (yonset >= 0) yval = *(float *)((elem + elemsize * i) + yonset); else yval = 0;
                  useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval);
!                 glist_each(y,elemtemplatecanvas) {
                      t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
                      if (!wb) continue;
***************
*** 5750,5754 ****
              for (i = 0; i < nelem; i++) {
                  t_gobj *y;
!                 for (y = elemtemplatecanvas->gl_list; y; y = y->g_next) {
                      t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
                      if (!wb) continue;
--- 5746,5750 ----
              for (i = 0; i < nelem; i++) {
                  t_gobj *y;
!                 glist_each(y,elemtemplatecanvas) {
                      t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
                      if (!wb) continue;
***************
*** 6152,6156 ****
      if (wantselected && !glist_isvisible(glist)) {pd_error(x, "ptrobj_vnext: next-selected only works for a visible window"); return;}
      gobj = &gp->gp_un.gp_scalar->sc_gobj;
!     if (!gobj) gobj = glist->gl_list;
      else gobj = gobj->g_next;
      while (gobj && (pd_class(&gobj->g_pd) != scalar_class || wantselected)) gobj = gobj->g_next;
--- 6148,6152 ----
      if (wantselected && !glist_isvisible(glist)) {pd_error(x, "ptrobj_vnext: next-selected only works for a visible window"); return;}
      gobj = &gp->gp_un.gp_scalar->sc_gobj;
!     if (!gobj) gobj = glist->list;
      else gobj = gobj->g_next;
      while (gobj && (pd_class(&gobj->g_pd) != scalar_class || wantselected)) gobj = gobj->g_next;
***************
*** 6690,6695 ****
          oldsc->sc_gobj.g_next = &sc->sc_gobj;
      } else {
!         sc->sc_gobj.g_next = glist->gl_list;
!         glist->gl_list = &sc->sc_gobj;
      }
      if (glist_isvisible(glist_getcanvas(glist))) gobj_changed(&sc->sc_gobj, 0);
--- 6686,6691 ----
          oldsc->sc_gobj.g_next = &sc->sc_gobj;
      } else {
!         sc->sc_gobj.g_next = glist->list;
!         glist->list = &sc->sc_gobj;
      }
      if (glist_isvisible(glist_getcanvas(glist))) gobj_changed(&sc->sc_gobj, 0);
***************
*** 7417,7423 ****
      	canvas_objtext(x,atom_getintarg(3,argc,argv),atom_getintarg(4,argc,argv),0,b);
  	*/
! 	x->gl_next_add = i;
  	canvas_obj(x,gensym("obj"),argc-3,argv+3);
! 	x->gl_next_add = -1;
  	/* canvas_reorder_last(x,i); */
  	gobj_changed(x,0);
--- 7413,7419 ----
      	canvas_objtext(x,atom_getintarg(3,argc,argv),atom_getintarg(4,argc,argv),0,b);
  	*/
! 	x->next_add = i;
  	canvas_obj(x,gensym("obj"),argc-3,argv+3);
! 	x->next_add = -1;
  	/* canvas_reorder_last(x,i); */
  	gobj_changed(x,0);





More information about the Pd-cvs mailing list