Update of /cvsroot/pure-data/externals/clr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26055
Modified Files: clr.c test-clr.pd Log Message: working on lists of atoms
Index: test-clr.pd =================================================================== RCS file: /cvsroot/pure-data/externals/clr/test-clr.pd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test-clr.pd 12 Jan 2006 11:59:58 -0000 1.2 --- test-clr.pd 12 Jan 2006 17:09:45 -0000 1.3 *************** *** 1,3 **** ! #N canvas 0 0 734 482 12; #X obj 97 383 clr; #X obj 105 80 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 --- 1,3 ---- ! #N canvas 0 0 738 486 12; #X obj 97 383 clr; #X obj 105 80 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 *************** *** 23,26 **** --- 23,27 ---- #X msg 239 364 selFloatList 0.001 1000; #X msg 239 387 selGenericList 0.001 abaco 1000; + #X msg 238 409 selGenericList abaco 1.1; #X connect 0 0 14 0; #X connect 1 0 0 0; *************** *** 41,42 **** --- 42,44 ---- #X connect 18 0 0 0; #X connect 19 0 0 0; + #X connect 20 0 0 0;
Index: clr.c =================================================================== RCS file: /cvsroot/pure-data/externals/clr/clr.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** clr.c 12 Jan 2006 11:59:58 -0000 1.2 --- clr.c 12 Jan 2006 17:09:45 -0000 1.3 *************** *** 54,61 **** //t_atomtype_simple a_type; int a_type; ! union{ float float_value; MonoString *string_value; ! } stuff; };
--- 54,62 ---- //t_atomtype_simple a_type; int a_type; ! //MonoString *a_type; ! //union{ float float_value; MonoString *string_value; ! //} stuff; };
*************** *** 71,74 **** --- 72,76 ---- MonoAssembly *assembly; MonoObject *obj; + MonoImage *image; MonoMethod *method, *setUp; MonoClass *klass; *************** *** 103,107 **** // const char *file="D:\Davide\cygwin\home\Davide\externalTest1.dll"; const char *file="PureData.dll"; ! MonoImage *image; MonoMethod *m = NULL, *ctor = NULL, *fail = NULL, *mvalues; gpointer iter; --- 105,109 ---- // const char *file="D:\Davide\cygwin\home\Davide\externalTest1.dll"; const char *file="PureData.dll"; ! MonoMethod *m = NULL, *ctor = NULL, *fail = NULL, *mvalues; gpointer iter; *************** *** 147,156 **** }
! image = mono_assembly_get_image (x->assembly);
! x->klass = mono_class_from_name (image, "PureData", "External"); if (!x->klass) { ! error("Can't find MyType in assembly %s\n", mono_image_get_filename (image)); //exit (1); } --- 149,158 ---- }
! x->image = mono_assembly_get_image (x->assembly);
! x->klass = mono_class_from_name (x->image, "PureData", "External"); if (!x->klass) { ! error("Can't find MyType in assembly %s\n", mono_image_get_filename (x->image)); //exit (1); } *************** *** 293,321 **** float ftmp; char *str; MonoArray * arystr; ! int j; ! arystr = mono_array_new (x->domain, mono_get_string_class (), argc); for (j=0; j<argc; j++) { ! atom_simple *atmp = malloc(sizeof(atom_simple)); switch ((argv+j)->a_type) { case A_FLOAT: post("setting type float in position %i", j); ! atmp->a_type = 1; ftmp = atom_getfloat(argv+j); ! atmp->stuff.float_value = ftmp; break; case A_SYMBOL: post("setting type symbol in position %i", j); ! atmp->a_type = 2; strsymbol = atom_getsymbol(argv+j); ! atmp->stuff.string_value = mono_string_new (x->domain, strsymbol->s_name); break; default: post("setting type null in position %i", j); ! atmp->a_type = 0; } ! mono_array_set (arystr, atom_simple *, j, atmp); //int * ftmp = malloc(sizeof(int)); --- 295,339 ---- float ftmp; char *str; + char strtmp[265], strtmp2[256]; MonoArray * arystr; ! int j; ! atom_simple *atmp; ! atom_simple *atmp2, *atmp3; ! ! int *tipo; ! float *fp; ! ! MonoClass *c = mono_class_from_name (x->image, "PureData", "Atom"); ! arystr = mono_array_new (x->domain, c /*mono_get_string_class ()*/, argc); ! //arystr = mono_array_new (x->domain, c, 2); ! /* for (j=0; j<argc; j++) { ! atmp = malloc(sizeof(atom_simple)); switch ((argv+j)->a_type) { case A_FLOAT: post("setting type float in position %i", j); ! //atmp->a_type = 1; ! sprintf(strtmp, "1"); ! // atmp->a_type = mono_string_new (x->domain, strtmp); ftmp = atom_getfloat(argv+j); ! atmp->float_value = ftmp; break; case A_SYMBOL: post("setting type symbol in position %i", j); ! //atmp->a_type = 2; ! sprintf(strtmp, "2"); ! // atmp->a_type = mono_string_new (x->domain, strtmp); strsymbol = atom_getsymbol(argv+j); ! atmp->string_value = mono_string_new (x->domain, strsymbol->s_name); break; default: post("setting type null in position %i", j); ! //atmp->a_type = 0; ! sprintf(strtmp, "0"); ! // atmp->a_type = mono_string_new (x->domain, strtmp); } ! // mono_array_set (arystr, MonoString *, j, atmp->a_type); mono_array_set (arystr, atom_simple *, j, atmp); //int * ftmp = malloc(sizeof(int)); *************** *** 331,335 ****
} ! args[0] = arystr; //args[0] = strings; --- 349,388 ----
} ! */ ! ! // debug: ! // send just 1 atom ! ! atmp2 = malloc(sizeof(atom_simple)); ! atmp2->a_type = 121; ! atmp2->float_value = atom_getfloat(argv); ! strsymbol = atom_getsymbol(argv); ! atmp2->string_value = mono_string_new (x->domain, strsymbol->s_name); ! args[0] = atmp2; ! ! ! /* ! // a list of atoms ! for (j=0; j<argc; j++) ! { ! atmp2 = malloc(sizeof(atom_simple)); ! atmp2->a_type = 4; ! atmp2->float_value = atom_getfloat(argv+j); ! strsymbol = atom_getsymbol(argv+j); ! atmp2->string_value = mono_string_new (x->domain, strsymbol->s_name); ! mono_array_set (arystr, atom_simple *, j, atmp2); ! } ! */ ! ! ! /* ! atmp3 = malloc(sizeof(atom_simple)); ! atmp3->a_type = 2; ! atmp3->float_value = 0.5; ! sprintf(strtmp2, "abracadabra"); ! atmp3->string_value = mono_string_new (x->domain, strtmp2); ! mono_array_set (arystr, atom_simple *, 1, atmp3); ! */ ! // args[0] = arystr; //args[0] = strings;