From 31a2d9dcc2b3a519033918e180f81c4e7b9f8e7e Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 15 Mar 2005 04:56:36 +0000 Subject: new data type flext::AtomListStatic using pre-allocated space if possible fixes for OSX replaced memory-intensive STL maps by custom-made vector/map-container fix for gcc strangeness no more static assignment of symbols (problems with Metrowerks) small fix for gcc fixed bugs in SIMD code for non-power-of-2 lengths fixes for attribute editor (to deal with large dialogs) svn path=/trunk/; revision=2628 --- externals/grill/flext/source/flbind.cpp | 40 +++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'externals/grill/flext/source/flbind.cpp') diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp index 5b0bfeac..ff84e4ea 100644 --- a/externals/grill/flext/source/flbind.cpp +++ b/externals/grill/flext/source/flbind.cpp @@ -144,13 +144,14 @@ bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbo return true; } - bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbol *s,int argc,t_atom *argv,void *data),void **data) { bool ok = false; if(bindhead && bindhead->Contained(0)) { ItemSet &set = bindhead->GetInlet(); + +/* ItemSet::iterator it1,it2; if(sym) { // specific tag @@ -173,13 +174,37 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym } } } +*/ + BindItem *item = NULL; + if(sym) { + // symbol is given + Item *it = set.find(sym); + if(fun) { + // check if function matches + for(; it && static_cast(it)->fun != fun; it = it->nxt); + } + item = static_cast(it); + } + else { + // take any entry that matches + for(ItemSet::iterator si(set); si && !item; ++si) { + for(Item *i = si.data(); i; i = i->nxt) { + BindItem *bit = (BindItem *)i; + if(!fun || bit->fun == fun) { + item = bit; + if(!sym) sym = si.key(); + break; + } + } + } + } - if(it) { - if(data) *data = it->px->data; - ok = bindhead->Remove(it,sym,0,false); + if(item) { + if(data) *data = item->px->data; + ok = bindhead->Remove(item,sym,0,false); if(ok) { - it->Unbind(sym); - delete it; + item->Unbind(sym); + delete item; } } } @@ -207,7 +232,8 @@ bool flext_base::UnbindAll() { if(bindhead && bindhead->Contained(0)) { ItemSet &set = bindhead->GetInlet(); - for(ItemSet::iterator si = set.begin(); si != set.end(); ++si) { +// for(ItemSet::iterator si = set.begin(); si != set.end(); ++si) { + for(ItemSet::iterator si(set); si; ++si) { Item *lst = si.data(); while(lst) { Item *nxt = lst->nxt; -- cgit v1.2.1