[PD-cvs] pd/src builtins.c,1.1.2.19,1.1.2.20

Mathieu Bouchard matju at users.sourceforge.net
Thu Jun 28 18:46:26 CEST 2007


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

Modified Files:
      Tag: desiredata
	builtins.c 
Log Message:
cleanup of [t]


Index: builtins.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -C2 -d -r1.1.2.19 -r1.1.2.20
*** builtins.c	28 Jun 2007 16:36:29 -0000	1.1.2.19
--- builtins.c	28 Jun 2007 16:46:24 -0000	1.1.2.20
***************
*** 1651,1664 ****
  }
  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);}
--- 1651,1658 ----
  }
  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);}
***************
*** 1759,1770 ****
  
  static t_class *trigger_class;
- #define TR_BANG 0
- #define TR_FLOAT 1
- #define TR_SYMBOL 2
- #define TR_POINTER 3
- #define TR_LIST 4
- #define TR_ANYTHING 5
  struct t_triggerout {
!     int type;         /* outlet type from above */
      t_outlet *outlet;
  };
--- 1753,1758 ----
  
  static t_class *trigger_class;
  struct t_triggerout {
!     int type;
      t_outlet *outlet;
  };
***************
*** 1786,1805 ****
      t_triggerout *u = x->vec;
      t_atom *ap = argv;
!     for (int i = 0; i < argc; u++, ap++, i++) {
          t_atomtype thistype = ap->a_type;
          char c;
!         if (thistype == TR_SYMBOL) c = ap->a_symbol->name[0];
!         else if (thistype == TR_FLOAT) c = 'f';
          else c = 0;
!         if      (c == 'p') u->type = TR_POINTER,  u->outlet = outlet_new(x, &s_pointer);
!         else if (c == 'f') u->type = TR_FLOAT,    u->outlet = outlet_new(x, &s_float);
!         else if (c == 'b') u->type = TR_BANG,     u->outlet = outlet_new(x, &s_bang);
!         else if (c == 'l') u->type = TR_LIST,     u->outlet = outlet_new(x, &s_list);
!         else if (c == 's') u->type = TR_SYMBOL,   u->outlet = outlet_new(x, &s_symbol);
!         else if (c == 'a') u->type = TR_ANYTHING, u->outlet = outlet_new(x, &s_symbol);
          else {
              pd_error(x, "trigger: %s: bad type", ap->a_symbol->name);
!             u->type = TR_FLOAT, u->outlet = outlet_new(x, &s_float);
          }
      }
      return x;
--- 1774,1794 ----
      t_triggerout *u = x->vec;
      t_atom *ap = argv;
!     for (int i=0; i<argc; u++, ap++, i++) {
          t_atomtype thistype = ap->a_type;
          char c;
!         if (thistype == A_SYMBOL) c = ap->a_symbol->name[0];
!         else if (thistype == A_FLOAT) c = 'f';
          else c = 0;
!         if      (c == 'p') u->outlet = outlet_new(x, &s_pointer);
!         else if (c == 'f') u->outlet = outlet_new(x, &s_float);
!         else if (c == 'b') u->outlet = outlet_new(x, &s_bang);
!         else if (c == 'l') u->outlet = outlet_new(x, &s_list);
!         else if (c == 's') u->outlet = outlet_new(x, &s_symbol);
!         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);
          }
+ 	u->type = c;
      }
      return x;
***************
*** 1808,1816 ****
      t_triggerout *u = x->vec+x->n;
      for (int i = x->n; u--, i--;) {
!         if      (u->type == TR_FLOAT)   outlet_float(u->outlet, argc ? atom_getfloat(argv) : 0);
!         else if (u->type == TR_BANG)    outlet_bang(u->outlet);
!         else if (u->type == TR_SYMBOL)  outlet_symbol(u->outlet, argc ? atom_getsymbol(argv) : &s_symbol);
!         else if (u->type == TR_POINTER) {
!             if (!argc || argv->a_type != TR_POINTER) 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);
--- 1797,1805 ----
      t_triggerout *u = x->vec+x->n;
      for (int i = x->n; u--, i--;) {
!         if      (u->type == 'f')   outlet_float(u->outlet, argc ? atom_getfloat(argv) : 0);
!         else if (u->type == 'b')    outlet_bang(u->outlet);
!         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);
***************
*** 1820,1825 ****
      t_triggerout *u = x->vec+x->n;
      for (int i = x->n; u--, i--;) {
!         if      (u->type == TR_BANG)     outlet_bang(u->outlet);
!         else if (u->type == TR_ANYTHING) outlet_anything(u->outlet, s, argc, argv);
          else pd_error(x, "trigger: can only convert 's' to 'b' or 'a'", s->name);
      }
--- 1809,1814 ----
      t_triggerout *u = x->vec+x->n;
      for (int i = x->n; u--, i--;) {
!         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);
      }
***************
*** 1944,1955 ****
  /* doesn't do any typechecking or even counting the % signs properly */
  static void makefilename_float(t_makefilename *x, t_floatarg f) {
!     char *buf; asprintf(&buf, x->format->name, (int)f);
!     outlet_symbol(x->outlet, gensym(buf));
!     free(buf);
  }
  static void makefilename_symbol(t_makefilename *x, t_symbol *s) {
!     char *buf; asprintf(&buf, x->format->name, s->name);
!     outlet_symbol(x->outlet, gensym(buf));
!     free(buf);
  }
  
--- 1933,1940 ----
  /* doesn't do any typechecking or even counting the % signs properly */
  static void makefilename_float(t_makefilename *x, t_floatarg f) {
!     char *buf; asprintf(&buf, x->format->name,  (int)f); outlet_symbol(x->outlet, gensym(buf)); free(buf);
  }
  static void makefilename_symbol(t_makefilename *x, t_symbol *s) {
!     char *buf; asprintf(&buf, x->format->name, s->name); outlet_symbol(x->outlet, gensym(buf)); free(buf);
  }
  





More information about the Pd-cvs mailing list