Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3516
Modified Files: Tag: desiredata desire.h m_class.c kernel.c Log Message: removed more c_ prefixes
Index: m_class.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_class.c,v retrieving revision 1.3.4.7.2.22.2.15 retrieving revision 1.3.4.7.2.22.2.16 diff -C2 -d -r1.3.4.7.2.22.2.15 -r1.3.4.7.2.22.2.16 *** m_class.c 27 Dec 2006 00:26:28 -0000 1.3.4.7.2.22.2.15 --- m_class.c 27 Dec 2006 01:15:28 -0000 1.3.4.7.2.22.2.16 *************** *** 43,68 **** static void pd_defaultbang(t_pd *x) { t_class *c = pd_class(x); ! if (c->c_listmethod != pd_defaultlist) c->c_listmethod(x,0,0,0); ! else c->c_anymethod(x,&s_bang,0,0); ! } ! ! static void pd_defaultpointer(t_pd *x, t_gpointer *gp) { ! t_class *c = pd_class(x); t_atom at; SETPOINTER(&at, gp); ! if (c->c_listmethod != pd_defaultlist) c->c_listmethod(x,0,1,&at); ! else c->c_anymethod(x,&s_pointer,1,&at); }
static void pd_defaultfloat(t_pd *x, t_float f) { t_class *c = pd_class(x); t_atom at; SETFLOAT(&at, f); ! if (c->c_listmethod != pd_defaultlist) c->c_listmethod(x,0,1,&at); ! else c->c_anymethod(x,&s_float,1,&at); } - static void pd_defaultsymbol(t_pd *x, t_symbol *s) { t_class *c = pd_class(x); t_atom at; SETSYMBOL(&at, s); ! if (c->c_listmethod != pd_defaultlist) c->c_listmethod(x,0,1,&at); ! else c->c_anymethod(x,&s_symbol,1,&at); }
void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv); static void class_nosavefn(t_gobj *z, t_binbuf *b); --- 43,64 ---- static void pd_defaultbang(t_pd *x) { t_class *c = pd_class(x); ! if (c->listmethod != pd_defaultlist) c->listmethod(x,0,0,0); ! else c->anymethod(x,&s_bang,0,0); }
static void pd_defaultfloat(t_pd *x, t_float f) { t_class *c = pd_class(x); t_atom at; SETFLOAT(&at, f); ! if (c->listmethod != pd_defaultlist) c->listmethod(x,0,1,&at); else c->anymethod(x,&s_float,1,&at); } static void pd_defaultsymbol(t_pd *x, t_symbol *s) { t_class *c = pd_class(x); t_atom at; SETSYMBOL(&at, s); ! if (c->listmethod != pd_defaultlist) c->listmethod(x,0,1,&at); else c->anymethod(x,&s_symbol,1,&at); ! } ! static void pd_defaultpointer(t_pd *x, t_gpointer *gp) { ! t_class *c = pd_class(x); t_atom at; SETPOINTER(&at, gp); ! if (c->listmethod != pd_defaultlist) c->listmethod(x,0,1,&at); else c->anymethod(x,&s_pointer,1,&at); }
+ void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv); static void class_nosavefn(t_gobj *z, t_binbuf *b); *************** *** 72,88 **** t_class *c = pd_class(x); /* a list with no elements is handled by the 'bang' method if one exists. */ ! if (argc == 0 && c->c_bangmethod != pd_defaultbang) {c->c_bangmethod(x); return;} /* a list with one element which is a number can be handled by a "float" method if any is defined; same for "symbol", "pointer". */ if (argc == 1) { #define HANDLE(A,M,D,F) if (argv->a_type==A && c->M != D) {c->M(x, argv->a_w.F); return;} ! HANDLE(A_FLOAT ,c_floatmethod ,pd_defaultfloat ,w_float) ! HANDLE(A_SYMBOL ,c_symbolmethod ,pd_defaultsymbol ,w_symbol) ! HANDLE(A_POINTER,c_pointermethod,pd_defaultpointer,w_gpointer) } /* Next try for an "anything" method; if the object is patchable (i.e., can have proper inlets) send it on to obj_list which will unpack the list into the inlets. otherwise gove up and complain. */ ! if (c->c_anymethod != pd_defaultanything) c->c_anymethod(x,&s_list,argc,argv); else if (c->c_patchable) obj_list((t_object *)x, s, argc, argv); else pd_defaultanything(x, &s_list, argc, argv); --- 68,84 ---- t_class *c = pd_class(x); /* a list with no elements is handled by the 'bang' method if one exists. */ ! if (argc == 0 && c->bangmethod != pd_defaultbang) {c->bangmethod(x); return;} /* a list with one element which is a number can be handled by a "float" method if any is defined; same for "symbol", "pointer". */ if (argc == 1) { #define HANDLE(A,M,D,F) if (argv->a_type==A && c->M != D) {c->M(x, argv->a_w.F); return;} ! HANDLE(A_FLOAT ,floatmethod ,pd_defaultfloat ,w_float) ! HANDLE(A_SYMBOL ,symbolmethod ,pd_defaultsymbol ,w_symbol) ! HANDLE(A_POINTER,pointermethod,pd_defaultpointer,w_gpointer) } /* Next try for an "anything" method; if the object is patchable (i.e., can have proper inlets) send it on to obj_list which will unpack the list into the inlets. otherwise gove up and complain. */ ! if (c->anymethod != pd_defaultanything) c->anymethod(x,&s_list,argc,argv); else if (c->c_patchable) obj_list((t_object *)x, s, argc, argv); else pd_defaultanything(x, &s_list, argc, argv); *************** *** 158,168 **** c->c_methods = (t_methodentry *)t_getbytes(0); c->c_nmethod = 0; ! c->c_freemethod = (t_method)freemethod; ! c->c_bangmethod = pd_defaultbang; ! c->c_pointermethod = pd_defaultpointer; ! c->c_floatmethod = pd_defaultfloat; ! c->c_symbolmethod = pd_defaultsymbol; ! c->c_listmethod = pd_defaultlist; ! c->c_anymethod = pd_defaultanything; c->c_firstin = ((flags & CLASS_NOINLET) == 0); c->firsttip = gensym("?"); --- 154,164 ---- c->c_methods = (t_methodentry *)t_getbytes(0); c->c_nmethod = 0; ! c->freemethod = (t_method)freemethod; ! c->bangmethod = pd_defaultbang; ! c->pointermethod = pd_defaultpointer; ! c->floatmethod = pd_defaultfloat; ! c->symbolmethod = pd_defaultsymbol; ! c->listmethod = pd_defaultlist; ! c->anymethod = pd_defaultanything; c->c_firstin = ((flags & CLASS_NOINLET) == 0); c->firsttip = gensym("?"); *************** *** 296,305 ****
/* Instead of these, see the "class_addfloat", etc., macros in m_pd.h */ ! void class_addbang( t_class *c, t_method fn) { c->c_bangmethod = (t_bangmethod)fn;} ! void class_addpointer( t_class *c, t_method fn) {c->c_pointermethod = (t_pointermethod)fn;} ! void class_doaddfloat( t_class *c, t_method fn) { c->c_floatmethod = (t_floatmethod)fn;} ! void class_addsymbol( t_class *c, t_method fn) {c->c_symbolmethod = (t_symbolmethod)fn;} ! void class_addlist( t_class *c, t_method fn) {c->c_listmethod = (t_listmethod)fn;} ! void class_addanything(t_class *c, t_method fn) { c->c_anymethod = (t_anymethod)fn;}
char *class_getname(t_class *c) {return c->c_name->s_name;} --- 292,301 ----
/* Instead of these, see the "class_addfloat", etc., macros in m_pd.h */ ! void class_addbang( t_class *c, t_method fn) { c->bangmethod = (t_bangmethod)fn;} ! void class_addpointer( t_class *c, t_method fn) {c->pointermethod = (t_pointermethod)fn;} ! void class_doaddfloat( t_class *c, t_method fn) { c->floatmethod = (t_floatmethod)fn;} ! void class_addsymbol( t_class *c, t_method fn) {c->symbolmethod = (t_symbolmethod)fn;} ! void class_addlist( t_class *c, t_method fn) {c->listmethod = (t_listmethod)fn;} ! void class_addanything(t_class *c, t_method fn) { c->anymethod = (t_anymethod)fn;}
char *class_getname(t_class *c) {return c->c_name->s_name;} *************** *** 310,331 **** void class_setnotice(t_class *c, t_notice notice) {c->notice = notice;}
! static void pd_floatforsignal(t_pd *x, t_float f) ! { int offset = (*x)->c_floatsignalin; if (offset > 0) *(t_sample *)(((char *)x) + offset) = f; else ! pd_error(x, "%s: float unexpected for signal input", ! (*x)->c_name->s_name); }
! void class_domainsignalin(t_class *c, int onset) ! { if (onset <= 0) onset = -1; ! else ! { ! if (c->c_floatmethod != pd_defaultfloat) post("warning: %s: float method overwritten", c->c_name->s_name); ! c->c_floatmethod = (t_floatmethod)pd_floatforsignal; } c->c_floatsignalin = onset; --- 306,323 ---- void class_setnotice(t_class *c, t_notice notice) {c->notice = notice;}
! static void pd_floatforsignal(t_pd *x, t_float f) { int offset = (*x)->c_floatsignalin; if (offset > 0) *(t_sample *)(((char *)x) + offset) = f; else ! pd_error(x, "%s: float unexpected for signal input", (*x)->c_name->s_name); }
! void class_domainsignalin(t_class *c, int onset) { if (onset <= 0) onset = -1; ! else { ! if (c->floatmethod != pd_defaultfloat) post("warning: %s: float method overwritten", c->c_name->s_name); ! c->floatmethod = (t_floatmethod)pd_floatforsignal; } c->c_floatsignalin = onset; *************** *** 371,382 **** /* tb: made dogensym() threadsafe * supported by vibrez.net */ ! t_symbol *dogensym(char *s, size_t n, t_symbol *oldsym) ! { ! static t_symbol *symhash[HASHSIZE]; #ifdef THREADSAFE_GENSYM static pthread_mutex_t hash_lock = PTHREAD_MUTEX_INITIALIZER; #endif ! ! t_symbol **sym1, *sym2; #ifdef NEWHASH unsigned short hash2 = hash(s,n); --- 363,372 ---- /* tb: made dogensym() threadsafe * supported by vibrez.net */ ! t_symbol *dogensym(char *s, size_t n, t_symbol *oldsym) { ! static t_symbol *symhash[HASHSIZE]; #ifdef THREADSAFE_GENSYM static pthread_mutex_t hash_lock = PTHREAD_MUTEX_INITIALIZER; #endif ! t_symbol **sym1, *sym2; #ifdef NEWHASH unsigned short hash2 = hash(s,n); *************** *** 384,388 **** unsigned int hash2 = hash(s,n); #endif ! #ifdef NEWHASH hash2 = hash2 * HASHFACTOR; sym1 = symhash + hash2; --- 374,378 ---- unsigned int hash2 = hash(s,n); #endif ! #ifdef NEWHASH hash2 = hash2 * HASHFACTOR; sym1 = symhash + hash2; *************** *** 390,403 **** sym1 = symhash + (hash2 & (HASHSIZE-1)); #endif ! while (sym2 = *sym1) ! { ! if (!strcmp(sym2->s_name, s)) return(sym2); sym1 = &sym2->s_next; } - #ifdef THREADSAFE_GENSYM ! pthread_mutex_lock(&hash_lock); ! /* tb: maybe another thread added the symbol to the hash table ! * double check */ while (sym2 = *sym1) { --- 380,390 ---- sym1 = symhash + (hash2 & (HASHSIZE-1)); #endif ! while (sym2 = *sym1) { ! if (!strcmp(sym2->s_name, s)) return sym2; sym1 = &sym2->s_next; } #ifdef THREADSAFE_GENSYM ! pthread_mutex_lock(&hash_lock); ! /* tb: maybe another thread added the symbol to the hash table; double check */ while (sym2 = *sym1) { *************** *** 562,574 **** to pd_objectmaker doesn't require that we supply a pointer value. */ if (s == &s_float) { ! if (!argc) c->c_floatmethod(x, 0.); ! else if (argv->a_type == A_FLOAT) c->c_floatmethod(x, argv->a_w.w_float); else goto badarg; 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; } --- 549,561 ---- to pd_objectmaker doesn't require that we supply a pointer value. */ if (s == &s_float) { ! if (!argc) c->floatmethod(x, 0.); ! else if (argv->a_type == A_FLOAT) c->floatmethod(x, argv->a_w.w_float); else goto badarg; return; } ! if (s == &s_bang) {c->bangmethod(x); return;} ! if (s == &s_list) {c->listmethod(x,s,argc,argv); return;} if (s == &s_symbol) { ! c->symbolmethod(x, argc && argv->a_type==A_SYMBOL ? argv->a_w.w_symbol : &s_); return; } *************** *** 642,646 **** return; } ! c->c_anymethod(x, s, argc, argv); return; badarg: --- 629,633 ---- return; } ! c->anymethod(x, s, argc, argv); return; badarg: *************** *** 753,762 **** "firsttip "%s" methods {",s->s_name,c->c_helpname->s_name,c->c_externdir->s_name, c->c_size,c->c_gobj,c->c_patchable,c->c_firstin,c->firsttip->s_name); ! if (c-> c_bangmethod != pd_defaultbang) sys_vgui("<bang> "); ! if (c->c_pointermethod != pd_defaultpointer) sys_vgui("<pointer> "); ! if (c-> c_floatmethod != pd_defaultfloat) sys_vgui("<float> "); ! if (c-> c_symbolmethod != pd_defaultsymbol) sys_vgui("<symbol> "); ! if (c-> c_listmethod != pd_defaultlist) sys_vgui("<list> "); ! if (c-> c_anymethod != pd_defaultanything) sys_vgui("<any> "); {int i; for (i=0; i<c->c_nmethod; i++) sys_vgui("%s ",c->c_methods[i].me_name->s_name);} sys_vgui("}]; %s %s %s\n",cb_recv->s_name, cb_sel->s_name, s->s_name); --- 740,749 ---- "firsttip "%s" methods {",s->s_name,c->c_helpname->s_name,c->c_externdir->s_name, c->c_size,c->c_gobj,c->c_patchable,c->c_firstin,c->firsttip->s_name); ! if (c-> bangmethod != pd_defaultbang) sys_vgui("<bang> "); ! if (c->pointermethod != pd_defaultpointer) sys_vgui("<pointer> "); ! if (c-> floatmethod != pd_defaultfloat) sys_vgui("<float> "); ! if (c-> symbolmethod != pd_defaultsymbol) sys_vgui("<symbol> "); ! if (c-> listmethod != pd_defaultlist) sys_vgui("<list> "); ! if (c-> anymethod != pd_defaultanything) sys_vgui("<any> "); {int i; for (i=0; i<c->c_nmethod; i++) sys_vgui("%s ",c->c_methods[i].me_name->s_name);} sys_vgui("}]; %s %s %s\n",cb_recv->s_name, cb_sel->s_name, s->s_name);
Index: kernel.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** kernel.c 27 Dec 2006 00:26:28 -0000 1.1.2.7 --- kernel.c 27 Dec 2006 01:15:28 -0000 1.1.2.8 *************** *** 306,310 **** { t_class *c = *x; ! if (c->c_freemethod) ((t_gotfn)(c->c_freemethod))(x); if (c->c_gobj) appendix_free((t_gobj *)x); hash_delete(object_table,x); --- 306,310 ---- { t_class *c = *x; ! if (c->freemethod) ((t_gotfn)(c->freemethod))(x); if (c->c_gobj) appendix_free((t_gobj *)x); hash_delete(object_table,x); *************** *** 470,496 **** }
! void pd_bang(t_pd *x) {(*x)->c_bangmethod(x);} ! void pd_float(t_pd *x, t_float f) {(*x)->c_floatmethod(x, f);} ! void pd_pointer(t_pd *x, t_gpointer *gp) {(*x)->c_pointermethod(x, gp);} ! void pd_symbol(t_pd *x, t_symbol *s) {(*x)->c_symbolmethod(x, s);} void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv) ! {(*x)->c_listmethod(x, &s_list, argc, argv);} ! ! void mess_init(void); ! void obj_init(void); ! void conf_init(void); ! void glob_init(void); ! void garray_init(void); ! ! void pd_init(void) ! { ! object_table = hash_new(127); ! mess_init(); ! obj_init(); ! conf_init(); ! glob_init(); ! garray_init(); ! } !
/* this file handles Max-style patchable objects, i.e., objects which --- 470,479 ---- }
! void pd_bang(t_pd *x) {(*x)->bangmethod(x);} ! void pd_float(t_pd *x, t_float f) {(*x)->floatmethod(x, f);} ! void pd_pointer(t_pd *x, t_gpointer *gp) {(*x)->pointermethod(x, gp);} ! void pd_symbol(t_pd *x, t_symbol *s) {(*x)->symbolmethod(x, s);} void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv) ! {(*x)->listmethod(x, &s_list, argc, argv);}
/* this file handles Max-style patchable objects, i.e., objects which *************** *** 1011,1024 **** }
! /* and these are only used in g_io.c... */ ! int inlet_getsignalindex(t_inlet *x) { int n=0; t_inlet *i; ! for (i = x->i_owner->ob_inlet, n = 0; i && i != x; i = i->i_next) if (i->i_symfrom == &s_signal) n++; return n; } int outlet_getsignalindex(t_outlet *x) { int n=0; t_outlet *o; ! for (o = x->o_owner->ob_outlet, n = 0; o && o != x; o = o->o_next) if (o->o_sym == &s_signal) n++; return n; } --- 994,1021 ---- }
! /* and those two are only used in g_io.c... */ int inlet_getsignalindex(t_inlet *x) { int n=0; t_inlet *i; ! for (i = x->i_owner->ob_inlet; i && i != x; i = i->i_next) if (i->i_symfrom == &s_signal) n++; return n; } int outlet_getsignalindex(t_outlet *x) { int n=0; t_outlet *o; ! for (o = x->o_owner->ob_outlet; o && o != x; o = o->o_next) if (o->o_sym == &s_signal) n++; return n; } + + + void mess_init(void); + void conf_init(void); + void glob_init(void); + void garray_init(void); + void pd_init(void) { + object_table = hash_new(127); + mess_init(); + obj_init(); + conf_init(); + glob_init(); + garray_init(); + } +
Index: desire.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.h,v retrieving revision 1.1.2.49.2.16 retrieving revision 1.1.2.49.2.17 diff -C2 -d -r1.1.2.49.2.16 -r1.1.2.49.2.17 *** desire.h 27 Dec 2006 00:26:28 -0000 1.1.2.49.2.16 --- desire.h 27 Dec 2006 01:15:27 -0000 1.1.2.49.2.17 *************** *** 77,87 **** t_methodentry *c_methods; /* methods other than bang, etc below */ int c_nmethod; /* number of methods */ ! t_method c_freemethod; /* function to call before freeing */ ! t_bangmethod c_bangmethod; /* common methods */ ! t_pointermethod c_pointermethod; ! t_floatmethod c_floatmethod; ! t_symbolmethod c_symbolmethod; /* or t_stringmethod, but C doesn't have anonymous unions */ ! t_listmethod c_listmethod; ! t_anymethod c_anymethod; t_savefn c_savefn; /* function to call when saving */ int c_floatsignalin; /* onset to float for signal input */ --- 77,87 ---- t_methodentry *c_methods; /* methods other than bang, etc below */ int c_nmethod; /* number of methods */ ! t_method freemethod; /* function to call before freeing */ ! t_bangmethod bangmethod; /* common methods */ ! t_pointermethod pointermethod; ! t_floatmethod floatmethod; ! t_symbolmethod symbolmethod; /* or t_stringmethod, but C doesn't have anonymous unions */ ! t_listmethod listmethod; ! t_anymethod anymethod; t_savefn c_savefn; /* function to call when saving */ int c_floatsignalin; /* onset to float for signal input */