Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28037
Modified Files: Tag: devel_0_39 desire.c Log Message: #V supports any list (not just one symbol) and the comma.
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.89 retrieving revision 1.1.2.90 diff -C2 -d -r1.1.2.89 -r1.1.2.90 *** desire.c 2 Jul 2006 02:21:24 -0000 1.1.2.89 --- desire.c 3 Jul 2006 03:26:03 -0000 1.1.2.90 *************** *** 57,60 **** --- 57,66 ---- // externals compiled for PureMSP.
+ typedef struct _arglist { + long c; + long dummy; + t_atom v[0]; + } t_arglist; + t_appendix *appendix_new (t_gobj *master) { t_appendix *self = (t_appendix *)malloc(sizeof(t_appendix)); *************** *** 77,82 **** binbuf_addv(b, "s", gensym("#V")); hash_foreach(k,v,h) { ! binbuf_addv(b, "ss", k, v); // :-( ! if (i+1==hash_size(h)) binbuf_addv(b, ";"); else binbuf_addv(b, "s", gensym(",")); } } --- 83,92 ---- binbuf_addv(b, "s", gensym("#V")); hash_foreach(k,v,h) { ! t_arglist *al = (t_arglist *)v; ! binbuf_addv(b,"s",k); ! binbuf_add(b,al->c,al->v); ! if (i+1==hash_size(h)) binbuf_addv(b, ";"); ! else binbuf_addv(b, "s", gensym(",")); ! i++; } } *************** *** 85,88 **** --- 95,101 ---- void appendix_free (t_gobj *master) { t_appendix *self = master->g_adix; + hashkey k; + hashvalue v; + hash_foreach(k,v,self->visual) {free(v);} hash_free(self->visual); free(self); *************** *** 12762,12773 **** static void visualloader_free(t_pd *self) {free(self);}
static void visualloader_anything(t_gobj *self, t_symbol *s, int argc, t_atom *argv) { ! t_symbol *v; ! if (argc!=1) {post("#V's messages take exactly one arg"); return;} ! if (argv[0].a_type != A_SYMBOL) {post("#V's messages must take a symbol arg"); return;} ! v = atom_getsymbolarg(0, argc, argv); ! post("#V got message '%s' with $1='%s' and newest=%p",s->s_name,v->s_name,newest); ! if (!newest) {post("#V: there is no newest object"); return;} ! hash_set(((t_gobj *)newest)->g_adix->visual,s,v); }
--- 12775,12806 ---- static void visualloader_free(t_pd *self) {free(self);}
+ static void copy_atoms(int argc, t_atom *argvdest, t_atom *argvsrc) { + memcpy(argvdest,argvsrc,argc*sizeof(t_atom)); + } + static void visualloader_anything(t_gobj *self, t_symbol *s, int argc, t_atom *argv) { ! printf("visualloader_anything start newest=%p\n",newest); ! //t_hash *h = self->g_adix->visual; ! t_hash *h = ((t_gobj *)newest)->g_adix->visual; ! int i=0,j=0; ! while (j<argc) { ! t_arglist *al; ! i=j; ! while (j<argc && atom_getsymbolarg(j,argc,argv)!=gensym(",")) j++; ! if (i==j) {j++; continue;} ! al = (t_arglist *) malloc(sizeof(t_arglist) + (j-i)*sizeof(t_atom)); ! al->c=j-i; ! copy_atoms(al->c,al->v,&argv[i]); ! printf("#V reading '%s':\n",s->s_name); ! if (!newest) {printf("#V: there is no newest object\n"); return;} ! if (hash_exists(h,s)) { ! printf("'%s' exists, deleting\n",s->s_name); ! free(hash_get(h,s)); ! } ! hash_set(h,s,al); ! j++; ! if (j<argc) {s=atom_getsymbolarg(j,argc,argv);j++;} ! } ! printf("visualloader_anything end\n"); }