[PD-cvs] pd/src builtins.c,1.1.2.46,1.1.2.47

Mathieu Bouchard matju at users.sourceforge.net
Fri Jul 20 23:37:50 CEST 2007


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

Modified Files:
      Tag: desiredata
	builtins.c 
Log Message:
[unpack] disregards its arguments completely. outlets have no types (just "atom" in general)


Index: builtins.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v
retrieving revision 1.1.2.46
retrieving revision 1.1.2.47
diff -C2 -d -r1.1.2.46 -r1.1.2.47
*** builtins.c	20 Jul 2007 14:33:55 -0000	1.1.2.46
--- builtins.c	20 Jul 2007 21:37:47 -0000	1.1.2.47
***************
*** 1505,1515 ****
  
  static t_class *unpack_class;
- struct t_unpackout {
-     t_atomtype type;
-     t_outlet *outlet;
- };
  struct t_unpack : t_object {
      t_int n;
!     t_unpackout *vec;
  };
  static void *unpack_new(t_symbol *s, int argc, t_atom *argv) {
--- 1505,1511 ----
  
  static t_class *unpack_class;
  struct t_unpack : t_object {
      t_int n;
!     t_outlet **vec;
  };
  static void *unpack_new(t_symbol *s, int argc, t_atom *argv) {
***************
*** 1523,1562 ****
      }
      x->n = argc;
!     x->vec = (t_unpackout *)getbytes(argc * sizeof(*x->vec));
!     t_unpackout *u = x->vec;
      t_atom *ap=argv;
!     for (int i=0; i < argc; u++, ap++, i++) {
!         t_atomtype type = ap->a_type;
!         if (type == A_SYMBOL) {
!             char c = *ap->a_symbol->name;
!             if (c == 's') {
!                 u->type = A_SYMBOL;
!                 u->outlet = outlet_new(x, &s_symbol);
!             } else if (c == 'p') {
!                 u->type =  A_POINTER;
!                 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);
!             }
!         } else {
!             u->type =  A_FLOAT;
!             u->outlet = outlet_new(x, &s_float);
!         }
!     }
      return x;
  }
  static void unpack_list(t_unpack *x, t_symbol *s, int argc, t_atom *argv) {
      if (argc > x->n) argc = x->n;
!     t_unpackout *u = x->vec+argc;
!     t_atom *ap = argv+argc;
!     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);
!         else                      outlet_pointer(u->outlet, ap->a_pointer);
!     }
  }
  static void unpack_anything(t_unpack *x, t_symbol *s, int ac, t_atom *av) {
--- 1519,1531 ----
      }
      x->n = argc;
!     x->vec = (t_outlet **)getbytes(argc * sizeof(*x->vec));
!     t_outlet **u = x->vec;
      t_atom *ap=argv;
!     for (int i=0; i < argc; ap++, i++) u[i] = outlet_new(x,0);
      return x;
  }
  static void unpack_list(t_unpack *x, t_symbol *s, int argc, t_atom *argv) {
      if (argc > x->n) argc = x->n;
!     for (int i=argc-1; i>=0; i--) outlet_atom(x->vec[i],&argv[i]);
  }
  static void unpack_anything(t_unpack *x, t_symbol *s, int ac, t_atom *av) {
***************
*** 2714,2719 ****
      x->n = argc;
      vec = x->vec = (t_atom *)getbytes(argc * sizeof(*x->vec));
!     int i;
!     for (i = 0, vp = vec, ap = argv; i < argc; i++, ap++, vp++) {
          if (ap->a_type == A_FLOAT) {
              *vp = *ap;
--- 2683,2689 ----
      x->n = argc;
      vec = x->vec = (t_atom *)getbytes(argc * sizeof(*x->vec));
!     vp = vec;
!     ap = argv;
!     for (int i=0; i<argc; i++, ap++, vp++) {
          if (ap->a_type == A_FLOAT) {
              *vp = *ap;
***************
*** 2722,2738 ****
          } else if (ap->a_type == A_SYMBOL) {
              char c = *ap->a_symbol->name;
!             if (c=='s') {
!                 SETSYMBOL(vp, &s_symbol);
!                 outlet_new(x, &s_symbol);
!                 if (i) symbolinlet_new(x, &vp->a_symbol);
!             } else if (c=='p') {
!                 vp->a_type = A_POINTER;
!                 outlet_new(x, &s_pointer);
!                 //if (i) pointerinlet_new(x, gp);
!             } else if (c=='f') {
!                 SETFLOAT(vp,0);
!                 outlet_new(x, &s_float);
!                 if (i) floatinlet_new(x, &vp->a_float);
!             } else error("pack: %s: bad type", ap->a_symbol->name);
          }
      }
--- 2692,2699 ----
          } else if (ap->a_type == A_SYMBOL) {
              char c = *ap->a_symbol->name;
!             if      (c=='s') {SETSYMBOL(vp, &s_symbol); outlet_new(x, &s_symbol); if (i) symbolinlet_new(x, &vp->a_symbol);}
!             else if (c=='p') {vp->a_type = A_POINTER; outlet_new(x, &s_pointer); /*if (i) pointerinlet_new(x, gp);*/}
!             else if (c=='f') {SETFLOAT(vp,0); outlet_new(x, &s_float); if (i) floatinlet_new(x, &vp->a_float);}
!             else error("pack: %s: bad type", ap->a_symbol->name);
          }
      }





More information about the Pd-cvs mailing list