diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-04-16 21:35:06 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-04-16 21:35:06 +0000 |
commit | a7389a1405e6c160989e3d7097813b55e08e0f8d (patch) | |
tree | 9234122a98f9b8f41699e58e168feb10dda6bf03 /externals/grill/flext/source | |
parent | 0792fe88f2ad1d4f0bbc2c02c0fe6bb5782c31b6 (diff) |
updated templates
changed template parameter of TableMap
fixes for OSX
fixed problems with symbol binding
svn path=/trunk/; revision=2771
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r-- | externals/grill/flext/source/flattr.cpp | 4 | ||||
-rw-r--r-- | externals/grill/flext/source/flbind.cpp | 9 | ||||
-rw-r--r-- | externals/grill/flext/source/flclass.h | 4 | ||||
-rwxr-xr-x | externals/grill/flext/source/flitem.cpp | 18 | ||||
-rwxr-xr-x | externals/grill/flext/source/fllib.cpp | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flmap.h | 10 | ||||
-rwxr-xr-x | externals/grill/flext/source/flmeth.cpp | 4 |
7 files changed, 25 insertions, 26 deletions
diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp index d0c33ebb..79a63ab3 100644 --- a/externals/grill/flext/source/flattr.cpp +++ b/externals/grill/flext/source/flattr.cpp @@ -103,7 +103,7 @@ void flext_base::AddAttrib(t_classid c,const t_symbol *attr,metharg tp,methfun g void flext_base::ListAttrib(AtomList &la) const { - typedef TablePtrMap<int,t_symbol,32> AttrList; + typedef TablePtrMap<int,const t_symbol *,32> AttrList; AttrList list[2]; int i; @@ -114,7 +114,7 @@ void flext_base::ListAttrib(AtomList &la) const for(ItemSet::iterator as(ai); as; ++as) { for(Item *al = as.data(); al; al = al->nxt) { AttrItem *aa = (AttrItem *)al; - list[i].insert(aa->index,const_cast<t_symbol *>(as.key())); + list[i].insert(aa->index,as.key()); break; } } diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp index ff84e4ea..7611fc59 100644 --- a/externals/grill/flext/source/flbind.cpp +++ b/externals/grill/flext/source/flbind.cpp @@ -62,12 +62,17 @@ flext_base::BindItem::BindItem(bool (*f)(flext_base *,t_symbol *s,int,t_atom *,v flext_base::BindItem::~BindItem() { - if(px) object_free(&px->obj); + if(px) { + FLEXT_ASSERT(!fun); // check if already unbound + object_free(&px->obj); + } } void flext_base::BindItem::Unbind(const t_symbol *tag) { if(px) { + FLEXT_ASSERT(fun); + #if FLEXT_SYS == FLEXT_SYS_PD pd_unbind(&px->obj.ob_pd,const_cast<t_symbol *>(tag)); #elif FLEXT_SYS == FLEXT_SYS_MAX @@ -78,6 +83,8 @@ void flext_base::BindItem::Unbind(const t_symbol *tag) #else # pragma warning("Not implemented") #endif + + fun = NULL; } } diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index d15ae09d..cf11bdb8 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -659,7 +659,7 @@ protected: ~ItemSet(); }; */ - typedef TablePtrMapOwned<const t_symbol *,Item,8> ItemSet; + typedef TablePtrMapOwned<const t_symbol *,Item *,8> ItemSet; /*! This class holds hashed item entries \note not thread-safe! @@ -775,7 +775,7 @@ protected: ~AttrDataCont(); }; */ - typedef TablePtrMapOwned<const t_symbol *,AttrData,8> AttrDataCont; + typedef TablePtrMapOwned<const t_symbol *,AttrData *,8> AttrDataCont; // these outlet functions don't check for thread but send directly to the real-time system #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp index c73ee91a..4cab1481 100755 --- a/externals/grill/flext/source/flitem.cpp +++ b/externals/grill/flext/source/flitem.cpp @@ -21,16 +21,6 @@ flext_base::Item::~Item() if(nxt) delete nxt; } -/* -flext_base::ItemSet::ItemSet() {} - -flext_base::ItemSet::~ItemSet() -{ - for(iterator it = begin(); it != end(); ++it) - if(it.data()) delete it.data(); -} -*/ - flext_base::ItemCont::ItemCont(): members(0),memsize(0),size(0),cont(NULL) {} @@ -88,8 +78,10 @@ bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet,bool if(prv) prv->nxt = lit->nxt; else if(lit->nxt) set.insert(tag,lit->nxt); - else - set.erase(tag); + else { + Item *l = set.remove(tag); + FLEXT_ASSERT(l == lit); + } lit->nxt = NULL; if(free) delete lit; @@ -108,7 +100,7 @@ flext_base::Item *flext_base::ItemCont::FindList(const t_symbol *tag,int inlet) // --- class item lists (methods and attributes) ---------------- -typedef TablePtrMap<flext_base::t_classid,flext_base::ItemCont,64> ClassMap; +typedef TablePtrMap<flext_base::t_classid,flext_base::ItemCont *,64> ClassMap; static ClassMap classarr[2]; diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp index e98a4137..6b1ccb92 100755 --- a/externals/grill/flext/source/fllib.cpp +++ b/externals/grill/flext/source/fllib.cpp @@ -126,7 +126,7 @@ libclass::libclass(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(f {} -typedef TablePtrMap<const t_symbol *,libclass,8> LibMap; +typedef TablePtrMap<const t_symbol *,libclass *,8> LibMap; static LibMap libnames; diff --git a/externals/grill/flext/source/flmap.h b/externals/grill/flext/source/flmap.h index 4c3a1c9e..57e806e1 100644 --- a/externals/grill/flext/source/flmap.h +++ b/externals/grill/flext/source/flmap.h @@ -248,12 +248,12 @@ public: inline int size() const { return TableAnyMap::size(); } - inline void insert(K k,T *t) { TableAnyMap::insert(*(size_t *)&k,t); } + inline void insert(K k,T t) { TableAnyMap::insert(*(size_t *)&k,(void *)t); } - inline T *find(K k) const { return (T *)TableAnyMap::find(*(size_t *)&k); } + inline T find(K k) const { return (T)TableAnyMap::find(*(size_t *)&k); } inline void erase(K k) { TableAnyMap::erase(*(size_t *)&k); } - inline T *remove(K k) { return (T *)TableAnyMap::remove(*(size_t *)&k); } + inline T remove(K k) { return (T)TableAnyMap::remove(*(size_t *)&k); } class iterator : TableAnyMap::iterator @@ -266,7 +266,7 @@ public: inline iterator &operator =(const iterator &it) { TableAnyMap::operator =(it); return *this; } inline operator bool() const {return TableAnyMap::iterator::operator bool(); } - inline T *data() const { return (T *)TableAnyMap::iterator::data(); } + inline T data() const { return (T)TableAnyMap::iterator::data(); } inline K key() const { return (K)TableAnyMap::iterator::key(); } inline iterator &operator ++() { TableAnyMap::iterator::operator ++(); return *this; } @@ -294,7 +294,7 @@ protected: virtual void Free(void *ptr) { // FLEXT_ASSERT(ptr); - delete (T *)ptr; + delete (T)ptr; } }; diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp index 11b6d42d..df9a6ca6 100755 --- a/externals/grill/flext/source/flmeth.cpp +++ b/externals/grill/flext/source/flmeth.cpp @@ -89,7 +89,7 @@ void flext_base::AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fu void flext_base::ListMethods(AtomList &la,int inlet) const { - typedef TablePtrMap<int,t_symbol,32> MethList; + typedef TablePtrMap<int,const t_symbol *,32> MethList; MethList list[2]; int i; @@ -102,7 +102,7 @@ void flext_base::ListMethods(AtomList &la,int inlet) const MethItem *aa = (MethItem *)al; // check it's not related to an attribute if(!aa->IsAttr()) { - list[i].insert(aa->index,const_cast<t_symbol *>(as.key())); + list[i].insert(aa->index,as.key()); break; } } |