[PD-cvs] pd/src desire.c,1.1.2.217.2.148,1.1.2.217.2.149

Mathieu Bouchard matju at users.sourceforge.net
Tue Jul 10 21:35:16 CEST 2007


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

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.148
retrieving revision 1.1.2.217.2.149
diff -C2 -d -r1.1.2.217.2.148 -r1.1.2.217.2.149
*** desire.c	10 Jul 2007 17:52:52 -0000	1.1.2.217.2.148
--- desire.c	10 Jul 2007 19:35:11 -0000	1.1.2.217.2.149
***************
*** 1592,1596 ****
  void garray_arrayviewlist_new(t_garray *x) {
      int yonset=0, elemsize=0;
-     float yval;
      char cmdbuf[200];
      t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
--- 1592,1595 ----
***************
*** 1599,1603 ****
      sprintf(cmdbuf, "pdtk_array_listview_new %%s %s %d\n", x->realname->name, 0);
      for (int i=0; i < ARRAYPAGESIZE && i < a->n; i++) {
!         yval = *(float *)(a->vec + elemsize*i + yonset);
          sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->realname->name, i, i, yval);
      }
--- 1598,1602 ----
      sprintf(cmdbuf, "pdtk_array_listview_new %%s %s %d\n", x->realname->name, 0);
      for (int i=0; i < ARRAYPAGESIZE && i < a->n; i++) {
!         float yval = *(float *)(a->vec + elemsize*i + yonset);
          sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->realname->name, i, i, yval);
      }
***************
*** 1606,1610 ****
  void garray_arrayviewlist_fillpage(t_garray *x, t_float page, t_float fTopItem) {
      int yonset=0, elemsize=0, topItem=(int)fTopItem;
-     float yval;
      t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
      if (!a) pd_error(x,"error in garray_arrayviewlist_new()");
--- 1605,1608 ----
***************
*** 1618,1622 ****
      sys_vgui(".%sArrayWindow.lb delete 0 %d\n", x->realname->name, ARRAYPAGESIZE - 1);
      for (int i = (int)page * ARRAYPAGESIZE; (i < (page+1)*ARRAYPAGESIZE && i < a->n); i++)    {
!         yval = *(float *)(a->vec + elemsize*i + yonset);
          sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->realname->name, i%ARRAYPAGESIZE, i, yval);
      }
--- 1616,1620 ----
      sys_vgui(".%sArrayWindow.lb delete 0 %d\n", x->realname->name, ARRAYPAGESIZE - 1);
      for (int i = (int)page * ARRAYPAGESIZE; (i < (page+1)*ARRAYPAGESIZE && i < a->n); i++)    {
!         float yval = *(float *)(a->vec + elemsize*i + yonset);
          sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->realname->name, i%ARRAYPAGESIZE, i, yval);
      }
***************
*** 1625,1632 ****
  
  static void garray_free(t_garray *x) {
-     t_pd *x2;
      if (x->listviewing) garray_arrayviewlist_close(x);
      pd_unbind(x,x->realname);
      /* LATER find a way to get #A unbound earlier (at end of load?) */
      while ((x2 = pd_findbyclass(gensym("#A"), garray_class))) pd_unbind(x2, gensym("#A"));
  }
--- 1623,1630 ----
  
  static void garray_free(t_garray *x) {
      if (x->listviewing) garray_arrayviewlist_close(x);
      pd_unbind(x,x->realname);
      /* LATER find a way to get #A unbound earlier (at end of load?) */
+     t_pd *x2;
      while ((x2 = pd_findbyclass(gensym("#A"), garray_class))) pd_unbind(x2, gensym("#A"));
  }
***************
*** 2019,2026 ****
  static void garray_yticks(t_garray *x, t_floatarg point, t_floatarg inc, t_floatarg f)
  {vmess(x->canvas, gensym("yticks"), "fff", point, inc, f);}
! static void garray_xlabel(t_garray *x, t_symbol *s, int argc, t_atom *argv)
! {typedmess(x->canvas, s, argc, argv);}
! static void garray_ylabel(t_garray *x, t_symbol *s, int argc, t_atom *argv)
! {typedmess(x->canvas, s, argc, argv);}
  
  static void garray_rename(t_garray *x, t_symbol *s) {
--- 2017,2022 ----
  static void garray_yticks(t_garray *x, t_floatarg point, t_floatarg inc, t_floatarg f)
  {vmess(x->canvas, gensym("yticks"), "fff", point, inc, f);}
! static void garray_xlabel(t_garray *x, t_symbol *s, int argc, t_atom *argv) {typedmess(x->canvas, s, argc, argv);}
! static void garray_ylabel(t_garray *x, t_symbol *s, int argc, t_atom *argv) {typedmess(x->canvas, s, argc, argv);}
  
  static void garray_rename(t_garray *x, t_symbol *s) {
***************
*** 2040,2045 ****
      TEMPLATE_FLOATY(x,array,)
      nelem = array->n;
!     if ((filedesc = canvas_open(canvas_getcanvas(x->canvas),
!       filename->name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0 || !(fd = fdopen(filedesc, "r"))) {
          pd_error(x,"%s: can't open", filename->name);
          return;
--- 2036,2041 ----
      TEMPLATE_FLOATY(x,array,)
      nelem = array->n;
!     filedesc = canvas_open(canvas_getcanvas(x->canvas), filename->name, "", buf, &bufptr, MAXPDSTRING, 0);
!     if (filedesc<0 || !(fd = fdopen(filedesc, "r"))) {
          pd_error(x,"%s: can't open", filename->name);
          return;
***************
*** 2088,2093 ****
      t_array *array = garray_getarray(x);
      int n = f<1?1:(int)f;
!     garray_fittograph(x, n, (int)template_getfloat(
!         template_findbyname(x->scalar->t), gensym("style"), x->scalar->v, 1));
      array_resize_and_redraw(array, n);
      if (x->usedindsp) canvas_update_dsp();
--- 2084,2088 ----
      t_array *array = garray_getarray(x);
      int n = f<1?1:(int)f;
!     garray_fittograph(x, n, (int)template_getfloat(template_findbyname(x->scalar->t), gensym("style"), x->scalar->v, 1));
      array_resize_and_redraw(array, n);
      if (x->usedindsp) canvas_update_dsp();
***************
*** 2214,2220 ****
  static t_gobj *canvas_merge(t_canvas *x, t_gobj *g1, t_gobj *g2) {
      t_gobj *g = 0, *g9 = 0;
!     float f1 = 0, f2 = 0;
!     if (g1) f1 = gobj_getxforsort(g1);
!     if (g2) f2 = gobj_getxforsort(g2);
      while (1) {
  	if (g1 && !(g2 && f1>f2)) {
--- 2209,2214 ----
  static t_gobj *canvas_merge(t_canvas *x, t_gobj *g1, t_gobj *g2) {
      t_gobj *g = 0, *g9 = 0;
!     float f1 = g1 ? gobj_getxforsort(g1) : 0;
!     float f2 = g2 ? gobj_getxforsort(g2) : 0;
      while (1) {
  	if (g1 && !(g2 && f1>f2)) {
***************
*** 2382,2396 ****
  static int canvas_xtopixels(t_canvas *x, float xval) {
      int x1, y1, x2, y2; float width = x->x2-x->x1;
!     if (!x->isgraph) return (int)((xval-x->x1)/width);
!     if (x->havewindow) return (int)((x->screenx2-x->screenx1) * (xval-x->x1) / width);
      graph_graphrect(x, x->owner, &x1, &y1, &x2, &y2);
!     return (int)(x1 + (x2-x1) * (xval-x->x1) / width);
  }
  static int canvas_ytopixels(t_canvas *x, float yval) {
      int x1, y1, x2, y2; float height = x->y2-x->y1;
!     if (!x->isgraph) return (int)((yval-x->y1)/height);
!     if (x->havewindow) return (int)((x->screeny2-x->screeny1) * (yval-x->y1) / height);
      graph_graphrect(x, x->owner, &x1, &y1, &x2, &y2);
!     return (int)(y1 + (y2-y1) * (yval-x->y1) / height);
  }
  
--- 2376,2390 ----
  static int canvas_xtopixels(t_canvas *x, float xval) {
      int x1, y1, x2, y2; float width = x->x2-x->x1;
!     if (!x->isgraph) return int((xval-x->x1)/width);
!     if (x->havewindow) return int((x->screenx2-x->screenx1) * (xval-x->x1) / width);
      graph_graphrect(x, x->owner, &x1, &y1, &x2, &y2);
!     return int(x1 + (x2-x1) * (xval-x->x1) / width);
  }
  static int canvas_ytopixels(t_canvas *x, float yval) {
      int x1, y1, x2, y2; float height = x->y2-x->y1;
!     if (!x->isgraph) return int((yval-x->y1)/height);
!     if (x->havewindow) return int((x->screeny2-x->screeny1) * (yval-x->y1) / height);
      graph_graphrect(x, x->owner, &x1, &y1, &x2, &y2);
!     return int(y1 + (y2-y1) * (yval-x->y1) / height);
  }
  
***************
*** 2488,2497 ****
  	#define DRAWLABEL(x1,y1) sys_vgui(".x%lx.c create text %d %d -text {%s} -font "FONT" -tags %s\n", (long)c, \
  		int(canvas_xtopixels(x,x1)),int(canvas_ytopixels(x,y1)),s,canvas_getfont(x),tag);
!         for (int i=0; i < x->nxlabels; i++) {
! 	    char *s = x->xlabel[i]->name; DRAWLABEL(atof(s),x->xlabely);
! 	}
!         for (int i=0; i < x->nylabels; i++) {
! 	    char *s = x->ylabel[i]->name; DRAWLABEL(x->ylabelx,atof(s));
! 	}
  }
  
--- 2482,2487 ----
  	#define DRAWLABEL(x1,y1) sys_vgui(".x%lx.c create text %d %d -text {%s} -font "FONT" -tags %s\n", (long)c, \
  		int(canvas_xtopixels(x,x1)),int(canvas_ytopixels(x,y1)),s,canvas_getfont(x),tag);
!         for (int i=0; i < x->nxlabels; i++) {char *s = x->xlabel[i]->name; DRAWLABEL(atof(s),x->xlabely);}
!         for (int i=0; i < x->nylabels; i++) {char *s = x->ylabel[i]->name; DRAWLABEL(x->ylabelx,atof(s));}
  }
  
***************
*** 2571,2575 ****
  static void canvas_readatoms(t_canvas *x, int natoms, t_atom *vec,
  int *p_nextmsg, t_symbol *templatesym, t_word *w, int argc, t_atom *argv) {
-     int message, n;
      t_template *t = template_findbyname(templatesym);
      if (!t) {
--- 2561,2564 ----
***************
*** 2579,2583 ****
      }
      word_restore(w, t, argc, argv);
!     n = t->n;
      for (int i = 0; i < n; i++) {
          if (t->vec[i].type == DT_ARRAY) {
--- 2568,2572 ----
      }
      word_restore(w, t, argc, argv);
!     int n = t->n;
      for (int i = 0; i < n; i++) {
          if (t->vec[i].type == DT_ARRAY) {
***************
*** 2586,2593 ****
              t_symbol *arraytemplatesym = t->vec[i].arraytemplate;
              t_template *arraytemplate = template_findbyname(arraytemplatesym);
!             if (!arraytemplate) {
!                 pd_error(x,"%s: no such template", arraytemplatesym->name);
!             }
              else while (1) {
                  t_word *element;
                  int nline = canvas_scanbinbuf(natoms, vec, &message, p_nextmsg);
--- 2575,2581 ----
              t_symbol *arraytemplatesym = t->vec[i].arraytemplate;
              t_template *arraytemplate = template_findbyname(arraytemplatesym);
!             if (!arraytemplate) pd_error(x,"%s: no such template", arraytemplatesym->name);
              else while (1) {
+ 		int message;
                  t_word *element;
                  int nline = canvas_scanbinbuf(natoms, vec, &message, p_nextmsg);
***************
*** 2599,2604 ****
                  nitems++;
              }
!         }
!         else if (t->vec[i].type == DT_LIST) {
              while (1) {
                  if (!canvas_readscalar(w->w_list, natoms, vec, p_nextmsg, 0)) break;
--- 2587,2591 ----
                  nitems++;
              }
!         } else if (t->vec[i].type == DT_LIST) {
              while (1) {
                  if (!canvas_readscalar(w->w_list, natoms, vec, p_nextmsg, 0)) break;
***************
*** 2693,2699 ****
      t_canvas *canvas = canvas_getcanvas(x);
      int wasvis = canvas_isvisible(canvas);
!     int cr = 0;
!     if (!strcmp(format->name, "cr")) cr = 1;
!     else if (*format->name) pd_error(x,"canvas_read: unknown flag: %s", format->name);
  
      /* flag 2 means eval continuously. this is required to autodetect the syntax */
--- 2680,2685 ----
      t_canvas *canvas = canvas_getcanvas(x);
      int wasvis = canvas_isvisible(canvas);
!     int cr = strcmp(format->name, "cr")==0;
!     if (!cr && *format->name) pd_error(x,"canvas_read: unknown flag: %s", format->name);
  
      /* flag 2 means eval continuously. this is required to autodetect the syntax */
***************
*** 2717,2721 ****
     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;
      canvas_each(y,x) {
--- 2703,2707 ----
     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, scindex=-1;
      t_gobj *y, *y2 = 0, *newone, *oldone = 0;
      canvas_each(y,x) {
***************
*** 2729,2733 ****
          /* 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;
--- 2715,2720 ----
          /* take the new object off the list */
          if (ntotal) {
! 	    int nnew = 1;
!             for (y = x->list; (y2 = y->g_next); y = y2, nnew++) if (nnew == ntotal) {
                  newone = y2;
                  y->g_next = y2->g_next;
***************
*** 2744,2748 ****
          canvas_delete(x, oldone);
          if (scindex > 0) {
! 	    nnew = 1;
              canvas_each(y,x) {
                if (nnew == scindex || !y->g_next) {
--- 2731,2735 ----
          canvas_delete(x, oldone);
          if (scindex > 0) {
! 	    int nnew = 1;
              canvas_each(y,x) {
                if (nnew == scindex || !y->g_next) {
***************
*** 2826,2835 ****
  
  static void canvas_addtemplatesforscalar(t_symbol *templatesym, t_word *w, int *p_ntemplates, t_symbol ***p_templatevec) {
-     t_dataslot *ds;
-     int i;
      t_template *t = template_findbyname(templatesym);
      canvas_doaddtemplate(templatesym, p_ntemplates, p_templatevec);
!     if (!t) bug("canvas_addtemplatesforscalar");
!     else for (ds = t->vec, i = t->n; i--; ds++, w++) {
          if (ds->type == DT_ARRAY) {
              t_array *a = w->w_array;
--- 2813,2821 ----
  
  static void canvas_addtemplatesforscalar(t_symbol *templatesym, t_word *w, int *p_ntemplates, t_symbol ***p_templatevec) {
      t_template *t = template_findbyname(templatesym);
      canvas_doaddtemplate(templatesym, p_ntemplates, p_templatevec);
!     if (!t) {bug("canvas_addtemplatesforscalar"); return;}
!     t_dataslot *ds = t->vec;
!     for (int i=t->n; i--; ds++, w++) {
          if (ds->type == DT_ARRAY) {
              t_array *a = w->w_array;
***************
*** 2890,2899 ****
  
  static void canvas_write(t_canvas *x, t_symbol *filename, t_symbol *format) {
-     int cr = 0;
      char buf[MAXPDSTRING];
      t_canvas *canvas = canvas_getcanvas(x);
      canvas_makefilename(canvas, filename->name, buf, MAXPDSTRING);
!     if (!strcmp(format->name, "cr")) cr = 1;
!     else if (*format->name) pd_error(x,"canvas_write: unknown flag: %s", format->name);
      t_binbuf *b = canvas_writetobinbuf(x);
      if (b) {
--- 2876,2884 ----
  
  static void canvas_write(t_canvas *x, t_symbol *filename, t_symbol *format) {
      char buf[MAXPDSTRING];
      t_canvas *canvas = canvas_getcanvas(x);
      canvas_makefilename(canvas, filename->name, buf, MAXPDSTRING);
!     int cr = strcmp(format->name, "cr")==0;
!     if (!cr && *format->name) pd_error(x,"canvas_write: unknown flag: %s", format->name);
      t_binbuf *b = canvas_writetobinbuf(x);
      if (b) {
***************
*** 2929,2935 ****
  static void canvas_savecoordsto(t_canvas *x, t_binbuf *b) {
      /* if everything is the default, skip saving this line */
!     if (!x->isgraph && x->x1==0 && x->y1==0 &&
!         x->x2==1 && x->y2==1 && x->pixwidth==0 && x->pixheight==0) return;
! 
      /* if we have a graph-on-parent rectangle, we're new style. The format is arranged so
         that old versions of Pd can at least do something with it.
--- 2914,2918 ----
  static void canvas_savecoordsto(t_canvas *x, t_binbuf *b) {
      /* if everything is the default, skip saving this line */
!     if (!x->isgraph && x->x1==0 && x->y1==0 && x->x2==1 && x->y2==1 && x->pixwidth==0 && x->pixheight==0) return;
      /* if we have a graph-on-parent rectangle, we're new style. The format is arranged so
         that old versions of Pd can at least do something with it.
***************
*** 2972,2976 ****
      for (int i=0; i < ntemplates; i++) {
          t_template *t = template_findbyname(templatevec[i]);
-         int j, m = t->n;
          if (!t) {
              bug("canvas_savetemplatesto");
--- 2955,2958 ----
***************
*** 2979,2983 ****
          /* drop "pd-" prefix from template symbol to print */
          binbuf_addv(b,"ttt","#N","struct",templatevec[i]->name+3);
!         for (j = 0; j < m; j++) {
              t_symbol *type;
              switch (t->vec[j].type) {
--- 2961,2965 ----
          /* drop "pd-" prefix from template symbol to print */
          binbuf_addv(b,"ttt","#N","struct",templatevec[i]->name+3);
!         for (int j=0; j<t->n; j++) {
              t_symbol *type;
              switch (t->vec[j].type) {
***************
*** 3052,3067 ****
  }
  
! static void vinlet_bang(t_vinlet *x)
! {outlet_bang(x->ob_outlet);}
! static void vinlet_pointer(t_vinlet *x, t_gpointer *gp)
! {outlet_pointer(x->ob_outlet, gp);}
! static void vinlet_float(t_vinlet *x, t_float f)
! {outlet_float(x->ob_outlet, f);}
! static void vinlet_symbol(t_vinlet *x, t_symbol *s)
! {outlet_symbol(x->ob_outlet, s);}
! static void vinlet_list(t_vinlet *x, t_symbol *s, int argc, t_atom *argv)
! {outlet_list(x->ob_outlet, s, argc, argv);}
! static void vinlet_anything(t_vinlet *x, t_symbol *s, int argc, t_atom *argv)
! {outlet_anything(x->ob_outlet, s, argc, argv);}
  
  static void vinlet_free(t_vinlet *x) {
--- 3034,3043 ----
  }
  
! static void vinlet_bang(t_vinlet *x)                    {outlet_bang(x->outlet);}
! static void vinlet_pointer(t_vinlet *x, t_gpointer *gp) {outlet_pointer(x->outlet, gp);}
! static void vinlet_float(t_vinlet *x, t_float f)        {outlet_float(x->outlet, f);}
! static void vinlet_symbol(t_vinlet *x, t_symbol *s)     {outlet_symbol(x->outlet, s);}
! static void vinlet_list(t_vinlet *x, t_symbol *s, int argc, t_atom *argv)     {outlet_list(x->outlet, s, argc, argv);}
! static void vinlet_anything(t_vinlet *x, t_symbol *s, int argc, t_atom *argv) {outlet_anything(x->outlet, s, argc, argv);}
  
  static void vinlet_free(t_vinlet *x) {
***************
*** 4000,4004 ****
  
  void template_notify(t_template *t, t_symbol *s, int argc, t_atom *argv) {
!     if (t->list) outlet_anything(t->list->ob_outlet, s, argc, argv);
  }
  
--- 3976,3980 ----
  
  void template_notify(t_template *t, t_symbol *s, int argc, t_atom *argv) {
!     if (t->list) outlet_anything(t->list->outlet, s, argc, argv);
  }
  
***************
*** 5309,5313 ****
      if (indx >= nitems) indx = nitems-1;
      gpointer_setarray(&x->gp, array, (t_word *)&array->vec[indx*elemsize]);
!     outlet_pointer(x->ob_outlet, &x->gp);
  }
  
--- 5285,5289 ----
      if (indx >= nitems) indx = nitems-1;
      gpointer_setarray(&x->gp, array, (t_word *)&array->vec[indx*elemsize]);
!     outlet_pointer(x->outlet, &x->gp);
  }
  
***************
*** 5351,5355 ****
      t_word *w = gpointer_word(gp);
      t_array *array = *(t_array **)(((char *)w) + onset);
!     outlet_float(x->ob_outlet, (float)(array->n));
  }
  
--- 5327,5331 ----
      t_word *w = gpointer_word(gp);
      t_array *array = *(t_array **)(((char *)w) + onset);
!     outlet_float(x->outlet, (float)(array->n));
  }
  
***************
*** 5478,5482 ****
      for (int i=0; i<nitems; i++,vp++) template_setfloat(t, vp->sym, vec, vp->f, 1);
      scalar_redraw(sc, canvas);
!     outlet_pointer(x->ob_outlet, gp);
  }
  
--- 5454,5458 ----
      for (int i=0; i<nitems; i++,vp++) template_setfloat(t, vp->sym, vec, vp->f, 1);
      scalar_redraw(sc, canvas);
!     outlet_pointer(x->outlet, gp);
  }
  
***************
*** 5518,5522 ****
      t_word *w = gpointer_word(gp);
      gpointer_setcanvas(&x->gp, *(t_canvas **)(((char *)w) + onset), 0);
!     outlet_pointer(x->ob_outlet, &x->gp);
  }
  
--- 5494,5498 ----
      t_word *w = gpointer_word(gp);
      gpointer_setcanvas(&x->gp, *(t_canvas **)(((char *)w) + onset), 0);
!     outlet_pointer(x->outlet, &x->gp);
  }
  
***************
*** 5697,5705 ****
  }
  
! struct t_mresp {
!     t_pd mr_pd;
      t_outlet *outlet;
  };
- 
  struct t_message : t_text {
      t_mresp mresp;
--- 5673,5679 ----
  }
  
! struct t_mresp : t_pd {
      t_outlet *outlet;
  };
  struct t_message : t_text {
      t_mresp mresp;
***************
*** 5716,5726 ****
  
  static void message_bang(t_message *x)
! {binbuf_eval(x->binbuf, &x->mresp.mr_pd, 0, 0);}
  static void message_float(t_message *x, t_float f)
! {t_atom at; SETFLOAT(&at, f);  binbuf_eval(x->binbuf, &x->mresp.mr_pd, 1, &at);}
  static void message_symbol(t_message *x, t_symbol *s)
! {t_atom at; SETSYMBOL(&at, s); binbuf_eval(x->binbuf, &x->mresp.mr_pd, 1, &at);}
  static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_eval(x->binbuf, &x->mresp.mr_pd, argc, argv);}
  static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
  {binbuf_add(x->binbuf, argc, argv); gobj_changed(x,"binbuf");}
--- 5690,5700 ----
  
  static void message_bang(t_message *x)
! {binbuf_eval(x->binbuf,&x->mresp, 0, 0);}
  static void message_float(t_message *x, t_float f)
! {t_atom at; SETFLOAT(&at, f);  binbuf_eval(x->binbuf, &x->mresp, 1, &at);}
  static void message_symbol(t_message *x, t_symbol *s)
! {t_atom at; SETSYMBOL(&at, s); binbuf_eval(x->binbuf, &x->mresp, 1, &at);}
  static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_eval(x->binbuf, &x->mresp, argc, argv);}
  static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
  {binbuf_add(x->binbuf, argc, argv); gobj_changed(x,"binbuf");}
***************
*** 5751,5755 ****
  void canvas_msg(t_canvas *gl, t_symbol *s, int argc, t_atom *argv) {
      t_message *x = (t_message *)pd_new(message_class);
!     x->mresp.mr_pd._class = mresp_class;
      x->mresp.outlet = outlet_new(x,&s_float);
      x->binbuf = binbuf_new();
--- 5725,5729 ----
  void canvas_msg(t_canvas *gl, t_symbol *s, int argc, t_atom *argv) {
      t_message *x = (t_message *)pd_new(message_class);
!     x->mresp._class = mresp_class;
      x->mresp.outlet = outlet_new(x,&s_float);
      x->binbuf = binbuf_new();
***************
*** 6448,6452 ****
  
  static void bng_bout2(t_bng *x) {
!     outlet_bang(x->ob_outlet);
      if(x->snd && x->snd->thing) pd_bang(x->snd->thing);
  }
--- 6422,6426 ----
  
  static void bng_bout2(t_bng *x) {
!     outlet_bang(x->outlet);
      if(x->snd && x->snd->thing) pd_bang(x->snd->thing);
  }
***************
*** 6454,6458 ****
  static void bng_bang(t_bng *x) {
      bng_set(x);
!     outlet_bang(x->ob_outlet);
      if(x->snd && x->snd->thing && iemgui_forward(x)) pd_bang(x->snd->thing);
  }
--- 6428,6432 ----
  static void bng_bang(t_bng *x) {
      bng_set(x);
!     outlet_bang(x->outlet);
      if(x->snd && x->snd->thing && iemgui_forward(x)) pd_bang(x->snd->thing);
  }
***************
*** 6509,6513 ****
  
  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);
  }
--- 6483,6487 ----
  
  static void toggle_action(t_toggle *x) {
!     outlet_float(x->outlet, x->on);
      if(x->snd && x->snd->thing) pd_float(x->snd->thing, x->on);
  }
***************
*** 6568,6577 ****
  	SETFLOAT(x->at,a);
  	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);
  }
--- 6542,6551 ----
  	SETFLOAT(x->at,a);
  	SETFLOAT(x->at+1,b);
! 	outlet_list(x->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->outlet,a);
  	if(x->snd && x->snd->thing) pd_float(x->snd->thing,a);
  }
***************
*** 6708,6712 ****
      double out = x->is_log ? x->min*exp(t) : x->min+t;
      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);
  }
--- 6682,6686 ----
      double out = x->is_log ? x->min*exp(t) : x->min+t;
      if (fabs(out) < 1.0e-10) out = 0.0;
!     outlet_float(x->outlet, out);
      if(x->snd && x->snd->thing) pd_float(x->snd->thing, out);
  }
***************
*** 6791,6795 ****
  
  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);
  }
--- 6765,6769 ----
  
  static void nbx_bang(t_nbx *x) {
!     outlet_float(x->outlet, x->val);
      if(x->snd && x->snd->thing) pd_float(x->snd->thing, x->val);
  }
***************
*** 7012,7016 ****
  
  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);
  }
--- 6986,6990 ----
  
  static void dropper_bang(t_dropper *x) {
!     outlet_symbol(x->outlet, x->ds);
      if(x->snd && x->snd->thing) pd_symbol(x->snd->thing, x->ds);
  }
***************
*** 7124,7140 ****
  }
  
!     /* utility function to read a file, looking first down the canvas's search
!     path (set with "declare" objects in the patch and recursively in calling
!     patches), then down the system one.  The filename is the concatenation of
!     "name" and "ext".  "Name" may be absolute, or may be relative with
!     slashes.  If anything can be opened, the true directory
!     ais put in the buffer dirresult (provided by caller), which should
!     be "size" bytes.  The "nameresult" pointer will be set somewhere in
!     the interior of "dirresult" and will give the file basename (with
!     slashes trimmed).  If "bin" is set a 'binary' open is
!     attempted, otherwise ASCII (this only matters on Microsoft.) 
!     If "x" is zero, the file is sought in the directory "." or in the
!     global path.*/
! 
  int canvas_open(t_canvas *x, const char *name, const char *ext,
  char *dirresult, char **nameresult, unsigned int size, int bin) {
--- 7098,7109 ----
  }
  
! /* utility function to read a file, looking first down the canvas's search path (set with "declare"
!    objects in the patch and recursively in calling patches), then down the system one. The filename
!    is the concatenation of "name" and "ext". "Name" may be absolute, or may be relative with slashes.
!    If anything can be opened, the true directory is put in the buffer dirresult (provided by caller),
!    which should be "size" bytes.  The "nameresult" pointer will be set somewhere in the interior of
!    "dirresult" and will give the file basename (with slashes trimmed).  If "bin" is set a 'binary'
!    open is attempted, otherwise ASCII (this only matters on Microsoft.) If "x" is zero, the file is
!    sought in the directory "." or in the global path.*/
  int canvas_open(t_canvas *x, const char *name, const char *ext,
  char *dirresult, char **nameresult, unsigned int size, int bin) {
***************
*** 7168,7172 ****
      reply_class = class_new2("reply",0,reply_free,sizeof(t_reply),CLASS_GOBJ,"!");
  //    class_setsavefn(reply_class, (t_savefn)reply_savefn);
- 
      declare_class = class_new2("declare",declare_new,declare_free,sizeof(t_declare),CLASS_NOINLET,"*");
      t_class *c = canvas_class = class_new2("canvas",0,canvas_free,sizeof(t_canvas),CLASS_NOINLET,"");
--- 7137,7140 ----
***************
*** 7228,7243 ****
  t_class *visualloader_class;
  
! static t_pd *visualloader_new(t_symbol *s, int argc, t_atom *argv) {
!     return pd_new(visualloader_class);
! }
! 
  static void visualloader_free(t_pd *self) {free(self);}
! 
! static void copy_atoms(int argc, t_atom *argvdest, t_atom *argvsrc) {
! 	memcpy(argvdest,argvsrc,argc*sizeof(t_atom));
! }
! 
  static void visualloader_anything(t_gobj *self, t_symbol *s, int argc, t_atom *argv) {
- 	t_hash *h;
  	int i=0,j=0;
  	//printf("visualloader_anything start newest=%p\n",newest);
--- 7196,7203 ----
  t_class *visualloader_class;
  
! static t_pd *visualloader_new(t_symbol *s, int argc, t_atom *argv) {return pd_new(visualloader_class);}
  static void visualloader_free(t_pd *self) {free(self);}
! static void copy_atoms(int argc, t_atom *argvdest, t_atom *argvsrc) {memcpy(argvdest,argvsrc,argc*sizeof(t_atom));}
  static void visualloader_anything(t_gobj *self, t_symbol *s, int argc, t_atom *argv) {
  	int i=0,j=0;
  	//printf("visualloader_anything start newest=%p\n",newest);
***************
*** 7251,7255 ****
  		//printf("#V reading '%s':\n",s->name);
  		if (!newest) {pd_error(self,"#V: there is no newest object\n"); return;}
! 		h = ((t_gobj *)newest)->dix->visual;
  		if (hash_exists(h,s)) {
  			//printf("'%s' exists, deleting\n",s->name);
--- 7211,7215 ----
  		//printf("#V reading '%s':\n",s->name);
  		if (!newest) {pd_error(self,"#V: there is no newest object\n"); return;}
! 		t_hash *h = ((t_gobj *)newest)->dix->visual;
  		if (hash_exists(h,s)) {
  			//printf("'%s' exists, deleting\n",s->name);
***************
*** 7504,7521 ****
      char buf[256], buf2[256];
      char cwd[666];
-     t_namelist *nl;
      getcwd(cwd,665);
      sys_socketreceiver=netreceive_newest_receiver(sys_netreceive);
      //fprintf(stderr,"sys_socketreceiver=%p\n",sys_socketreceiver);
      /* load dynamic libraries specified with "-lib" args */
!     for (nl = sys_externlist; nl; nl = nl->nl_next)
          if (!sys_load_lib(0, nl->nl_string))
              post("%s: can't load library", nl->nl_string);
      /* open patches specified with "-open" args */
!     for  (nl = sys_openlist; nl; nl = nl->nl_next) openit(cwd, nl->nl_string);
      namelist_free(sys_openlist);
      sys_openlist = 0;
      /* send messages specified with "-send" args */
!     for (nl = sys_messagelist; nl; nl = nl->nl_next) {
          t_binbuf *b = binbuf_new();
          binbuf_text(b, nl->nl_string, strlen(nl->nl_string));
--- 7464,7480 ----
      char buf[256], buf2[256];
      char cwd[666];
      getcwd(cwd,665);
      sys_socketreceiver=netreceive_newest_receiver(sys_netreceive);
      //fprintf(stderr,"sys_socketreceiver=%p\n",sys_socketreceiver);
      /* load dynamic libraries specified with "-lib" args */
!     for (t_namelist *nl=sys_externlist; nl; nl = nl->nl_next)
          if (!sys_load_lib(0, nl->nl_string))
              post("%s: can't load library", nl->nl_string);
      /* open patches specified with "-open" args */
!     for  (t_namelist *nl=sys_openlist; nl; nl = nl->nl_next) openit(cwd, nl->nl_string);
      namelist_free(sys_openlist);
      sys_openlist = 0;
      /* send messages specified with "-send" args */
!     for (t_namelist *nl=sys_messagelist; nl; nl = nl->nl_next) {
          t_binbuf *b = binbuf_new();
          binbuf_text(b, nl->nl_string, strlen(nl->nl_string));





More information about the Pd-cvs mailing list