Update of /cvsroot/pure-data/externals/grill/flext/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26917/source
Modified Files: flcontainers.h flqueue.cpp Log Message: small name change and reuse of Fifo cells fixed eol-style new lock-free lifo and fifo fixes for linux eliminated ChannelsIn/ChannelsOut updated docs build system: added profiler mode, more fixes fix for linux autodetection of build platform fix for flext_dsp @ Max
Index: flqueue.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flqueue.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** flqueue.cpp 26 Feb 2005 04:56:22 -0000 1.28 --- flqueue.cpp 27 Feb 2005 04:56:10 -0000 1.29 *************** *** 30,34 **** class qmsg: public flext, ! public Cell { public: --- 30,34 ---- class qmsg: public flext, ! public Fifo::Cell { public: *************** *** 38,41 **** --- 38,48 ---- {}
+ void Set(flext_base *t,int o,const t_symbol *s,int ac,const t_atom *av) + { + th = t; + out = o; + msg(s,ac,av); + } + // \note PD sys lock must already be held by caller void Send() const *************** *** 60,85 **** class Queue: public flext, ! public Fifo { public: inline bool Empty() const { return Size() == 0; }
! inline void Push(qmsg *q) { Fifo::Put(q); } ! ! inline qmsg *Pop() { return static_cast<qmsg *>(Fifo::Get()); }
! void Push(flext_base *th,int o) // bang { ! Put(new qmsg(th,o,sym_bang,0,NULL)); }
! void Push(flext_base *th,int o,float dt) { t_atom at; SetFloat(at,dt); ! Put(new qmsg(th,o,sym_float,1,&at)); }
! void Push(flext_base *th,int o,int dt) { t_atom at; --- 67,90 ---- class Queue: public flext, ! public TypedFifo<qmsg> { public: inline bool Empty() const { return Size() == 0; }
! void New(flext_base *t,int o,const t_symbol *s,int ac,const t_atom *av);
! inline void Push(flext_base *th,int o) // bang { ! New(th,o,sym_bang,0,NULL); }
! inline void Push(flext_base *th,int o,float dt) { t_atom at; SetFloat(at,dt); ! New(th,o,sym_float,1,&at); }
! inline void Push(flext_base *th,int o,int dt) { t_atom at; *************** *** 93,104 **** #error Not implemented! #endif ! Put(new qmsg(th,o,sym,1,&at)); }
! void Push(flext_base *th,int o,const t_symbol *dt) { t_atom at; SetSymbol(at,dt); ! Put(new qmsg(th,o,sym_symbol,1,&at)); }
--- 98,109 ---- #error Not implemented! #endif ! New(th,o,sym,1,&at); }
! inline void Push(flext_base *th,int o,const t_symbol *dt) { t_atom at; SetSymbol(at,dt); ! New(th,o,sym_symbol,1,&at); }
*************** *** 122,140 **** return; } ! Put(new qmsg(th,o,sym,1,&a)); }
! void Push(flext_base *th,int o,int argc,const t_atom *argv) { ! Put(new qmsg(th,o,sym_list,argc,argv)); }
! void Push(flext_base *th,int o,const t_symbol *sym,int argc,const t_atom *argv) { ! Put(new qmsg(th,o,sym,argc,argv)); } };
! static Queue queue;
--- 127,155 ---- return; } ! New(th,o,sym,1,&a); }
! inline void Push(flext_base *th,int o,int argc,const t_atom *argv) { ! New(th,o,sym_list,argc,argv); }
! inline void Push(flext_base *th,int o,const t_symbol *sym,int argc,const t_atom *argv) { ! New(th,o,sym,argc,argv); } };
! static Queue queue,requeue; ! ! void Queue::New(flext_base *t,int o,const t_symbol *s,int ac,const t_atom *av) ! { ! qmsg *m = requeue.Get(); ! if(m) ! m->Set(t,o,s,ac,av); ! else ! m = new qmsg(t,o,s,ac,av); ! Put(m); ! }
*************** *** 164,170 ****
qmsg *q; ! while((q = queue.Pop()) != NULL) { q->Send(); ! delete q; }
--- 179,185 ----
qmsg *q; ! while((q = queue.Get()) != NULL) { q->Send(); ! requeue.Put(q); }
Index: flcontainers.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flcontainers.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** flcontainers.h 26 Feb 2005 04:56:22 -0000 1.1 --- flcontainers.h 27 Feb 2005 04:56:10 -0000 1.2 *************** *** 22,34 ****
- class Cell - { - friend class Lifo; - friend class Fifo; - private: - Cell *link; - }; - - #if 1 //def __Pentium__ #define VTYPE volatile --- 22,25 ---- *************** *** 43,46 **** --- 34,45 ---- { public: + class Cell + { + friend class Lifo; + friend class Fifo; + private: + Cell *link; + }; + inline Lifo() { Init(); }
*************** *** 114,118 ****
inline size_t Size() const { return ic-oc; } ! #elif defined(__GNUC__) && defined(__) #ifndef SMPLOCK # ifdef __SMP__ --- 113,117 ----
inline size_t Size() const { return ic-oc; } ! #elif defined(__GNUC__) && (defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__)) #ifndef SMPLOCK # ifdef __SMP__ *************** *** 146,150 **** inline Cell *Pop() { ! cell* v=0; __asm__ __volatile__ ( "# LFPOP \n\t" --- 145,149 ---- inline Cell *Pop() { ! Cell *v=0; __asm__ __volatile__ ( "# LFPOP \n\t" *************** *** 172,176 **** }
! inline size_t Size() { size_t n; --- 171,175 ---- }
! inline size_t Size() const { size_t n; *************** *** 259,266 **** --- 258,277 ---- };
+ template <typename T> + class TypedLifo + : public Lifo + { + public: + inline T *Avail() { return static_cast<T *>(Lifo::Avail()); } + inline void Push(T *c) { Lifo::Push(static_cast<T *>(c)); } + inline T *Pop() { return static_cast<T *>(Lifo::Pop()); } + }; +
class FLEXT_SHARE Fifo { public: + typedef Lifo::Cell Cell; + void Init() { in.Init(); out.Init(); }
*************** *** 312,315 **** --- 323,337 ---- };
+ template <typename T> + class TypedFifo + : public Fifo + { + public: + inline T *Avail() { return static_cast<T *>(Fifo::Avail()); } + inline void Put(T *c) { Fifo::Put(static_cast<T *>(c)); } + inline T *Get() { return static_cast<T *>(Fifo::Get()); } + inline T *Clear() { return static_cast<T *>(Fifo::Clear()); } + }; +
#endif