[PD-cvs] pd/src desire.c,1.1.2.200,1.1.2.201

Mathieu Bouchard matju at users.sourceforge.net
Fri Nov 24 02:11:15 CET 2006


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

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


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.200
retrieving revision 1.1.2.201
diff -C2 -d -r1.1.2.200 -r1.1.2.201
*** desire.c	23 Nov 2006 20:06:50 -0000	1.1.2.200
--- desire.c	24 Nov 2006 01:11:11 -0000	1.1.2.201
***************
*** 220,225 ****
  	post("queue_get: items in queue: %d",self->len);
  	if (stuff) {
! 		t_binbuf *b;
! 		b = ((t_text *)stuff)->te_binbuf;
  		if (b) {
  			char *buf; int bufn;
--- 220,224 ----
  	post("queue_get: items in queue: %d",self->len);
  	if (stuff) {
! 		t_binbuf *b = ((t_text *)stuff)->te_binbuf;
  		if (b) {
  			char *buf; int bufn;
***************
*** 451,458 ****
          outno = t->nextoutno;
          while (outno == t->nout) {
-             t_gobj *y;
              t_object *ob = 0;
!             if (!t->from) y = t->canvas->list;
!             else y = t->from->ob_g.g_next;
              for (; y; y = y->g_next) if ((ob = pd_checkobject(&y->g_pd))) break;
              if (!ob) return 0;
--- 450,455 ----
          outno = t->nextoutno;
          while (outno == t->nout) {
              t_object *ob = 0;
!             t_gobj *y = t->from ? t->from->ob_g.g_next : t->canvas->list;
              for (; y; y = y->g_next) if ((ob = pd_checkobject(&y->g_pd))) break;
              if (!ob) return 0;
***************
*** 716,722 ****
  
  static void canvas_free(t_canvas *x) {
-     t_gobj *y;
      int dspstate = canvas_suspend_dsp();
      if (canvas_whichfind == x) canvas_whichfind = 0;
      while ((y = x->list)) canvas_delete(x, y);
      canvas_vis(x, 0);
--- 713,719 ----
  
  static void canvas_free(t_canvas *x) {
      int dspstate = canvas_suspend_dsp();
      if (canvas_whichfind == x) canvas_whichfind = 0;
+     t_gobj *y;
      while ((y = x->list)) canvas_delete(x, y);
      canvas_vis(x, 0);
***************
*** 1245,1251 ****
  static int canvas_isconnected (t_canvas *x, t_text *ob1, int n1, t_text *ob2, int n2) {
      canvas_wires_each(oc,t,x)
!         if (t.from == ob1 && t.outlet == n1 &&
!             t.to == ob2 && t.inlet == n2)
!                 return 1;
      return 0;
  }
--- 1242,1246 ----
  static int canvas_isconnected (t_canvas *x, t_text *ob1, int n1, t_text *ob2, int n2) {
      canvas_wires_each(oc,t,x)
! 	if (t.from == ob1 && t.outlet == n1 && t.to == ob2 && t.inlet == n2) return 1;
      return 0;
  }
***************
*** 1505,1512 ****
  
  extern "C" void garray_init(void) {
-     t_binbuf *b;
      hack = 0; /* invisible canvases must be, uh, invisible */
      if (garray_arraytemplatecanvas) return;
!     b = binbuf_new();
      glob_setfilename(0, gensym("_float"), gensym("."));
      binbuf_text(b, garray_floattemplatefile, strlen(garray_floattemplatefile));
--- 1500,1506 ----
  
  extern "C" void garray_init(void) {
      hack = 0; /* invisible canvases must be, uh, invisible */
      if (garray_arraytemplatecanvas) return;
!     t_binbuf *b = binbuf_new();
      glob_setfilename(0, gensym("_float"), gensym("."));
      binbuf_text(b, garray_floattemplatefile, strlen(garray_floattemplatefile));
***************
*** 1529,1535 ****
  
  static t_garray *graph_scalar(t_canvas *gl, t_symbol *s, t_symbol *templatesym, int saveit) {
-     t_garray *x;
      if (!template_findbyname(templatesym)) return 0;
!     x = (t_garray *)pd_new(garray_class);
      x->scalar = scalar_new(gl, templatesym);
      x->realname = s;
--- 1523,1528 ----
  
  static t_garray *graph_scalar(t_canvas *gl, t_symbol *s, t_symbol *templatesym, int saveit) {
      if (!template_findbyname(templatesym)) return 0;
!     t_garray *x = (t_garray *)pd_new(garray_class);
      x->scalar = scalar_new(gl, templatesym);
      x->realname = s;
***************
*** 1606,1615 ****
      int n = (int)fsize, zonset, ztype, saveit;
      t_symbol *zarraytype;
-     t_garray *x;
-     t_pd *x2;
-     t_template *t, *ztemplate;
      t_symbol *templatesym = gensym("pd-_float_array");
      int flags = (int)fflags;
!     int filestyle = ((flags & 6) >> 1);
      int style = filestyle == 0 ? PLOTSTYLE_POLY : filestyle == 1 ? PLOTSTYLE_POINTS : filestyle;
      if (templateargsym != &s_float) {
--- 1599,1605 ----
      int n = (int)fsize, zonset, ztype, saveit;
      t_symbol *zarraytype;
      t_symbol *templatesym = gensym("pd-_float_array");
      int flags = (int)fflags;
!     int filestyle = (flags & 6)>>1;
      int style = filestyle == 0 ? PLOTSTYLE_POLY : filestyle == 1 ? PLOTSTYLE_POINTS : filestyle;
      if (templateargsym != &s_float) {
***************
*** 1617,1621 ****
          return 0;
      }
!     t = template_findbyname(templatesym);
      TEMPLATE_CHECK(gl,templatesym,0)
      if (!template_find_field(t, gensym("z"), &zonset, &ztype, &zarraytype)) {
--- 1607,1611 ----
          return 0;
      }
!     t_template *t = template_findbyname(templatesym);
      TEMPLATE_CHECK(gl,templatesym,0)
      if (!template_find_field(t, gensym("z"), &zonset, &ztype, &zarraytype)) {
***************
*** 1627,1641 ****
          return 0;
      }
!     if (!(ztemplate = template_findbyname(zarraytype))) {
          pd_error(gl,"no template of type %s", zarraytype->s_name);
          return 0;
      }
!     saveit = ((flags & 1) != 0);
!     x = graph_scalar(gl, s, templatesym, saveit);
      if (n <= 0) n = 100;
      array_resize(x->scalar->sc_vec[zonset].w_array, n);
      template_setfloat(t, gensym("style"),     x->scalar->sc_vec, style, 1);
      template_setfloat(t, gensym("linewidth"), x->scalar->sc_vec, style==PLOTSTYLE_POINTS?2:1, 1);
!     x2 = pd_findbyclass(gensym("#A"), garray_class);
      if (x2) pd_unbind(x2, gensym("#A"));
      pd_bind(&x->x_gobj.g_pd, gensym("#A"));
--- 1617,1632 ----
          return 0;
      }
!     t_template *ztemplate = template_findbyname(zarraytype);
!     if (!ztemplate) {
          pd_error(gl,"no template of type %s", zarraytype->s_name);
          return 0;
      }
!     saveit = (flags & 1) != 0;
!     t_garray *x = graph_scalar(gl, s, templatesym, saveit);
      if (n <= 0) n = 100;
      array_resize(x->scalar->sc_vec[zonset].w_array, n);
      template_setfloat(t, gensym("style"),     x->scalar->sc_vec, style, 1);
      template_setfloat(t, gensym("linewidth"), x->scalar->sc_vec, style==PLOTSTYLE_POINTS?2:1, 1);
!     t_pd *x2 = pd_findbyclass(gensym("#A"), garray_class);
      if (x2) pd_unbind(x2, gensym("#A"));
      pd_bind(&x->x_gobj.g_pd, gensym("#A"));
***************
*** 1656,1665 ****
  t_floatarg fflags, t_floatarg otherflag) {
      t_canvas *gl;
-     t_garray *a;
      int flags = (int)fflags;
      if (size < 1) size = 1;
      if (otherflag == 0 || !(gl = canvas_findgraph(parent)))
          gl = canvas_addcanvas(parent, &s_, 0, 1, (size>1 ? size-1 : size), -1, 0, 0, 0, 0);
!     a = graph_array(gl, sharptodollar(name), &s_float, size, flags);
  }
  
--- 1647,1655 ----
  t_floatarg fflags, t_floatarg otherflag) {
      t_canvas *gl;
      int flags = (int)fflags;
      if (size < 1) size = 1;
      if (otherflag == 0 || !(gl = canvas_findgraph(parent)))
          gl = canvas_addcanvas(parent, &s_, 0, 1, (size>1 ? size-1 : size), -1, 0, 0, 0, 0);
!     graph_array(gl, sharptodollar(name), &s_float, size, flags);
  }
  
***************
*** 2181,2185 ****
  
  static void garray_write(t_garray *x, t_symbol *filename) {
-     FILE *fd;
      char buf[MAXPDSTRING];
      int yonset, elemsize;
--- 2171,2174 ----
***************
*** 2188,2192 ****
      canvas_makefilename(canvas_getcanvas(x->canvas), filename->s_name, buf, MAXPDSTRING);
      sys_bashfilename(buf, buf);
!     if (!(fd = fopen(buf, "w"))) {
          pd_error(x,"can't create file '%s'", buf);
          return;
--- 2177,2182 ----
      canvas_makefilename(canvas_getcanvas(x->canvas), filename->s_name, buf, MAXPDSTRING);
      sys_bashfilename(buf, buf);
!     FILE *fd = fopen(buf, "w");
!     if (!fd) {
          pd_error(x,"can't create file '%s'", buf);
          return;
***************
*** 2842,2848 ****
  /* FIXME: remove references to the selection, which isn't server-side */
  static int canvas_readscalar(t_canvas *x, int natoms, t_atom *vec, int *p_nextmsg, int selectit) {
-     int message, nline;
-     t_template *t;
-     t_scalar *sc;
      int nextmsg = *p_nextmsg;
      int wasvis = canvas_isvisible(x);
--- 2832,2835 ----
***************
*** 2854,2863 ****
      t_symbol *templatesym = canvas_makebindsym(vec[nextmsg].a_w.w_symbol);
      *p_nextmsg = nextmsg + 1;
!     if (!(t = template_findbyname(templatesym))) {
          pd_error(x,"canvas_read: %s: no such template", templatesym->s_name);
          *p_nextmsg = natoms;
          return 0;
      }
!     sc = scalar_new(x, templatesym);
      if (!sc) {
          pd_error(x,"couldn't create scalar \"%s\"", templatesym->s_name);
--- 2841,2851 ----
      t_symbol *templatesym = canvas_makebindsym(vec[nextmsg].a_w.w_symbol);
      *p_nextmsg = nextmsg + 1;
!     t_template *t = template_findbyname(templatesym);
!     if (!t) {
          pd_error(x,"canvas_read: %s: no such template", templatesym->s_name);
          *p_nextmsg = natoms;
          return 0;
      }
!     t_scalar *sc = scalar_new(x, templatesym);
      if (!sc) {
          pd_error(x,"couldn't create scalar \"%s\"", templatesym->s_name);
***************
*** 2867,2871 ****
      if (wasvis) canvas_getcanvas(x)->mapped = 0;
      canvas_add(x, &sc->sc_gobj);
!     nline = canvas_scanbinbuf(natoms, vec, &message, p_nextmsg);
      canvas_readatoms(x, natoms, vec, p_nextmsg, templatesym, sc->sc_vec, nline, vec + message);
      if (wasvis) canvas_getcanvas(x)->mapped = 1;
--- 2855,2860 ----
      if (wasvis) canvas_getcanvas(x)->mapped = 0;
      canvas_add(x, &sc->sc_gobj);
!     int message;
!     int nline = canvas_scanbinbuf(natoms, vec, &message, p_nextmsg);
      canvas_readatoms(x, natoms, vec, p_nextmsg, templatesym, sc->sc_vec, nline, vec + message);
      if (wasvis) canvas_getcanvas(x)->mapped = 1;
***************
*** 2875,2884 ****
  
  static void canvas_readfrombinbuf(t_canvas *x, t_binbuf *b, char *filename, int selectem) {
!     int natoms, nline, message, nextmsg = 0;
!     t_atom *vec;
!     natoms = binbuf_getnatom(b);
!     vec = binbuf_getvec(b);
      /* check for file type */
!     nline = canvas_scanbinbuf(natoms, vec, &message, &nextmsg);
      if (nline!=1 && vec[message].a_type != A_SYMBOL && strcmp(vec[message].a_w.w_symbol->s_name, "data")) {
          pd_error(x, "%s: file apparently of wrong type", filename);
--- 2864,2872 ----
  
  static void canvas_readfrombinbuf(t_canvas *x, t_binbuf *b, char *filename, int selectem) {
!     int message, nextmsg = 0;
!     int natoms = binbuf_getnatom(b);
!     t_atom *vec = binbuf_getvec(b);
      /* check for file type */
!     int nline = canvas_scanbinbuf(natoms, vec, &message, &nextmsg);
      if (nline!=1 && vec[message].a_type != A_SYMBOL && strcmp(vec[message].a_w.w_symbol->s_name, "data")) {
          pd_error(x, "%s: file apparently of wrong type", filename);
***************
*** 3131,3135 ****
  static void canvas_write(t_canvas *x, t_symbol *filename, t_symbol *format) {
      int cr = 0;
-     t_binbuf *b;
      char buf[MAXPDSTRING];
      t_canvas *canvas = canvas_getcanvas(x);
--- 3119,3122 ----
***************
*** 3137,3141 ****
      if (!strcmp(format->s_name, "cr")) cr = 1;
      else if (*format->s_name) pd_error(x,"canvas_write: unknown flag: %s", format->s_name);
!     b = canvas_writetobinbuf(x, 1);
      if (b) {
          if (binbuf_write(b, buf, "", cr)) pd_error(x,"%s: write failed", filename->s_name);
--- 3124,3128 ----
      if (!strcmp(format->s_name, "cr")) cr = 1;
      else if (*format->s_name) pd_error(x,"canvas_write: unknown flag: %s", format->s_name);
!     t_binbuf *b = canvas_writetobinbuf(x, 1);
      if (b) {
          if (binbuf_write(b, buf, "", cr)) pd_error(x,"%s: write failed", filename->s_name);
***************
*** 3805,3814 ****
     by value in the word_init() routine so we can throw our copy away. */
  t_scalar *scalar_new(t_canvas *owner, t_symbol *templatesym) {
-     t_scalar *x;
      t_gpointer gp;
      gpointer_init(&gp);
      t_template *t = template_findbyname(templatesym);
      TEMPLATE_CHECK(owner,templatesym,0)
!     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;
--- 3792,3800 ----
     by value in the word_init() routine so we can throw our copy away. */
  t_scalar *scalar_new(t_canvas *owner, t_symbol *templatesym) {
      t_gpointer gp;
      gpointer_init(&gp);
      t_template *t = template_findbyname(templatesym);
      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;
***************
*** 3822,3826 ****
  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));
-     t_binbuf *b;
      int natoms, nextmsg = 0;
      t_atom *vec;
--- 3808,3811 ----
***************
*** 3829,3833 ****
          return;
      }
!     b = binbuf_new();
      binbuf_restore(b, argc, argv);
      natoms = binbuf_getnatom(b);
--- 3814,3818 ----
          return;
      }
!     t_binbuf *b = binbuf_new();
      binbuf_restore(b, argc, argv);
      natoms = binbuf_getnatom(b);
***************
*** 4853,4862 ****
  int *xonsetp, int *yonsetp, int *wonsetp) {
      int type;
-     t_template *elemtemplate;
      t_symbol *dummy, *varname;
      t_canvas *elemtemplatecanvas = 0;
      /* the "float" template is special in not having to have a canvas;
         template_findbyname is hardwired to return a predefined template. */
!     if (!(elemtemplate = template_findbyname(elemtemplatesym))) {
          error("%s: no such template", elemtemplatesym->s_name);
          return -1;
--- 4838,4847 ----
  int *xonsetp, int *yonsetp, int *wonsetp) {
      int type;
      t_symbol *dummy, *varname;
      t_canvas *elemtemplatecanvas = 0;
      /* the "float" template is special in not having to have a canvas;
         template_findbyname is hardwired to return a predefined template. */
!     t_template *elemtemplate = template_findbyname(elemtemplatesym);
!     if (!elemtemplate) {
          error("%s: no such template", elemtemplatesym->s_name);
          return -1;
***************
*** 4946,4955 ****
      int nelem;
      char *elem;
-     t_slot *xslot, *yslot, *wslot;
      if (plot_readownertemplate(x, data, t, &elemtemplatesym, &array, &linewidth, &xloc, &xinc,
  	&yloc, &style, &vis, &scalarvis)) return;
!     xslot = &x->xpoints;
!     yslot = &x->ypoints;
!     wslot = &x->wpoints;
      if (!vis) return;
      if (array_getfields(elemtemplatesym, &elemtemplatecanvas, &elemtemplate, &elemsize,
--- 4931,4937 ----
      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;
      if (array_getfields(elemtemplatesym, &elemtemplatecanvas, &elemtemplate, &elemsize,
***************
*** 5536,5549 ****
  
  static void get_pointer(t_get *x, t_gpointer *gp) {
!     int nitems = x->nout, i;
      t_template *t = template_findbyname(x->templatesym);
      t_gstub *gs = gp->gp_stub;
-     t_word *vec;
      t_getvariable *vp;
      TEMPLATE_CHECK(x,x->templatesym,)
      if (!gpointer_check(gp, 0)) {pd_error(x, "stale or empty pointer"); return;}
!     if (gs->gs_which == GP_ARRAY) vec = gp->gp_un.gp_w;
!     else vec = gp->gp_un.gp_scalar->sc_vec;
!     for (i = nitems - 1, vp = x->variables + i; i >= 0; i--, vp--) {
          int onset, type;
          t_symbol *arraytype;
--- 5518,5530 ----
  
  static void get_pointer(t_get *x, t_gpointer *gp) {
!     int nitems = x->nout;
      t_template *t = template_findbyname(x->templatesym);
      t_gstub *gs = gp->gp_stub;
      t_getvariable *vp;
      TEMPLATE_CHECK(x,x->templatesym,)
      if (!gpointer_check(gp, 0)) {pd_error(x, "stale or empty pointer"); return;}
!     t_word *vec = gs->gs_which==GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
!     vp = x->variables + nitems-1;
!     for (int i=nitems-1; i>=0; i--, vp--) {
          int onset, type;
          t_symbol *arraytype;
***************
*** 5608,5615 ****
      int nitems = x->nin;
      t_template *t = template_findbyname(x->templatesym);
-     t_setvariable *vp;
      t_gpointer *gp = &x->gp;
      t_gstub *gs = gp->gp_stub;
-     t_word *vec;
      TEMPLATE_CHECK(x,x->templatesym,)
      if (!gpointer_check(gp, 0)) {pd_error(x, "empty pointer"); return;}
--- 5589,5594 ----
***************
*** 5619,5624 ****
      }
      if (!nitems) return;
!     vec = gs->gs_which == GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
!     vp=x->variables;
      if (x->issymbol)
           for (int i=0; i<nitems; i++,vp++) template_setsymbol(t, vp->sym, vec, vp->w.w_symbol, 1);
--- 5598,5603 ----
      }
      if (!nitems) return;
!     t_word *vec = gs->gs_which == GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
!     t_setvariable *vp=x->variables;
      if (x->issymbol)
           for (int i=0; i<nitems; i++,vp++) template_setsymbol(t, vp->sym, vec, vp->w.w_symbol, 1);
***************
*** 5674,5678 ****
      t_template *elemtemplate;
      t_gpointer *gparent = &x->gparent;
-     t_word *w;
      t_array *array;
      int elemsize, type;
--- 5653,5656 ----
***************
*** 5684,5689 ****
          return;
      }
!     if (gparent->gp_stub->gs_which == GP_ARRAY) w = gparent->gp_un.gp_w;
!     else w = gparent->gp_un.gp_scalar->sc_vec;
      TEMPLATE_CHECK(x,x->templatesym,)
      if (!template_find_field(t, fieldsym, &onset, &type, &elemtemplatesym)) {
--- 5662,5666 ----
          return;
      }
!     t_word *w = gparent->gp_stub->gs_which==GP_ARRAY ? gparent->gp_un.gp_w : gparent->gp_un.gp_scalar->sc_vec;
      TEMPLATE_CHECK(x,x->templatesym,)
      if (!template_find_field(t, fieldsym, &onset, &type, &elemtemplatesym)) {
***************
*** 5731,5736 ****
      t_symbol *fieldsym = x->fieldsym, *elemtemplatesym;
      t_template *t = template_findbyname(x->templatesym);
-     t_word *w;
-     t_array *array;
      t_gstub *gs = gp->gp_stub;
      TEMPLATE_CHECK(x,x->templatesym,)
--- 5708,5711 ----
***************
*** 5746,5751 ****
          return;
      }
!     w = gs->gs_which==GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
!     array = *(t_array **)(((char *)w) + onset);
      outlet_float(x->ob_outlet, (float)(array->n));
  }
--- 5721,5726 ----
          return;
      }
!     t_word *w = gs->gs_which==GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
!     t_array *array = *(t_array **)(((char *)w) + onset);
      outlet_float(x->ob_outlet, (float)(array->n));
  }
***************
*** 5771,5781 ****
  
  static void setsize_float(t_setsize *x, t_float f) {
!     int nitems, onset, type;
!     t_symbol *fieldsym = x->fieldsym, *elemtemplatesym;
      t_template *t = template_findbyname(x->templatesym);
-     t_template *elemtemplate;
-     t_word *w;
-     t_array *array;
-     int elemsize;
      int newsize = (int)f;
      t_gpointer *gp = &x->gp;
--- 5746,5751 ----
  
  static void setsize_float(t_setsize *x, t_float f) {
!     int onset, type;
      t_template *t = template_findbyname(x->templatesym);
      int newsize = (int)f;
      t_gpointer *gp = &x->gp;
***************
*** 5786,5804 ****
          return;
      }
!     w = gs->gs_which==GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
      TEMPLATE_CHECK(x,x->templatesym,)
!     if (!template_find_field(t, fieldsym, &onset, &type, &elemtemplatesym)) {
!         pd_error(x,"couldn't find array field %s", fieldsym->s_name);
          return;
      }
!     if (type != DT_ARRAY) {pd_error(x,"field %s not of type array", fieldsym->s_name); return;}
!     if (!(elemtemplate = template_findbyname(elemtemplatesym))) {
          pd_error(x,"couldn't find field template %s", elemtemplatesym->s_name);
          return;
      }
!     elemsize = elemtemplate->n * sizeof(t_word);
!     array = *(t_array **)(((char *)w) + onset);
      if (elemsize != array->elemsize) bug("setsize_gpointer");
!     nitems = array->n;
      if (newsize < 1) newsize = 1;
      if (newsize == nitems) return;
--- 5756,5776 ----
          return;
      }
!     t_word *w = gs->gs_which==GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
      TEMPLATE_CHECK(x,x->templatesym,)
!     t_symbol *elemtemplatesym;
!     if (!template_find_field(t, x->fieldsym, &onset, &type, &elemtemplatesym)) {
!         pd_error(x,"couldn't find array field %s", x->fieldsym->s_name);
          return;
      }
!     if (type != DT_ARRAY) {pd_error(x,"field %s not of type array", x->fieldsym->s_name); return;}
!     t_template *elemtemplate = template_findbyname(elemtemplatesym);
!     if (!elemtemplate) {
          pd_error(x,"couldn't find field template %s", elemtemplatesym->s_name);
          return;
      }
!     int elemsize = elemtemplate->n * sizeof(t_word);
!     t_array *array = *(t_array **)(((char *)w) + onset);
      if (elemsize != array->elemsize) bug("setsize_gpointer");
!     int nitems = array->n;
      if (newsize < 1) newsize = 1;
      if (newsize == nitems) return;
***************
*** 5933,5937 ****
      t_gstub *gs = gp->gp_stub;
      int onset, type;
-     t_word *w;
      TEMPLATE_CHECK(x,x->templatesym,)
      if (!gpointer_check(gp, 0)) {pd_error(x, "stale or empty pointer"); return;}
--- 5905,5908 ----
***************
*** 5941,5946 ****
      }
      if (type != DT_LIST) {pd_error(x, "field %s not of type list", x->fieldsym->s_name); return;}
!     if (gs->gs_which == GP_ARRAY) w = gp->gp_un.gp_w;
!     else w = gp->gp_un.gp_scalar->sc_vec;
      gpointer_setcanvas(&x->gp, *(t_canvas **)(((char *)w) + onset), 0);
      outlet_pointer(x->ob_outlet, &x->gp);
--- 5912,5916 ----
      }
      if (type != DT_LIST) {pd_error(x, "field %s not of type list", x->fieldsym->s_name); return;}
!     t_word *w = gs->gs_which==GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->sc_vec;
      gpointer_setcanvas(&x->gp, *(t_canvas **)(((char *)w) + onset), 0);
      outlet_pointer(x->ob_outlet, &x->gp);
***************
*** 6388,6396 ****
      if (x->te_type == T_OBJECT) {
  	t_binbuf *b = binbuf_new();
- 	int natom1, natom2;
- 	t_atom *vec1, *vec2;
  	binbuf_text(b, buf, bufsize);
! 	natom1 = binbuf_getnatom(x->te_binbuf); vec1 = binbuf_getvec(x->te_binbuf);
! 	natom2 = binbuf_getnatom(b);            vec2 = binbuf_getvec(b);
  	/* special case: if  pd args change just pass the message on. */
  	if (natom1 >= 1 && natom2 >= 1 &&
--- 6358,6364 ----
      if (x->te_type == T_OBJECT) {
  	t_binbuf *b = binbuf_new();
  	binbuf_text(b, buf, bufsize);
! 	int natom1 = binbuf_getnatom(x->te_binbuf); t_atom *vec1 = binbuf_getvec(x->te_binbuf);
! 	int natom2 = binbuf_getnatom(b);            t_atom *vec2 = binbuf_getvec(b);
  	/* special case: if  pd args change just pass the message on. */
  	if (natom1 >= 1 && natom2 >= 1 &&
***************
*** 6438,6442 ****
  
  static long canvas_children_count(t_canvas *x) {
! 	long n;
  	canvas_each(y,x) n++;
  	return n;
--- 6406,6410 ----
  
  static long canvas_children_count(t_canvas *x) {
! 	long n=0;
  	canvas_each(y,x) n++;
  	return n;
***************
*** 6456,6463 ****
  	//t_text *o;
  	//t_binbuf *b;
- 	int i;
  	if (argc<1) {pd_error(x,"not enough args"); return;}
  	if (argv[0].a_type != A_FLOAT) {pd_error(x,"$1 must be float"); return;}
! 	i = atom_getint(argv);
          /*
  	b = binbuf_new();
--- 6424,6430 ----
  	//t_text *o;
  	//t_binbuf *b;
  	if (argc<1) {pd_error(x,"not enough args"); return;}
  	if (argv[0].a_type != A_FLOAT) {pd_error(x,"$1 must be float"); return;}
! 	int i = atom_getint(argv);
          /*
  	b = binbuf_new();
***************
*** 6474,6480 ****
  
  static void g_text_setup(void) {
! 	t_class *c;
!     text_class = class_new(gensym("text"), 0, 0, sizeof(t_text),
!     	CLASS_NOINLET | CLASS_PATCHABLE, 0);
  
      c = mresp_class = class_new(gensym("messresponder"), 0, 0,
--- 6441,6446 ----
  
  static void g_text_setup(void) {
!     t_class *c;
!     text_class = class_new(gensym("text"), 0, 0, sizeof(t_text), CLASS_NOINLET|CLASS_PATCHABLE, 0);
  
      c = mresp_class = class_new(gensym("messresponder"), 0, 0,
***************
*** 7190,7194 ****
  static void slider_check_minmax(t_slider *x) {
      double min=x->min, max=x->max;
-     double diff;
      if(x->is_log) {
  	if(min == 0.0 && max == 0.0) max = 1.0;
--- 7156,7159 ----
***************
*** 7198,7202 ****
      x->min = min;
      x->max = max;
!     diff = x->is_log ? log(x->max/x->min) : (x->max-x->min);
      x->k = diff / (double)(isvert(x) ? (x->h-1) : (x->w-1));
  }
--- 7163,7167 ----
      x->min = min;
      x->max = max;
!     double diff = x->is_log ? log(x->max/x->min) : (x->max-x->min);
      x->k = diff / (double)(isvert(x) ? (x->h-1) : (x->w-1));
  }





More information about the Pd-cvs mailing list