Update of /cvsroot/pure-data/externals/clr
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12601
Modified Files:
clr.c test-clr.pd
Log Message:
lists of atom working! still missing output
Index: test-clr.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/clr/test-clr.pd,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test-clr.pd 12 Jan 2006 17:09:45 -0000 1.3
--- test-clr.pd 13 Jan 2006 19:02:36 -0000 1.4
***************
*** 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
--- 1,3 ----
! #N canvas 0 0 742 490 12;
#X obj 97 383 clr;
#X obj 105 80 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
***************
*** 22,27 ****
#X msg 239 342 selFloatList 1.1 2.2 3.3 4.4;
#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;
--- 22,27 ----
#X msg 239 342 selFloatList 1.1 2.2 3.3 4.4;
#X msg 239 364 selFloatList 0.001 1000;
#X msg 238 409 selGenericList abaco 1.1;
+ #X msg 239 387 selGenericList 0.001 abaco 1000 poroppoppero;
#X connect 0 0 14 0;
#X connect 1 0 0 0;
Index: clr.c
===================================================================
RCS file: /cvsroot/pure-data/externals/clr/clr.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** clr.c 13 Jan 2006 13:02:17 -0000 1.4
--- clr.c 13 Jan 2006 19:02:36 -0000 1.5
***************
*** 104,108 ****
void createInlet(void *x1, MonoString *selectorString, int type);
void createOutlet(void *x1, int type);
! void out2outlet(void *x, int outlet, int type, unsigned char *val /* TODO */);
void post2pd(MonoString *mesString);
void error2pd(MonoString *mesString);
--- 104,108 ----
void createInlet(void *x1, MonoString *selectorString, int type);
void createOutlet(void *x1, int type);
! void out2outlet(void *x1, int outlet, int atoms_length, atom_simple *atoms);
void post2pd(MonoString *mesString);
void error2pd(MonoString *mesString);
***************
*** 141,144 ****
--- 141,147 ----
printf("will load %s, random_name %s\n", file, random_name_str);
+ //mono_set_dirs (NULL, NULL);
+ //mono_config_parse (NULL);
+
x->domain = mono_jit_init (random_name_str);
***************
*** 299,418 ****
{
gpointer args [1];
! MonoString *strmono;
t_symbol *strsymbol;
! 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", "Atom2");
! if (!c)
! error("----> can't find Atom");
! //arystr = mono_array_new (x->domain, atom_simple, argc);
! 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));
! //*ftmp = j;
! //float ftmp = atom_getfloat(argv+j);
! //strsymbol = atom_getsymbol(argv+j);
! //MonoString *arg = mono_string_new (x->domain, strsymbol->s_name);
! //mono_array_set (arystr, MonoString *, j, arg);
! // gpointer
!
! //mono_array_set (arystr, gint32 , j, *ftmp);
! //mono_array_set (arystr, gint32 , j, ftmp);
!
! }
! */
!
! // debug:
! // send just 1 atom
!
!
! atmp2 = malloc(sizeof(atom_simple));
! atmp2->a_type = 121;
! atmp2->float_value = atom_getfloat(argv);
! strsymbol = atom_getsymbol(argv);
! printf("strsymbol->s_name = %s\n", strsymbol->s_name);
! atmp2->string_value = mono_string_new (x->domain, strsymbol->s_name);
! args[0] = atmp2;
!
!
! /*
! atmp2 = malloc(sizeof(atom_simple));
! atmp2->a = 121;
! atmp2->b = 1;
! 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;
mono_runtime_invoke (x->selectors[i].func, x->obj, args, NULL);
break;
}
}
-
- //result = mono_runtime_invoke (x->selectors[i].func, x->obj, args, NULL);
- //val = *(int*)mono_object_unbox (result);
- //x->n = val;
return;
}
--- 302,346 ----
{
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->image, "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->selectors[i].func, x->obj, args, NULL);
break;
}
}
return;
}
***************
*** 421,427 ****
i = MAX_SELECTORS;
}
-
error("clr: selector not recognized");
-
}
--- 349,353 ----
***************
*** 556,565 ****
// out to outlet
! void out2outlet(void *x1, int outlet, int type, unsigned char *val /* TODO */)
{
t_clr *x;
x = (t_clr *)x1;
t_atom *lista;
!
if ((outlet>MAX_OUTLETS) || (outlet<0))
{
--- 482,493 ----
// out to outlet
! void out2outlet(void *x1, int outlet, int atoms_length, atom_simple *atoms)
{
t_clr *x;
x = (t_clr *)x1;
t_atom *lista;
! int n;
! printf("outlet = %i\n" + outlet);
! printf("atoms_length = %i\n" + atoms_length);
if ((outlet>MAX_OUTLETS) || (outlet<0))
{
***************
*** 572,585 ****
return;
}
! printf("ricevuto %i %i\n", val[0], val[1]);
! if (val[0]==0x01)
! printf("val[0]==0x00");
! lista = (t_atom *) malloc(sizeof(t_atom) * 2);
! SETFLOAT(lista, (float) val[0]);
! SETFLOAT(lista+1, (float) val[1]);
outlet_anything(x->outlets[outlet].outlet_pointer,
gensym("list") ,
! 2,
lista);
free(lista);
--- 500,525 ----
return;
}
! lista = (t_atom *) malloc(sizeof(t_atom) * atoms_length);
! for (n=0; n<atoms_length; n++)
! {
! char *mesCstring;
! switch (atoms[n].a_type)
! {
! case A_S_NULL:
! SETFLOAT(lista+n, (float) 0);
! break;
! case A_S_FLOAT:
! mesCstring = mono_string_to_utf8 (atoms[n].string_value);
! SETFLOAT(lista+n, (float) atoms[n].float_value);
! break;
! case A_S_SYMBOL:
! SETSYMBOL(lista+n, gensym(mesCstring));
! break;
! }
! }
outlet_anything(x->outlets[outlet].outlet_pointer,
gensym("list") ,
! atoms_length,
lista);
free(lista);