Update of /cvsroot/pure-data/externals/clr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2201
Modified Files: clr.c test-clr.pd Added Files: PureData.dll Log Message: now selectors take delegates instead of function names, lists without selectors ok, added the PureData.dll assembly to let people compile externals without having to compile the pd project
--- NEW FILE: PureData.dll --- (This appears to be a binary file; contents omitted.)
Index: test-clr.pd =================================================================== RCS file: /cvsroot/pure-data/externals/clr/test-clr.pd,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test-clr.pd 16 Jan 2006 13:02:33 -0000 1.6 --- test-clr.pd 16 Jan 2006 16:26:58 -0000 1.7 *************** *** 1,3 **** ! #N canvas 73 31 756 564 12; #X obj 49 51 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; --- 1,3 ---- ! #N canvas 73 31 760 568 12; #X obj 49 51 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; *************** *** 14,19 **** -1 -1 0 1; #X text 224 242 mapped to selFloat; ! #X msg 99 216 selGenericList 12 a 0.5 b; ! #X text 98 194 complex list; #X obj 82 297 print; #X text 43 329 arguments: Class name , Filename; --- 14,19 ---- -1 -1 0 1; #X text 224 242 mapped to selFloat; ! #X msg 94 210 selGenericList 12 a 0.5 b; ! #X text 93 188 complex list; #X obj 82 297 print; #X text 43 329 arguments: Class name , Filename; *************** *** 35,38 **** --- 35,39 ---- ; #X text 37 477 NB: a class corresponding constructor must exist; + #X msg 309 210 1 2 3 a b c; #X connect 0 0 16 0; #X connect 1 0 16 0; *************** *** 50,51 **** --- 51,53 ---- #X connect 24 0 15 1; #X connect 26 0 15 0; + #X connect 29 0 16 0;
Index: clr.c =================================================================== RCS file: /cvsroot/pure-data/externals/clr/clr.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** clr.c 16 Jan 2006 12:44:44 -0000 1.8 --- clr.c 16 Jan 2006 16:26:58 -0000 1.9 *************** *** 356,361 ****
int i; - // first i extract the first atom which should be a symbol - post("clr_manage_list, got symbol = %s", sl->s_name); if (x->loaded == 0) { --- 356,359 ---- *************** *** 363,366 **** --- 361,418 ---- return; } + + // check if a selector is present ! + //printf("clr_manage_list, got symbol = %s\n", sl->s_name); + if (strcmp("list", sl->s_name) == 0) + { + printf("lista senza selector"); + if (x->manageList) + { + gpointer args [1]; + MonoString *stringtmp; + double *floattmp; + t_atomtype_simple *typetmp; + t_symbol *strsymbol; + MonoArray *atoms; + atom_simple *atom_array; + int j; + char strfloat[256], strnull[256]; + sprintf(strfloat, "float"); + sprintf(strnull, "null"); + atom_array = malloc(sizeof(atom_simple)*argc); + MonoClass *c = mono_class_from_name (x->imagePureData, "PureData", "Atom"); + atoms = mono_array_new (x->domain, c, argc); + for (j=0; j<argc; j++) + { + switch ((argv+j)->a_type) + { + case A_FLOAT: + atom_array[j].a_type = A_S_FLOAT; + atom_array[j].float_value = (double) atom_getfloat(argv+j); + atom_array[j].string_value = mono_string_new (x->domain, strfloat); + break; + case A_SYMBOL: + atom_array[j].a_type = A_S_SYMBOL; + strsymbol = atom_getsymbol(argv+j); + atom_array[j].string_value = mono_string_new (x->domain, strsymbol->s_name); + atom_array[j].float_value = 0; + break; + default: + atom_array[j].a_type = A_S_NULL; + atom_array[j].float_value = 0; + atom_array[j].string_value = mono_string_new (x->domain, strnull); + } + mono_array_set (atoms, atom_simple , j, atom_array[j]); + } + + args[0] = atoms; + mono_runtime_invoke (x->manageList, x->obj, args, NULL); + return; + } else + { + error("you did not specified a function to call for lists without selectors"); + return; + } + } for (i=0; i<MAX_SELECTORS; i++) {