aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flbind.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-05-15 02:32:38 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-05-15 02:32:38 +0000
commit8b042a66a4fd811589412747e38e8c7ee784db3c (patch)
tree61fc9c31e1efbd4479a2c9d3bdaa3904de3b127a /externals/grill/flext/source/flbind.cpp
parent629e6072a6e75d0b7b6b713756e1270ef86527c8 (diff)
""
svn path=/trunk/; revision=618
Diffstat (limited to 'externals/grill/flext/source/flbind.cpp')
-rw-r--r--externals/grill/flext/source/flbind.cpp35
1 files changed, 27 insertions, 8 deletions
diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp
index 53f041c6..d2a00129 100644
--- a/externals/grill/flext/source/flbind.cpp
+++ b/externals/grill/flext/source/flbind.cpp
@@ -135,17 +135,36 @@ bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbo
}
-bool flext_base::UnbindMethod(const t_symbol *sym,void **data)
+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;
- binditem *it = bindhead?(binditem *)bindhead->Find(sym,0):NULL;
- void *d = NULL;
- if(it) {
- d = it->px->data;
- ok = bindhead->Remove(it);
- if(ok) delete it;
+
+ if(bindhead) {
+ void *d = NULL;
+ binditem *it = NULL;
+ if(sym) {
+ it = (binditem *)bindhead->Find(sym,0);
+ while(it) {
+ if(it->tag == sym && (!fun || it->fun == fun)) break;
+ }
+ }
+ else {
+ int sz = bindhead->Size();
+ if(!sz) sz = 1;
+
+ for(int i = 0; i < sz; ++i) {
+ for(it = (binditem *)bindhead->Item(0); it; it = (binditem *)it->nxt) {
+ if(it->tag == sym && (!fun || it->fun == fun)) break;
+ }
+ if(it) break;
+ }
+ }
+ if(it) {
+ if(data) *data = it->px->data;
+ ok = bindhead->Remove(it);
+ if(ok) delete it;
+ }
}
- if(data) *data = d;
return ok;
}