Update of /cvsroot/pure-data/externals/miXed/shared/unstable In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23748/shared/unstable
Modified Files: forky.c fragile.c fragile.h pd_imp.h Log Message: cyclone alpha52 and toxy alpha15 (see notes.txt for cyclone, toxy and shared)
Index: pd_imp.h =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/shared/unstable/pd_imp.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** pd_imp.h 23 May 2003 12:29:53 -0000 1.1.1.1 --- pd_imp.h 27 Jan 2005 14:42:54 -0000 1.2 *************** *** 7,12 **** --- 7,14 ----
#ifdef PD_MINOR_VERSION + /* 0.37 and up */ #include "m_imp.h" #else + /* 0.36 and down */
typedef struct _methodentry
Index: forky.c =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/shared/unstable/forky.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** forky.c 10 Dec 2004 20:47:05 -0000 1.6 --- forky.c 27 Jan 2005 14:42:54 -0000 1.7 *************** *** 79,83 ****
/* Not really a forky, just found no better place to put it in. ! Used in bitwise signal binops (sickle). Checked against msp2. */ t_int forky_getbitmask(int ac, t_atom *av) { --- 79,84 ----
/* Not really a forky, just found no better place to put it in. ! Used in sickle's bitwise signal binops (which use forky_hasfeeders() too). ! Checked against msp2. */ t_int forky_getbitmask(int ac, t_atom *av) {
Index: fragile.c =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/shared/unstable/fragile.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** fragile.c 17 Apr 2004 17:45:29 -0000 1.5 --- fragile.c 27 Jan 2005 14:42:54 -0000 1.6 *************** *** 1,3 **** ! /* Copyright (c) 1997-2003 Miller Puckette, krzYszcz, and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ --- 1,3 ---- ! /* Copyright (c) 1997-2005 Miller Puckette, krzYszcz, and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ *************** *** 16,19 **** --- 16,191 ---- }
+ /* Raising and voluntary mutation is a method of resolving name clashes. + A raised class hides other equivocal candidates. A simpler method, + raising and lowering, works only in global scope, because, currently, Pd + has only one visibility stack. Until this is changed, abstraction scope + will involve some kind of a hack for overriding global visibility stack. */ + + void fragile_class_raise(t_symbol *cname, t_newmethod thiscall) + { + t_methodentry *mp = pd_objectmaker->c_methods, *topmp = 0; + int count = pd_objectmaker->c_nmethod; + while (count--) + { + if (mp->me_name == cname) + { + if (mp->me_fun == (t_gotfn)thiscall) + { + if (topmp) + { + t_methodentry auxmp; + /* no linkage there, but anyway... */ + loud_warning(0, 0, "%s is raising itself...", + cname->s_name); + memcpy(&auxmp, mp, sizeof(t_methodentry)); + memcpy(mp, topmp, sizeof(t_methodentry)); + memcpy(topmp, &auxmp, sizeof(t_methodentry)); + } + return; + } + else if (!topmp) + topmp = mp; + } + mp++; + } + loudbug_bug("fragile_class_raise"); + } + + t_pd *fragile_class_mutate(t_symbol *cname, t_newmethod thiscall, + int ac, t_atom *av) + { + t_newmethod fn; + t_atomtype *argtypes; + if (fn = fragile_class_getalien(cname, thiscall, &argtypes)) + { + t_pd *z; + loud_warning(0, 0, "%s is mutating now...", cname->s_name); + if (z = fragile_class_createobject(cname, fn, argtypes, ac, av)) + { + post("...succeeded"); + return (z); + } + else post("...failed"); + } + return (0); + } + + t_newmethod fragile_class_getalien(t_symbol *cname, t_newmethod thiscall, + t_atomtype **argtypesp) + { + t_methodentry *mp = pd_objectmaker->c_methods; + int count = pd_objectmaker->c_nmethod; + while (count--) + { + if (mp->me_name == cname && mp->me_fun != (t_gotfn)thiscall) + { + *argtypesp = mp->me_arg; + return ((t_newmethod)mp->me_fun); + } + mp++; + } + return (0); + } + + /* A specialized copy of pd_typedmess() from m_class.c, + somewhat simplified for readability. */ + + typedef t_pd *(*t_newgimme)(t_symbol *s, int ac, t_atom *av); + typedef t_pd *(*t_new0)( + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); + typedef t_pd *(*t_new1)( + t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); + typedef t_pd *(*t_new2)( + t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); + typedef t_pd *(*t_new3)( + t_symbol*, t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); + typedef t_pd *(*t_new4)( + t_symbol*, t_symbol*, t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); + typedef t_pd *(*t_new5)( + t_symbol*, t_symbol*, t_symbol*, t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); + typedef t_pd *(*t_new6)( + t_symbol*, t_symbol*, t_symbol*, t_symbol*, t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); + + t_pd *fragile_class_createobject(t_symbol *cname, t_newmethod callthis, + t_atomtype *argtypes, int ac, t_atom *av) + { + t_floatarg ff[MAXPDARG+1], *fp = ff; + t_symbol *ss[MAXPDARG+1], **sp = ss; + int nsymbols = 0; + t_atomtype wanttype; + if (*argtypes == A_GIMME) + return ((*((t_newgimme)(callthis)))(cname, ac, av)); + if (ac > MAXPDARG) + ac = MAXPDARG; + while (wanttype = *argtypes++) + { + switch (wanttype) + { + case A_POINTER: + goto badarg; + case A_FLOAT: + if (!ac) goto badarg; + case A_DEFFLOAT: + if (!ac) *fp = 0; + else + { + if (av->a_type == A_FLOAT) + *fp = av->a_w.w_float; + else goto badarg; + ac--; av++; + } + fp++; + break; + case A_SYMBOL: + if (!ac) goto badarg; + case A_DEFSYM: + if (!ac) *sp = &s_; + else + { + if (av->a_type == A_SYMBOL) + *sp = av->a_w.w_symbol; + else if (av->a_type == A_FLOAT && av->a_w.w_float == 0) + *sp = &s_; + else goto badarg; + ac--; av++; + } + nsymbols++; + sp++; + } + } + switch (nsymbols) + { + case 0: return ((*(t_new0)(callthis)) + (ff[0], ff[1], ff[2], ff[3], ff[4])); + case 1: return ((*(t_new1)(callthis)) + (ss[0], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 2: return ((*(t_new2)(callthis)) + (ss[0], ss[1], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 3: return ((*(t_new3)(callthis)) + (ss[0], ss[1], ss[2], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 4: return ((*(t_new4)(callthis)) + (ss[0], ss[1], ss[2], ss[3], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 5: return ((*(t_new5)(callthis)) + (ss[0], ss[1], ss[2], ss[3], ss[4], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 6: return ((*(t_new6)(callthis)) + (ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], + ff[0], ff[1], ff[2], ff[3], ff[4])); + } + badarg: + loud_error(0, "bad creation arguments for class '%s'", cname->s_name); + return (0); + } + void fragile_class_printnames(char *msg, int firstndx, int lastndx) {
Index: fragile.h =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/shared/unstable/fragile.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fragile.h 19 Feb 2004 22:23:17 -0000 1.3 --- fragile.h 27 Jan 2005 14:42:54 -0000 1.4 *************** *** 1,3 **** ! /* Copyright (c) 2003 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ --- 1,3 ---- ! /* Copyright (c) 2005 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ *************** *** 7,10 **** --- 7,17 ----
int fragile_class_count(void); + void fragile_class_raise(t_symbol *cname, t_newmethod thiscall); + t_pd *fragile_class_mutate(t_symbol *cname, t_newmethod thiscall, + int ac, t_atom *av); + t_newmethod fragile_class_getalien(t_symbol *cname, t_newmethod thiscall, + t_atomtype **argtypesp); + t_pd *fragile_class_createobject(t_symbol *cname, t_newmethod callthis, + t_atomtype *argtypes, int ac, t_atom *av); void fragile_class_printnames(char *msg, int firstndx, int lastndx); t_glist *fragile_garray_glist(void *arr);