diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-04-25 12:50:35 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-04-25 12:50:35 +0000 |
commit | e2e771a22a3fd072b16409932e339ad52b040a91 (patch) | |
tree | 1e70c160f99df157d19ed5fd3ebb875567c69892 /externals/grill/flext/source | |
parent | 6a08f42af3f1c3584882081936ca18c39693d8a1 (diff) |
small fixes
fixes for MSVC6
svn path=/trunk/; revision=2813
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r-- | externals/grill/flext/source/flext.cpp | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flmap.h | 28 | ||||
-rwxr-xr-x | externals/grill/flext/source/flqueue.cpp | 21 |
3 files changed, 35 insertions, 16 deletions
diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index c4fa81c4..c88e5f00 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -175,7 +175,7 @@ void flext_base::cb_loadbang(t_class *c) { thisObject(c)->CbLoadbang(); } #endif void flext_base::m_loadbang() {} -void flext_base::CbLoadbang() { return m_loadbang(); } +void flext_base::CbLoadbang() { m_loadbang(); } void flext_base::CbClick() {} diff --git a/externals/grill/flext/source/flmap.h b/externals/grill/flext/source/flmap.h index f0cb01be..52f6e030 100644 --- a/externals/grill/flext/source/flmap.h +++ b/externals/grill/flext/source/flmap.h @@ -23,7 +23,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. class FLEXT_SHARE TableAnyMap { -protected: +public: + virtual TableAnyMap *_newmap(TableAnyMap *parent) = 0; virtual void _delmap(TableAnyMap *map) = 0; @@ -35,6 +36,9 @@ protected: void *value; }; +protected: + // constructor and destructor are protected so that they can't be directly instantiated + TableAnyMap(TableAnyMap *p,Data *dt) : data(dt) , parent(p),left(0),right(0) @@ -43,6 +47,8 @@ protected: virtual ~TableAnyMap(); +public: + #if 0 // set 1 for asserting the map structure (very cpu-intensive!) void check(int tsize) { if(n) _check(tsize); } #else @@ -105,8 +111,6 @@ protected: int ix; }; -private: - void _init(size_t k,void *t) { data[0](k,t); n = 1; } void *_toleft(int tsize,size_t k,void *t) @@ -178,7 +182,11 @@ private: template <typename K,typename T,int N = 8> class TablePtrMap - : TableAnyMap + : +#if defined(_MSC_VER) && _MSC_VER < 1300 + public // necessary for VC6 +#endif + TableAnyMap { public: TablePtrMap(): TableAnyMap(0,slots),count(0) {} @@ -204,6 +212,7 @@ public: return (T)d; } + class iterator : TableAnyMap::iterator { @@ -212,14 +221,15 @@ public: iterator(const TablePtrMap &m): TableAnyMap::iterator(m) {} iterator(iterator &it): TableAnyMap::iterator(it) {} - inline iterator &operator =(const iterator &it) { TableAnyMap::operator =(it); return *this; } + // this ugly syntax (cast to parent class) is needed for MSVC6 - inline operator bool() const {return TableAnyMap::iterator::operator bool(); } - inline T data() const { return (T)TableAnyMap::iterator::data(); } - inline K key() const { return (K)TableAnyMap::iterator::key(); } + inline iterator &operator =(const iterator &it) { ((TableAnyMap::iterator &)*this) = it; return *this; } - inline iterator &operator ++() { TableAnyMap::iterator::operator ++(); return *this; } + inline operator bool() const { return (bool)((TableAnyMap::iterator &)*this); } + inline T data() const { return (T)(((TableAnyMap::iterator &)*this).data()); } + inline K key() const { return (K)(((TableAnyMap::iterator &)*this).key()); } + inline iterator &operator ++() { ++((TableAnyMap::iterator &)*this); return *this; } }; protected: diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp index ddfd0303..1cf2aab5 100755 --- a/externals/grill/flext/source/flqueue.cpp +++ b/externals/grill/flext/source/flqueue.cpp @@ -26,6 +26,13 @@ WARRANTIES, see the file, "license.txt," in this distribution. flext::thrid_t flext::thrmsgid = 0; #endif +#ifdef FLEXT_SHARED +/* + For the shared version it _should_ be possible to have only one queue for all externals. + Yet I don't know how to do this cross-platform +*/ +#define PERMANENTIDLE +#endif static void Trigger(); @@ -196,18 +203,20 @@ static void QTick(flext_base *c) } #elif FLEXT_QMODE == 1 -#ifndef FLEXT_SHARED +#ifndef PERMANENTIDLE static bool qtickactive = false; #endif static t_int QTick(t_int *) { -#ifndef FLEXT_SHARED +#ifndef PERMANENTIDLE qtickactive = false; #endif + QWork(false); -#ifdef FLEXT_SHARED + +#ifdef PERMANENTIDLE // will be run in the next idle cycle - return 2; + return 2; #else // won't be run again // for non-shared externals assume that there's rarely a message waiting @@ -239,7 +248,7 @@ static void Trigger() #if FLEXT_QMODE == 2 // wake up worker thread qthrcond.Signal(); - #elif FLEXT_QMODE == 1 && !defined(FLEXT_SHARED) + #elif FLEXT_QMODE == 1 && !defined(PERMANENTIDLE) if(!qtickactive) { sys_callback(QTick,NULL,0); qtickactive = true; @@ -280,7 +289,7 @@ void flext_base::StartQueue() else started = true; #if FLEXT_QMODE == 1 -#ifdef FLEXT_SHARED +#ifdef PERMANENTIDLE sys_callback(QTick,NULL,0); #endif #elif FLEXT_QMODE == 2 |