diff options
author | N.N. <krzyszcz@users.sourceforge.net> | 2004-02-19 22:23:18 +0000 |
---|---|---|
committer | N.N. <krzyszcz@users.sourceforge.net> | 2004-02-19 22:23:18 +0000 |
commit | d0f6986345970955d6390a6953c35babf587c262 (patch) | |
tree | b9c55d804a317558da506f9655ff495856ef47d8 /shared/unstable | |
parent | d405128358369b5b7424c086c67345d12edfde7d (diff) |
many small improvements in toxy, plustot added
svn path=/trunk/externals/miXed/; revision=1321
Diffstat (limited to 'shared/unstable')
-rw-r--r-- | shared/unstable/fragile.c | 56 | ||||
-rw-r--r-- | shared/unstable/fragile.h | 5 |
2 files changed, 61 insertions, 0 deletions
diff --git a/shared/unstable/fragile.c b/shared/unstable/fragile.c index 2c9e8e3..b86fba8 100644 --- a/shared/unstable/fragile.c +++ b/shared/unstable/fragile.c @@ -6,6 +6,7 @@ #include <string.h> #include "m_pd.h" +#include "common/loud.h" #include "unstable/pd_imp.h" #include "unstable/fragile.h" @@ -68,6 +69,61 @@ t_outconnect *fragile_outlet_connections(t_outlet *o) return (o ? o->o_connections : 0); } +t_outconnect *fragile_outlet_nextconnection(t_outconnect *last, + t_object **destp, int *innop) +{ + t_inlet *dummy; + return (obj_nexttraverseoutlet(last, destp, &dummy, innop)); +} + +/* silent, if caller is empty */ +t_object *fragile_outlet_destination(t_outlet *op, + int ntypes, t_symbol **types, + t_pd *caller, char *errand) +{ + t_object *booty = 0; + t_symbol *badtype = 0; + int count = 0; + t_outconnect *tobooty = fragile_outlet_connections(op); + while (tobooty) + { + t_object *ob; + int inno; + count++; + tobooty = fragile_outlet_nextconnection(tobooty, &ob, &inno); + if (ob && inno == 0) + { + /* LATER ask for class_getname()'s symbol version */ + t_symbol **tp, *dsttype = gensym(class_getname(*(t_pd *)ob)); + int i; + for (i = 0, tp = types; i < ntypes; i++, tp++) + { + if (*tp == dsttype) + { + booty = ob; + break; + } + else badtype = dsttype; + } + } + } + if (booty) + { + if (count > 1 && caller) + loud_warning(caller, "multiple targets"); + } + else if (caller) + { + if (badtype) + loud_error(caller, "bad target type '%s'", badtype->s_name); + else + loud_error(caller, "no target"); + if (errand) + loud_errand(caller, errand); + } + return (booty); +} + /* These are local to m_obj.c. */ union inletunion { diff --git a/shared/unstable/fragile.h b/shared/unstable/fragile.h index 984fb0a..ad26384 100644 --- a/shared/unstable/fragile.h +++ b/shared/unstable/fragile.h @@ -9,6 +9,11 @@ int fragile_class_count(void); void fragile_class_printnames(char *msg, int firstndx, int lastndx); t_glist *fragile_garray_glist(void *arr); t_outconnect *fragile_outlet_connections(t_outlet *o); +t_outconnect *fragile_outlet_nextconnection(t_outconnect *last, + t_object **destp, int *innop); +t_object *fragile_outlet_destination(t_outlet *op, + int ntypes, t_symbol **types, + t_pd *caller, char *errand); t_sample *fragile_inlet_signalscalar(t_inlet *i); #endif |