From e2e771a22a3fd072b16409932e339ad52b040a91 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 25 Apr 2005 12:50:35 +0000 Subject: small fixes fixes for MSVC6 svn path=/trunk/; revision=2813 --- externals/grill/flext/flext.vcproj | 3 +++ externals/grill/flext/notes.txt | 4 +++- externals/grill/flext/source/flext.cpp | 2 +- externals/grill/flext/source/flmap.h | 28 +++++++++++++++++++--------- externals/grill/flext/source/flqueue.cpp | 21 +++++++++++++++------ 5 files changed, 41 insertions(+), 17 deletions(-) (limited to 'externals') diff --git a/externals/grill/flext/flext.vcproj b/externals/grill/flext/flext.vcproj index 49f30ac1..46b42f75 100644 --- a/externals/grill/flext/flext.vcproj +++ b/externals/grill/flext/flext.vcproj @@ -3177,6 +3177,9 @@ copy F:\prog\max\flext\max-msvc\flext.max.dll f:\prog\dll + + diff --git a/externals/grill/flext/notes.txt b/externals/grill/flext/notes.txt index aed2641b..d5669606 100644 --- a/externals/grill/flext/notes.txt +++ b/externals/grill/flext/notes.txt @@ -24,7 +24,9 @@ Porting to new compilers/platforms: ---------------------------------------------------------------------------- KNOWN BUGS: -- can't use MFC libraries because of global new and delete overloadings +- Some few external libraries have troubles with flext's global new and delete overloadings. + In these cases one can switch back to the C library memory operators by defining the FLEXT_NOGLOBALNEW macro before + inclusion of the flext.h header file (e.g. as a -D compiler option) - MaxMSP Mach-O DSP externals cannot be the first externals loaded (e.g. in Max Runtime) there must be a CFM signal external loaded beforehand!!! (Max will crash otherwise) 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 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 -- cgit v1.2.1