diff options
author | Davide Morelli <morellid@users.sourceforge.net> | 2006-01-16 16:26:58 +0000 |
---|---|---|
committer | Davide Morelli <morellid@users.sourceforge.net> | 2006-01-16 16:26:58 +0000 |
commit | 447a1fe81422c021e33787ba11c56fa34d379c9d (patch) | |
tree | 8ecefbac29923517d3daa0fb2081b2fe3cea8877 /clr.c | |
parent | 6727d8b42c156a14ea690ceff639fcc1ad7f18af (diff) |
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
svn path=/trunk/externals/clr/; revision=4424
Diffstat (limited to 'clr.c')
-rwxr-xr-x | clr.c | 56 |
1 files changed, 54 insertions, 2 deletions
@@ -355,13 +355,65 @@ void clr_manage_list(t_clr *x, t_symbol *sl, int argc, t_atom *argv) float valFloat; 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) { error("assembly not specified"); 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++) { if (strcmp(x->selectors[i].sel, sl->s_name) == 0) |