From 216da4973fc523fc207d5d0f5986da227e7e6665 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 6 Jul 2005 16:08:20 +0000 Subject: changed initialization functions accordingly FIFO code with mutex lock c++ conformance fix fixes for Codewarrior updates for OSX extracted maps into flmap.h fix for BCC made flext::Forward threadsafe don't install build system yet digest one-element list messages as single atoms updated tutorials fixes for MSVC6 documentation slimmed object data structures simplified message analysis corrected flext version to 0.4.5 added X86-64 code for lockfree fifos preparation of release upgraded version number svn path=/trunk/; revision=3292 --- externals/grill/flext/source/flbase.h | 21 ++++++-------- externals/grill/flext/source/flbind.cpp | 2 +- externals/grill/flext/source/flclass.h | 16 ++++++----- externals/grill/flext/source/flcontainers.h | 43 ++++++++++++++++++++++++++++- externals/grill/flext/source/fldoxygen.h | 6 ++-- externals/grill/flext/source/flext.h | 2 +- externals/grill/flext/source/flitem.cpp | 2 +- externals/grill/flext/source/flmap.h | 2 +- externals/grill/flext/source/flprefix.h | 4 ++- externals/grill/flext/source/flsupport.h | 8 ++++-- externals/grill/flext/source/flthr.cpp | 8 +++--- 11 files changed, 79 insertions(+), 35 deletions(-) (limited to 'externals/grill/flext/source') diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h index b487a63e..d20f1866 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -94,12 +94,9 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): { public: - /*! \defgroup FLEXT_OBJCLASS Object base class - @{ - */ // --- creation ------------------------------------------------------- - /*! \defgroup FLEXT_O_CREATION Creation/Destruction functionality + /*! \defgroup FLEXT_OBJ_CREATION Object creation/destruction functionality @{ */ @@ -129,11 +126,11 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): //! Virtual function called at destruction (before the destructor) virtual void Exit(); - //! @} FLEXT_O_CREATION + //! @} FLEXT_OBJ_CREATION // --- info ------------------------------------------------------- - /*! \defgroup FLEXT_O_INFO Get various information + /*! \defgroup FLEXT_OBJ_INFO Get various information @{ */ @@ -161,11 +158,11 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): bool HasAttributes() const; - //! @} FLEXT_O_INFO + //! @} FLEXT_OBJ_INFO // --- help ------------------------------------------------------- - /*! \defgroup FLEXT_O_HELP Help/assistance functionality + /*! \defgroup FLEXT_OBJ_HELP Help/assistance functionality \remark This is still PD only @{ */ @@ -178,12 +175,12 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): //! Define the help reference symbol for a class void DefineHelp(const char *ref,const char *dir = NULL,bool addtilde = false) { DefineHelp(thisClassId(),ref,dir,addtilde); } - //! @} + //! @} FLEXT_OBJ_HELP // --- internal stuff ------------------------------------------------------- - /*! \defgroup FLEXT_O_INTERNAL Internal stuff + /*! \defgroup FLEXT_OBJ_INTERNAL Internal stuff \internal @{ */ @@ -262,9 +259,7 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): //! Get the canvas arguments void CanvasArgs(AtomList &args) const; - //! @} FLEXT_O_INTERNAL - - //! @} FLEXT_OBJCLASS + //! @} FLEXT_OBJ_INTERNAL }; diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp index 7611fc59..8f78c300 100644 --- a/externals/grill/flext/source/flbind.cpp +++ b/externals/grill/flext/source/flbind.cpp @@ -188,7 +188,7 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym Item *it = set.find(sym); if(fun) { // check if function matches - for(; it && static_cast(it)->fun != fun; it = it->nxt); + for(; it && static_cast(it)->fun != fun; it = it->nxt) {} } item = static_cast(it); } diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index e8b68e69..ff9e8a26 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -506,6 +506,15 @@ public: // xxx internal stuff xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +public: // needed by VC++ 6 + + enum xlettype { + xlet_none = 0, + xlet_float,xlet_int,xlet_sym,xlet_list,xlet_any, + xlet_LIST,xlet_ANY, // use AtomList and AtomAnything + xlet_sig + }; + protected: FLEXT_CLASSDEF(flext_base)(); @@ -516,13 +525,6 @@ protected: virtual bool Init(); - enum xlettype { - xlet_none = 0, - xlet_float,xlet_int,xlet_sym,xlet_list,xlet_any, - xlet_LIST,xlet_ANY, // use AtomList and AtomAnything - xlet_sig - }; - /*! \defgroup FLEXT_C_ATTR Attribute handling methods (object scope) @{ */ diff --git a/externals/grill/flext/source/flcontainers.h b/externals/grill/flext/source/flcontainers.h index 0e248ffb..76442d15 100644 --- a/externals/grill/flext/source/flcontainers.h +++ b/externals/grill/flext/source/flcontainers.h @@ -307,8 +307,49 @@ public: } inline size_t Size() const { return oc; } + #else -#error Platform not supported + // no lock free code available for this compiler/platform + + inline void Push(Cell *c) + { +#ifdef FLEXT_THREADS + mutex.Lock(); +#endif + c->link = (Cell *)top; + top = c; + ++oc; +#ifdef FLEXT_THREADS + mutex.Unlock(); +#endif + } + + inline Cell *Pop() + { + if(top) { + Cell *r; +#ifdef FLEXT_THREADS + mutex.Lock(); +#endif + r = (Cell *)top; + top = r->link; + --oc; +#ifdef FLEXT_THREADS + mutex.Unlock(); +#endif + return r; + } + else + return NULL; + } + + inline size_t Size() const { return oc; } + +private: +#ifdef FLEXT_THREADS + flext::ThrMutex mutex; +#endif + #endif private: diff --git a/externals/grill/flext/source/fldoxygen.h b/externals/grill/flext/source/fldoxygen.h index 51579520..96343528 100644 --- a/externals/grill/flext/source/fldoxygen.h +++ b/externals/grill/flext/source/fldoxygen.h @@ -14,7 +14,7 @@ Currently there exist two widely used modular systems for real-time audio that can be extended by self-written objects (so called "externals"):
-Max/MSP (http://www.cycling74.com) and Pure Data (http://www.pure-data.org). +Max/MSP (http://www.cycling74.com) and Pure Data (http://www.pure-data.org) . Both come with APIs that are not very different (as they share their origin), but as well not quite the same. Flext seeks to provide a unifying interface for the APIs of those real-time systems while also @@ -48,7 +48,7 @@ Currently, flext supports
  • PD on Windows with Microsoft Visual C++, Borland C++ and gcc(cygwin) compilers
  • PD on Linux with gcc -
  • PD on Mac OSX with gcc (makefile or Project Builder) +
  • PD on Mac OSX with gcc (makefile or Xcode)
  • Max/MSP on Mac OS9 and OSX with Metrowerks CodeWarrior
@@ -78,7 +78,7 @@ referenced works and their license texts. \section DOWNLOAD Download -Download the latest flext version from http://www.parasitaere-kapazitaeten.net/ext/flext .
+Download the latest flext version from http://grrrr.org/ext/flext .
Alternatively, you can check out the cvs version from http://sourceforge.net/projects/pure-data . \section USAGE Usage diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h index f58447e5..a55e2b67 100644 --- a/externals/grill/flext/source/flext.h +++ b/externals/grill/flext/source/flext.h @@ -26,7 +26,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define FLEXT_VERSION 500 //! \brief flext version string -#define FLEXT_VERSTR "0.5.0pre" +#define FLEXT_VERSTR "0.5.0" //! @} diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp index 52657c75..1ae65fa8 100755 --- a/externals/grill/flext/source/flitem.cpp +++ b/externals/grill/flext/source/flitem.cpp @@ -124,4 +124,4 @@ flext_base::ItemCont *flext_base::GetClassArr(t_classid c,int ix) if(!cont) map.insert(c,cont = new ItemCont); return cont; } -*/ \ No newline at end of file +*/ diff --git a/externals/grill/flext/source/flmap.h b/externals/grill/flext/source/flmap.h index 0d3f623d..601f1df7 100644 --- a/externals/grill/flext/source/flmap.h +++ b/externals/grill/flext/source/flmap.h @@ -188,7 +188,7 @@ private: template class TablePtrMap : -#if defined(_MSC_VER) && _MSC_VER < 1300 +#if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__) || defined(__MWERKS__) public // necessary for VC6 #endif TableAnyMap diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h index 4b3e96fb..68d9e120 100755 --- a/externals/grill/flext/source/flprefix.h +++ b/externals/grill/flext/source/flprefix.h @@ -364,7 +364,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. exported functions refer to the first instance loaded! Therefore different class names are used so that the correct type of flext function is called. */ -#if defined(FLEXT_SHARED) +#ifdef __DOXYGEN__ + #define FLEXT_CLASSDEF(CL) CL +#elif defined(FLEXT_SHARED) #define FLEXT_CLASSDEF(CL) CL##_shared #elif defined(FLEXT_THREADS) #define FLEXT_CLASSDEF(CL) CL##_multi diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index 9d91ee9c..a439b47b 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -53,8 +53,10 @@ public: //! Overloaded delete method void operator delete(void *blk); +#ifndef __BORLANDC__ inline void *operator new(size_t,void *p) { return p; } inline void operator delete(void *,void *) {} +#endif #ifdef FLEXT_DEBUGMEM static bool MemCheck(void *blk); @@ -62,13 +64,15 @@ public: static bool MemCheck(void *) { return true; } #endif - #ifndef __MRC__ // doesn't allow new[] overloading?! +#ifndef __MRC__ // doesn't allow new[] overloading?! inline void *operator new[](size_t bytes) { return operator new(bytes); } inline void operator delete[](void *blk) { operator delete(blk); } +#ifndef __BORLANDC__ inline void *operator new[](size_t,void *p) { return p; } inline void operator delete[](void *,void *) {} - #endif +#endif +#endif //! Get an aligned memory block static void *NewAligned(size_t bytes,int bitalign = 128); diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp index fb2a28b5..e7e534eb 100644 --- a/externals/grill/flext/source/flthr.cpp +++ b/externals/grill/flext/source/flthr.cpp @@ -25,7 +25,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include -#if FLEXT_OSAPI == FLEXT_OSAPI_UNIX_POSIX || FLEXT_OSAPI == FLEXT_OSAPI_WIN_POSIX +#if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH || FLEXT_OSAPI == FLEXT_OSAPI_UNIX_POSIX || FLEXT_OSAPI == FLEXT_OSAPI_WIN_POSIX #include #include #elif FLEXT_OS == FLEXT_OS_WIN @@ -51,7 +51,7 @@ class thr_entry , public Fifo::Cell { public: - void thr_entry::Set(void (*m)(thr_params *),thr_params *p,thrid_t id = GetThreadId()) + void Set(void (*m)(thr_params *),thr_params *p,thrid_t id = GetThreadId()) { th = p?p->cl:NULL; meth = m,params = p,thrid = id; @@ -91,7 +91,7 @@ public: thr_entry *fnd; while((fnd = Pop()) && !fnd->Is(id)) qutmp.Push(fnd); // put back entries - for(thr_entry *ti; ti = qutmp.Pop(); ) Push(ti); + for(thr_entry *ti; (ti = qutmp.Pop()) != NULL; ) Push(ti); if(fnd && !pop) Push(fnd); return fnd; } @@ -180,7 +180,7 @@ void flext::ThrHelper(void *) // start all inactive threads thr_entry *ti; - while(ti = thrpending.Pop()) { + while((ti = thrpending.Pop()) != NULL) { bool ok; #if FLEXT_THREADS == FLEXT_THR_POSIX -- cgit v1.2.1