[PD-cvs] pd/src builtins.c, 1.1.2.33, 1.1.2.34 builtins_dsp.c, 1.1.2.22, 1.1.2.23

Mathieu Bouchard matju at users.sourceforge.net
Thu Jul 19 07:14:05 CEST 2007


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

Modified Files:
      Tag: desiredata
	builtins.c builtins_dsp.c 
Log Message:
replaced most pd_error() by error()


Index: builtins_dsp.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins_dsp.c,v
retrieving revision 1.1.2.22
retrieving revision 1.1.2.23
diff -C2 -d -r1.1.2.22 -r1.1.2.23
*** builtins_dsp.c	17 Jul 2007 19:11:11 -0000	1.1.2.22
--- builtins_dsp.c	19 Jul 2007 05:14:02 -0000	1.1.2.23
***************
*** 309,316 ****
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      if (!a) {
!         if (*s->name) pd_error(x, "tabwrite~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &x->nsampsintab, &x->vec)) {
!         pd_error(x, "%s: bad template for tabwrite~", x->arrayname->name);
          x->vec = 0;
      } else garray_usedindsp(a);
--- 309,316 ----
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      if (!a) {
!         if (*s->name) error("tabwrite~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &x->nsampsintab, &x->vec)) {
!         error("%s: bad template for tabwrite~", x->arrayname->name);
          x->vec = 0;
      } else garray_usedindsp(a);
***************
*** 390,397 ****
      x->arrayname = s;
      if (!a) {
!         if (*s->name) pd_error(x, "tabplay~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &x->nsampsintab, &x->vec)) {
!         pd_error(x, "%s: bad template for tabplay~", x->arrayname->name);
          x->vec = 0;
      } else garray_usedindsp(a);
--- 390,397 ----
      x->arrayname = s;
      if (!a) {
!         if (*s->name) error("tabplay~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &x->nsampsintab, &x->vec)) {
!         error("%s: bad template for tabplay~", x->arrayname->name);
          x->vec = 0;
      } else garray_usedindsp(a);
***************
*** 460,467 ****
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      if (!a) {
!         if (*s->name) pd_error(x, "tabread~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &x->npoints, &x->vec)) {
!         pd_error(x, "%s: bad template for tabread~", x->arrayname->name);
          x->vec = 0;
      } else garray_usedindsp(a);
--- 460,467 ----
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      if (!a) {
!         if (*s->name) error("tabread~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &x->npoints, &x->vec)) {
!         error("%s: bad template for tabread~", x->arrayname->name);
          x->vec = 0;
      } else garray_usedindsp(a);
***************
*** 545,552 ****
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      if (!a) {
!         if (*s->name) pd_error(x, "tabread4~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &x->npoints, &x->vec)) {
!         pd_error(x, "%s: bad template for tabread4~", x->arrayname->name);
          x->vec = 0;
      } else garray_usedindsp(a);
--- 545,552 ----
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      if (!a) {
!         if (*s->name) error("tabread4~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &x->npoints, &x->vec)) {
!         error("%s: bad template for tabread4~", x->arrayname->name);
          x->vec = 0;
      } else garray_usedindsp(a);
***************
*** 653,664 ****
      if (!a) {
          if (*s->name)
!             pd_error(x, "tabosc4~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &pointsinarray, &x->vec)) {
!         pd_error(x, "%s: bad template for tabosc4~", x->arrayname->name);
          x->vec = 0;
      } else if ((npoints = pointsinarray - 3) != (1 << ilog2(pointsinarray - 3))) {
!         pd_error(x, "%s: number of points (%d) not a power of 2 plus three",
!             x->arrayname->name, pointsinarray);
          x->vec = 0;
          garray_usedindsp(a);
--- 653,663 ----
      if (!a) {
          if (*s->name)
!             error("tabosc4~: %s: no such array", x->arrayname->name);
          x->vec = 0;
      } else if (!garray_getfloatarray(a, &pointsinarray, &x->vec)) {
!         error("%s: bad template for tabosc4~", x->arrayname->name);
          x->vec = 0;
      } else if ((npoints = pointsinarray - 3) != (1 << ilog2(pointsinarray - 3))) {
!         error("%s: number of points (%d) not a power of 2 plus three", x->arrayname->name, pointsinarray);
          x->vec = 0;
          garray_usedindsp(a);
***************
*** 742,748 ****
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      if (!a) {
!         if (*x->arrayname->name) {pd_error(x, "tabsend~: %s: no such array", x->arrayname->name); return;}
      } else if (!garray_getfloatarray(a, &vecsize, &x->vec)) {
!         pd_error(x, "%s: bad template for tabsend~", x->arrayname->name); return;
      } else {
          int n = sp[0]->n;
--- 741,747 ----
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      if (!a) {
!         if (*x->arrayname->name) {error("tabsend~: %s: no such array", x->arrayname->name); return;}
      } else if (!garray_getfloatarray(a, &vecsize, &x->vec)) {
!         error("%s: bad template for tabsend~", x->arrayname->name); return;
      } else {
          int n = sp[0]->n;
***************
*** 802,808 ****
      t_garray *a;
      if (!(a = (t_garray *)pd_findbyclass(x->arrayname, garray_class))) {
!         if (*x->arrayname->name) pd_error(x, "tabsend~: %s: no such array", x->arrayname->name);
      } else if (!garray_getfloatarray(a, &x->vecsize, &x->vec)) {
!         pd_error(x, "%s: bad template for tabreceive~", x->arrayname->name);
      } else {
  	if (x->vecsize > sp[0]->n) x->vecsize = sp[0]->n;
--- 801,807 ----
      t_garray *a;
      if (!(a = (t_garray *)pd_findbyclass(x->arrayname, garray_class))) {
!         if (*x->arrayname->name) error("tabsend~: %s: no such array", x->arrayname->name);
      } else if (!garray_getfloatarray(a, &x->vecsize, &x->vec)) {
!         error("%s: bad template for tabreceive~", x->arrayname->name);
      } else {
  	if (x->vecsize > sp[0]->n) x->vecsize = sp[0]->n;
***************
*** 835,841 ****
      t_float *vec;
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
!     if (!a) pd_error(x, "%s: no such array", x->arrayname->name);
      else if (!garray_getfloatarray(a, &npoints, &vec)) {
!         pd_error(x, "%s: bad template for tabread", x->arrayname->name);
      } else {
          int n = (int)f;
--- 834,840 ----
      t_float *vec;
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
!     if (!a) error("%s: no such array", x->arrayname->name);
      else if (!garray_getfloatarray(a, &npoints, &vec)) {
!         error("%s: bad template for tabread", x->arrayname->name);
      } else {
          int n = (int)f;
***************
*** 870,876 ****
      t_float *vec;
      if (!a)
!         pd_error(x, "%s: no such array", x->arrayname->name);
      else if (!garray_getfloatarray(a, &npoints, &vec))
!         pd_error(x, "%s: bad template for tabread4", x->arrayname->name);
      else if (npoints < 4)
          outlet_float(x->outlet, 0);
--- 869,875 ----
      t_float *vec;
      if (!a)
!         error("%s: no such array", x->arrayname->name);
      else if (!garray_getfloatarray(a, &npoints, &vec))
!         error("%s: bad template for tabread4", x->arrayname->name);
      else if (npoints < 4)
          outlet_float(x->outlet, 0);
***************
*** 919,925 ****
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      t_float *vec;
!     if (!a) pd_error(x, "%s: no such array", x->arrayname->name);
      else if (!garray_getfloatarray(a, &vecsize, &vec))
!         pd_error(x, "%s: bad template for tabwrite", x->arrayname->name);
      else {
          int n = (int)x->ft1;
--- 918,924 ----
      t_garray *a = (t_garray *)pd_findbyclass(x->arrayname, garray_class);
      t_float *vec;
!     if (!a) error("%s: no such array", x->arrayname->name);
      else if (!garray_getfloatarray(a, &vecsize, &vec))
!         error("%s: bad template for tabwrite", x->arrayname->name);
      else {
          int n = (int)x->ft1;
***************
*** 1788,1792 ****
  #if 0
      else if (vecsize != x->vecsize)
!         pd_error(x, "delread/delwrite/vd vector size mismatch");
  #endif
  }
--- 1787,1791 ----
  #if 0
      else if (vecsize != x->vecsize)
!         error("delread/delwrite/vd vector size mismatch");
  #endif
  }
***************
*** 3283,3291 ****
              x->wherefrom = sender->vec;
          else {
!             pd_error(x, "receive~ %s: vector size mismatch", x->sym->name);
              x->wherefrom = 0;
          }
      } else {
!         pd_error(x, "receive~ %s: no matching send", x->sym->name);
          x->wherefrom = 0;
      }
--- 3282,3290 ----
              x->wherefrom = sender->vec;
          else {
!             error("receive~ %s: vector size mismatch", x->sym->name);
              x->wherefrom = 0;
          }
      } else {
!         error("receive~ %s: no matching send", x->sym->name);
          x->wherefrom = 0;
      }
***************
*** 3293,3297 ****
  static void sigreceive_dsp(t_sigreceive *x, t_signal **sp) {
      const int n = x->n;
!     if (sp[0]->n != n) {pd_error(x, "receive~ %s: vector size mismatch", x->sym->name); return;}
      sigreceive_set(x, x->sym);
      /* x->wherefrom is aligned because we aligned the sender memory buffer */
--- 3292,3296 ----
  static void sigreceive_dsp(t_sigreceive *x, t_signal **sp) {
      const int n = x->n;
!     if (sp[0]->n != n) {error("receive~ %s: vector size mismatch", x->sym->name); return;}
      sigreceive_set(x, x->sym);
      /* x->wherefrom is aligned because we aligned the sender memory buffer */
***************
*** 3398,3407 ****
      if (catcher) {
          if (catcher->n == x->n) x->whereto = catcher->vec;
!         else pd_error(x, "throw~ %s: vector size mismatch", x->sym->name);
!     } else pd_error(x, "throw~ %s: no matching catch", x->sym->name);
  }
  static void sigthrow_dsp(t_sigthrow *x, t_signal **sp) {
      const int n = x->n;
!     if (sp[0]->n != n) {pd_error(x, "throw~ %s: vector size mismatch", x->sym->name); return;}
      sigthrow_set(x, x->sym);
      if(SIMD_CHECK1(n,sp[0]->v)) /* the memory of the catcher is aligned in any case */
--- 3397,3406 ----
      if (catcher) {
          if (catcher->n == x->n) x->whereto = catcher->vec;
!         else error("throw~ %s: vector size mismatch", x->sym->name);
!     } else error("throw~ %s: no matching catch", x->sym->name);
  }
  static void sigthrow_dsp(t_sigthrow *x, t_signal **sp) {
      const int n = x->n;
!     if (sp[0]->n != n) {error("throw~ %s: vector size mismatch", x->sym->name); return;}
      sigthrow_set(x, x->sym);
      if(SIMD_CHECK1(n,sp[0]->v)) /* the memory of the catcher is aligned in any case */

Index: builtins.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v
retrieving revision 1.1.2.33
retrieving revision 1.1.2.34
diff -C2 -d -r1.1.2.33 -r1.1.2.34
*** builtins.c	18 Jul 2007 21:46:35 -0000	1.1.2.33
--- builtins.c	19 Jul 2007 05:14:02 -0000	1.1.2.34
***************
*** 327,331 ****
          if (emsg > msg) {
              for (int i = msg; i < emsg; i++) if (at[i].a_type == A_DOLLAR || at[i].a_type == A_DOLLSYM) {
!                 pd_error(x, "netreceive: got dollar sign in message");
                  goto nodice;
              }
--- 327,331 ----
          if (emsg > msg) {
              for (int i = msg; i < emsg; i++) if (at[i].a_type == A_DOLLAR || at[i].a_type == A_DOLLSYM) {
!                 error("netreceive: got dollar sign in message");
                  goto nodice;
              }
***************
*** 1575,1579 ****
                  gp++;
              } else {
!                 if (c != 'f') pd_error(x, "pack: %s: bad type", ap->a_symbol->name);
                  SETFLOAT(vp, 0);
                  if (i) floatinlet_new(x, &vp->a_float);
--- 1575,1579 ----
                  gp++;
              } else {
!                 if (c != 'f') error("pack: %s: bad type", ap->a_symbol->name);
                  SETFLOAT(vp, 0);
                  if (i) floatinlet_new(x, &vp->a_float);
***************
*** 1589,1593 ****
      t_atom *outvec;
      for (int i = x->nptr; i--; gp++) if (!gpointer_check(gp, 1)) {
!         pd_error(x, "pack: stale pointer");
          return;
      }
--- 1589,1593 ----
      t_atom *outvec;
      for (int i = x->nptr; i--; gp++) if (!gpointer_check(gp, 1)) {
!         error("pack: stale pointer");
          return;
      }
***************
*** 1615,1625 ****
          if (gp->o) gp->o->refcount++;
          pack_bang(x);
!     } else pd_error(x, "pack_pointer: wrong type");
  }
  static void pack_float(t_pack *x, t_float f) {
!     if (x->vec->a_type == A_FLOAT ) {x->vec->a_float = f;  pack_bang(x);} else pd_error(x, "pack_float: wrong type");
  }
  static void pack_symbol(t_pack *x, t_symbol *s) {
!     if (x->vec->a_type == A_SYMBOL) {x->vec->a_symbol = s; pack_bang(x);} else pd_error(x, "pack_symbol: wrong type");
  }
  static void pack_list(t_pack *x, t_symbol *s, int ac, t_atom *av) {obj_list(x, 0, ac, av);}
--- 1615,1625 ----
          if (gp->o) gp->o->refcount++;
          pack_bang(x);
!     } else error("pack_pointer: wrong type");
  }
  static void pack_float(t_pack *x, t_float f) {
!     if (x->vec->a_type == A_FLOAT ) {x->vec->a_float = f;  pack_bang(x);} else error("pack_float: wrong type");
  }
  static void pack_symbol(t_pack *x, t_symbol *s) {
!     if (x->vec->a_type == A_SYMBOL) {x->vec->a_symbol = s; pack_bang(x);} else error("pack_symbol: wrong type");
  }
  static void pack_list(t_pack *x, t_symbol *s, int ac, t_atom *av) {obj_list(x, 0, ac, av);}
***************
*** 1682,1686 ****
                  u->outlet = outlet_new(x, &s_pointer);
              } else {
!                 if (c != 'f') pd_error(x, "unpack: %s: bad type", ap->a_symbol->name);
                  u->type = A_FLOAT;
                  u->outlet = outlet_new(x, &s_float);
--- 1682,1686 ----
                  u->outlet = outlet_new(x, &s_pointer);
              } else {
!                 if (c != 'f') error("unpack: %s: bad type", ap->a_symbol->name);
                  u->type = A_FLOAT;
                  u->outlet = outlet_new(x, &s_float);
***************
*** 1699,1703 ****
      for (int i = argc; u--, ap--, i--;) {
          t_atomtype type = u->type;
!         if (type != ap->a_type)   pd_error(x, "unpack: type mismatch");
          else if (type == A_FLOAT) outlet_float(  u->outlet, ap->a_float);
          else if (type == A_SYMBOL)outlet_symbol( u->outlet, ap->a_symbol);
--- 1699,1703 ----
      for (int i = argc; u--, ap--, i--;) {
          t_atomtype type = u->type;
!         if (type != ap->a_type)   error("unpack: type mismatch");
          else if (type == A_FLOAT) outlet_float(  u->outlet, ap->a_float);
          else if (type == A_SYMBOL)outlet_symbol( u->outlet, ap->a_symbol);
***************
*** 1754,1758 ****
          else if (c == 'a') u->outlet = outlet_new(x, &s_symbol);
          else {
!             pd_error(x, "trigger: %s: bad type", ap->a_symbol->name);
              c='f'; u->outlet = outlet_new(x, &s_float);
          }
--- 1754,1758 ----
          else if (c == 'a') u->outlet = outlet_new(x, &s_symbol);
          else {
!             error("trigger: %s: bad type", ap->a_symbol->name);
              c='f'; u->outlet = outlet_new(x, &s_float);
          }
***************
*** 1768,1772 ****
          else if (u->type == 's')  outlet_symbol(u->outlet, argc ? atom_getsymbol(argv) : &s_symbol);
          else if (u->type == 'p') {
!             if (!argc || argv->a_type != 'p') pd_error(x, "unpack: bad pointer");
              else outlet_pointer(u->outlet, argv->a_w.w_gpointer);
          } else outlet_list(u->outlet, &s_list, argc, argv);
--- 1768,1772 ----
          else if (u->type == 's')  outlet_symbol(u->outlet, argc ? atom_getsymbol(argv) : &s_symbol);
          else if (u->type == 'p') {
!             if (!argc || argv->a_type != 'p') error("unpack: bad pointer");
              else outlet_pointer(u->outlet, argv->a_w.w_gpointer);
          } else outlet_list(u->outlet, &s_list, argc, argv);
***************
*** 1778,1782 ****
          if      (u->type == 'b') outlet_bang(u->outlet);
          else if (u->type == 'a') outlet_anything(u->outlet, s, argc, argv);
!         else pd_error(x, "trigger: can only convert 's' to 'b' or 'a'", s->name);
      }
  }
--- 1778,1782 ----
          if      (u->type == 'b') outlet_bang(u->outlet);
          else if (u->type == 'a') outlet_anything(u->outlet, s, argc, argv);
!         else error("trigger: can only convert 's' to 'b' or 'a'", s->name);
      }
  }





More information about the Pd-cvs mailing list