[PD-cvs] pd/src m_class.c,1.3.4.7.2.22.2.5,1.3.4.7.2.22.2.6

Mathieu Bouchard matju at users.sourceforge.net
Fri Dec 8 06:34:28 CET 2006


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

Modified Files:
      Tag: desiredata
	m_class.c 
Log Message:
.


Index: m_class.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_class.c,v
retrieving revision 1.3.4.7.2.22.2.5
retrieving revision 1.3.4.7.2.22.2.6
diff -C2 -d -r1.3.4.7.2.22.2.5 -r1.3.4.7.2.22.2.6
*** m_class.c	8 Dec 2006 05:28:38 -0000	1.3.4.7.2.22.2.5
--- m_class.c	8 Dec 2006 05:34:26 -0000	1.3.4.7.2.22.2.6
***************
*** 206,224 ****
      called back (and the new method explicitly takes care of this.) */
  
! void class_addcreator(t_newmethod newmethod, t_symbol *s, 
!     t_atomtype type1, ...)
! {
      va_list ap;
      t_atomtype vec[MAXPDARG+1], *vp = vec;
      int count = 0;
      *vp = type1;
- 
      va_start(ap, type1);
!     while (*vp)
!     {
!         if (count == MAXPDARG)
!         {
!             error("class %s: sorry: only %d creation args allowed",
!                 s->s_name, MAXPDARG);
              break;
          }
--- 206,218 ----
      called back (and the new method explicitly takes care of this.) */
  
! void class_addcreator(t_newmethod newmethod, t_symbol *s, t_atomtype type1, ...) {
      va_list ap;
      t_atomtype vec[MAXPDARG+1], *vp = vec;
      int count = 0;
      *vp = type1;
      va_start(ap, type1);
!     while (*vp) {
!         if (count == MAXPDARG) {
!             error("class %s: sorry: only %d creation args allowed", s->s_name, MAXPDARG);
              break;
          }
***************
*** 226,230 ****
          count++;
          *vp = va_arg(ap, t_atomtype);
!     } 
      va_end(ap);
      class_addmethod(pd_objectmaker, (t_method)newmethod, s,
--- 220,224 ----
          count++;
          *vp = va_arg(ap, t_atomtype);
!     }
      va_end(ap);
      class_addmethod(pd_objectmaker, (t_method)newmethod, s,
***************
*** 246,265 ****
  }
  
! void class_addmethod2(t_class *c, t_method fn, t_symbol *sel, const char *fmt)
! {
      t_methodentry *m;
      int argtype = *fmt++;
      int nargs;
! 	/* "signal" method specifies that we take audio signals but
!         that we don't want automatic float to signal conversion.  This
!         is obsolete; you should now use the CLASS_MAINSIGNALIN macro. */
!     if (sel == &s_signal)
!     {
!         if (c->c_floatsignalin)
!             post("warning: signal method overrides class_mainsignalin");
          c->c_floatsignalin = -1;
      }
!         /* check for special cases.  "Pointer" is missing here so that
!         pd_objectmaker's pointer method can be typechecked differently.  */
      if      (sel == &s_bang)   {if (argtype) goto phooey; class_addbang(c, fn);}
      else if (sel == &s_float)  {if (argtype!='f' || *fmt) goto phooey; class_doaddfloat(c,fn);}
--- 240,256 ----
  }
  
! void class_addmethod2(t_class *c, t_method fn, t_symbol *sel, const char *fmt) {
      t_methodentry *m;
      int argtype = *fmt++;
      int nargs;
!     /* "signal" method specifies that we take audio signals but
!        that we don't want automatic float to signal conversion.  This
!        is obsolete; you should now use the CLASS_MAINSIGNALIN macro. */
!     if (sel == &s_signal) {
!         if (c->c_floatsignalin) post("warning: signal method overrides class_mainsignalin");
          c->c_floatsignalin = -1;
      }
!     /* check for special cases.  "Pointer" is missing here so that
!        pd_objectmaker's pointer method can be typechecked differently.  */
      if      (sel == &s_bang)   {if (argtype) goto phooey; class_addbang(c, fn);}
      else if (sel == &s_float)  {if (argtype!='f' || *fmt) goto phooey; class_doaddfloat(c,fn);}
***************
*** 449,453 ****
  	pthread_mutex_unlock(&hash_lock);
  #endif
!     return (sym2);
  }
  
--- 440,444 ----
  	pthread_mutex_unlock(&hash_lock);
  #endif
!     return sym2;
  }
  
***************
*** 584,591 ****
  /* This is externally available, but note that it might later disappear; the
  whole "newest" thing is a hack which needs to be redesigned. */
! t_pd *pd_newest(void)
! {
!     return (newest);
! }
  
      /* horribly, we need prototypes for each of the artificial function
--- 575,579 ----
  /* This is externally available, but note that it might later disappear; the
  whole "newest" thing is a hack which needs to be redesigned. */
! t_pd *pd_newest(void) {return newest;}
  
      /* horribly, we need prototypes for each of the artificial function
***************
*** 624,637 ****
          return;
      }
!     if (s == &s_bang) {
!         c->c_bangmethod(x);
!         return;
!     }
!     if (s == &s_list) {
!         c->c_listmethod(x, s, argc, argv);
!         return;
!     }
      if (s == &s_symbol) {
! 	c->c_symbolmethod(x, argc && argv->a_type==A_SYMBOL ?  argv->a_w.w_symbol : &s_);
          return;
      }
--- 612,619 ----
          return;
      }
!     if (s == &s_bang) {c->c_bangmethod(x); return;}
!     if (s == &s_list) {c->c_listmethod(x,s,argc,argv); return;}
      if (s == &s_symbol) {
! 	c->c_symbolmethod(x, argc && argv->a_type==A_SYMBOL ? argv->a_w.w_symbol : &s_);
          return;
      }
***************
*** 711,716 ****
  }
  
! void pd_vmess(t_pd *x, t_symbol *sel, char *fmt, ...)
! {
      va_list ap;
      t_atom arg[MAXPDARG], *at =arg;
--- 693,697 ----
  }
  
! void pd_vmess(t_pd *x, t_symbol *sel, char *fmt, ...) {
      va_list ap;
      t_atom arg[MAXPDARG], *at =arg;
***************
*** 719,734 ****
  
      va_start(ap, fmt);
!     while (1)
!     {
!         if (nargs > MAXPDARG)
!         {
              pd_error(x, "pd_vmess: only %d allowed", MAXPDARG);
              break;
          }
!         switch(*fp++)
!         {
          case 'f': SETFLOAT(at, va_arg(ap, double)); break;
          case 's': SETSYMBOL(at, va_arg(ap, t_symbol *)); break;
!         case 'i': SETFLOAT(at, va_arg(ap, t_int)); break;       
          case 'p': SETPOINTER(at, va_arg(ap, t_gpointer *)); break;
          default: goto done;
--- 700,712 ----
  
      va_start(ap, fmt);
!     while (1) {
!         if (nargs > MAXPDARG) {
              pd_error(x, "pd_vmess: only %d allowed", MAXPDARG);
              break;
          }
!         switch(*fp++) {
          case 'f': SETFLOAT(at, va_arg(ap, double)); break;
          case 's': SETSYMBOL(at, va_arg(ap, t_symbol *)); break;
!         case 'i': SETFLOAT(at, va_arg(ap, t_int)); break;
          case 'p': SETPOINTER(at, va_arg(ap, t_gpointer *)); break;
          default: goto done;
***************
*** 742,796 ****
  }
  
! void pd_forwardmess(t_pd *x, int argc, t_atom *argv)
! {
!     if (argc)
!     {
          t_atomtype t = argv->a_type;
          if (t == A_SYMBOL) pd_typedmess(x, argv->a_w.w_symbol, argc-1, argv+1);
!         else if (t == A_POINTER)
!         {
!             if (argc == 1) pd_pointer(x, argv->a_w.w_gpointer);
!             else pd_list(x, &s_list, argc, argv);
          }
!         else if (t == A_FLOAT)
!         {
!             if (argc == 1) pd_float(x, argv->a_w.w_float);
!             else pd_list(x, &s_list, argc, argv);
          }
          else bug("pd_forwardmess");
      }
- 
  }
  
  void nullfn(void) {}
  
! t_gotfn getfn(t_pd *x, t_symbol *s)
! {
      t_class *c = *x;
      t_methodentry *m;
      int i;
! 
!     for (i = c->c_nmethod, m = c->c_methods; i--; m++)
!         if (m->me_name == s) return(m->me_fun);
      pd_error(x, "%s: no method for message '%s'", c->c_name->s_name, s->s_name);
      return((t_gotfn)nullfn);
  }
  
! t_gotfn zgetfn(t_pd *x, t_symbol *s)
! {
      t_class *c = *x;
      t_methodentry *m;
      int i;
! 
!     for (i = c->c_nmethod, m = c->c_methods; i--; m++)
!         if (m->me_name == s) return(m->me_fun);
!     return(0);
  }
  
! 
! void class_settip(t_class *x,t_symbol* s)
! {
!   x->c_firsttip = s;
! }
  
  /* ---------------------------------------------------------------- */
--- 720,757 ----
  }
  
! void pd_forwardmess(t_pd *x, int argc, t_atom *argv) {
!     if (argc) {
          t_atomtype t = argv->a_type;
          if (t == A_SYMBOL) pd_typedmess(x, argv->a_w.w_symbol, argc-1, argv+1);
!         else if (t == A_POINTER) {
!             if (argc == 1) pd_pointer(x, argv->a_w.w_gpointer); else pd_list(x, &s_list, argc, argv);
          }
! 	else if (t == A_FLOAT) {
!             if (argc == 1)   pd_float(x, argv->a_w.w_float);    else pd_list(x, &s_list, argc, argv);
          }
          else bug("pd_forwardmess");
      }
  }
  
  void nullfn(void) {}
  
! t_gotfn getfn(t_pd *x, t_symbol *s) {
      t_class *c = *x;
      t_methodentry *m;
      int i;
!     for (i = c->c_nmethod, m = c->c_methods; i--; m++) if (m->me_name == s) return m->me_fun;
      pd_error(x, "%s: no method for message '%s'", c->c_name->s_name, s->s_name);
      return((t_gotfn)nullfn);
  }
  
! t_gotfn zgetfn(t_pd *x, t_symbol *s) {
      t_class *c = *x;
      t_methodentry *m;
      int i;
!     for (i = c->c_nmethod, m = c->c_methods; i--; m++) if (m->me_name == s) return m->me_fun;
!     return 0;
  }
  
! void class_settip(t_class *x,t_symbol* s) {x->c_firsttip = s;}
  
  /* ---------------------------------------------------------------- */





More information about the Pd-cvs mailing list