Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22846/source
Modified Files:
flatom_app.cpp flatom_part.cpp flatom_pr.cpp flattr_ed.cpp
flbase.cpp flbase.h flbind.cpp flbuf.cpp flcwmax-thr.h
flcwmax-x-thr.h flcwmax.h flcwpd-x-thr.h flcwpd-x.h fldefs.h
fldefs_attradd.h fldefs_attrcb.h fldefs_attrvar.h
fldefs_methadd.h fldefs_methcall.h fldefs_methcb.h
fldefs_setup.h fldoxygen.h fldsp.cpp flext.cpp flext.h
flinternal.h flitem.cpp fllib.cpp flmeth.cpp flmsg.cpp
flmspbuffer.h flout.cpp flprefix.h flproxy.cpp flqueue.cpp
flsimd.cpp flsndobj.cpp flsndobj.h flstdc.h flstk.cpp flstk.h
flsupport.h fltimer.cpp flutil.cpp flxlet.cpp
Log Message:
""
Index: flqueue.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flqueue.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** flqueue.cpp 20 Mar 2004 03:23:11 -0000 1.15
--- flqueue.cpp 21 Jun 2004 13:58:19 -0000 1.16
***************
*** 28,68 ****
{
public:
! qmsg(flext_base *b): nxt(NULL),th(b),tp(tp_none) {}
! ~qmsg();
! qmsg *nxt;
! void Clear();
! void SetBang(int o) { Clear(); out = o; tp = tp_bang; }
! void SetFloat(int o,float f) { Clear(); out = o; tp = tp_float; _float = f; }
! void SetInt(int o,int i) { Clear(); out = o; tp = tp_int; _int = i; }
! void SetSymbol(int o,const t_symbol *s) { Clear(); out = o; tp = tp_sym; _sym = s; }
! void SetList(int o,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_list; _list.argc = argc,_list.argv = flext::CopyList(argc,argv); }
! void SetAny(int o,const t_symbol *s,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_any; _any.s = s,_any.argc = argc,_any.argv = flext::CopyList(argc,argv); }
! flext_base *th;
! int out;
! enum { tp_none,tp_bang,tp_float,tp_int,tp_sym,tp_list,tp_any } tp;
! union {
! float _float;
! int _int;
! const t_symbol *_sym;
! struct { int argc; t_atom *argv; } _list;
! struct { const t_symbol *s; int argc; t_atom *argv; } _any;
! };
};
qmsg::~qmsg()
{
! Clear();
! if(nxt) delete nxt;
}
void qmsg::Clear()
{
! if(tp == tp_list) { if(_list.argv) delete[] _list.argv; }
! else if(tp == tp_any) { if(_any.argv) delete[] _any.argv; }
! tp = tp_none;
}
--- 28,68 ----
{
public:
! qmsg(flext_base *b): nxt(NULL),th(b),tp(tp_none) {}
! ~qmsg();
! qmsg *nxt;
! void Clear();
! void SetBang(int o) { Clear(); out = o; tp = tp_bang; }
! void SetFloat(int o,float f) { Clear(); out = o; tp = tp_float; _float = f; }
! void SetInt(int o,int i) { Clear(); out = o; tp = tp_int; _int = i; }
! void SetSymbol(int o,const t_symbol *s) { Clear(); out = o; tp = tp_sym; _sym = s; }
! void SetList(int o,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_list; _list.argc = argc,_list.argv = flext::CopyList(argc,argv); }
! void SetAny(int o,const t_symbol *s,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_any; _any.s = s,_any.argc = argc,_any.argv = flext::CopyList(argc,argv); }
! flext_base *th;
! int out;
! enum { tp_none,tp_bang,tp_float,tp_int,tp_sym,tp_list,tp_any } tp;
! union {
! float _float;
! int _int;
! const t_symbol *_sym;
! struct { int argc; t_atom *argv; } _list;
! struct { const t_symbol *s; int argc; t_atom *argv; } _any;
! };
};
qmsg::~qmsg()
{
! Clear();
! if(nxt) delete nxt;
}
void qmsg::Clear()
{
! if(tp == tp_list) { if(_list.argv) delete[] _list.argv; }
! else if(tp == tp_any) { if(_any.argv) delete[] _any.argv; }
! tp = tp_none;
}
***************
*** 84,175 ****
static void QWork(bool qlock,bool syslock)
{
! for(;;) {
! // Since qcnt can only be increased from any other function than QWork
! // qc will be a minimum guaranteed number of present queue elements.
! // On the other hand, if new queue elements are added by the methods called
! // in the loop, these will be sent in the next tick to avoid recursion overflow.
! int qc = qcnt;
! if(!qc) break;
! #ifdef FLEXT_QTHR
! if(syslock) sys_lock();
! #endif
! for(int i = 0; i < qc && qhead; ++i) {
! #ifdef FLEXT_THREADS
! if(qlock) qmutex.Lock();
! #endif
! qmsg *m = qhead;
! qcnt--;
! qhead = m->nxt;
! if(!qhead) qtail = NULL;
! m->nxt = NULL;
! #ifdef FLEXT_THREADS
! if(qlock) qmutex.Unlock();
! #endif
! if(m->out < 0) {
! // message to self
! const int n = -1-m->out;
! t_atom tmp;
! switch(m->tp) {
! case qmsg::tp_bang:
! m->th->m_methodmain(n,flext::sym_bang,0,&tmp);
! break;
! case qmsg::tp_float:
! flext::SetFloat(tmp,m->_float);
! m->th->m_methodmain(n,flext::sym_float,1,&tmp);
! break;
! case qmsg::tp_int:
! flext::SetInt(tmp,m->_int);
! #if FLEXT_SYS == FLEXT_SYS_PD
! m->th->m_methodmain(n,flext::sym_float,1,&tmp);
! #elif FLEXT_SYS == FLEXT_SYS_MAX
! m->th->m_methodmain(n,flext::sym_int,1,&tmp);
! #else
! #error Not implemented!
! #endif
! case qmsg::tp_sym:
! flext::SetSymbol(tmp,m->_sym);
! m->th->m_methodmain(n,flext::sym_symbol,1,&tmp);
! break;
! case qmsg::tp_list:
! m->th->m_methodmain(n,flext::sym_list,m->_list.argc,m->_list.argv);
! break;
! case qmsg::tp_any:
! m->th->m_methodmain(n,m->_any.s,m->_any.argc,m->_any.argv);
! break;
! #ifdef FLEXT_DEBUG
! default: ERRINTERNAL();
! #endif
! }
! }
! else {
! // message to outlet
! switch(m->tp) {
! case qmsg::tp_bang: m->th->ToSysBang(m->out); break;
! case qmsg::tp_float: m->th->ToSysFloat(m->out,m->_float); break;
! case qmsg::tp_int: m->th->ToSysInt(m->out,m->_int); break;
! case qmsg::tp_sym: m->th->ToSysSymbol(m->out,m->_sym); break;
! case qmsg::tp_list: m->th->ToSysList(m->out,m->_list.argc,m->_list.argv); break;
! case qmsg::tp_any: m->th->ToSysAnything(m->out,m->_any.s,m->_any.argc,m->_any.argv); break;
! #ifdef FLEXT_DEBUG
! default: ERRINTERNAL();
! #endif
! }
! }
! // delete processed queue element
! delete m;
! } // inner loop
! #ifdef FLEXT_QTHR
! if(syslock) sys_unlock();
! #endif
! } // for(;;)
}
--- 84,175 ----
static void QWork(bool qlock,bool syslock)
{
! for(;;) {
! // Since qcnt can only be increased from any other function than QWork
! // qc will be a minimum guaranteed number of present queue elements.
! // On the other hand, if new queue elements are added by the methods called
! // in the loop, these will be sent in the next tick to avoid recursion overflow.
! int qc = qcnt;
! if(!qc) break;
! #ifdef FLEXT_QTHR
! if(syslock) sys_lock();
! #endif
! for(int i = 0; i < qc && qhead; ++i) {
! #ifdef FLEXT_THREADS
! if(qlock) qmutex.Lock();
! #endif
! qmsg *m = qhead;
! qcnt--;
! qhead = m->nxt;
! if(!qhead) qtail = NULL;
! m->nxt = NULL;
! #ifdef FLEXT_THREADS
! if(qlock) qmutex.Unlock();
! #endif
! if(m->out < 0) {
! // message to self
! const int n = -1-m->out;
! t_atom tmp;
! switch(m->tp) {
! case qmsg::tp_bang:
! m->th->m_methodmain(n,flext::sym_bang,0,&tmp);
! break;
! case qmsg::tp_float:
! flext::SetFloat(tmp,m->_float);
! m->th->m_methodmain(n,flext::sym_float,1,&tmp);
! break;
! case qmsg::tp_int:
! flext::SetInt(tmp,m->_int);
! #if FLEXT_SYS == FLEXT_SYS_PD
! m->th->m_methodmain(n,flext::sym_float,1,&tmp);
! #elif FLEXT_SYS == FLEXT_SYS_MAX
! m->th->m_methodmain(n,flext::sym_int,1,&tmp);
! #else
! #error Not implemented!
! #endif
! case qmsg::tp_sym:
! flext::SetSymbol(tmp,m->_sym);
! m->th->m_methodmain(n,flext::sym_symbol,1,&tmp);
! break;
! case qmsg::tp_list:
! m->th->m_methodmain(n,flext::sym_list,m->_list.argc,m->_list.argv);
! break;
! case qmsg::tp_any:
! m->th->m_methodmain(n,m->_any.s,m->_any.argc,m->_any.argv);
! break;
! #ifdef FLEXT_DEBUG
! default: ERRINTERNAL();
! #endif
! }
! }
! else {
! // message to outlet
! switch(m->tp) {
! case qmsg::tp_bang: m->th->ToSysBang(m->out); break;
! case qmsg::tp_float: m->th->ToSysFloat(m->out,m->_float); break;
! case qmsg::tp_int: m->th->ToSysInt(m->out,m->_int); break;
! case qmsg::tp_sym: m->th->ToSysSymbol(m->out,m->_sym); break;
! case qmsg::tp_list: m->th->ToSysList(m->out,m->_list.argc,m->_list.argv); break;
! case qmsg::tp_any: m->th->ToSysAnything(m->out,m->_any.s,m->_any.argc,m->_any.argv); break;
! #ifdef FLEXT_DEBUG
! default: ERRINTERNAL();
! #endif
! }
! }
! // delete processed queue element
! delete m;
! } // inner loop
! #ifdef FLEXT_QTHR
! if(syslock) sys_unlock();
! #endif
! } // for(;;)
}
***************
*** 182,190 ****
{
#endif
! // post("qtick");
#ifdef FLEXT_THREADS
! FLEXT_ASSERT(flext::IsSystemThread());
#endif
! QWork(true,false);
}
#endif
--- 182,190 ----
{
#endif
! // post("qtick");
#ifdef FLEXT_THREADS
! FLEXT_ASSERT(flext::IsSystemThread());
#endif
! QWork(true,false);
}
#endif
***************
*** 197,211 ****
{
#ifdef FLEXT_THREADS
! if(!IsSystemThread()) {
! error("flext - Queue flush called by wrong thread!");
! return;
! }
#endif
#ifdef FLEXT_THREADS
! qmutex.Lock();
#endif
! while(qcnt) QWork(false,false);
#ifdef FLEXT_THREADS
! qmutex.Unlock();
#endif
}
--- 197,211 ----
{
#ifdef FLEXT_THREADS
! if(!IsSystemThread()) {
! error("flext - Queue flush called by wrong thread!");
! return;
! }
#endif
#ifdef FLEXT_THREADS
! qmutex.Lock();
#endif
! while(qcnt) QWork(false,false);
#ifdef FLEXT_THREADS
! qmutex.Unlock();
#endif
}
***************
*** 213,227 ****
static void Queue(qmsg *m)
{
! // post("Queue");
#ifdef FLEXT_THREADS
! qmutex.Lock();
#endif
! if(qtail) qtail->nxt = m;
! else qhead = m;
! qtail = m;
! qcnt++;
#ifdef FLEXT_THREADS
! qmutex.Unlock();
#endif
--- 213,227 ----
static void Queue(qmsg *m)
{
! // post("Queue");
#ifdef FLEXT_THREADS
! qmutex.Lock();
#endif
! if(qtail) qtail->nxt = m;
! else qhead = m;
! qtail = m;
! qcnt++;
#ifdef FLEXT_THREADS
! qmutex.Unlock();
#endif
***************
*** 230,242 ****
// wake up a worker thread
// (instead of triggering the clock)
! qthrcond.Signal();
! #else
! clock_delay(qclk,0);
#endif
#elif FLEXT_SYS == FLEXT_SYS_MAX
! qelem_set(qclk);
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! // this is dangerous because there may be other timers on this object!
! fts_timebase_add_call(fts_get_timebase(), (fts_object_t *)thisHdr(), QTick, NULL, 0);
#else
#error Not implemented
--- 230,242 ----
// wake up a worker thread
// (instead of triggering the clock)
! qthrcond.Signal();
! #else
! clock_delay(qclk,0);
#endif
#elif FLEXT_SYS == FLEXT_SYS_MAX
! qelem_set(qclk);
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! // this is dangerous because there may be other timers on this object!
! fts_timebase_add_call(fts_get_timebase(), (fts_object_t *)thisHdr(), QTick, NULL, 0);
#else
#error Not implemented
***************
*** 248,255 ****
{
thrmsgid = GetThreadId();
! for(;;) {
! qthrcond.Wait();
! QWork(true,true);
! }
}
#endif
--- 248,255 ----
{
thrmsgid = GetThreadId();
! for(;;) {
! qthrcond.Wait();
! QWork(true,true);
! }
}
#endif
***************
*** 257,273 ****
void flext_base::StartQueue()
{
! static bool started = false;
! if(started) return;
! else started = true;
! // message queue ticker
! qhead = qtail = NULL;
! qcnt = 0;
#ifdef FLEXT_QTHR
! LaunchThread(QWorker,NULL);
#else
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! qclk = (t_qelem *)(qelem_new(NULL,(t_method)QTick));
#else
#error Not implemented!
--- 257,273 ----
void flext_base::StartQueue()
{
! static bool started = false;
! if(started) return;
! else started = true;
! // message queue ticker
! qhead = qtail = NULL;
! qcnt = 0;
#ifdef FLEXT_QTHR
! LaunchThread(QWorker,NULL);
#else
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! qclk = (t_qelem *)(qelem_new(NULL,(t_method)QTick));
#else
#error Not implemented!
***************
*** 278,325 ****
void flext_base::ToQueueBang(int o) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetBang(o);
! Queue(m);
}
void flext_base::ToQueueFloat(int o,float f) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetFloat(o,f);
! Queue(m);
}
void flext_base::ToQueueInt(int o,int f) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetInt(o,f);
! Queue(m);
}
void flext_base::ToQueueSymbol(int o,const t_symbol *s) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetSymbol(o,s);
! Queue(m);
}
void flext_base::ToQueueList(int o,int argc,const t_atom *argv) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetList(o,argc,argv);
! Queue(m);
}
void flext_base::ToQueueAnything(int o,const t_symbol *s,int argc,const t_atom *argv) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetAny(o,s,argc,argv);
! Queue(m);
}
--- 278,325 ----
void flext_base::ToQueueBang(int o) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetBang(o);
! Queue(m);
}
void flext_base::ToQueueFloat(int o,float f) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetFloat(o,f);
! Queue(m);
}
void flext_base::ToQueueInt(int o,int f) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetInt(o,f);
! Queue(m);
}
void flext_base::ToQueueSymbol(int o,const t_symbol *s) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetSymbol(o,s);
! Queue(m);
}
void flext_base::ToQueueList(int o,int argc,const t_atom *argv) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetList(o,argc,argv);
! Queue(m);
}
void flext_base::ToQueueAnything(int o,const t_symbol *s,int argc,const t_atom *argv) const
{
! FLEXT_ASSERT(o >= 0);
! qmsg *m = new qmsg(const_cast<flext_base *>(this));
! m->SetAny(o,s,argc,argv);
! Queue(m);
}
Index: fldefs_attrcb.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldefs_attrcb.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** fldefs_attrcb.h 12 Dec 2003 03:32:56 -0000 1.3
--- fldefs_attrcb.h 21 Jun 2004 13:58:19 -0000 1.4
***************
*** 20,24 ****
/*! \brief Declare a attribute set function
! \internal
*/
#define FLEXT_CALLSET_(FUN,TP) \
--- 20,24 ----
/*! \brief Declare a attribute set function
! \internal
*/
#define FLEXT_CALLSET_(FUN,TP) \
***************
*** 27,31 ****
/*! \brief Declare a attribute get function
! \internal
*/
#define FLEXT_CALLGET_(FUN,TP) \
--- 27,31 ----
/*! \brief Declare a attribute get function
! \internal
*/
#define FLEXT_CALLGET_(FUN,TP) \
***************
*** 35,41 ****
! /*! \defgroup FLEXT_DA_CALLSET Definition of attribute set handlers
\ingroup FLEXT_D_ATTRIB
! @{
*/
--- 35,41 ----
! /*! \defgroup FLEXT_DA_CALLSET Definition of attribute set handlers
\ingroup FLEXT_D_ATTRIB
! @{
*/
***************
*** 76,82 ****
//! @} FLEXT_DA_CALLSET
! /*! \defgroup FLEXT_DA_CALLGET Definition of attribute get handlers
\ingroup FLEXT_D_ATTRIB
! @{
*/
--- 76,82 ----
//! @} FLEXT_DA_CALLSET
! /*! \defgroup FLEXT_DA_CALLGET Definition of attribute get handlers
\ingroup FLEXT_D_ATTRIB
! @{
*/
***************
*** 118,124 ****
! /*! \defgroup FLEXT_DA_CALLVAR Definition of attribute transfer handlers (both get and set)
\ingroup FLEXT_D_ATTRIB
! @{
*/
--- 118,124 ----
! /*! \defgroup FLEXT_DA_CALLVAR Definition of attribute transfer handlers (both get and set)
\ingroup FLEXT_D_ATTRIB
! @{
*/
Index: flproxy.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flproxy.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** flproxy.cpp 10 Dec 2003 03:32:53 -0000 1.6
--- flproxy.cpp 21 Jun 2004 13:58:19 -0000 1.7
***************
*** 25,40 ****
void flext_base::px_object::px_method(px_object *obj,const t_symbol *s,int argc,t_atom *argv)
{
! obj->base->m_methodmain(obj->index,s,argc,argv);
}
void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
{
! thisObject(c)->m_methodmain(0,s,argc,argv);
}
#define DEF_IN_FT(IX) \
void flext_base::cb_px_ft ## IX(t_class *c,float v) { \
! t_atom atom; SETFLOAT(&atom,v); \
! thisObject(c)->m_methodmain(IX,sym_float,1,&atom); \
}
--- 25,40 ----
void flext_base::px_object::px_method(px_object *obj,const t_symbol *s,int argc,t_atom *argv)
{
! obj->base->m_methodmain(obj->index,s,argc,argv);
}
void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
{
! thisObject(c)->m_methodmain(0,s,argc,argv);
}
#define DEF_IN_FT(IX) \
void flext_base::cb_px_ft ## IX(t_class *c,float v) { \
! t_atom atom; SETFLOAT(&atom,v); \
! thisObject(c)->m_methodmain(IX,sym_float,1,&atom); \
}
***************
*** 46,54 ****
void flext_base::cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *argv)
{
! // check if inlet allows anything (or list)
!
! flext_base *o = thisObject(c);
! int ci = ((flext_hdr *)o->x_obj)->curinlet;
! o->m_methodmain(ci,s,argc,argv);
}
--- 46,54 ----
void flext_base::cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *argv)
{
! // check if inlet allows anything (or list)
!
! flext_base *o = thisObject(c);
! int ci = ((flext_hdr *)o->x_obj)->curinlet;
! o->m_methodmain(ci,s,argc,argv);
}
***************
*** 58,93 ****
void flext_base::cb_px_int(t_class *c,long v)
{
! flext_base *o = thisObject(c);
! int ci = proxy_getinlet((t_object *)o->x_obj);
! // check if inlet allows int type
! t_atom atom;
! SetInt(atom,v);
! o->m_methodmain(ci,sym_int,1,&atom);
}
void flext_base::cb_px_float(t_class *c,double v)
{
! flext_base *o = thisObject(c);
! int ci = proxy_getinlet((t_object *)o->x_obj);
! // check if inlet allows float type
! t_atom atom;
! SetFloat(atom,v);
! o->m_methodmain(ci,sym_float,1,&atom);
}
#else
void flext_base::cb_px_int(t_class *c,long v)
{
! // check if inlet allows int type
! t_atom atom;
! SetInt(atom,v);
! cb_px_anything(c,sym_int,1,&atom);
}
void flext_base::cb_px_float(t_class *c,double v)
{
! // check if inlet allows float type
! t_atom atom;
! SetFloat(atom,v);
! cb_px_anything(c,sym_float,1,&atom);
}
#endif
--- 58,93 ----
void flext_base::cb_px_int(t_class *c,long v)
{
! flext_base *o = thisObject(c);
! int ci = proxy_getinlet((t_object *)o->x_obj);
! // check if inlet allows int type
! t_atom atom;
! SetInt(atom,v);
! o->m_methodmain(ci,sym_int,1,&atom);
}
void flext_base::cb_px_float(t_class *c,double v)
{
! flext_base *o = thisObject(c);
! int ci = proxy_getinlet((t_object *)o->x_obj);
! // check if inlet allows float type
! t_atom atom;
! SetFloat(atom,v);
! o->m_methodmain(ci,sym_float,1,&atom);
}
#else
void flext_base::cb_px_int(t_class *c,long v)
{
! // check if inlet allows int type
! t_atom atom;
! SetInt(atom,v);
! cb_px_anything(c,sym_int,1,&atom);
}
void flext_base::cb_px_float(t_class *c,double v)
{
! // check if inlet allows float type
! t_atom atom;
! SetFloat(atom,v);
! cb_px_anything(c,sym_float,1,&atom);
}
#endif
***************
*** 95,100 ****
void flext_base::cb_px_bang(t_class *c)
{
! // check if inlet allows bang
! cb_px_anything(c,sym_bang,0,NULL);
}
--- 95,100 ----
void flext_base::cb_px_bang(t_class *c)
{
! // check if inlet allows bang
! cb_px_anything(c,sym_bang,0,NULL);
}
***************
*** 124,158 ****
void flext_base::SetProxies(t_class *c)
{
! // proxy for extra inlets
#if FLEXT_SYS == FLEXT_SYS_PD
! add_anything(c,cb_px_anything); // for leftmost inlet
px_class = class_new(gensym("flext_base proxy"),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL);
! add_anything(px_class,px_object::px_method); // for other inlets
#elif FLEXT_SYS == FLEXT_SYS_MAX
! add_bang(c,cb_px_bang);
! add_method1(c,cb_px_int,"int",A_INT);
! add_method1(c,cb_px_float,"float",A_FLOAT);
! add_methodG(c,cb_px_anything,"list");
! add_anything(c,cb_px_anything);
#else
#error Not implemented!
! #endif
#if 0 //FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
! // could also work for OSX!
! addint((method)cb_px_int);
! addfloat((method)cb_px_float);
#else
! // setup non-leftmost ints and floats
! ADD_IN_FT(1);
! ADD_IN_FT(2);
! ADD_IN_FT(3);
! ADD_IN_FT(4);
! ADD_IN_FT(5);
! ADD_IN_FT(6);
! ADD_IN_FT(7);
! ADD_IN_FT(8);
! ADD_IN_FT(9);
#endif
}
--- 124,158 ----
void flext_base::SetProxies(t_class *c)
{
! // proxy for extra inlets
#if FLEXT_SYS == FLEXT_SYS_PD
! add_anything(c,cb_px_anything); // for leftmost inlet
px_class = class_new(gensym("flext_base proxy"),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL);
! add_anything(px_class,px_object::px_method); // for other inlets
#elif FLEXT_SYS == FLEXT_SYS_MAX
! add_bang(c,cb_px_bang);
! add_method1(c,cb_px_int,"int",A_INT);
! add_method1(c,cb_px_float,"float",A_FLOAT);
! add_methodG(c,cb_px_anything,"list");
! add_anything(c,cb_px_anything);
#else
#error Not implemented!
! #endif
#if 0 //FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
! // could also work for OSX!
! addint((method)cb_px_int);
! addfloat((method)cb_px_float);
#else
! // setup non-leftmost ints and floats
! ADD_IN_FT(1);
! ADD_IN_FT(2);
! ADD_IN_FT(3);
! ADD_IN_FT(4);
! ADD_IN_FT(5);
! ADD_IN_FT(6);
! ADD_IN_FT(7);
! ADD_IN_FT(8);
! ADD_IN_FT(9);
#endif
}
***************
*** 161,171 ****
void flext_base::jmax_proxy(fts_object_t *c, int winlet, fts_symbol_t s, int argc, const fts_atom_t *argv)
{
! flext_base *o = thisObject(c);
! o->m_methodmain(winlet,s,argc,argv);
}
void flext_base::SetProxies(t_class *c)
{
! fts_class_set_default_handler(c, jmax_proxy);
}
--- 161,171 ----
void flext_base::jmax_proxy(fts_object_t *c, int winlet, fts_symbol_t s, int argc, const fts_atom_t *argv)
{
! flext_base *o = thisObject(c);
! o->m_methodmain(winlet,s,argc,argv);
}
void flext_base::SetProxies(t_class *c)
{
! fts_class_set_default_handler(c, jmax_proxy);
}
Index: flmsg.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmsg.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** flmsg.cpp 6 Mar 2004 03:25:48 -0000 1.11
--- flmsg.cpp 21 Jun 2004 13:58:19 -0000 1.12
***************
*** 17,74 ****
bool flext_base::CallMeth(const MethItem &m,int argc,const t_atom *argv)
{
! bool ret = false;
! int ix;
! t_any aargs[FLEXT_MAXMETHARGS];
! bool ok = true;
! for(ix = 0; ix < argc && ok; ++ix) {
! switch(m.args[ix]) {
! case a_float: {
! if(IsFloat(argv[ix])) aargs[ix].ft = GetFloat(argv[ix]);
! else if(IsInt(argv[ix])) aargs[ix].ft = (float)GetInt(argv[ix]);
! else ok = false;
!
! if(ok) FLEXT_LOG2("int arg %i = %f",ix,aargs[ix].ft);
! break;
! }
! case a_int: {
! if(IsFloat(argv[ix])) aargs[ix].it = (int)GetFloat(argv[ix]);
! else if(IsInt(argv[ix])) aargs[ix].it = GetInt(argv[ix]);
! else ok = false;
!
! if(ok) FLEXT_LOG2("float arg %i = %i",ix,aargs[ix].it);
! break;
! }
! case a_symbol: {
! if(IsSymbol(argv[ix])) aargs[ix].st = GetSymbol(argv[ix]);
! else ok = false;
!
! if(ok) FLEXT_LOG2("symbol arg %i = %s",ix,GetString(aargs[ix].st));
! break;
! }
#if FLEXT_SYS == FLEXT_SYS_PD
! case a_pointer: {
! if(IsPointer(argv[ix])) aargs[ix].pt = (t_gpointer *)GetPointer(argv[ix]);
! else ok = false;
! break;
! }
#endif
! default:
! error("Argument type illegal");
! ok = false;
! }
! }
! if(ok && ix == argc) {
! switch(argc) {
! case 0: ret = ((methfun_0)m.fun)(this); break;
! case 1: ret = ((methfun_1)m.fun)(this,aargs[0]); break;
! case 2: ret = ((methfun_2)m.fun)(this,aargs[0],aargs[1]); break;
! case 3: ret = ((methfun_3)m.fun)(this,aargs[0],aargs[1],aargs[2]); break;
! case 4: ret = ((methfun_4)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3]); break;
! case 5: ret = ((methfun_5)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3],aargs[4]); break;
! }
! }
!
! return ret;
}
--- 17,74 ----
bool flext_base::CallMeth(const MethItem &m,int argc,const t_atom *argv)
{
! bool ret = false;
! int ix;
! t_any aargs[FLEXT_MAXMETHARGS];
! bool ok = true;
! for(ix = 0; ix < argc && ok; ++ix) {
! switch(m.args[ix]) {
! case a_float: {
! if(IsFloat(argv[ix])) aargs[ix].ft = GetFloat(argv[ix]);
! else if(IsInt(argv[ix])) aargs[ix].ft = (float)GetInt(argv[ix]);
! else ok = false;
!
! if(ok) FLEXT_LOG2("int arg %i = %f",ix,aargs[ix].ft);
! break;
! }
! case a_int: {
! if(IsFloat(argv[ix])) aargs[ix].it = (int)GetFloat(argv[ix]);
! else if(IsInt(argv[ix])) aargs[ix].it = GetInt(argv[ix]);
! else ok = false;
!
! if(ok) FLEXT_LOG2("float arg %i = %i",ix,aargs[ix].it);
! break;
! }
! case a_symbol: {
! if(IsSymbol(argv[ix])) aargs[ix].st = GetSymbol(argv[ix]);
! else ok = false;
!
! if(ok) FLEXT_LOG2("symbol arg %i = %s",ix,GetString(aargs[ix].st));
! break;
! }
#if FLEXT_SYS == FLEXT_SYS_PD
! case a_pointer: {
! if(IsPointer(argv[ix])) aargs[ix].pt = (t_gpointer *)GetPointer(argv[ix]);
! else ok = false;
! break;
! }
#endif
! default:
! error("Argument type illegal");
! ok = false;
! }
! }
! if(ok && ix == argc) {
! switch(argc) {
! case 0: ret = ((methfun_0)m.fun)(this); break;
! case 1: ret = ((methfun_1)m.fun)(this,aargs[0]); break;
! case 2: ret = ((methfun_2)m.fun)(this,aargs[0],aargs[1]); break;
! case 3: ret = ((methfun_3)m.fun)(this,aargs[0],aargs[1],aargs[2]); break;
! case 4: ret = ((methfun_4)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3]); break;
! case 5: ret = ((methfun_5)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3],aargs[4]); break;
! }
! }
!
! return ret;
}
***************
*** 79,105 ****
// FLEXT_LOG3("found method tag %s: inlet=%i, argc=%i",GetString(tag),m->inlet,argc);
!
! if(m->attr) {
! // attributes are treated differently
! if(m->attr->IsGet())
! return DumpAttrib(tag,m->attr);
! else
! return SetAttrib(tag,m->attr,argc,argv);
! }
! else {
! if(m->argc == 1) {
! // try list
! if(m->args[0] == a_list && ((methfun_V)m->fun)(this,argc,const_cast<t_atom *>(argv))) return true;
! // try anything
! if(m->args[0] == a_any && ((methfun_A)m->fun)(this,tag,argc,const_cast<t_atom *>(argv))) return true;
! }
! // try matching number of args
! if(argc == m->argc && CallMeth(*m,argc,argv)) return true;
! }
! }
! return false;
}
--- 79,105 ----
// FLEXT_LOG3("found method tag %s: inlet=%i, argc=%i",GetString(tag),m->inlet,argc);
!
! if(m->attr) {
! // attributes are treated differently
! if(m->attr->IsGet())
! return DumpAttrib(tag,m->attr);
! else
! return SetAttrib(tag,m->attr,argc,argv);
! }
! else {
! if(m->argc == 1) {
! // try list
! if(m->args[0] == a_list && ((methfun_V)m->fun)(this,argc,const_cast<t_atom *>(argv))) return true;
! // try anything
! if(m->args[0] == a_any && ((methfun_A)m->fun)(this,tag,argc,const_cast<t_atom *>(argv))) return true;
! }
! // try matching number of args
! if(argc == m->argc && CallMeth(*m,argc,argv)) return true;
! }
! }
! return false;
}
***************
*** 109,120 ****
MethItem *m = (MethItem *)lst;
! if(!m->IsAttr()) {
! // FLEXT_LOG3("found symbol method for %s: inlet=%i, symbol=%s",GetString(m->tag),m->inlet,GetString(s));
! t_any sym; sym.st = const_cast<t_symbol *>(s);
! if(((methfun_1)m->fun)(this,sym)) return true;
! }
! }
! return false;
}
--- 109,120 ----
MethItem *m = (MethItem *)lst;
! if(!m->IsAttr()) {
! // FLEXT_LOG3("found symbol method for %s: inlet=%i, symbol=%s",GetString(m->tag),m->inlet,GetString(s));
! t_any sym; sym.st = const_cast<t_symbol *>(s);
! if(((methfun_1)m->fun)(this,sym)) return true;
! }
! }
! return false;
}
***************
*** 124,132 ****
MethItem *m = (MethItem *)lst;
! if(!m->IsAttr() && m->argc == 1 && m->args[0] == a_any) {
! // FLEXT_LOG4("found any method for %s: inlet=%i, symbol=%s, argc=%i",GetString(m->tag),m->inlet,GetString(s),argc);
! if(((methfun_A)m->fun)(this,s,argc,const_cast<t_atom *>(argv))) return true;
! }
}
return false;
--- 124,132 ----
MethItem *m = (MethItem *)lst;
! if(!m->IsAttr() && m->argc == 1 && m->args[0] == a_any) {
! // FLEXT_LOG4("found any method for %s: inlet=%i, symbol=%s, argc=%i",GetString(m->tag),m->inlet,GetString(s),argc);
! if(((methfun_A)m->fun)(this,s,argc,const_cast<t_atom *>(argv))) return true;
! }
}
return false;
***************
*** 134,138 ****
/*! \brief Find a method item for a specific tag and arguments
! \remark All attributes are also stored in the method list and retrieved by a member of the method item
*/
bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv)
--- 134,138 ----
/*! \brief Find a method item for a specific tag and arguments
! \remark All attributes are also stored in the method list and retrieved by a member of the method item
*/
bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv)
***************
*** 140,255 ****
Item *lst;
! // search for exactly matching tag
! if((lst = methhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
! if((lst = clmethhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
!
! // if no list args, then search for pure symbol
! if(!argc) {
! if((lst = methhead->FindList(sym_symbol,inlet)) != NULL && TryMethSym(lst,s)) return true;
! if((lst = clmethhead->FindList(sym_symbol,inlet)) != NULL && TryMethSym(lst,s)) return true;
! }
!
! // otherwise search for anything
! if((lst = methhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
! if((lst = clmethhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
! // if nothing found try any inlet
! return inlet >= 0 && FindMeth(-1,s,argc,argv);
}
/*! \brief All the message processing
! The messages of all the inlets go here and are promoted to the registered callback functions
*/
bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom *argv)
{
! static bool trap = false;
! curtag = s;
! // post("methodmain inlet:%i args:%i symbol:%s",inlet,argc,s?GetString(s):"");
!
! bool ret = FindMeth(inlet,s,argc,argv);
! if(ret) goto end;
#if FLEXT_SYS == FLEXT_SYS_MAX
! // If float message is not explicitly handled: try int handler instead
! if(argc == 1 && s == sym_float && !trap) {
! t_atom fl;
! SetInt(fl,GetAInt(argv[0]));
! trap = true;
! ret = m_methodmain(inlet,sym_int,1,&fl);
! trap = false;
! }
! if(ret) goto end;
!
! // If int message is not explicitly handled: try float handler instead
! if(argc == 1 && s == sym_int && !trap) {
! t_atom fl;
! SetFloat(fl,GetAFloat(argv[0]));
! trap = true;
! ret = m_methodmain(inlet,sym_float,1,&fl);
! trap = false;
! }
! if(ret) goto end;
#endif
!
! // If float or int message is not explicitly handled: try list handler instead
! if(!trap && argc == 1 && (s == sym_float
#if FLEXT_SYS == FLEXT_SYS_MAX
! || s == sym_int
#endif
! )) {
! t_atom list;
! if(s == sym_float)
! SetFloat(list,GetFloat(argv[0]));
#if FLEXT_SYS == FLEXT_SYS_MAX
! else if(s == sym_int)
! SetInt(list,GetInt(argv[0]));
#endif
! trap = true;
! ret = m_methodmain(inlet,sym_list,1,&list);
! trap = false;
! }
! if(ret) goto end;
! // If symbol message (pure anything without args) is not explicitly handled: try list handler instead
! if(!trap && argc == 0) {
! t_atom list;
! SetSymbol(list,s);
! trap = true;
! ret = m_methodmain(inlet,sym_list,1,&list);
! trap = false;
! }
! if(ret) goto end;
! // if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior)
! if(distmsgs && !trap && inlet == 0 && s == sym_list && insigs <= 1) {
! int i = incnt;
! if(i > argc) i = argc;
! for(--i; i >= 0; --i) { // right to left distribution
! const t_symbol *sym = NULL;
! if(IsFloat(argv[i])) sym = sym_float;
! else if(IsInt(argv[i])) sym = sym_int;
! else if(IsSymbol(argv[i])) sym = sym_symbol;
#if FLEXT_SYS == FLEXT_SYS_PD
! else if(IsPointer(argv[i])) sym = sym_pointer; // can pointer atoms occur here?
#endif
! if(sym) {
! trap = true;
! m_methodmain(i,sym,1,argv+i);
! trap = false;
! }
! }
!
! ret = true;
! }
!
! if(!ret && !trap) ret = m_method_(inlet,s,argc,argv);
!
end:
! curtag = NULL;
! return ret; // true if appropriate handler was found and called
}
--- 140,267 ----
Item *lst;
! // search for exactly matching tag
! if((lst = methhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
! if((lst = clmethhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
!
! // if no list args, then search for pure symbol
! if(!argc) {
! if((lst = methhead->FindList(sym_symbol,inlet)) != NULL && TryMethSym(lst,s)) return true;
! if((lst = clmethhead->FindList(sym_symbol,inlet)) != NULL && TryMethSym(lst,s)) return true;
! }
!
! // otherwise search for anything
! if((lst = methhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
! if((lst = clmethhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
! // if nothing found try any inlet
! return inlet >= 0 && FindMeth(-1,s,argc,argv);
}
/*! \brief All the message processing
! The messages of all the inlets go here and are promoted to the registered callback functions
*/
bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom *argv)
{
! static bool trap = false;
! curtag = s;
! // post("methodmain inlet:%i args:%i symbol:%s",inlet,argc,s?GetString(s):"");
!
! bool ret = FindMeth(inlet,s,argc,argv);
! if(ret) goto end;
!
! try {
#if FLEXT_SYS == FLEXT_SYS_MAX
! // If float message is not explicitly handled: try int handler instead
! if(argc == 1 && s == sym_float && !trap) {
! t_atom fl;
! SetInt(fl,GetAInt(argv[0]));
! trap = true;
! ret = m_methodmain(inlet,sym_int,1,&fl);
! trap = false;
! }
! if(ret) goto end;
!
! // If int message is not explicitly handled: try float handler instead
! if(argc == 1 && s == sym_int && !trap) {
! t_atom fl;
! SetFloat(fl,GetAFloat(argv[0]));
! trap = true;
! ret = m_methodmain(inlet,sym_float,1,&fl);
! trap = false;
! }
! if(ret) goto end;
#endif
!
! // If float or int message is not explicitly handled: try list handler instead
! if(!trap && argc == 1 && (s == sym_float
#if FLEXT_SYS == FLEXT_SYS_MAX
! || s == sym_int
#endif
! )) {
! t_atom list;
! if(s == sym_float)
! SetFloat(list,GetFloat(argv[0]));
#if FLEXT_SYS == FLEXT_SYS_MAX
! else if(s == sym_int)
! SetInt(list,GetInt(argv[0]));
#endif
! trap = true;
! ret = m_methodmain(inlet,sym_list,1,&list);
! trap = false;
! }
! if(ret) goto end;
! // If symbol message (pure anything without args) is not explicitly handled: try list handler instead
! if(!trap && argc == 0) {
! t_atom list;
! SetSymbol(list,s);
! trap = true;
! ret = m_methodmain(inlet,sym_list,1,&list);
! trap = false;
! }
! if(ret) goto end;
! // if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior)
! if(distmsgs && !trap && inlet == 0 && s == sym_list && insigs <= 1) {
! int i = incnt;
! if(i > argc) i = argc;
! for(--i; i >= 0; --i) { // right to left distribution
! const t_symbol *sym = NULL;
! if(IsFloat(argv[i])) sym = sym_float;
! else if(IsInt(argv[i])) sym = sym_int;
! else if(IsSymbol(argv[i])) sym = sym_symbol;
#if FLEXT_SYS == FLEXT_SYS_PD
! else if(IsPointer(argv[i])) sym = sym_pointer; // can pointer atoms occur here?
#endif
! if(sym) {
! trap = true;
! m_methodmain(i,sym,1,argv+i);
! trap = false;
! }
! }
!
! ret = true;
! }
!
! if(!ret && !trap) ret = m_method_(inlet,s,argc,argv);
! }
! catch(std::exception &x) {
! error("%s - Exception while processing method: %s",thisName(),x.what());
! }
! catch(const char *txt) {
! error("%s - Exception while processing method: %s",thisName(),txt);
! }
! catch(...) {
! error("%s - Unknown exception while processing method",thisName());
! }
!
end:
! curtag = NULL;
! return ret; // true if appropriate handler was found and called
}
***************
*** 257,263 ****
{
//#ifdef FLEXT_DEBUG
! post("%s: message unhandled - inlet:%i args:%i symbol:%s",thisName(),inlet,argc,s?GetString(s):"");
//#endif
! return false;
}
--- 269,275 ----
{
//#ifdef FLEXT_DEBUG
! post("%s: message unhandled - inlet:%i args:%i symbol:%s",thisName(),inlet,argc,s?GetString(s):"");
//#endif
! return false;
}
Index: fldsp.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldsp.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** fldsp.cpp 29 Nov 2003 03:32:48 -0000 1.20
--- fldsp.cpp 21 Jun 2004 13:58:19 -0000 1.21
***************
*** 25,42 ****
void flext_dsp::Setup(t_classid id)
{
! t_class *c = getClass(id);
#if FLEXT_SYS == FLEXT_SYS_MAX
! // dsp_initclass();
! dsp_initboxclass();
! add_dsp(c,cb_dsp);
#elif FLEXT_SYS == FLEXT_SYS_PD
! CLASS_MAINSIGNALIN(c,flext_hdr,defsig); // float messages going into the left inlet are converted to signal
! add_dsp(c,cb_dsp);
! add_method1(c,cb_enable,"enable",A_FLOAT);
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_declare_function(dspsym,dspmeth);
! fts_class_message_varargs(c, fts_s_put, cb_dsp);
! fts_class_message_varargs(c, MakeSymbol("enable"), cb_enable);
#endif
}
--- 25,42 ----
void flext_dsp::Setup(t_classid id)
{
! t_class *c = getClass(id);
#if FLEXT_SYS == FLEXT_SYS_MAX
! // dsp_initclass();
! dsp_initboxclass();
! add_dsp(c,cb_dsp);
#elif FLEXT_SYS == FLEXT_SYS_PD
! CLASS_MAINSIGNALIN(c,flext_hdr,defsig); // float messages going into the left inlet are converted to signal
! add_dsp(c,cb_dsp);
! add_method1(c,cb_enable,"enable",A_FLOAT);
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_declare_function(dspsym,dspmeth);
! fts_class_message_varargs(c, fts_s_put, cb_dsp);
! fts_class_message_varargs(c, MakeSymbol("enable"), cb_enable);
#endif
}
***************
*** 44,72 ****
flext_dsp::FLEXT_CLASSDEF(flext_dsp)():
#if FLEXT_SYS == FLEXT_SYS_JMAX
! srate(fts_dsp_get_sample_rate()), // should we set it?
! blksz(fts_dsp_get_tick_size()),
#else
! srate(sys_getsr()), // should we set it?
! blksz(sys_getblksize()),
#endif
#if FLEXT_SYS == FLEXT_SYS_PD
! chnsin(sys_get_inchannels()),
! chnsout(sys_get_outchannels()),
#elif FLEXT_SYS == FLEXT_SYS_MAX
! chnsin(sys_getch()),
! chnsout(sys_getch()),
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! #pragma message("not implemented")
! chnsin(0),chnsout(0),
#else
#error
#endif
#if FLEXT_SYS != FLEXT_SYS_MAX
! dspon(true),
#endif
! invecs(NULL),outvecs(NULL)
{
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_object_init(thisHdr());
#endif
}
--- 44,72 ----
flext_dsp::FLEXT_CLASSDEF(flext_dsp)():
#if FLEXT_SYS == FLEXT_SYS_JMAX
! srate(fts_dsp_get_sample_rate()), // should we set it?
! blksz(fts_dsp_get_tick_size()),
#else
! srate(sys_getsr()), // should we set it?
! blksz(sys_getblksize()),
#endif
#if FLEXT_SYS == FLEXT_SYS_PD
! chnsin(sys_get_inchannels()),
! chnsout(sys_get_outchannels()),
#elif FLEXT_SYS == FLEXT_SYS_MAX
! chnsin(sys_getch()),
! chnsout(sys_getch()),
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! #pragma message("not implemented")
! chnsin(0),chnsout(0),
#else
#error
#endif
#if FLEXT_SYS != FLEXT_SYS_MAX
! dspon(true),
#endif
! invecs(NULL),outvecs(NULL)
{
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_object_init(thisHdr());
#endif
}
***************
*** 76,91 ****
{
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_object_delete(thisHdr());
#endif
/*
#if FLEXT_SYS == FLEXT_SYS_MAX
! // switch off dsp as the dsp function might get called afterwards (?!)
! thisHdr()->z_disabled = true;
!
! if(invecs) delete[] invecs;
! if(outvecs) delete[] outvecs;
#elif FLEXT_SYS == FLEXT_SYS_PD
! dspon = false;
#endif
*/
--- 76,91 ----
{
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_object_delete(thisHdr());
#endif
/*
#if FLEXT_SYS == FLEXT_SYS_MAX
! // switch off dsp as the dsp function might get called afterwards (?!)
! thisHdr()->z_disabled = true;
!
! if(invecs) delete[] invecs;
! if(outvecs) delete[] outvecs;
#elif FLEXT_SYS == FLEXT_SYS_PD
! dspon = false;
#endif
*/
***************
*** 99,119 ****
t_int *flext_dsp::dspmeth(t_int *w)
{
! flext_dsp *obj = (flext_dsp *)w[1];
/*
#ifdef FLEXT_DEBUG
! if(!obj->thisHdr()) {
! // object is already deleted!
! ERRINTERNAL();
! return w+3;
! }
#endif
*/
#if FLEXT_SYS == FLEXT_SYS_MAX
! if(!obj->thisHdr()->z_disabled)
#else
! if(obj->dspon)
#endif
! obj->m_signal(obj->blksz,obj->invecs,obj->outvecs);
! return w+2;
}
#endif
--- 99,119 ----
t_int *flext_dsp::dspmeth(t_int *w)
{
! flext_dsp *obj = (flext_dsp *)w[1];
/*
#ifdef FLEXT_DEBUG
! if(!obj->thisHdr()) {
! // object is already deleted!
! ERRINTERNAL();
! return w+3;
! }
#endif
*/
#if FLEXT_SYS == FLEXT_SYS_MAX
! if(!obj->thisHdr()->z_disabled)
#else
! if(obj->dspon)
#endif
! obj->m_signal(obj->blksz,obj->invecs,obj->outvecs);
! return w+2;
}
#endif
***************
*** 127,196 ****
#endif
{
! flext_dsp *obj = thisObject(c);
! if(obj->CntInSig()+obj->CntOutSig() == 0) return;
! // store current dsp parameters
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_descr_t *dsp = (fts_dsp_descr_t *)fts_get_pointer(at+0);
! obj->srate = fts_dsp_get_input_srate(dsp,0);
! obj->blksz = fts_dsp_get_input_size(dsp,0); // is this guaranteed to be the same as sys_getblksize() ?
#else
! obj->srate = sp[0]->s_sr;
! obj->blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ?
#endif
/*
#if FLEXT_SYS == FLEXT_SYS_PD
! obj->chnsin = sys_get_inchannels();
! obj->chnsout = sys_get_outchannels();
#elif FLEXT_SYS == FLEXT_SYS_MAX
! obj->chnsin = obj->chnsout = sys_getch();
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! #pragma message ("How to query the channels?")
#else
#error
#endif
*/
! // store in and out signal vectors
! int i;
! int in = obj->chnsin = obj->CntInSig();
! int out = obj->chnsout = obj->CntOutSig();
#if FLEXT_SYS == FLEXT_SYS_PD
! // min. 1 input channel! (CLASS_MAININLET in pd...)
! if(!in) { obj->chnsin = in = 1; }
#endif
! if(obj->invecs) delete[] obj->invecs;
! obj->invecs = new t_signalvec[in];
! for(i = 0; i < in; ++i)
! obj->invecs[i] =
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_get_input_name(dsp,i);
#else
! sp[i]->s_vec;
#endif
! if(obj->outvecs) delete[] obj->outvecs;
! obj->outvecs = new t_signalvec[out];
! for(i = 0; i < out; ++i)
! obj->outvecs[i] =
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_get_output_name(dsp,i);
#else
! sp[in+i]->s_vec;
#endif
! // with the following call derived classes can do their eventual DSP setup
! obj->m_dsp(obj->blksz,obj->invecs,obj->outvecs);
! // set the DSP function
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_atom_t args;
! fts_set_pointer(args,obj);
! fts_dsp_add_function(dspsym,1,args);
#else
! dsp_add((t_dspmethod)dspmeth,1,obj);
#endif
}
--- 127,196 ----
#endif
{
! flext_dsp *obj = thisObject(c);
! if(obj->CntInSig()+obj->CntOutSig() == 0) return;
! // store current dsp parameters
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_descr_t *dsp = (fts_dsp_descr_t *)fts_get_pointer(at+0);
! obj->srate = fts_dsp_get_input_srate(dsp,0);
! obj->blksz = fts_dsp_get_input_size(dsp,0); // is this guaranteed to be the same as sys_getblksize() ?
#else
! obj->srate = sp[0]->s_sr;
! obj->blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ?
#endif
/*
#if FLEXT_SYS == FLEXT_SYS_PD
! obj->chnsin = sys_get_inchannels();
! obj->chnsout = sys_get_outchannels();
#elif FLEXT_SYS == FLEXT_SYS_MAX
! obj->chnsin = obj->chnsout = sys_getch();
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! #pragma message ("How to query the channels?")
#else
#error
#endif
*/
! // store in and out signal vectors
! int i;
! int in = obj->chnsin = obj->CntInSig();
! int out = obj->chnsout = obj->CntOutSig();
#if FLEXT_SYS == FLEXT_SYS_PD
! // min. 1 input channel! (CLASS_MAININLET in pd...)
! if(!in) { obj->chnsin = in = 1; }
#endif
! if(obj->invecs) delete[] obj->invecs;
! obj->invecs = new t_signalvec[in];
! for(i = 0; i < in; ++i)
! obj->invecs[i] =
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_get_input_name(dsp,i);
#else
! sp[i]->s_vec;
#endif
! if(obj->outvecs) delete[] obj->outvecs;
! obj->outvecs = new t_signalvec[out];
! for(i = 0; i < out; ++i)
! obj->outvecs[i] =
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_dsp_get_output_name(dsp,i);
#else
! sp[in+i]->s_vec;
#endif
! // with the following call derived classes can do their eventual DSP setup
! obj->m_dsp(obj->blksz,obj->invecs,obj->outvecs);
! // set the DSP function
#if FLEXT_SYS == FLEXT_SYS_JMAX
! fts_atom_t args;
! fts_set_pointer(args,obj);
! fts_dsp_add_function(dspsym,1,args);
#else
! dsp_add((t_dspmethod)dspmeth,1,obj);
#endif
}
***************
*** 200,209 ****
void flext_dsp::cb_dsp_init(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
{
! fts_dsp_add_object(c);
}
void flext_dsp::cb_dsp_delete(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
{
! fts_dsp_remove_object(c);
}
#endif
--- 200,209 ----
void flext_dsp::cb_dsp_init(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
{
! fts_dsp_add_object(c);
}
void flext_dsp::cb_dsp_delete(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
{
! fts_dsp_remove_object(c);
}
#endif
***************
*** 214,218 ****
void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *outs)
{
! for(int i = 0; i < CntOutSig(); ++i) ZeroSamples(outs[i],n);
}
--- 214,218 ----
void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *outs)
{
! for(int i = 0; i < CntOutSig(); ++i) ZeroSamples(outs[i],n);
}
Index: flbind.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flbind.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** flbind.cpp 6 Mar 2004 03:25:48 -0000 1.13
--- flbind.cpp 21 Jun 2004 13:58:19 -0000 1.14
***************
*** 28,62 ****
void flext_base::SetupBindProxy()
{
! // already initialized?
! if(!pxbnd_class) {
#if FLEXT_SYS == FLEXT_SYS_PD
! pxbnd_class = class_new(gensym("flext_base bind proxy"),NULL,NULL,sizeof(pxbnd_object),CLASS_PD|CLASS_NOINLET, A_NULL);
! add_anything(pxbnd_class,pxbnd_object::px_method); // for symbol-bound methods
#elif FLEXT_SYS == FLEXT_SYS_MAX
! pxbnd_class = new t_class;
! pxbnd_class->c_sym = gensym("");
! pxbnd_class->c_freelist = &px_freelist;
! pxbnd_class->c_freefun = NULL;
! pxbnd_class->c_size = sizeof(pxbnd_object);
! pxbnd_class->c_tiny = 0;
! pxbnd_class->c_noinlet = 1;
! px_messlist[0].m_sym = (t_symbol *)pxbnd_class;
! px_messlist[1].m_sym = gensym("anything");
! px_messlist[1].m_fun = (method)pxbnd_object::px_method;
! px_messlist[1].m_type[0] = A_GIMME;
! px_messlist[1].m_type[1] = 0;
! px_messlist[2].m_sym = 0;
#else
#pragma warning("Not implemented!")
#endif
! }
}
flext_base::BindItem::BindItem(bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *data),pxbnd_object *p):
! Item(NULL),fun(f),px(p)
{}
--- 28,62 ----
void flext_base::SetupBindProxy()
{
! // already initialized?
! if(!pxbnd_class) {
#if FLEXT_SYS == FLEXT_SYS_PD
! pxbnd_class = class_new(gensym("flext_base bind proxy"),NULL,NULL,sizeof(pxbnd_object),CLASS_PD|CLASS_NOINLET, A_NULL);
! add_anything(pxbnd_class,pxbnd_object::px_method); // for symbol-bound methods
#elif FLEXT_SYS == FLEXT_SYS_MAX
! pxbnd_class = new t_class;
! pxbnd_class->c_sym = gensym("");
! pxbnd_class->c_freelist = &px_freelist;
! pxbnd_class->c_freefun = NULL;
! pxbnd_class->c_size = sizeof(pxbnd_object);
! pxbnd_class->c_tiny = 0;
! pxbnd_class->c_noinlet = 1;
! px_messlist[0].m_sym = (t_symbol *)pxbnd_class;
! px_messlist[1].m_sym = gensym("anything");
! px_messlist[1].m_fun = (method)pxbnd_object::px_method;
! px_messlist[1].m_type[0] = A_GIMME;
! px_messlist[1].m_type[1] = 0;
! px_messlist[2].m_sym = 0;
#else
#pragma warning("Not implemented!")
#endif
! }
}
flext_base::BindItem::BindItem(bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *data),pxbnd_object *p):
! Item(NULL),fun(f),px(p)
{}
***************
*** 123,133 ****
if(px) {
! BindItem *mi = new BindItem(fun,px);
! bindhead->Add(mi,sym);
px->init(this,mi,data);
#if FLEXT_SYS == FLEXT_SYS_PD
! pd_bind(&px->obj.ob_pd,const_cast<t_symbol *>(sym));
#elif FLEXT_SYS == FLEXT_SYS_MAX
if(!sym->s_thing)
--- 123,133 ----
if(px) {
! BindItem *mi = new BindItem(fun,px);
! bindhead->Add(mi,sym);
px->init(this,mi,data);
#if FLEXT_SYS == FLEXT_SYS_PD
! pd_bind(&px->obj.ob_pd,const_cast<t_symbol *>(sym));
#elif FLEXT_SYS == FLEXT_SYS_MAX
if(!sym->s_thing)
***************
*** 206,219 ****
Item *lst = si.data();
while(lst) {
! Item *nxt = lst->nxt;
BindItem *it = (BindItem *)lst;
it->Unbind(si.key());
delete it;
! lst = nxt;
}
}
set.clear();
}
! return true;
}
--- 206,219 ----
Item *lst = si.data();
while(lst) {
! Item *nxt = lst->nxt;
BindItem *it = (BindItem *)lst;
it->Unbind(si.key());
delete it;
! lst = nxt;
}
}
set.clear();
}
! return true;
}
Index: flbase.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flbase.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** flbase.cpp 3 Apr 2004 02:21:04 -0000 1.16
--- flbase.cpp 21 Jun 2004 13:58:19 -0000 1.17
***************
*** 12,16 ****
\brief Implementation of the internal flext base classes.
! \remark This is all derived from GEM by Mark Danks
*/
--- 12,16 ----
\brief Implementation of the internal flext base classes.
! \remark This is all derived from GEM by Mark Danks
*/
***************
*** 22,31 ****
#if FLEXT_SYS == FLEXT_SYS_PD
#ifdef _MSC_VER
! #pragma warning (push)
! #pragma warning (disable:4091)
#endif
#include <g_canvas.h>
#ifdef _MSC_VER
! #pragma warning (pop)
#endif
#endif
--- 22,31 ----
#if FLEXT_SYS == FLEXT_SYS_PD
#ifdef _MSC_VER
! #pragma warning (push)
! #pragma warning (disable:4091)
#endif
#include <g_canvas.h>
#ifdef _MSC_VER
! #pragma warning (pop)
#endif
#endif
***************
*** 53,59 ****
flext_obj :: FLEXT_CLASSDEF(flext_obj)()
: x_obj(m_holder)
! , procattr(m_holdattr)
! , init_ok(true)
! , m_name(m_holdname)
{
#if FLEXT_SYS == FLEXT_SYS_PD
--- 53,59 ----
flext_obj :: FLEXT_CLASSDEF(flext_obj)()
: x_obj(m_holder)
! , procattr(m_holdattr)
! , init_ok(true)
! , m_name(m_holdname)
{
#if FLEXT_SYS == FLEXT_SYS_PD
***************
*** 70,74 ****
/////////////////////////////////////////////////////////
flext_obj :: ~FLEXT_CLASSDEF(flext_obj)() {
! x_obj = NULL;
}
--- 70,74 ----
/////////////////////////////////////////////////////////
flext_obj :: ~FLEXT_CLASSDEF(flext_obj)() {
! x_obj = NULL;
}
***************
*** 81,97 ****
{
#if FLEXT_SYS == FLEXT_SYS_PD
! char tmp[256];
! if(dir) {
! strcpy(tmp,dir);
! strcat(tmp,"/");
! strcat(tmp,ref);
! }
! else
! strcpy(tmp,ref);
! if(addtilde) strcat(tmp,"~");
::class_sethelpsymbol(getClass(c),gensym(const_cast<char *>(tmp)));
#else
! // no solution for Max/MSP yet
#endif
}
--- 81,97 ----
{
#if FLEXT_SYS == FLEXT_SYS_PD
! char tmp[256];
! if(dir) {
! strcpy(tmp,dir);
! strcat(tmp,"/");
! strcat(tmp,ref);
! }
! else
! strcpy(tmp,ref);
! if(addtilde) strcat(tmp,"~");
::class_sethelpsymbol(getClass(c),gensym(const_cast<char *>(tmp)));
#else
! // no solution for Max/MSP yet
#endif
}
***************
*** 100,134 ****
{
#if FLEXT_SYS == FLEXT_SYS_PD
! if(!c) c = canvas_getcurrent();
! const char *s = GetString(sym);
! if((s[0] == '$' || s[0] == '#') && isdigit(s[1])) {
! const t_symbol *res;
! // patcher parameter detected... get value!
! if(s[0] != '$') {
! char tmp[MAXPDSTRING];
! strcpy(tmp,s);
! tmp[0] = '$';
! res = canvas_realizedollar(c,const_cast<t_symbol *>(MakeSymbol(tmp)));
! }
! else
! res = canvas_realizedollar(c,const_cast<t_symbol *>(sym));
! // check for number
! const char *c = GetString(res);
! while(*c && (isdigit(*c) || *c == '.')) ++c;
! if(!*c)
! SetFloat(dst,(float)atof(GetString(res)));
! else
! SetSymbol(dst,res);
! return true;
! }
! else
#else
! #pragma message("Not implemented")
#endif
! SetSymbol(dst,sym);
! return true;
}
--- 100,134 ----
{
#if FLEXT_SYS == FLEXT_SYS_PD
! if(!c) c = canvas_getcurrent();
! const char *s = GetString(sym);
! if((s[0] == '$' || s[0] == '#') && isdigit(s[1])) {
! const t_symbol *res;
! // patcher parameter detected... get value!
! if(s[0] != '$') {
! char tmp[MAXPDSTRING];
! strcpy(tmp,s);
! tmp[0] = '$';
! res = canvas_realizedollar(c,const_cast<t_symbol *>(MakeSymbol(tmp)));
! }
! else
! res = canvas_realizedollar(c,const_cast<t_symbol *>(sym));
! // check for number
! const char *c = GetString(res);
! while(*c && (isdigit(*c) || *c == '.')) ++c;
! if(!*c)
! SetFloat(dst,(float)atof(GetString(res)));
! else
! SetSymbol(dst,res);
! return true;
! }
! else
#else
! #pragma message("Not implemented")
#endif
! SetSymbol(dst,sym);
! return true;
}
***************
*** 143,154 ****
{
#if FLEXT_SYS == FLEXT_SYS_PD
! int argc;
! t_atom *argv;
! canvas_getargs(&argc,&argv);
! args(argc);
! for(int i = 0; i < argc; ++i) args[i] = argv[i];
#else
! #pragma message("Not implemented")
! args(0);
#endif
}
--- 143,154 ----
{
#if FLEXT_SYS == FLEXT_SYS_PD
! int argc;
! t_atom *argv;
! canvas_getargs(&argc,&argv);
! args(argc);
! for(int i = 0; i < argc; ++i) args[i] = argv[i];
#else
! #pragma message("Not implemented")
! args(0);
#endif
}
Index: fldoxygen.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldoxygen.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** fldoxygen.h 12 Dec 2003 03:32:56 -0000 1.8
--- fldoxygen.h 21 Jun 2004 13:58:19 -0000 1.9
***************
*** 3,8 ****
/*! \file fldoxygen.h
! \brief Doxygen definitions
! \remark There is no code in here, just documentation stuff.
*/
--- 3,8 ----
/*! \file fldoxygen.h
! \brief Doxygen definitions
! \remark There is no code in here, just documentation stuff.
*/
***************
*** 111,117 ****
\verbatim
class attr1:
! public flext_base
{
! FLEXT_HEADER(attr1,flext_base)
\endverbatim
--- 111,117 ----
\verbatim
class attr1:
! public flext_base
{
! FLEXT_HEADER(attr1,flext_base)
\endverbatim
***************
*** 122,127 ****
\verbatim
public:
! // constructor
! attr1();
\endverbatim
--- 122,127 ----
\verbatim
public:
! // constructor
! attr1();
\endverbatim
***************
*** 130,137 ****
\verbatim
protected:
! void m_trigger(float f);
!
! // stored argument
! float arg;
\endverbatim
--- 130,137 ----
\verbatim
protected:
! void m_trigger(float f);
!
! // stored argument
! float arg;
\endverbatim
***************
*** 141,149 ****
\verbatim
private:
! // callback for method "m_trigger" (with one float argument)
! FLEXT_CALLBACK_F(m_trigger);
! // define attribute callbacks for variable "arg" (with GET and SET properties)
! FLEXT_ATTRVAR_F(arg);
};
\endverbatim
--- 141,149 ----
\verbatim
private:
! // callback for method "m_trigger" (with one float argument)
! FLEXT_CALLBACK_F(m_trigger);
! // define attribute callbacks for variable "arg" (with GET and SET properties)
! FLEXT_ATTRVAR_F(arg);
};
\endverbatim
***************
*** 167,187 ****
\verbatim
attr1::attr1():
! arg(0) // initialize argument
{
! // define inlets
! AddInAnything(); // first inlet of type anything (index 0)
!
! // define outlets
! AddOutFloat(); // one float outlet (has index 0)
\endverbatim
!
Every inlet and outlet that the object shall have has to be registered.
This is done with the functions in \ref FLEXT_C_IO_ADD.
\verbatim
! // register methods
! FLEXT_ADDMETHOD(0,m_trigger); // register method (for floats) "m_trigger" for inlet 0
! FLEXT_ADDATTR_VAR1("arg",arg); // register attribute "arg" with variable arg
}
\endverbatim
--- 167,187 ----
\verbatim
attr1::attr1():
! arg(0) // initialize argument
{
! // define inlets
! AddInAnything(); // first inlet of type anything (index 0)
!
! // define outlets
! AddOutFloat(); // one float outlet (has index 0)
\endverbatim
!
Every inlet and outlet that the object shall have has to be registered.
This is done with the functions in \ref FLEXT_C_IO_ADD.
\verbatim
! // register methods
! FLEXT_ADDMETHOD(0,m_trigger); // register method (for floats) "m_trigger" for inlet 0
! FLEXT_ADDATTR_VAR1("arg",arg); // register attribute "arg" with variable arg
}
\endverbatim
***************
*** 196,203 ****
void attr1::m_trigger(float f)
{
! float res = arg+f;
!
! // output value to outlet
! ToOutFloat(0,res); // (0 stands for the outlet index 0)
}
\endverbatim
--- 196,203 ----
void attr1::m_trigger(float f)
{
! float res = arg+f;
!
! // output value to outlet
! ToOutFloat(0,res); // (0 stands for the outlet index 0)
}
\endverbatim
Index: fldefs_setup.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldefs_setup.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** fldefs_setup.h 12 Dec 2003 03:32:56 -0000 1.3
--- fldefs_setup.h 21 Jun 2004 13:58:19 -0000 1.4
***************
*** 19,23 ****
// ====================================================================================
! /*! \defgroup FLEXT_D_INSTANCE Class instantiation
\note For stand-alone externals (not part of a library) the name of your class
\note is of importance! It must be the same as the external (excluded an eventual ~ (tilde))
--- 19,23 ----
// ====================================================================================
! /*! \defgroup FLEXT_D_INSTANCE Class instantiation
\note For stand-alone externals (not part of a library) the name of your class
\note is of importance! It must be the same as the external (excluded an eventual ~ (tilde))
***************
*** 33,51 ****
! /*! \defgroup FLEXT_D_NEW Stand-alone class instantiation
! Makes an actual instance of a stand-alone class.
*/
! /*! \defgroup FLEXT_D_NEW_DSP Dsp class instantiation
! Makes an actual instance of a dsp (aka "tilde") class (with signal processing).
*/
! /*! \defgroup FLEXT_D_LIB Library class instantiation
! Makes an actual instance of a class which is part of an object library (and not stand-alone).
*/
! /*! \defgroup FLEXT_D_LIB_DSP Dsp library class instantiation
! Makes an actual instance of a dsp (aka "tilde") class with signal processing
! which is part of an object library (and not stand-alone).
*/
--- 33,51 ----
! /*! \defgroup FLEXT_D_NEW Stand-alone class instantiation
! Makes an actual instance of a stand-alone class.
*/
! /*! \defgroup FLEXT_D_NEW_DSP Dsp class instantiation
! Makes an actual instance of a dsp (aka "tilde") class (with signal processing).
*/
! /*! \defgroup FLEXT_D_LIB Library class instantiation
! Makes an actual instance of a class which is part of an object library (and not stand-alone).
*/
! /*! \defgroup FLEXT_D_LIB_DSP Dsp library class instantiation
! Makes an actual instance of a dsp (aka "tilde") class with signal processing
! which is part of an object library (and not stand-alone).
*/
***************
*** 54,74 ****
/*! \brief Implementation of a flext class with no arguments
! \ingroup FLEXT_D_NEW
! \param NAME the object's actual name(s) as a string (like "*", "trigger", "noise~", etc.)
! \param NEW_CLASS the object's C++ class name
*/
! #define FLEXT_NEW(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,0,0)
/*! \brief Implementation of a flext dsp class with no arguments
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,1,0)
/*! \brief Implementation of a flext class (part of a library) with no arguments
! \ingroup FLEXT_D_LIB
*/
#define FLEXT_LIB(NAME,NEW_CLASS) \
--- 54,74 ----
/*! \brief Implementation of a flext class with no arguments
! \ingroup FLEXT_D_NEW
! \param NAME the object's actual name(s) as a string (like "*", "trigger", "noise~", etc.)
! \param NEW_CLASS the object's C++ class name
*/
! #define FLEXT_NEW(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,0,0)
/*! \brief Implementation of a flext dsp class with no arguments
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,1,0)
/*! \brief Implementation of a flext class (part of a library) with no arguments
! \ingroup FLEXT_D_LIB
*/
#define FLEXT_LIB(NAME,NEW_CLASS) \
***************
*** 77,83 ****
/*! \brief Implementation of a flext dsp class (part of a library) with no arguments
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,1,1)
--- 77,83 ----
/*! \brief Implementation of a flext dsp class (part of a library) with no arguments
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,1,1)
***************
*** 88,115 ****
/*! \brief Implementation of a flext class with a variable argument list
! \ingroup FLEXT_D_NEW
*/
! #define FLEXT_NEW_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS,0,0) \
/*! \brief Implementation of a flext dsp class with a variable argument list
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS,1,0) \
/*! \brief Implementation of a flext class (part of a library) with a variable argument list
! \ingroup FLEXT_D_LIB
*/
! #define FLEXT_LIB_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS, 0,1)
/*! \brief Implementation of a flext dsp class (part of a library) with a variable argument list
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS, 1,1)
--- 88,115 ----
/*! \brief Implementation of a flext class with a variable argument list
! \ingroup FLEXT_D_NEW
*/
! #define FLEXT_NEW_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS,0,0) \
/*! \brief Implementation of a flext dsp class with a variable argument list
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS,1,0) \
/*! \brief Implementation of a flext class (part of a library) with a variable argument list
! \ingroup FLEXT_D_LIB
*/
! #define FLEXT_LIB_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS, 0,1)
/*! \brief Implementation of a flext dsp class (part of a library) with a variable argument list
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS, 1,1)
***************
*** 120,138 ****
/*! \brief Implementation of a flext class with one argument
! \ingroup FLEXT_D_NEW
*/
! #define FLEXT_NEW_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 0, 0,TYPE) \
/*! \brief Implementation of a flext dsp class with one argument
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 1, 0,TYPE) \
/*! \brief Implementation of a flext class (part of a library) with one argument
! \ingroup FLEXT_D_LIB
*/
#define FLEXT_LIB_1(NAME,NEW_CLASS, TYPE) \
--- 120,138 ----
/*! \brief Implementation of a flext class with one argument
! \ingroup FLEXT_D_NEW
*/
! #define FLEXT_NEW_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 0, 0,TYPE) \
/*! \brief Implementation of a flext dsp class with one argument
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 1, 0,TYPE) \
/*! \brief Implementation of a flext class (part of a library) with one argument
! \ingroup FLEXT_D_LIB
*/
#define FLEXT_LIB_1(NAME,NEW_CLASS, TYPE) \
***************
*** 141,147 ****
/*! \brief Implementation of a flext dsp class (part of a library) with one argument
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 1,1, TYPE)
--- 141,147 ----
/*! \brief Implementation of a flext dsp class (part of a library) with one argument
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 1,1, TYPE)
***************
*** 152,179 ****
/*! \brief Implementation of a flext class with 2 arguments
! \ingroup FLEXT_D_NEW
*/
! #define FLEXT_NEW_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2) \
/*! \brief Implementation of a flext dsp class with 2 arguments
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2) \
/*! \brief Implementation of a flext class (part of a library) with 2 arguments
! \ingroup FLEXT_D_LIB
*/
! #define FLEXT_LIB_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 0,1, TYPE1, TYPE2)
/*! \brief Implementation of a flext dsp class (part of a library) with 2 arguments
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2)
--- 152,179 ----
/*! \brief Implementation of a flext class with 2 arguments
! \ingroup FLEXT_D_NEW
*/
! #define FLEXT_NEW_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2) \
/*! \brief Implementation of a flext dsp class with 2 arguments
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2) \
/*! \brief Implementation of a flext class (part of a library) with 2 arguments
! \ingroup FLEXT_D_LIB
*/
! #define FLEXT_LIB_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 0,1, TYPE1, TYPE2)
/*! \brief Implementation of a flext dsp class (part of a library) with 2 arguments
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2)
***************
*** 184,188 ****
/*! \brief Implementation of a flext class with 3 arguments
! \ingroup FLEXT_D_NEW
*/
#define FLEXT_NEW_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
--- 184,188 ----
/*! \brief Implementation of a flext class with 3 arguments
! \ingroup FLEXT_D_NEW
*/
#define FLEXT_NEW_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
***************
*** 191,211 ****
/*! \brief Implementation of a flext dsp class with 3 arguments
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2, TYPE3) \
/*! \brief Implementation of a flext class (part of a library) with 3 arguments
! \ingroup FLEXT_D_LIB
*/
! #define FLEXT_LIB_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 0,1,TYPE1, TYPE2, TYPE3)
/*! \brief Implementation of a flext dsp class (part of a library) with 3 arguments
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
--- 191,211 ----
/*! \brief Implementation of a flext dsp class with 3 arguments
! \ingroup FLEXT_D_NEW_DSP
*/
! #define FLEXT_NEW_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2, TYPE3) \
/*! \brief Implementation of a flext class (part of a library) with 3 arguments
! \ingroup FLEXT_D_LIB
*/
! #define FLEXT_LIB_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 0,1,TYPE1, TYPE2, TYPE3)
/*! \brief Implementation of a flext dsp class (part of a library) with 3 arguments
! \ingroup FLEXT_D_LIB_DSP
*/
! #define FLEXT_LIB_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
***************
*** 214,220 ****
// deprecated stuff
! /*! \defgroup FLEXT_D_DEPRECATED Deprecated definitions
! \deprecated
! @{
*/
--- 214,220 ----
// deprecated stuff
! /*! \defgroup FLEXT_D_DEPRECATED Deprecated definitions
! \deprecated
! @{
*/
***************
*** 240,259 ****
! /*! \defgroup FLEXT_D_LIBRARY Definitions for library objects
! @{
*/
/*! \brief Specify that to declare the library itself.
! \note If you have a library this is compulsory (to register all the objects of the library)
*/
#define FLEXT_LIB_SETUP(NAME,SETUPFUN) REAL_LIB_SETUP(NAME,SETUPFUN)
/*! \brief Register an object in the library.
! \note This is used in the library setup function
*/
#define FLEXT_SETUP(cl) REAL_SETUP(cl,0)
/*! \brief Register a DSP object in the library.
! \note This is used in the library setup function
*/
#define FLEXT_DSP_SETUP(cl) REAL_SETUP(cl,1)
--- 240,259 ----
! /*! \defgroup FLEXT_D_LIBRARY Definitions for library objects
! @{
*/
/*! \brief Specify that to declare the library itself.
! \note If you have a library this is compulsory (to register all the objects of the library)
*/
#define FLEXT_LIB_SETUP(NAME,SETUPFUN) REAL_LIB_SETUP(NAME,SETUPFUN)
/*! \brief Register an object in the library.
! \note This is used in the library setup function
*/
#define FLEXT_SETUP(cl) REAL_SETUP(cl,0)
/*! \brief Register a DSP object in the library.
! \note This is used in the library setup function
*/
#define FLEXT_DSP_SETUP(cl) REAL_SETUP(cl,1)
Index: fldefs_methcb.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldefs_methcb.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** fldefs_methcb.h 12 Dec 2003 03:32:56 -0000 1.2
--- fldefs_methcb.h 21 Jun 2004 13:58:19 -0000 1.3
***************
*** 18,24 ****
! /*! \defgroup FLEXT_D_CALLBACK Declare callbacks for class methods
\ingroup FLEXT_D_METHOD
! @{
*/
--- 18,24 ----
! /*! \defgroup FLEXT_D_CALLBACK Declare callbacks for class methods
\ingroup FLEXT_D_METHOD
! @{
*/
***************
*** 84,88 ****
! // Shortcuts
//! Set up a method callback for 1 float argument
--- 84,88 ----
! // Shortcuts
//! Set up a method callback for 1 float argument
Index: flprefix.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flprefix.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** flprefix.h 27 Mar 2004 03:22:14 -0000 1.27
--- flprefix.h 21 Jun 2004 13:58:19 -0000 1.28
***************
*** 17,58 ****
// --- definitions for FLEXT_SYS ---------------------
! #define FLEXT_SYS_UNKNOWN 0
#ifndef FLEXT_SYS_MAX
! #define FLEXT_SYS_MAX 1
#else
! // already defined
! #undef FLEXT_SYS_MAX
! #define FLEXT_SYS_MAX 1
! #define FLEXT_SYS FLEXT_SYS_MAX
#endif
#ifndef FLEXT_SYS_PD
! #define FLEXT_SYS_PD 2
#else
! // already defined
! #undef FLEXT_SYS_PD
! #define FLEXT_SYS_PD 2
! #define FLEXT_SYS FLEXT_SYS_PD
#endif
#ifndef FLEXT_SYS_JMAX
! #define FLEXT_SYS_JMAX 3
#else
! // already defined
! #undef FLEXT_SYS_JMAX
! #define FLEXT_SYS_JMAX 3
! #define FLEXT_SYS FLEXT_SYS_JMAX
#endif
// --- definitions for FLEXT_OS ----------------------
! #define FLEXT_OS_UNKNOWN 0
! #define FLEXT_OS_WIN 1
! #define FLEXT_OS_MAC 2
! #define FLEXT_OS_LINUX 3
! #define FLEXT_OS_IRIX 4
// --- definitions for FLEXT_OS_API ---------------------
! #define FLEXT_OSAPI_UNKNOWN 0
#define FLEXT_OSAPI_UNIX_POSIX 1
--- 17,58 ----
// --- definitions for FLEXT_SYS ---------------------
! #define FLEXT_SYS_UNKNOWN 0
#ifndef FLEXT_SYS_MAX
! #define FLEXT_SYS_MAX 1
#else
! // already defined
! #undef FLEXT_SYS_MAX
! #define FLEXT_SYS_MAX 1
! #define FLEXT_SYS FLEXT_SYS_MAX
#endif
#ifndef FLEXT_SYS_PD
! #define FLEXT_SYS_PD 2
#else
! // already defined
! #undef FLEXT_SYS_PD
! #define FLEXT_SYS_PD 2
! #define FLEXT_SYS FLEXT_SYS_PD
#endif
#ifndef FLEXT_SYS_JMAX
! #define FLEXT_SYS_JMAX 3
#else
! // already defined
! #undef FLEXT_SYS_JMAX
! #define FLEXT_SYS_JMAX 3
! #define FLEXT_SYS FLEXT_SYS_JMAX
#endif
// --- definitions for FLEXT_OS ----------------------
! #define FLEXT_OS_UNKNOWN 0
! #define FLEXT_OS_WIN 1
! #define FLEXT_OS_MAC 2
! #define FLEXT_OS_LINUX 3
! #define FLEXT_OS_IRIX 4
// --- definitions for FLEXT_OS_API ---------------------
! #define FLEXT_OSAPI_UNKNOWN 0
#define FLEXT_OSAPI_UNIX_POSIX 1
***************
*** 63,79 ****
#define FLEXT_OSAPI_WIN_NATIVE 5 // WIN32 Platform
! #define FLEXT_OSAPI_WIN_POSIX 6 // POSIX API (e.g. cygwin)
// --- definitions for FLEXT_CPU ---------------------
! #define FLEXT_CPU_UNKNOWN 0
#define FLEXT_CPU_INTEL 1
! #define FLEXT_CPU_PPC 2
! #define FLEXT_CPU_MIPS 3
! #define FLEXT_CPU_ALPHA 4
// --- definitions for FLEXT_THREADS -----------------
#define FLEXT_THR_POSIX 1 // pthreads
! #define FLEXT_THR_WIN32 2 // Win32 native
! #define FLEXT_THR_MP 3 // MacOS MPThreads
// ---------------------------------------------------
--- 63,79 ----
#define FLEXT_OSAPI_WIN_NATIVE 5 // WIN32 Platform
! #define FLEXT_OSAPI_WIN_POSIX 6 // POSIX API (e.g. cygwin)
// --- definitions for FLEXT_CPU ---------------------
! #define FLEXT_CPU_UNKNOWN 0
#define FLEXT_CPU_INTEL 1
! #define FLEXT_CPU_PPC 2
! #define FLEXT_CPU_MIPS 3
! #define FLEXT_CPU_ALPHA 4
// --- definitions for FLEXT_THREADS -----------------
#define FLEXT_THR_POSIX 1 // pthreads
! #define FLEXT_THR_WIN32 2 // Win32 native
! #define FLEXT_THR_MP 3 // MacOS MPThreads
// ---------------------------------------------------
***************
*** 81,96 ****
#ifndef FLEXT_SYS
! #if defined(MAXMSP)
! #define FLEXT_SYS FLEXT_SYS_MAX
! // #undef MAXMSP
! #elif defined(PD)
! #define FLEXT_SYS FLEXT_SYS_PD
! // #undef PD
! // #undef NT
! #endif
#endif
#if defined(_DEBUG) && !defined(FLEXT_DEBUG)
! #define FLEXT_DEBUG
#endif
--- 81,96 ----
#ifndef FLEXT_SYS
! #if defined(MAXMSP)
! #define FLEXT_SYS FLEXT_SYS_MAX
! // #undef MAXMSP
! #elif defined(PD)
! #define FLEXT_SYS FLEXT_SYS_PD
! // #undef PD
! // #undef NT
! #endif
#endif
#if defined(_DEBUG) && !defined(FLEXT_DEBUG)
! #define FLEXT_DEBUG
#endif
***************
*** 102,285 ****
#elif FLEXT_SYS == FLEXT_SYS_JMAX
#else
! #error "System must be defined by either FLEXT_SYS_MAX, FLEXT_SYS_PD or FLEXT_SYS_JMAX"
#endif
// Definition of OS/CPU
#if defined(_MSC_VER) || (defined(__ICC) && (FLEXT_OS == FLEXT_OS_WIN || defined(_WIN32)))
! // Microsoft C++
// and Intel C++ (as guessed)
!
! #ifndef FLEXT_CPU
! #if defined(_M_IX86)
! #define FLEXT_CPU FLEXT_CPU_INTEL
! #elif defined(_M_PPC)
! #define FLEXT_CPU FLEXT_CPU_PPC
! #elif defined(_M_MRX000)
! #define FLEXT_CPU FLEXT_CPU_MIPS
! #elif defined(_M_ALPHA)
! #define FLEXT_CPU FLEXT_CPU_ALPHA
! #else
! #define FLEXT_CPU FLEXT_CPU_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OS
! #if defined(_WIN32)
! #define FLEXT_OS FLEXT_OS_WIN
! #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
! #else
! #define FLEXT_OS FLEXT_OS_UNKNOWN
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
! #endif
#elif defined(__BORLANDC__)
! // Borland C++
! #ifndef FLEXT_CPU
! #define FLEXT_CPU FLEXT_CPU_INTEL
! #endif
! #ifndef FLEXT_OS
! #define FLEXT_OS FLEXT_OS_WIN
! #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
! #else
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
#elif defined(__MWERKS__)
! // Metrowerks CodeWarrior
! #ifdef __MACH__
! // quick fix for OSX Mach-O
! #define TARGET_CPU_PPC 1
! #define TARGET_OS_MAC 1
! #define TARGET_API_MAC_OSX 1
! #else
! #ifndef __CONDITIONALMACROS__
! #include <ConditionalMacros.h>
! #endif
! #endif
! #ifndef FLEXT_CPU
! #if TARGET_CPU_X86
! #define FLEXT_CPU FLEXT_CPU_INTEL
! #elif TARGET_CPU_PPC
! #define FLEXT_CPU FLEXT_CPU_PPC
! #elif TARGET_CPU_MIPS
! #define FLEXT_CPU FLEXT_CPU_MIPS
! #elif TARGET_CPU_ALPHA
! #define FLEXT_CPU FLEXT_CPU_ALPHA
! #else
! #define FLEXT_CPU FLEXT_CPU_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OS
! #if TARGET_OS_MAC
! #define FLEXT_OS FLEXT_OS_MAC
! #elif TARGET_OS_WIN32
! // assume Windows
! #define FLEXT_OS FLEXT_OS_WIN
! #else
! #define FLEXT_OS FLEXT_OS_UNKNOWN
! #endif
! #endif
!
! #ifndef FLEXT_OSAPI
! #if TARGET_API_MAC_MACH
! // this is for Mach-O
! // this has the precedence (MACH also supports Carbon, of course)
! #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
! #elif TARGET_API_MAC_CARBON
! // this is for CFM
! #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CARBON
! #else
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
! #endif
!
! // This is important for method and attribute callbacks
! #pragma enumsalwaysint on
! // This is important for everything
! #pragma bool on
#elif defined(__GNUG__) || (defined(__ICC) && (FLEXT_OS == FLEXT_OS_LINUX || defined(linux) || defined(__linux__)))
! // GNU C++
// and Intel (as suggested by Tim Blechmann)
! #ifndef FLEXT_CPU
! #if defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__)
! #define FLEXT_CPU FLEXT_CPU_INTEL
! #elif defined(__POWERPC__)
! #define FLEXT_CPU FLEXT_CPU_PPC
! #elif defined(__MIPS__)
! #define FLEXT_CPU FLEXT_CPU_MIPS
! #else
! #define FLEXT_CPU FLEXT_CPU_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OS
! #if defined(linux) || defined(__linux__)
! #define FLEXT_OS FLEXT_OS_LINUX
! #elif defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__)
! #define FLEXT_OS FLEXT_OS_WIN
! #elif defined(__APPLE__) && defined(__MACH__)
! #define FLEXT_OS FLEXT_OS_MAC
! // how about IRIX??
! #else
! #define FLEXT_OS FLEXT_OS_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OSAPI
! #if FLEXT_OS == FLEXT_OS_MAC
! #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
! #elif FLEXT_OS == FLEXT_OS_WIN
#if defined(__MINGW32__)
! #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
#else
! #define FLEXT_OSAPI FLEXT_OSAPI_WIN_POSIX
#endif
! #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX
! #define FLEXT_OSAPI FLEXT_OSAPI_UNIX_POSIX
! #else
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
! #endif
#elif defined(__MRC__) && defined(MPW_CPLUS)
! // Apple MPW MrCpp
! #if __MRC__ < 0x500
! #error Apple MPW MrCpp v.5.0.0 or later compiler required
! #endif
! #ifndef FLEXT_CPU
! #if defined(__POWERPC__)
! #define FLEXT_CPU FLEXT_CPU_PPC
! #else
! #define FLEXT_CPU FLEXT_CPU_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OS
! #if defined(macintosh)
! #define FLEXT_OS FLEXT_OS_MAC
! #else
! #define FLEXT_OS FLEXT_OS_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OSAPI
! #if FLEXT_OS == FLEXT_OS_MAC
! #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CLASSIC
! #else
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
! #endif
#endif
--- 102,285 ----
#elif FLEXT_SYS == FLEXT_SYS_JMAX
#else
! #error "System must be defined by either FLEXT_SYS_MAX, FLEXT_SYS_PD or FLEXT_SYS_JMAX"
#endif
// Definition of OS/CPU
#if defined(_MSC_VER) || (defined(__ICC) && (FLEXT_OS == FLEXT_OS_WIN || defined(_WIN32)))
! // Microsoft C++
// and Intel C++ (as guessed)
!
! #ifndef FLEXT_CPU
! #if defined(_M_IX86)
! #define FLEXT_CPU FLEXT_CPU_INTEL
! #elif defined(_M_PPC)
! #define FLEXT_CPU FLEXT_CPU_PPC
! #elif defined(_M_MRX000)
! #define FLEXT_CPU FLEXT_CPU_MIPS
! #elif defined(_M_ALPHA)
! #define FLEXT_CPU FLEXT_CPU_ALPHA
! #else
! #define FLEXT_CPU FLEXT_CPU_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OS
! #if defined(_WIN32)
! #define FLEXT_OS FLEXT_OS_WIN
! #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
! #else
! #define FLEXT_OS FLEXT_OS_UNKNOWN
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
! #endif
#elif defined(__BORLANDC__)
! // Borland C++
! #ifndef FLEXT_CPU
! #define FLEXT_CPU FLEXT_CPU_INTEL
! #endif
! #ifndef FLEXT_OS
! #define FLEXT_OS FLEXT_OS_WIN
! #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
! #else
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
#elif defined(__MWERKS__)
! // Metrowerks CodeWarrior
! #ifdef __MACH__
! // quick fix for OSX Mach-O
! #define TARGET_CPU_PPC 1
! #define TARGET_OS_MAC 1
! #define TARGET_API_MAC_OSX 1
! #else
! #ifndef __CONDITIONALMACROS__
! #include <ConditionalMacros.h>
! #endif
! #endif
! #ifndef FLEXT_CPU
! #if TARGET_CPU_X86
! #define FLEXT_CPU FLEXT_CPU_INTEL
! #elif TARGET_CPU_PPC
! #define FLEXT_CPU FLEXT_CPU_PPC
! #elif TARGET_CPU_MIPS
! #define FLEXT_CPU FLEXT_CPU_MIPS
! #elif TARGET_CPU_ALPHA
! #define FLEXT_CPU FLEXT_CPU_ALPHA
! #else
! #define FLEXT_CPU FLEXT_CPU_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OS
! #if TARGET_OS_MAC
! #define FLEXT_OS FLEXT_OS_MAC
! #elif TARGET_OS_WIN32
! // assume Windows
! #define FLEXT_OS FLEXT_OS_WIN
! #else
! #define FLEXT_OS FLEXT_OS_UNKNOWN
! #endif
! #endif
!
! #ifndef FLEXT_OSAPI
! #if TARGET_API_MAC_MACH
! // this is for Mach-O
! // this has the precedence (MACH also supports Carbon, of course)
! #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
! #elif TARGET_API_MAC_CARBON
! // this is for CFM
! #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CARBON
! #else
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
! #endif
!
! // This is important for method and attribute callbacks
! #pragma enumsalwaysint on
! // This is important for everything
! #pragma bool on
#elif defined(__GNUG__) || (defined(__ICC) && (FLEXT_OS == FLEXT_OS_LINUX || defined(linux) || defined(__linux__)))
! // GNU C++
// and Intel (as suggested by Tim Blechmann)
! #ifndef FLEXT_CPU
! #if defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__)
! #define FLEXT_CPU FLEXT_CPU_INTEL
! #elif defined(__POWERPC__)
! #define FLEXT_CPU FLEXT_CPU_PPC
! #elif defined(__MIPS__)
! #define FLEXT_CPU FLEXT_CPU_MIPS
! #else
! #define FLEXT_CPU FLEXT_CPU_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OS
! #if defined(linux) || defined(__linux__)
! #define FLEXT_OS FLEXT_OS_LINUX
! #elif defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__)
! #define FLEXT_OS FLEXT_OS_WIN
! #elif defined(__APPLE__) && defined(__MACH__)
! #define FLEXT_OS FLEXT_OS_MAC
! // how about IRIX??
! #else
! #define FLEXT_OS FLEXT_OS_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OSAPI
! #if FLEXT_OS == FLEXT_OS_MAC
! #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
! #elif FLEXT_OS == FLEXT_OS_WIN
#if defined(__MINGW32__)
! #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
#else
! #define FLEXT_OSAPI FLEXT_OSAPI_WIN_POSIX
#endif
! #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX
! #define FLEXT_OSAPI FLEXT_OSAPI_UNIX_POSIX
! #else
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
! #endif
#elif defined(__MRC__) && defined(MPW_CPLUS)
! // Apple MPW MrCpp
! #if __MRC__ < 0x500
! #error Apple MPW MrCpp v.5.0.0 or later compiler required
! #endif
! #ifndef FLEXT_CPU
! #if defined(__POWERPC__)
! #define FLEXT_CPU FLEXT_CPU_PPC
! #else
! #define FLEXT_CPU FLEXT_CPU_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OS
! #if defined(macintosh)
! #define FLEXT_OS FLEXT_OS_MAC
! #else
! #define FLEXT_OS FLEXT_OS_UNKNOWN
! #endif
! #endif
! #ifndef FLEXT_OSAPI
! #if FLEXT_OS == FLEXT_OS_MAC
! #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CLASSIC
! #else
! #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
! #endif
! #endif
#endif
***************
*** 287,328 ****
#if FLEXT_OS == FLEXT_OS_WIN
! // #pragma message("Compiling for Windows")
! #if FLEXT_SYS == FLEXT_SYS_MAX
! // #define WIN_VERSION 1
! #elif FLEXT_SYS == FLEXT_SYS_PD
! // #define PD
! // #define NT
! #endif
#elif FLEXT_OS == FLEXT_OS_LINUX
! // #pragma message("Compiling for Linux")
! #if FLEXT_SYS == FLEXT_SYS_PD
! // #define PD
! #else
! #error "Flext SYS/OS combination unknown"
! #endif
#elif FLEXT_OS == FLEXT_OS_IRIX
! // #pragma message("Compiling for Irix")
! #if FLEXT_SYS == FLEXT_SYS_PD
! // #define PD
! #else
! #error "Flext SYS/OS combination unknown"
! #endif
#elif FLEXT_OS == FLEXT_OS_MAC
! // #pragma message("Compiling for MacOS")
! #if FLEXT_SYS == FLEXT_SYS_PD
! // #define PD
! #endif
#else
! #error "Operating system could not be determined"
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
! // #pragma message("Compiling for Max/MSP")
#elif FLEXT_SYS == FLEXT_SYS_PD
! // #pragma message("Compiling for PD")
#endif
--- 287,328 ----
#if FLEXT_OS == FLEXT_OS_WIN
! // #pragma message("Compiling for Windows")
! #if FLEXT_SYS == FLEXT_SYS_MAX
! // #define WIN_VERSION 1
! #elif FLEXT_SYS == FLEXT_SYS_PD
! // #define PD
! // #define NT
! #endif
#elif FLEXT_OS == FLEXT_OS_LINUX
! // #pragma message("Compiling for Linux")
! #if FLEXT_SYS == FLEXT_SYS_PD
! // #define PD
! #else
! #error "Flext SYS/OS combination unknown"
! #endif
#elif FLEXT_OS == FLEXT_OS_IRIX
! // #pragma message("Compiling for Irix")
! #if FLEXT_SYS == FLEXT_SYS_PD
! // #define PD
! #else
! #error "Flext SYS/OS combination unknown"
! #endif
#elif FLEXT_OS == FLEXT_OS_MAC
! // #pragma message("Compiling for MacOS")
! #if FLEXT_SYS == FLEXT_SYS_PD
! // #define PD
! #endif
#else
! #error "Operating system could not be determined"
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
! // #pragma message("Compiling for Max/MSP")
#elif FLEXT_SYS == FLEXT_SYS_PD
! // #pragma message("Compiling for PD")
#endif
***************
*** 330,353 ****
// shared builds are always threaded (although this not be so....)
#ifdef FLEXT_SHARED
! #undef FLEXT_THREADS
! #define FLEXT_THREADS
/*
! // and also enabled for virtual daughter-classes??
! #undef FLEXT_VIRT
! #define FLEXT_VIRT
*/
#endif
#ifdef FLEXT_THREADS
! #undef FLEXT_THREADS
! #if FLEXT_OS == FLEXT_OS_MAC && FLEXT_SYS == FLEXT_SYS_MAX
! // Max crashes with posix threads (because it's in the CFM model)
! #define FLEXT_THREADS FLEXT_THR_MP
! #elif FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
! // for wmax use native Windows threads
! #define FLEXT_THREADS FLEXT_THR_WIN32
! #else
! #define FLEXT_THREADS FLEXT_THR_POSIX
! #endif
#endif
--- 330,353 ----
// shared builds are always threaded (although this not be so....)
#ifdef FLEXT_SHARED
! #undef FLEXT_THREADS
! #define FLEXT_THREADS
/*
! // and also enabled for virtual daughter-classes??
! #undef FLEXT_VIRT
! #define FLEXT_VIRT
*/
#endif
#ifdef FLEXT_THREADS
! #undef FLEXT_THREADS
! #if FLEXT_OS == FLEXT_OS_MAC && FLEXT_SYS == FLEXT_SYS_MAX
! // Max crashes with posix threads (because it's in the CFM model)
! #define FLEXT_THREADS FLEXT_THR_MP
! #elif FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
! // for wmax use native Windows threads
! #define FLEXT_THREADS FLEXT_THR_WIN32
! #else
! #define FLEXT_THREADS FLEXT_THR_POSIX
! #endif
#endif
***************
*** 356,367 ****
With linux (flat linker namespace) and more than one flext-based external loaded all calls to static
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)
! #define FLEXT_CLASSDEF(CL) CL##_shared
#elif defined(FLEXT_THREADS)
! #define FLEXT_CLASSDEF(CL) CL##_multi
#else
! #define FLEXT_CLASSDEF(CL) CL##_single
#endif
--- 356,367 ----
With linux (flat linker namespace) and more than one flext-based external loaded all calls to static
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)
! #define FLEXT_CLASSDEF(CL) CL##_shared
#elif defined(FLEXT_THREADS)
! #define FLEXT_CLASSDEF(CL) CL##_multi
#else
! #define FLEXT_CLASSDEF(CL) CL##_single
#endif
Index: flatom_part.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flatom_part.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** flatom_part.cpp 1 Jan 2003 04:32:04 -0000 1.2
--- flatom_part.cpp 21 Jun 2004 13:58:19 -0000 1.3
***************
*** 17,26 ****
int flext::AtomList::Get(t_atom *argv,int mxsz) const
{
! int argc = Count();
! if(mxsz >= 0 && argc > mxsz) argc = mxsz;
! for(int i = 0; i < argc; ++i) SetAtom(argv[i],lst[i]);
! return argc;
}
--- 17,26 ----
int flext::AtomList::Get(t_atom *argv,int mxsz) const
{
! int argc = Count();
! if(mxsz >= 0 && argc > mxsz) argc = mxsz;
! for(int i = 0; i < argc; ++i) SetAtom(argv[i],lst[i]);
! return argc;
}
***************
*** 28,37 ****
flext::AtomList flext::AtomList::GetPart(int offs,int len) const
{
! if(offs+len > Count()) {
! len = Count()-offs;
! if(len < 0) len = 0;
! }
! return AtomList(len,Atoms()+offs);
}
--- 28,37 ----
flext::AtomList flext::AtomList::GetPart(int offs,int len) const
{
! if(offs+len > Count()) {
! len = Count()-offs;
! if(len < 0) len = 0;
! }
! return AtomList(len,Atoms()+offs);
}
Index: flmspbuffer.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmspbuffer.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** flmspbuffer.h 1 Jan 2003 04:32:05 -0000 1.3
--- flmspbuffer.h 21 Jun 2004 13:58:19 -0000 1.4
***************
*** 11,18 ****
/*! \file flmspbuffer.h
\brief Definition of the Max/MSP buffer structure
! \internal
! This file comes from David Zicarellis inofficial package index.sit
! The latter is not easily found so i included the original file buffer.h with flext
*/
--- 11,18 ----
/*! \file flmspbuffer.h
\brief Definition of the Max/MSP buffer structure
! \internal
! This file comes from David Zicarellis inofficial package index.sit
! The latter is not easily found so i included the original file buffer.h with flext
*/
***************
*** 21,79 ****
enum {
! MAXCHAN = 4
};
enum {
! bi_basefreq = 0,
! bi_detune,
! bi_lowfreq,
! bi_hifreq,
! bi_lowvel,
! bi_hivel,
! bi_gain,
! bi_numparams
};
typedef struct _buffer
{
! t_object b_obj; // doesn't have any signals so it doesn't need to be pxobject
! long b_valid; // flag is off during read replacement or editing operation
! float *b_samples; // stored with interleaved channels if multi-channel
! long b_frames; // number of sample frames (each one is sizeof(float) * b_nchans bytes)
! long b_nchans; // number of channels
! long b_size; // size of buffer in floats
! float b_sr; // sampling rate of the buffer
! float b_1oversr; // 1 / sr
! float b_msr; // sr * .001
! // Mac-specific stuff
! float *b_memory; // pointer to where memory starts (initial padding for interp)
! t_symbol *b_name;
! short b_vol;
! short b_space;
! // looping info (from AIFF file)
! long b_susloopstart; // in samples
! long b_susloopend; // in samples
! long b_relloopstart; // in samples
! long b_relloopend; // in samples
! // instrument info (from AIFF file)
! short b_inst[bi_numparams];
! // window stuff
! void *b_wind;
! double b_pixperfr;
! double b_frperpix;
! long b_imagesize;
! Point b_scroll;
! long b_scrollscale;
! long b_selbegin[MAXCHAN];
! long b_selend[MAXCHAN];
! long b_zoom;
! long b_zim[11];
! void *b_mouseout;
! long b_format; // 'AIFF' or 'Sd2f'
! t_symbol *b_filename; // last file read (not written) for readagain message
! long b_oldnchans; // used for resizing window in case of # of channels change
! void *b_doneout;
! long b_outputbytes; // number of bytes used for output sample (1-4)
! long b_modtime; // last modified time ("dirty" method)
} t_buffer;
--- 21,79 ----
enum {
! MAXCHAN = 4
};
enum {
! bi_basefreq = 0,
! bi_detune,
! bi_lowfreq,
! bi_hifreq,
! bi_lowvel,
! bi_hivel,
! bi_gain,
! bi_numparams
};
typedef struct _buffer
{
! t_object b_obj; // doesn't have any signals so it doesn't need to be pxobject
! long b_valid; // flag is off during read replacement or editing operation
! float *b_samples; // stored with interleaved channels if multi-channel
! long b_frames; // number of sample frames (each one is sizeof(float) * b_nchans bytes)
! long b_nchans; // number of channels
! long b_size; // size of buffer in floats
! float b_sr; // sampling rate of the buffer
! float b_1oversr; // 1 / sr
! float b_msr; // sr * .001
! // Mac-specific stuff
! float *b_memory; // pointer to where memory starts (initial padding for interp)
! t_symbol *b_name;
! short b_vol;
! short b_space;
! // looping info (from AIFF file)
! long b_susloopstart; // in samples
! long b_susloopend; // in samples
! long b_relloopstart; // in samples
! long b_relloopend; // in samples
! // instrument info (from AIFF file)
! short b_inst[bi_numparams];
! // window stuff
! void *b_wind;
! double b_pixperfr;
! double b_frperpix;
! long b_imagesize;
! Point b_scroll;
! long b_scrollscale;
! long b_selbegin[MAXCHAN];
! long b_selend[MAXCHAN];
! long b_zoom;
! long b_zim[11];
! void *b_mouseout;
! long b_format; // 'AIFF' or 'Sd2f'
! t_symbol *b_filename; // last file read (not written) for readagain message
! long b_oldnchans; // used for resizing window in case of # of channels change
! void *b_doneout;
! long b_outputbytes; // number of bytes used for output sample (1-4)
! long b_modtime; // last modified time ("dirty" method)
} t_buffer;
Index: flattr_ed.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flattr_ed.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** flattr_ed.cpp 6 Mar 2004 03:25:48 -0000 1.20
--- flattr_ed.cpp 21 Jun 2004 13:58:19 -0000 1.21
***************
*** 46,54 ****
void flext_base::SetAttrEditor(t_classid c)
{
! // widgetbehavior struct MUST be resident... (static is just ok here)
#ifndef FLEXT_CLONEWIDGET
! ori_vis = c->c_wb->w_visfn;
! widgetbehavior.w_getrectfn = c->c_wb->w_getrectfn;
widgetbehavior.w_displacefn = c->c_wb->w_displacefn;
widgetbehavior.w_selectfn = c->c_wb->w_selectfn;
--- 46,54 ----
[...1206 lines suppressed...]
! a.SetInitValue(icnt,argv+ioffs);
! }
! else {
! if(it != th->attrdata->end()) {
! AttrData &a = *it.data();
! // if data is present reset flags
! a.SetSave(false);
! a.SetInit(false);
! // let init data as is
! }
! }
! }
! else {
! post("%s - Attribute %s can't be set",th->thisName(),GetString(aname));
! }
! }
! return true;
}
Index: fldefs_attrvar.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldefs_attrvar.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** fldefs_attrvar.h 12 Dec 2003 03:32:56 -0000 1.4
--- fldefs_attrvar.h 21 Jun 2004 13:58:19 -0000 1.5
***************
*** 19,23 ****
/*! \brief Declare an implicit attribute set function
! \internal
*/
#define FLEXT_ATTRSET_(VAR,TP) \
--- 19,23 ----
/*! \brief Declare an implicit attribute set function
! \internal
*/
#define FLEXT_ATTRSET_(VAR,TP) \
***************
*** 26,30 ****
/*! \brief Declare an implicit attribute get function
! \internal
*/
#define FLEXT_ATTRGET_(VAR,TP) \
--- 26,30 ----
/*! \brief Declare an implicit attribute get function
! \internal
*/
#define FLEXT_ATTRGET_(VAR,TP) \
***************
*** 34,40 ****
! /*! \defgroup FLEXT_DA_ATTRSET Definition of implicit attribute set handlers
\ingroup FLEXT_D_ATTRIB
! @{
*/
--- 34,40 ----
! /*! \defgroup FLEXT_DA_ATTRSET Definition of implicit attribute set handlers
\ingroup FLEXT_D_ATTRIB
! @{
*/
***************
*** 75,81 ****
//! @} FLEXT_DA_ATTRSET
! /*! \defgroup FLEXT_DA_ATTRGET Definition of implicit attribute get handlers
\ingroup FLEXT_D_ATTRIB
! @{
*/
--- 75,81 ----
//! @} FLEXT_DA_ATTRSET
! /*! \defgroup FLEXT_DA_ATTRGET Definition of implicit attribute get handlers
\ingroup FLEXT_D_ATTRIB
! @{
*/
***************
*** 117,123 ****
! /*! \defgroup FLEXT_DA_ATTRVAR Definition of implicit attribute transfer handlers (both get and set)
\ingroup FLEXT_D_ATTRIB
! @{
*/
--- 117,123 ----
! /*! \defgroup FLEXT_DA_ATTRVAR Definition of implicit attribute transfer handlers (both get and set)
\ingroup FLEXT_D_ATTRIB
! @{
*/
Index: flsimd.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsimd.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** flsimd.cpp 2 Apr 2004 02:21:20 -0000 1.12
--- flsimd.cpp 21 Jun 2004 13:58:19 -0000 1.13
***************
*** 10,14 ****
/*! \file flsimd.cpp
! \brief flext SIMD support functions
If FLEXT_USE_SIMD is defined at compilation, SIMD instructions are used wherever feasible.
--- 10,14 ----
/*! \file flsimd.cpp
! \brief flext SIMD support functions
[...2427 lines suppressed...]
else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(dst))
! ScaleAltivec(dst,src,opmul,opadd,cnt);
! else
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
{
! int n = cnt>>3;
! cnt -= n<<3;
! while(n--) {
! dst[0] = src[0]*opmul+opadd; dst[1] = src[1]*opmul+opadd;
! dst[2] = src[2]*opmul+opadd; dst[3] = src[3]*opmul+opadd;
! dst[4] = src[4]*opmul+opadd; dst[5] = src[5]*opmul+opadd;
! dst[6] = src[6]*opmul+opadd; dst[7] = src[7]*opmul+opadd;
! src += 8,dst += 8;
! }
! while(cnt--) *(dst++) = *(src++)*opmul+opadd;
}
#endif
Index: flbuf.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flbuf.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** flbuf.cpp 21 Mar 2004 03:28:52 -0000 1.17
--- flbuf.cpp 21 Jun 2004 13:58:19 -0000 1.18
***************
*** 28,50 ****
#if defined(PD_DEVEL_VERSION) && defined(PD_MAJOR_VERSION) && defined(PD_MINOR_VERSION)
#if PD_MINOR_VERSION >= 36
! #define FLEXT_PDBUFDIRTYTIME
#endif
#endif
flext::buffer::buffer(const t_symbol *bn,bool delayed):
! sym(NULL),data(NULL),
! chns(0),frames(0)
{
#if FLEXT_SYS == FLEXT_SYS_PD
! arr = NULL;
! interval = DIRTY_INTERVAL;
! isdirty = false;
! ticking = false;
tick = clock_new(this,(t_method)cb_tick);
#endif
! if(bn) Set(bn,delayed);
! ClearDirty();
}
--- 28,50 ----
#if defined(PD_DEVEL_VERSION) && defined(PD_MAJOR_VERSION) && defined(PD_MINOR_VERSION)
#if PD_MINOR_VERSION >= 36
! #define FLEXT_PDBUFDIRTYTIME
#endif
#endif
flext::buffer::buffer(const t_symbol *bn,bool delayed):
! sym(NULL),data(NULL),
! chns(0),frames(0)
{
#if FLEXT_SYS == FLEXT_SYS_PD
! arr = NULL;
! interval = DIRTY_INTERVAL;
! isdirty = false;
! ticking = false;
tick = clock_new(this,(t_method)cb_tick);
#endif
! if(bn) Set(bn,delayed);
! ClearDirty();
}
***************
*** 58,146 ****
int flext::buffer::Set(const t_symbol *s,bool nameonly)
{
! int ret = 0;
! bool valid = data != NULL; // valid now? (before change)
! if(s && sym != s) {
! ret = 1;
! data = NULL;
! frames = 0;
! chns = 0;
! }
! if(s && *GetString(s)) sym = s;
! if(!sym) {
! if(valid) ret = -1;
! }
! else if(!nameonly) {
#if FLEXT_SYS == FLEXT_SYS_PD
! int frames1;
! t_sample *data1;
! arr = (t_garray *)pd_findbyclass(const_cast<t_symbol *>(sym), garray_class);
! if(!arr)
! {
! if (*GetString(sym)) FLEXT_LOG1("buffer: no such array '%s'",GetString(sym));
! sym = NULL;
! if(valid) ret = -1;
! }
! else if(!garray_getfloatarray(arr, &frames1, &data1))
! {
! error("buffer: bad template '%s'",GetString(sym));
! data = NULL;
! frames = 0;
! if(valid) ret = -1;
! }
! else {
ret = 0;
! garray_usedindsp(arr);
! if(frames != frames1) { frames = frames1; if(!ret) ret = 1; }
! if(data != data1) { data = data1; if(!ret) ret = 1; }
! chns = 1;
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! if(sym->s_thing) {
! const _buffer *p = (const _buffer *)sym->s_thing;
!
! if(NOGOOD(p) || !p->b_valid) {
! post("buffer: buffer object '%s' no good",GetString(sym));
! if(valid) ret = -2;
! }
! else {
#ifdef FLEXT_DEBUG
! // post("flext: buffer object '%s' - valid:%i samples:%i channels:%i frames:%i",GetString(sym),p->b_valid,p->b_frames,p->b_nchans,p->b_frames);
#endif
! if(data != p->b_samples) { data = p->b_samples; if(!ret) ret = 1; }
! if(chns != p->b_nchans) { chns = p->b_nchans; if(!ret) ret = 1; }
! if(frames != p->b_frames) { frames = p->b_frames; if(!ret) ret = 1; }
! }
! }
! else {
! FLEXT_LOG1("buffer: symbol '%s' not defined", GetString(sym));
! /*if(valid)*/ ret = -1;
! }
#else
#error not implemented
#endif
! }
! return ret;
}
bool flext::buffer::Valid() const
{
! if(sym) {
#if FLEXT_SYS == FLEXT_SYS_PD
! int frames1;
! t_sample *data1;
! return arr && garray_getfloatarray(arr, &frames1, &data1) != 0;
#elif FLEXT_SYS == FLEXT_SYS_MAX
! const _buffer *p = (const _buffer *)sym->s_thing;
! return p && p->b_valid;
#else
#error
#endif
! }
! else return false;
}
--- 58,146 ----
int flext::buffer::Set(const t_symbol *s,bool nameonly)
{
! int ret = 0;
! bool valid = data != NULL; // valid now? (before change)
! if(s && sym != s) {
! ret = 1;
! data = NULL;
! frames = 0;
! chns = 0;
! }
! if(s && *GetString(s)) sym = s;
! if(!sym) {
! if(valid) ret = -1;
! }
! else if(!nameonly) {
#if FLEXT_SYS == FLEXT_SYS_PD
! int frames1;
! t_sample *data1;
! arr = (t_garray *)pd_findbyclass(const_cast<t_symbol *>(sym), garray_class);
! if(!arr)
! {
! if (*GetString(sym)) FLEXT_LOG1("buffer: no such array '%s'",GetString(sym));
! sym = NULL;
! if(valid) ret = -1;
! }
! else if(!garray_getfloatarray(arr, &frames1, &data1))
! {
! error("buffer: bad template '%s'",GetString(sym));
! data = NULL;
! frames = 0;
! if(valid) ret = -1;
! }
! else {
ret = 0;
! garray_usedindsp(arr);
! if(frames != frames1) { frames = frames1; if(!ret) ret = 1; }
! if(data != data1) { data = data1; if(!ret) ret = 1; }
! chns = 1;
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! if(sym->s_thing) {
! const _buffer *p = (const _buffer *)sym->s_thing;
!
! if(NOGOOD(p) || !p->b_valid) {
! post("buffer: buffer object '%s' no good",GetString(sym));
! if(valid) ret = -2;
! }
! else {
#ifdef FLEXT_DEBUG
! // post("flext: buffer object '%s' - valid:%i samples:%i channels:%i frames:%i",GetString(sym),p->b_valid,p->b_frames,p->b_nchans,p->b_frames);
#endif
! if(data != p->b_samples) { data = p->b_samples; if(!ret) ret = 1; }
! if(chns != p->b_nchans) { chns = p->b_nchans; if(!ret) ret = 1; }
! if(frames != p->b_frames) { frames = p->b_frames; if(!ret) ret = 1; }
! }
! }
! else {
! FLEXT_LOG1("buffer: symbol '%s' not defined", GetString(sym));
! /*if(valid)*/ ret = -1;
! }
#else
#error not implemented
#endif
! }
! return ret;
}
bool flext::buffer::Valid() const
{
! if(sym) {
#if FLEXT_SYS == FLEXT_SYS_PD
! int frames1;
! t_sample *data1;
! return arr && garray_getfloatarray(arr, &frames1, &data1) != 0;
#elif FLEXT_SYS == FLEXT_SYS_MAX
! const _buffer *p = (const _buffer *)sym->s_thing;
! return p && p->b_valid;
#else
#error
#endif
! }
! else return false;
}
***************
*** 148,183 ****
bool flext::buffer::Update()
{
! if(!Ok()) return false;
! bool ok = false;
#if FLEXT_SYS == FLEXT_SYS_PD
! int frames1;
! t_sample *data1;
! if(!garray_getfloatarray(arr, &frames1, &data1)) {
! frames = 0;
! data = NULL;
! chns = 0;
! ok = true;
! }
! else if(data != data1 || frames != frames1) {
! frames = frames1;
! data = data1;
! ok = true;
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! if(sym->s_thing) {
! const _buffer *p = (const _buffer *)sym->s_thing;
! if(data != p->b_samples || chns != p->b_nchans || frames != p->b_frames) {
! data = p->b_samples;
! chns = p->b_nchans;
! frames = p->b_frames;
! ok = true;
! }
! }
#else
#error not implemented
#endif
! return ok;
}
--- 148,183 ----
bool flext::buffer::Update()
{
! if(!Ok()) return false;
! bool ok = false;
#if FLEXT_SYS == FLEXT_SYS_PD
! int frames1;
! t_sample *data1;
! if(!garray_getfloatarray(arr, &frames1, &data1)) {
! frames = 0;
! data = NULL;
! chns = 0;
! ok = true;
! }
! else if(data != data1 || frames != frames1) {
! frames = frames1;
! data = data1;
! ok = true;
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! if(sym->s_thing) {
! const _buffer *p = (const _buffer *)sym->s_thing;
! if(data != p->b_samples || chns != p->b_nchans || frames != p->b_frames) {
! data = p->b_samples;
! chns = p->b_nchans;
! frames = p->b_frames;
! ok = true;
! }
! }
#else
#error not implemented
#endif
! return ok;
}
***************
*** 186,222 ****
#if FLEXT_SYS == FLEXT_SYS_PD
// is this function guaranteed to keep memory and set rest to zero?
! ::garray_resize(arr,(float)fr);
! Update();
#elif FLEXT_SYS == FLEXT_SYS_MAX
! t_sample *tmp = NULL;
! int sz = frames;
! if(fr < sz) sz = fr;
! if(keep) {
! // copy buffer data to tmp storage
tmp = (t_sample *)NewAligned(sz*sizeof(t_sample));
if(tmp)
! CopySamples(tmp,data,sz);
! else
! error("flext::buffer - not enough memory for keeping buffer~ contents");
! }
!
! t_atom msg;
! _buffer *buf = (_buffer *)sym->s_thing;
! // b_msr reflects buffer sample rate... is this what we want?
! // Max bug: adding half a sample to prevent roundoff errors....
! float ms = (fr+0.5)/buf->b_msr;
!
! SetFloat(msg,ms);
! ::typedmess((object *)buf,gensym("size"),1,&msg);
!
! Update();
! if(tmp) {
! // copy data back
! CopySamples(data,tmp,sz);
! FreeAligned(tmp);
if(zero && sz < fr) ZeroSamples(data+sz,fr-sz);
! }
else
if(zero) ZeroSamples(data,fr);
--- 186,222 ----
#if FLEXT_SYS == FLEXT_SYS_PD
// is this function guaranteed to keep memory and set rest to zero?
! ::garray_resize(arr,(float)fr);
! Update();
#elif FLEXT_SYS == FLEXT_SYS_MAX
! t_sample *tmp = NULL;
! int sz = frames;
! if(fr < sz) sz = fr;
! if(keep) {
! // copy buffer data to tmp storage
tmp = (t_sample *)NewAligned(sz*sizeof(t_sample));
if(tmp)
! CopySamples(tmp,data,sz);
! else
! error("flext::buffer - not enough memory for keeping buffer~ contents");
! }
!
! t_atom msg;
! _buffer *buf = (_buffer *)sym->s_thing;
! // b_msr reflects buffer sample rate... is this what we want?
! // Max bug: adding half a sample to prevent roundoff errors....
! float ms = (fr+0.5)/buf->b_msr;
!
! SetFloat(msg,ms);
! ::typedmess((object *)buf,gensym("size"),1,&msg);
!
! Update();
! if(tmp) {
! // copy data back
! CopySamples(data,tmp,sz);
! FreeAligned(tmp);
if(zero && sz < fr) ZeroSamples(data+sz,fr-sz);
! }
else
if(zero) ZeroSamples(data,fr);
***************
*** 230,238 ****
void flext::buffer::SetRefrIntv(float intv)
{
! interval = intv;
! if(interval == 0 && ticking) {
! clock_unset(tick);
! ticking = false;
! }
}
#elif FLEXT_SYS == FLEXT_SYS_MAX
--- 230,238 ----
void flext::buffer::SetRefrIntv(float intv)
{
! interval = intv;
! if(interval == 0 && ticking) {
! clock_unset(tick);
! ticking = false;
! }
}
#elif FLEXT_SYS == FLEXT_SYS_MAX
***************
*** 245,276 ****
void flext::buffer::Dirty(bool force)
{
! if(sym) {
#if FLEXT_SYS == FLEXT_SYS_PD
! if((!ticking) && (interval || force)) {
! ticking = true;
! cb_tick(this); // immediately redraw
! }
! else {
! if(force) clock_delay(tick,0);
! isdirty = true;
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! if(sym->s_thing) {
! _buffer *p = (_buffer *)sym->s_thing;
!
! if(NOGOOD(p)) {
! post("buffer: buffer object '%s' no good",sym->s_name);
! }
! else {
! p->b_modtime = gettime();
! }
! }
! else {
! FLEXT_LOG1("buffer: symbol '%s' not defined",sym->s_name);
! }
#else
#error Not implemented
#endif
! }
}
--- 245,276 ----
void flext::buffer::Dirty(bool force)
{
! if(sym) {
#if FLEXT_SYS == FLEXT_SYS_PD
! if((!ticking) && (interval || force)) {
! ticking = true;
! cb_tick(this); // immediately redraw
! }
! else {
! if(force) clock_delay(tick,0);
! isdirty = true;
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! if(sym->s_thing) {
! _buffer *p = (_buffer *)sym->s_thing;
!
! if(NOGOOD(p)) {
! post("buffer: buffer object '%s' no good",sym->s_name);
! }
! else {
! p->b_modtime = gettime();
! }
! }
! else {
! FLEXT_LOG1("buffer: symbol '%s' not defined",sym->s_name);
! }
#else
#error Not implemented
#endif
! }
}
***************
*** 278,293 ****
void flext::buffer::cb_tick(buffer *b)
{
! if(b->arr) garray_redraw(b->arr);
#ifdef FLEXT_DEBUG
! else error("buffer: array is NULL");
#endif
! if(b->isdirty && b->interval) {
! b->isdirty = false;
! b->ticking = true;
! clock_delay(b->tick,b->interval);
! }
! else
! b->ticking = false;
}
#endif
--- 278,293 ----
void flext::buffer::cb_tick(buffer *b)
{
! if(b->arr) garray_redraw(b->arr);
#ifdef FLEXT_DEBUG
! else error("buffer: array is NULL");
#endif
! if(b->isdirty && b->interval) {
! b->isdirty = false;
! b->ticking = true;
! clock_delay(b->tick,b->interval);
! }
! else
! b->ticking = false;
}
#endif
***************
*** 296,302 ****
{
#if FLEXT_SYS == FLEXT_SYS_PD
! cleantime = clock_getlogicaltime();
#elif FLEXT_SYS == FLEXT_SYS_MAX
! cleantime = gettime();
#else
#error Not implemented
--- 296,302 ----
{
#if FLEXT_SYS == FLEXT_SYS_PD
! cleantime = clock_getlogicaltime();
#elif FLEXT_SYS == FLEXT_SYS_MAX
! cleantime = gettime();
#else
#error Not implemented
***************
*** 307,328 ****
{
#if FLEXT_SYS == FLEXT_SYS_PD
! if(!arr) return false;
! #ifdef FLEXT_PDBUFDIRTYTIME
! return isdirty || garray_updatetime(arr) > cleantime;
! #else
! // Don't know.... (no method in PD judging whether buffer has been changed from outside flext...)
! return true;
! #endif
#elif FLEXT_SYS == FLEXT_SYS_MAX
! if(!sym->s_thing) return false;
! _buffer *p = (_buffer *)sym->s_thing;
#ifdef FLEXT_DEBUG
! if(NOGOOD(p)) {
! post("buffer: buffer object '%s' no good",sym->s_name);
! return false;
! }
#endif
! return p->b_modtime > cleantime;
#else
#error Not implemented
--- 307,328 ----
{
#if FLEXT_SYS == FLEXT_SYS_PD
! if(!arr) return false;
! #ifdef FLEXT_PDBUFDIRTYTIME
! return isdirty || garray_updatetime(arr) > cleantime;
! #else
! // Don't know.... (no method in PD judging whether buffer has been changed from outside flext...)
! return true;
! #endif
#elif FLEXT_SYS == FLEXT_SYS_MAX
! if(!sym->s_thing) return false;
! _buffer *p = (_buffer *)sym->s_thing;
#ifdef FLEXT_DEBUG
! if(NOGOOD(p)) {
! post("buffer: buffer object '%s' no good",sym->s_name);
! return false;
! }
#endif
! return p->b_modtime > cleantime;
#else
#error Not implemented
Index: flcwmax-x-thr.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flcwmax-x-thr.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** flcwmax-x-thr.h 27 Mar 2004 03:22:14 -0000 1.5
--- flcwmax-x-thr.h 21 Jun 2004 13:58:19 -0000 1.6
***************
*** 19,28 ****
/*
! old CodeWarrior version (<= 6) don't have sigset_t defined which
! is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ == 1) // read __MWERKS__ numbering starts with CW7
! typedef unsigned int sigset_t;
! #define _CW_NOPRECOMP // no precompiled headers
#endif
--- 19,28 ----
/*
! old CodeWarrior version (<= 6) don't have sigset_t defined which
! is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ == 1) // read __MWERKS__ numbering starts with CW7
! typedef unsigned int sigset_t;
! #define _CW_NOPRECOMP // no precompiled headers
#endif
Index: flstk.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flstk.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** flstk.cpp 13 Feb 2003 04:31:41 -0000 1.4
--- flstk.cpp 21 Jun 2004 13:58:19 -0000 1.5
***************
*** 13,89 ****
flext_stk::flext_stk():
! inobjs(0),outobjs(0),
! inobj(NULL),outobj(NULL),
! smprt(0),blsz(0)
{}
bool flext_stk::Init()
{
! bool ret = flext_dsp::Init();
! inobjs = CntInSig();
! outobjs = CntOutSig();
! return ret;
}
void flext_stk::Exit()
{
! ClearObjs();
! flext_dsp::Exit();
}
void flext_stk::ClearObjs()
{
! FreeObjs();
! if(inobj) {
! for(int i = 0; i < inobjs; ++i) delete inobj[i];
! delete[] inobj; inobj = NULL;
! }
! if(outobj) {
! for(int i = 0; i < outobjs; ++i) delete outobj[i];
! delete[] outobj; outobj = NULL;
! }
}
void flext_stk::m_dsp(int n,t_sample *const *in,t_sample *const *out)
{
! // called on every rebuild of the dsp chain
! int i;
!
! if(Blocksize() != blsz || Samplerate() != smprt) {
! // block size or sample rate has changed... rebuild all objects
! ClearObjs();
! smprt = Samplerate();
! blsz = Blocksize();
! Stk::setSampleRate(smprt);
! // set up sndobjs for inlets and outlets
! if(inobjs) {
! inobj = new Input *[inobjs];
! for(i = 0; i < inobjs; ++i)
! inobj[i] = new Input(in[i],blsz);
! }
! if(outobjs) {
! outobj = new Output *[outobjs];
! for(i = 0; i < outobjs; ++i)
! outobj[i] = new Output(out[i],blsz);
! }
! if(!NewObjs()) ClearObjs();
! }
! else {
! // assign changed input/output vectors
! for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]);
! for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]);
! }
}
void flext_stk::m_signal(int n,t_sample *const *in,t_sample *const *out)
{
! if(inobjs || outobjs) ProcessObjs(blsz);
}
--- 13,89 ----
flext_stk::flext_stk():
! inobjs(0),outobjs(0),
! inobj(NULL),outobj(NULL),
! smprt(0),blsz(0)
{}
bool flext_stk::Init()
{
! bool ret = flext_dsp::Init();
! inobjs = CntInSig();
! outobjs = CntOutSig();
! return ret;
}
void flext_stk::Exit()
{
! ClearObjs();
! flext_dsp::Exit();
}
void flext_stk::ClearObjs()
{
! FreeObjs();
! if(inobj) {
! for(int i = 0; i < inobjs; ++i) delete inobj[i];
! delete[] inobj; inobj = NULL;
! }
! if(outobj) {
! for(int i = 0; i < outobjs; ++i) delete outobj[i];
! delete[] outobj; outobj = NULL;
! }
}
void flext_stk::m_dsp(int n,t_sample *const *in,t_sample *const *out)
{
! // called on every rebuild of the dsp chain
! int i;
!
! if(Blocksize() != blsz || Samplerate() != smprt) {
! // block size or sample rate has changed... rebuild all objects
! ClearObjs();
! smprt = Samplerate();
! blsz = Blocksize();
! Stk::setSampleRate(smprt);
! // set up sndobjs for inlets and outlets
! if(inobjs) {
! inobj = new Input *[inobjs];
! for(i = 0; i < inobjs; ++i)
! inobj[i] = new Input(in[i],blsz);
! }
! if(outobjs) {
! outobj = new Output *[outobjs];
! for(i = 0; i < outobjs; ++i)
! outobj[i] = new Output(out[i],blsz);
! }
! if(!NewObjs()) ClearObjs();
! }
! else {
! // assign changed input/output vectors
! for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]);
! for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]);
! }
}
void flext_stk::m_signal(int n,t_sample *const *in,t_sample *const *out)
{
! if(inobjs || outobjs) ProcessObjs(blsz);
}
***************
*** 92,103 ****
flext_stk::Input::Input(const t_sample *b,int v):
! buf(b),vecsz(v),
! index(0)
{}
MY_FLOAT *flext_stk::Input::tick(MY_FLOAT *vector,unsigned int vectorSize)
{
! for(unsigned int i = 0; i < vectorSize; i++) vector[i] = tick();
! return vector;
}
--- 92,103 ----
flext_stk::Input::Input(const t_sample *b,int v):
! buf(b),vecsz(v),
! index(0)
{}
MY_FLOAT *flext_stk::Input::tick(MY_FLOAT *vector,unsigned int vectorSize)
{
! for(unsigned int i = 0; i < vectorSize; i++) vector[i] = tick();
! return vector;
}
***************
*** 106,116 ****
flext_stk::Output::Output(t_sample *b,int v):
! buf(b),vecsz(v),
! index(0)
{}
void flext_stk::Output::tick(const MY_FLOAT *vector,unsigned int vectorSize)
{
! for(unsigned int i = 0; i < vectorSize; i++) tick(vector[i]);
}
--- 106,116 ----
flext_stk::Output::Output(t_sample *b,int v):
! buf(b),vecsz(v),
! index(0)
{}
void flext_stk::Output::tick(const MY_FLOAT *vector,unsigned int vectorSize)
{
! for(unsigned int i = 0; i < vectorSize; i++) tick(vector[i]);
}
Index: flxlet.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flxlet.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** flxlet.cpp 1 Jan 2003 04:32:05 -0000 1.5
--- flxlet.cpp 21 Jun 2004 13:58:20 -0000 1.6
***************
*** 20,96 ****
flext_base::xlet::xlet(type t,const char *d):
! tp(t),nxt(NULL)
{
! if(d) {
! int ln = strlen(d);
! desc = new char[ln+1];
! memcpy(desc,d,ln);
! desc[ln] = 0;
! }
! else desc = NULL;
}
flext_base::xlet::~xlet()
{
! if(desc) delete[] desc;
! if(nxt) delete nxt;
}
void flext_base::AddXlet(xlet::type tp,int mult,const char *desc,xlet *&root)
{
! if(!root && mult) { root = new xlet(tp,desc); --mult; }
! if(mult) {
! xlet *xi = root;
! while(xi->nxt) xi = xi->nxt;
! while(mult--) xi = xi->nxt = new xlet(tp,desc);
! }
}
void flext_base::DescXlet(int ix,const char *d,xlet *&root)
{
! xlet *xi = root;
! for(int i = 0; xi && i < ix; xi = xi->nxt,++i) {}
! if(xi) {
! if(xi->desc) delete[] xi->desc;
! int ln = strlen(d);
! xi->desc = new char[ln+1];
! memcpy(xi->desc,d,ln);
! xi->desc[ln] = 0;
! }
}
unsigned long flext_base::XletCode(xlet::type tp,...)
{
! unsigned long code = 0;
! va_list marker;
! va_start(marker,tp);
! int cnt = 0;
! xlet::type arg = tp;
! for(; arg; ++cnt) {
#ifdef FLEXT_DEBUG
! if(cnt > 9) {
! error("%s - Too many in/outlets defined - truncated to 9",thisName());
! break;
! }
! #endif
! code = code*10+(int)arg;
! arg = (xlet::type)va_arg(marker,int);
! }
! va_end(marker);
! return code;
}
void flext_base::AddInlets(unsigned long code)
{
! for(; code; code /= 10) AddInlet((xlet::type)(code%10));
}
void flext_base::AddOutlets(unsigned long code)
{
! for(; code; code /= 10) AddOutlet((xlet::type)(code%10));
}
--- 20,96 ----
flext_base::xlet::xlet(type t,const char *d):
! tp(t),nxt(NULL)
{
! if(d) {
! int ln = strlen(d);
! desc = new char[ln+1];
! memcpy(desc,d,ln);
! desc[ln] = 0;
! }
! else desc = NULL;
}
flext_base::xlet::~xlet()
{
! if(desc) delete[] desc;
! if(nxt) delete nxt;
}
void flext_base::AddXlet(xlet::type tp,int mult,const char *desc,xlet *&root)
{
! if(!root && mult) { root = new xlet(tp,desc); --mult; }
! if(mult) {
! xlet *xi = root;
! while(xi->nxt) xi = xi->nxt;
! while(mult--) xi = xi->nxt = new xlet(tp,desc);
! }
}
void flext_base::DescXlet(int ix,const char *d,xlet *&root)
{
! xlet *xi = root;
! for(int i = 0; xi && i < ix; xi = xi->nxt,++i) {}
! if(xi) {
! if(xi->desc) delete[] xi->desc;
! int ln = strlen(d);
! xi->desc = new char[ln+1];
! memcpy(xi->desc,d,ln);
! xi->desc[ln] = 0;
! }
}
unsigned long flext_base::XletCode(xlet::type tp,...)
{
! unsigned long code = 0;
! va_list marker;
! va_start(marker,tp);
! int cnt = 0;
! xlet::type arg = tp;
! for(; arg; ++cnt) {
#ifdef FLEXT_DEBUG
! if(cnt > 9) {
! error("%s - Too many in/outlets defined - truncated to 9",thisName());
! break;
! }
! #endif
! code = code*10+(int)arg;
! arg = (xlet::type)va_arg(marker,int);
! }
! va_end(marker);
! return code;
}
void flext_base::AddInlets(unsigned long code)
{
! for(; code; code /= 10) AddInlet((xlet::type)(code%10));
}
void flext_base::AddOutlets(unsigned long code)
{
! for(; code; code /= 10) AddOutlet((xlet::type)(code%10));
}
Index: flext.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flext.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** flext.h 23 Apr 2004 22:14:14 -0000 1.20
--- flext.h 21 Jun 2004 13:58:19 -0000 1.21
***************
*** 24,31 ****
//! \brief flext version number
! #define FLEXT_VERSION 406
//! \brief flext version string
! #define FLEXT_VERSTR "0.4.6"
//! @}
--- 24,31 ----
//! \brief flext version number
! #define FLEXT_VERSION 407
//! \brief flext version string
! #define FLEXT_VERSTR "0.4.7pre"
//! @}
Index: flinternal.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flinternal.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** flinternal.h 10 Dec 2003 03:32:53 -0000 1.8
--- flinternal.h 21 Jun 2004 13:58:19 -0000 1.9
***************
*** 11,18 ****
/*! \file flinternal.h
\brief Definitions for internal flext usage
! \internal
Here, a few shortcuts for common Max/MSP or PD library calls and type definitions
! are declared
*/
--- 11,18 ----
/*! \file flinternal.h
\brief Definitions for internal flext usage
! \internal
Here, a few shortcuts for common Max/MSP or PD library calls and type definitions
! are declared
*/
***************
*** 27,31 ****
#define object_new(clss) pd_new(clss)
#define object_free(obj) pd_free(&(obj)->ob_pd)
!
--- 27,31 ----
#define object_new(clss) pd_new(clss)
#define object_free(obj) pd_free(&(obj)->ob_pd)
!
Index: flcwmax-thr.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flcwmax-thr.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** flcwmax-thr.h 27 Mar 2004 03:22:14 -0000 1.5
--- flcwmax-thr.h 21 Jun 2004 13:58:19 -0000 1.6
***************
*** 19,28 ****
/*
! old CodeWarrior version (<= 6) don't have sigset_t defined which
! is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ == 1) // read __MWERKS__ numbering starts with CW7
! typedef unsigned int sigset_t;
! #define _CW_NOPRECOMP // no precompiled headers
#endif
--- 19,28 ----
/*
! old CodeWarrior version (<= 6) don't have sigset_t defined which
! is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ == 1) // read __MWERKS__ numbering starts with CW7
! typedef unsigned int sigset_t;
! #define _CW_NOPRECOMP // no precompiled headers
#endif
Index: flcwpd-x.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flcwpd-x.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** flcwpd-x.h 30 Dec 2003 03:32:46 -0000 1.4
--- flcwpd-x.h 21 Jun 2004 13:58:19 -0000 1.5
***************
*** 15,19 ****
#ifndef __MWERKS__
! #error "This header file is for CodeWarrior only."
#endif
--- 15,19 ----
#ifndef __MWERKS__
! #error "This header file is for CodeWarrior only."
#endif
***************
*** 25,34 ****
#ifndef _CW_NOPRECOMP
! // #include <MacHeadersMach-O.h>
! // #include <MSL MacHeadersMach-O.h>
#endif
#if __option(sym) || !__option(opt_dead_code)
! #define FLEXT_DEBUG
#endif
--- 25,34 ----
#ifndef _CW_NOPRECOMP
! // #include <MacHeadersMach-O.h>
! // #include <MSL MacHeadersMach-O.h>
#endif
#if __option(sym) || !__option(opt_dead_code)
! #define FLEXT_DEBUG
#endif
Index: fltimer.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fltimer.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** fltimer.cpp 27 Mar 2004 03:22:14 -0000 1.4
--- fltimer.cpp 21 Jun 2004 13:58:20 -0000 1.5
***************
*** 10,14 ****
/*! \file fltimer.cpp
! \brief flext timer functions and classes
*/
--- 10,14 ----
/*! \file fltimer.cpp
! \brief flext timer functions and classes
*/
***************
*** 30,40 ****
{
#if FLEXT_SYS == FLEXT_SYS_PD
! return clock_gettimesince(0)*0.001;
#elif FLEXT_SYS == FLEXT_SYS_MAX
! double tm;
! clock_getftime(&tm);
! return tm*0.001;
#else
! #error Not implemented
#endif
}
--- 30,40 ----
{
#if FLEXT_SYS == FLEXT_SYS_PD
! return clock_gettimesince(0)*0.001;
#elif FLEXT_SYS == FLEXT_SYS_MAX
! double tm;
! clock_getftime(&tm);
! return tm*0.001;
#else
! #error Not implemented
#endif
}
***************
*** 43,51 ****
{
#if FLEXT_SYS == FLEXT_SYS_PD
! return 0;
#elif FLEXT_SYS == FLEXT_SYS_MAX
! return 0.001;
#else
! #error Not implemented
#endif
}
--- 43,51 ----
{
#if FLEXT_SYS == FLEXT_SYS_PD
! return 0;
#elif FLEXT_SYS == FLEXT_SYS_MAX
! return 0.001;
#else
! #error Not implemented
#endif
}
***************
*** 56,66 ****
static double getstarttime()
{
! starttime = 0;
! return flext::GetOSTime();
}
double flext::GetOSTime()
{
! double tm;
#if FLEXT_OS == FLEXT_OS_WIN
--- 56,66 ----
static double getstarttime()
{
! starttime = 0;
! return flext::GetOSTime();
}
double flext::GetOSTime()
{
! double tm;
#if FLEXT_OS == FLEXT_OS_WIN
***************
*** 76,90 ****
}
#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
! timeval tmv;
! gettimeofday(&tmv,NULL);
! tm = tmv.tv_sec+tmv.tv_usec*1.e-6;
#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9 & Carbon!
! UnsignedWide tick;
! Microseconds(&tick);
! tm = (tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo)*1.e-6;
#else
! #error Not implemented
#endif
! return tm-starttime;
}
--- 76,90 ----
}
#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
! timeval tmv;
! gettimeofday(&tmv,NULL);
! tm = tmv.tv_sec+tmv.tv_usec*1.e-6;
#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9 & Carbon!
! UnsignedWide tick;
! Microseconds(&tick);
! tm = (tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo)*1.e-6;
#else
! #error Not implemented
#endif
! return tm-starttime;
}
***************
*** 92,110 ****
{
#if FLEXT_OS == FLEXT_OS_WIN
! ::Sleep((long)(s*1000.));
#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
! usleep((long)(s*1000000.));
#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9 & Carbon!
! UnsignedWide tick;
! Microseconds(&tick);
! double target = tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo+s*1.e6;
! for(;;) {
! // this is just a loop running until the time has passed - stone age (but we yield at least)
! Microseconds(&tick);
! if(target <= tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo) break;
! YieldToAnyThread(); // yielding surely reduces the timing precision (but we're civilized)
! }
#else
! #error Not implemented
#endif
}
--- 92,110 ----
{
#if FLEXT_OS == FLEXT_OS_WIN
! ::Sleep((long)(s*1000.));
#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
! usleep((long)(s*1000000.));
#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9 & Carbon!
! UnsignedWide tick;
! Microseconds(&tick);
! double target = tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo+s*1.e6;
! for(;;) {
! // this is just a loop running until the time has passed - stone age (but we yield at least)
! Microseconds(&tick);
! if(target <= tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo) break;
! YieldToAnyThread(); // yielding surely reduces the timing precision (but we're civilized)
! }
#else
! #error Not implemented
#endif
}
***************
*** 114,128 ****
*/
flext::Timer::Timer(bool qu):
! queued(qu),
! clss(NULL),userdata(NULL),
! period(0)
{
#if FLEXT_SYS == FLEXT_SYS_PD
! clk = (t_clock *)clock_new(this,(t_method)callback);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clk = (t_clock *)clock_new(this,(t_method)callback);
! if(queued) qelem = (t_qelem *)qelem_new(this,(method)queuefun);
#else
! #error Not implemented
#endif
}
--- 114,128 ----
*/
flext::Timer::Timer(bool qu):
! queued(qu),
! clss(NULL),userdata(NULL),
! period(0)
{
#if FLEXT_SYS == FLEXT_SYS_PD
! clk = (t_clock *)clock_new(this,(t_method)callback);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clk = (t_clock *)clock_new(this,(t_method)callback);
! if(queued) qelem = (t_qelem *)qelem_new(this,(method)queuefun);
#else
! #error Not implemented
#endif
}
***************
*** 131,140 ****
{
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_free(clk);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_free(clk);
! if(queued) ::qelem_free(qelem);
#else
! #error Not implemented
#endif
}
--- 131,140 ----
{
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_free(clk);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_free(clk);
! if(queued) ::qelem_free(qelem);
#else
! #error Not implemented
#endif
}
***************
*** 143,245 ****
{
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_unset(clk);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_unset(clk);
! if(queued) ::qelem_unset(qelem);
#else
! #error Not implemented
#endif
! return true;
}
/*! \param tm absolute time (in seconds)
! \param data user data
! \param dopast if set events with times lying in the past will be triggered immediately, if not set they are ignored
! \return true on success
*/
bool flext::Timer::At(double tm,void *data,bool dopast)
{
! userdata = data;
! period = 0;
#if FLEXT_SYS == FLEXT_SYS_PD
! const double ms = tm*1000.;
! if(dopast || clock_gettimesince(ms) <= 0)
! clock_set(clk,ms);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! const double ms = tm*1000.;
! double cur;
! clock_getftime(&cur);
! if(cur <= ms)
! clock_fdelay(clk,ms-cur);
! else if(dopast) // trigger timer is past
! clock_fdelay(clk,0);
#else
! #error Not implemented
#endif
! return true;
}
/*! \param tm relative time (in seconds)
! \param data user data
! \return true on success
*/
bool flext::Timer::Delay(double tm,void *data)
{
! userdata = data;
! period = 0;
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_delay(clk,tm*1000);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_fdelay(clk,tm*1000.);
#else
! #error Not implemented
#endif
! return true;
}
/*! \param tm relative time between periodic events (in seconds)
! \param data user data
! \return true on success
! \note the first event will be delayed by tm
*/
bool flext::Timer::Periodic(double tm,void *data)
{
! userdata = data;
! period = tm;
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_delay(clk,tm*1000);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_fdelay(clk,tm*1000.);
#else
! #error Not implemented
#endif
! return true;
}
/*! \brief Callback function for system clock.
! \todo Make periodic events scheduled as such.
*/
void flext::Timer::callback(Timer *tmr)
{
! if(tmr->period) {
! // clearly it would be more precise if the periodic event is scheduled as such
! // and not retriggered every time
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_delay(tmr->clk,tmr->period*1000);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_fdelay(tmr->clk,tmr->period*1000.);
#else
! #error Not implemented
#endif
! }
! if(tmr->cback) {
#if FLEXT_SYS == FLEXT_SYS_MAX
! if(tmr->queued)
! qelem_set(tmr->qelem);
! else
#endif
! tmr->Work();
! }
}
--- 143,245 ----
{
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_unset(clk);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_unset(clk);
! if(queued) ::qelem_unset(qelem);
#else
! #error Not implemented
#endif
! return true;
}
/*! \param tm absolute time (in seconds)
! \param data user data
! \param dopast if set events with times lying in the past will be triggered immediately, if not set they are ignored
! \return true on success
*/
bool flext::Timer::At(double tm,void *data,bool dopast)
{
! userdata = data;
! period = 0;
#if FLEXT_SYS == FLEXT_SYS_PD
! const double ms = tm*1000.;
! if(dopast || clock_gettimesince(ms) <= 0)
! clock_set(clk,ms);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! const double ms = tm*1000.;
! double cur;
! clock_getftime(&cur);
! if(cur <= ms)
! clock_fdelay(clk,ms-cur);
! else if(dopast) // trigger timer is past
! clock_fdelay(clk,0);
#else
! #error Not implemented
#endif
! return true;
}
/*! \param tm relative time (in seconds)
! \param data user data
! \return true on success
*/
bool flext::Timer::Delay(double tm,void *data)
{
! userdata = data;
! period = 0;
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_delay(clk,tm*1000);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_fdelay(clk,tm*1000.);
#else
! #error Not implemented
#endif
! return true;
}
/*! \param tm relative time between periodic events (in seconds)
! \param data user data
! \return true on success
! \note the first event will be delayed by tm
*/
bool flext::Timer::Periodic(double tm,void *data)
{
! userdata = data;
! period = tm;
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_delay(clk,tm*1000);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_fdelay(clk,tm*1000.);
#else
! #error Not implemented
#endif
! return true;
}
/*! \brief Callback function for system clock.
! \todo Make periodic events scheduled as such.
*/
void flext::Timer::callback(Timer *tmr)
{
! if(tmr->period) {
! // clearly it would be more precise if the periodic event is scheduled as such
! // and not retriggered every time
#if FLEXT_SYS == FLEXT_SYS_PD
! clock_delay(tmr->clk,tmr->period*1000);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clock_fdelay(tmr->clk,tmr->period*1000.);
#else
! #error Not implemented
#endif
! }
! if(tmr->cback) {
#if FLEXT_SYS == FLEXT_SYS_MAX
! if(tmr->queued)
! qelem_set(tmr->qelem);
! else
#endif
! tmr->Work();
! }
}
***************
*** 251,262 ****
/*! \brief Virtual worker function - by default it calls the user callback function.
! \remark The respective callback parameter format is chosen depending on whether clss is defined or not.
*/
void flext::Timer::Work()
{
! if(clss)
! ((bool (*)(flext_base *,void *))cback)(clss,userdata);
! else
! cback(userdata);
}
--- 251,262 ----
/*! \brief Virtual worker function - by default it calls the user callback function.
! \remark The respective callback parameter format is chosen depending on whether clss is defined or not.
*/
void flext::Timer::Work()
{
! if(clss)
! ((bool (*)(flext_base *,void *))cback)(clss,userdata);
! else
! cback(userdata);
}
Index: flcwpd-x-thr.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flcwpd-x-thr.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** flcwpd-x-thr.h 30 Dec 2003 03:32:46 -0000 1.3
--- flcwpd-x-thr.h 21 Jun 2004 13:58:19 -0000 1.4
***************
*** 18,27 ****
#if 0
/*
! old CodeWarrior version (<= 6) don't have sigset_t defined which
! is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ <= 0x6000)
! typedef unsigned int sigset_t;
! #define _CW_NOPRECOMP // no precompiled headers
#endif
#endif
--- 18,27 ----
#if 0
/*
! old CodeWarrior version (<= 6) don't have sigset_t defined which
! is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ <= 0x6000)
! typedef unsigned int sigset_t;
! #define _CW_NOPRECOMP // no precompiled headers
#endif
#endif
Index: flsndobj.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsndobj.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** flsndobj.h 2 Jan 2003 04:32:06 -0000 1.6
--- flsndobj.h 21 Jun 2004 13:58:19 -0000 1.7
***************
*** 22,88 ****
class FLEXT_SHARE flext_sndobj:
! public flext_dsp
{
! FLEXT_HEADER(flext_sndobj,flext_dsp)
public:
! flext_sndobj();
! // these have to be overridden in child classes
! virtual bool NewObjs() { return true; }
! virtual void FreeObjs() {}
! virtual void ProcessObjs() {}
! // inputs and outputs
! SndObj &InObj(int i) { return *tmpobj[i]; }
! SndIO &OutObj(int i) { return *outobj[i]; }
protected:
! virtual bool Init();
! virtual void Exit();
! virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out);
! virtual void m_signal(int n,t_sample *const *in,t_sample *const *out);
private:
! //! SndObj for reading from inlet buffer
! class Inlet:
! public SndIO
! {
! public:
! Inlet(const t_sample *b,int vecsz,float sr);
! virtual short Read();
! virtual short Write();
! void SetBuf(const t_sample *b) { buf = b; }
! private:
! const t_sample *buf;
! };
! //! SndObj for writing to outlet buffer
! class Outlet:
! public SndIO
! {
! public:
! Outlet(t_sample *b,int vecsz,float sr);
! virtual short Read();
! virtual short Write();
! void SetBuf(t_sample *b) { buf = b; }
! private:
! t_sample *buf;
! };
! void ClearObjs();
! int inobjs,outobjs;
! SndObj **tmpobj;
! Inlet **inobj;
! Outlet **outobj;
! float smprt;
! int blsz;
};
--- 22,88 ----
class FLEXT_SHARE flext_sndobj:
! public flext_dsp
{
! FLEXT_HEADER(flext_sndobj,flext_dsp)
public:
! flext_sndobj();
! // these have to be overridden in child classes
! virtual bool NewObjs() { return true; }
! virtual void FreeObjs() {}
! virtual void ProcessObjs() {}
! // inputs and outputs
! SndObj &InObj(int i) { return *tmpobj[i]; }
! SndIO &OutObj(int i) { return *outobj[i]; }
protected:
! virtual bool Init();
! virtual void Exit();
! virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out);
! virtual void m_signal(int n,t_sample *const *in,t_sample *const *out);
private:
! //! SndObj for reading from inlet buffer
! class Inlet:
! public SndIO
! {
! public:
! Inlet(const t_sample *b,int vecsz,float sr);
! virtual short Read();
! virtual short Write();
! void SetBuf(const t_sample *b) { buf = b; }
! private:
! const t_sample *buf;
! };
! //! SndObj for writing to outlet buffer
! class Outlet:
! public SndIO
! {
! public:
! Outlet(t_sample *b,int vecsz,float sr);
! virtual short Read();
! virtual short Write();
! void SetBuf(t_sample *b) { buf = b; }
! private:
! t_sample *buf;
! };
! void ClearObjs();
! int inobjs,outobjs;
! SndObj **tmpobj;
! Inlet **inobj;
! Outlet **outobj;
! float smprt;
! int blsz;
};
Index: flsndobj.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsndobj.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** flsndobj.cpp 2 Jan 2003 04:32:06 -0000 1.6
--- flsndobj.cpp 21 Jun 2004 13:58:19 -0000 1.7
***************
*** 14,95 ****
flext_sndobj::flext_sndobj():
! inobjs(0),outobjs(0),
! inobj(NULL),tmpobj(NULL),outobj(NULL),
! smprt(0),blsz(0)
{}
bool flext_sndobj::Init()
{
! bool ret = flext_dsp::Init();
! inobjs = CntInSig();
! outobjs = CntOutSig();
! return ret;
}
void flext_sndobj::Exit()
{
! ClearObjs();
! flext_dsp::Exit();
}
void flext_sndobj::ClearObjs()
{
! FreeObjs();
! if(inobj) {
! for(int i = 0; i < inobjs; ++i) delete inobj[i];
! delete[] inobj; inobj = NULL;
! }
! if(tmpobj) {
! for(int i = 0; i < inobjs; ++i) delete tmpobj[i];
! delete[] tmpobj; tmpobj = NULL;
! }
! if(outobj) {
! for(int i = 0; i < outobjs; ++i) delete outobj[i];
! delete[] outobj; outobj = NULL;
! }
}
void flext_sndobj::m_dsp(int n,t_sample *const *in,t_sample *const *out)
{
! // called on every rebuild of the dsp chain
!
! int i;
! if(Blocksize() != blsz || Samplerate() != smprt) {
! // block size or sample rate has changed... rebuild all objects
! ClearObjs();
! blsz = Blocksize();
! smprt = Samplerate();
! // set up sndobjs for inlets and outlets
! if(inobjs) {
! inobj = new Inlet *[inobjs];
! tmpobj = new SndObj *[inobjs];
! for(i = 0; i < inobjs; ++i) {
! inobj[i] = new Inlet(in[i],blsz,smprt);
! tmpobj[i] = new SndObj(NULL,blsz,smprt);
! }
! }
! if(outobjs) {
! outobj = new Outlet *[outobjs];
! for(i = 0; i < outobjs; ++i) outobj[i] = new Outlet(out[i],blsz,smprt);
! }
! if(!NewObjs()) ClearObjs();
! }
! else {
! // assign changed input/output vectors
! for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]);
! for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]);
! }
}
void flext_sndobj::m_signal(int n,t_sample *const *in,t_sample *const *out)
{
! for(int i = 0; i < inobjs; ++i) *tmpobj[i] << *inobj[i];
! ProcessObjs();
}
--- 14,95 ----
flext_sndobj::flext_sndobj():
! inobjs(0),outobjs(0),
! inobj(NULL),tmpobj(NULL),outobj(NULL),
! smprt(0),blsz(0)
{}
bool flext_sndobj::Init()
{
! bool ret = flext_dsp::Init();
! inobjs = CntInSig();
! outobjs = CntOutSig();
! return ret;
}
void flext_sndobj::Exit()
{
! ClearObjs();
! flext_dsp::Exit();
}
void flext_sndobj::ClearObjs()
{
! FreeObjs();
! if(inobj) {
! for(int i = 0; i < inobjs; ++i) delete inobj[i];
! delete[] inobj; inobj = NULL;
! }
! if(tmpobj) {
! for(int i = 0; i < inobjs; ++i) delete tmpobj[i];
! delete[] tmpobj; tmpobj = NULL;
! }
! if(outobj) {
! for(int i = 0; i < outobjs; ++i) delete outobj[i];
! delete[] outobj; outobj = NULL;
! }
}
void flext_sndobj::m_dsp(int n,t_sample *const *in,t_sample *const *out)
{
! // called on every rebuild of the dsp chain
!
! int i;
! if(Blocksize() != blsz || Samplerate() != smprt) {
! // block size or sample rate has changed... rebuild all objects
! ClearObjs();
! blsz = Blocksize();
! smprt = Samplerate();
! // set up sndobjs for inlets and outlets
! if(inobjs) {
! inobj = new Inlet *[inobjs];
! tmpobj = new SndObj *[inobjs];
! for(i = 0; i < inobjs; ++i) {
! inobj[i] = new Inlet(in[i],blsz,smprt);
! tmpobj[i] = new SndObj(NULL,blsz,smprt);
! }
! }
! if(outobjs) {
! outobj = new Outlet *[outobjs];
! for(i = 0; i < outobjs; ++i) outobj[i] = new Outlet(out[i],blsz,smprt);
! }
! if(!NewObjs()) ClearObjs();
! }
! else {
! // assign changed input/output vectors
! for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]);
! for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]);
! }
}
void flext_sndobj::m_signal(int n,t_sample *const *in,t_sample *const *out)
{
! for(int i = 0; i < inobjs; ++i) *tmpobj[i] << *inobj[i];
! ProcessObjs();
}
***************
*** 101,110 ****
short flext_sndobj::Inlet::Read()
{
! if(!m_error) {
! for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
! m_output[m_vecpos] = buf[m_vecpos];
! return 1;
! }
! else return 0;
}
--- 101,110 ----
short flext_sndobj::Inlet::Read()
{
! if(!m_error) {
! for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
! m_output[m_vecpos] = buf[m_vecpos];
! return 1;
! }
! else return 0;
}
***************
*** 120,130 ****
short flext_sndobj::Outlet::Write()
{
! if(!m_error) {
! if(m_IOobjs[0])
! for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
! buf[m_vecpos] = m_IOobjs[0]->Output(m_vecpos);
! return 1;
! }
! else return 0;
}
--- 120,130 ----
short flext_sndobj::Outlet::Write()
{
! if(!m_error) {
! if(m_IOobjs[0])
! for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
! buf[m_vecpos] = m_IOobjs[0]->Output(m_vecpos);
! return 1;
! }
! else return 0;
}
Index: flout.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flout.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** flout.cpp 10 Dec 2003 03:32:53 -0000 1.15
--- flout.cpp 21 Jun 2004 13:58:19 -0000 1.16
***************
*** 59,405 ****
bool flext_base::InitInlets()
{
! bool ok = true;
! // ----------------------------------
! // create inlets
! // ----------------------------------
! incnt = insigs = 0;
// digest inlist
{
! xlet *xi;
! incnt = 0;
! for(xi = inlist; xi; xi = xi->nxt) ++incnt;
! xlet::type *list = new xlet::type[incnt];
! int i;
! for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
!
! #if FLEXT_SYS == FLEXT_SYS_MAX
! // copy inlet descriptions
! indesc = new char *[incnt];
! for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) {
! int l = xi->desc?strlen(xi->desc):0;
! if(l) {
! indesc[i] = new char[l+1];
! memcpy(indesc[i],xi->desc,l);
! indesc[i][l] = 0;
! }
! else
! indesc[i] = NULL;
! }
#endif
! delete inlist; inlist = NULL;
!
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! inlets = new px_object *[incnt];
! for(i = 0; i < incnt; ++i) inlets[i] = NULL;
#endif
!
! // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
! {
! int cnt = 0;
! if(incnt >= 1) {
! switch(list[0]) {
! case xlet::tp_sig:
! ++insigs;
! break;
! default:
! // leftmost inlet is already there...
! break;
! }
! ++cnt;
! }
! for(int ix = 1; ix < incnt; ++ix,++cnt) {
! switch(list[ix]) {
! case xlet::tp_float:
! case xlet::tp_int: {
! char sym[] = "ft??";
! if(ix >= 10) {
! if(compatibility) {
! // Max allows max. 9 inlets
! post("%s: Only 9 float/int inlets allowed in compatibility mode",thisName());
! ok = false;
! }
! else {
! if(ix > 99)
! post("%s: Inlet index > 99 not allowed for float/int inlets",thisName());
! sym[2] = '0'+ix/10,sym[3] = '0'+ix%10;
! }
! }
! else
! sym[2] = '0'+ix,sym[3] = 0;
! if(ok) inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym));
! break;
! }
! case xlet::tp_sym:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol);
! break;
! case xlet::tp_list:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list);
! break;
! case xlet::tp_any:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0);
! break;
! case xlet::tp_sig:
! if(compatibility && list[ix-1] != xlet::tp_sig) {
! post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
! ok = false;
! }
! else {
! // pd doesn't seem to be able to handle signals and messages into the same inlet...
!
! inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_signal, (t_symbol *)sym_signal);
! ++insigs;
! }
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
! ok = false;
! }
! }
! incnt = cnt;
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! {
! int ix,cnt;
! // count leftmost signal inlets
! while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
!
! for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
! if(ix == 0) {
! if(list[ix] != xlet::tp_any) {
! error("%s: Leftmost inlet must be of type signal or anything",thisName());
! ok = false;
! }
! }
! else {
! switch(list[ix]) {
! case xlet::tp_sig:
! error("%s: All signal inlets must be left-aligned",thisName());
! ok = false;
! break;
! case xlet::tp_float:
! if(ix >= 10) {
! post("%s: Only 9 float inlets possible",thisName());
! ok = false;
! }
! else
! floatin(x_obj,ix);
! break;
! case xlet::tp_int:
! if(ix >= 10) {
! post("%s: Only 9 int inlets possible",thisName());
! ok = false;
! }
! else
! intin(x_obj,ix);
! break;
! case xlet::tp_any: // non-leftmost
! case xlet::tp_sym:
! case xlet::tp_list:
! inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
! ok = false;
! }
! }
! }
! // incnt = cnt;
!
! if(insigs)
! // dsp_setup(thisHdr(),insigs); // signal inlets
! dsp_setupbox(thisHdr(),insigs); // signal inlets
! }
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! {
! t_class *cl = thisClass();
! int cnt = 0;
! for(int ix = 0; ix < incnt; ++ix,++cnt) {
! switch(list[ix]) {
! case xlet::tp_float:
! case xlet::tp_int:
! // fts_class_inlet_number(cl, ix, jmax_proxy);
! break;
! case xlet::tp_sym:
! // fts_class_inlet_symbol(cl, ix, jmax_proxy);
! break;
! case xlet::tp_sig:
! if(compatibility && list[ix-1] != xlet::tp_sig) {
! post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
! ok = false;
! }
! else {
! if(!insigs) fts_dsp_declare_inlet(cl,0);
! ++insigs;
! }
! // no break -> let a signal inlet also accept any messages
! case xlet::tp_list:
! case xlet::tp_any:
! // fts_class_inlet_varargs(cl,ix, jmax_proxy);
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
! ok = false;
! }
! }
! incnt = cnt;
! fts_object_set_inlets_number((fts_object_t *)thisHdr(), incnt);
! }
#else
#error
#endif
! delete[] list;
! }
! return ok;
}
bool flext_base::InitOutlets()
{
! bool ok = true;
! // ----------------------------------
! // create outlets
! // ----------------------------------
! outcnt = outsigs = 0;
!
#if FLEXT_SYS == FLEXT_SYS_MAX
! // for Max/MSP the rightmost outlet has to be created first
! outlet *attrtmp = NULL;
! if(procattr)
! attrtmp = (outlet *)newout_anything(thisHdr());
#endif
// digest outlist
! {
! xlet *xi;
! // count outlets
! outcnt = 0;
! for(xi = outlist; xi; xi = xi->nxt) ++outcnt;
! xlet::type *list = new xlet::type[outcnt];
! int i;
! for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
! #if FLEXT_SYS == FLEXT_SYS_MAX
! // copy outlet descriptions
! outdesc = new char *[outcnt];
! for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) {
! int l = xi->desc?strlen(xi->desc):0;
! if(l) {
! outdesc[i] = new char[l+1];
! memcpy(outdesc[i],xi->desc,l);
! outdesc[i][l] = 0;
! }
! else
! outdesc[i] = NULL;
! }
#endif
! delete outlist; outlist = NULL;
!
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! outlets = new outlet *[outcnt+(procattr?1:0)];
! // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
! for(int ix = 0; ix < outcnt; ++ix)
#elif FLEXT_SYS == FLEXT_SYS_MAX
! for(int ix = outcnt-1; ix >= 0; --ix)
#else
#error
#endif
! {
! switch(list[ix]) {
! case xlet::tp_float:
! outlets[ix] = (outlet *)newout_float(&x_obj->obj);
! break;
! case xlet::tp_int:
! outlets[ix] = (outlet *)newout_flint(&x_obj->obj);
! break;
! case xlet::tp_sig:
! outlets[ix] = (outlet *)newout_signal(&x_obj->obj);
! ++outsigs;
! break;
! case xlet::tp_sym:
! outlets[ix] = (outlet *)newout_symbol(&x_obj->obj);
! break;
! case xlet::tp_list:
! outlets[ix] = (outlet *)newout_list(&x_obj->obj);
! break;
! case xlet::tp_any:
! outlets[ix] = (outlet *)newout_anything(&x_obj->obj);
! break;
#ifdef FLEXT_DEBUG
! default:
! ERRINTERNAL();
! ok = false;
#endif
! }
! }
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! t_class *cl = thisClass();
! for(int ix = 0; ix < outcnt; ++ix) {
! switch(list[ix]) {
! case xlet::tp_float:
! case xlet::tp_int:
! // fts_class_outlet_number(cl, ix);
! break;
! case xlet::tp_sym:
! // fts_class_outlet_symbol(cl, ix);
! break;
! case xlet::tp_list:
! case xlet::tp_any:
! // fts_class_outlet_anything(cl, ix);
! break;
! case xlet::tp_sig:
! if(!outsigs) fts_dsp_declare_outlet(cl,0);
! ++outsigs;
! break;
#ifdef FLEXT_DEBUG
! default:
! ERRINTERNAL();
! ok = false;
#endif
! }
! }
! fts_object_set_outlets_number((fts_object_t *)thisHdr(), outcnt+(procattr?1:0));
#endif
! delete[] list;
! }
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! if(procattr) {
! // attribute dump outlet is the last one
! outlets[outcnt] =
#if FLEXT_SYS == FLEXT_SYS_PD
! // attribute dump outlet is the last one
! (outlet *)newout_anything(&x_obj->obj);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! attrtmp;
#endif
! }
#endif
!
! return ok;
}
--- 59,405 ----
bool flext_base::InitInlets()
{
! bool ok = true;
! // ----------------------------------
! // create inlets
! // ----------------------------------
! incnt = insigs = 0;
// digest inlist
{
! xlet *xi;
! incnt = 0;
! for(xi = inlist; xi; xi = xi->nxt) ++incnt;
! xlet::type *list = new xlet::type[incnt];
! int i;
! for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
!
! #if FLEXT_SYS == FLEXT_SYS_MAX
! // copy inlet descriptions
! indesc = new char *[incnt];
! for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) {
! int l = xi->desc?strlen(xi->desc):0;
! if(l) {
! indesc[i] = new char[l+1];
! memcpy(indesc[i],xi->desc,l);
! indesc[i][l] = 0;
! }
! else
! indesc[i] = NULL;
! }
#endif
! delete inlist; inlist = NULL;
!
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! inlets = new px_object *[incnt];
! for(i = 0; i < incnt; ++i) inlets[i] = NULL;
#endif
!
! // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
! {
! int cnt = 0;
! if(incnt >= 1) {
! switch(list[0]) {
! case xlet::tp_sig:
! ++insigs;
! break;
! default:
! // leftmost inlet is already there...
! break;
! }
! ++cnt;
! }
! for(int ix = 1; ix < incnt; ++ix,++cnt) {
! switch(list[ix]) {
! case xlet::tp_float:
! case xlet::tp_int: {
! char sym[] = "ft??";
! if(ix >= 10) {
! if(compatibility) {
! // Max allows max. 9 inlets
! post("%s: Only 9 float/int inlets allowed in compatibility mode",thisName());
! ok = false;
! }
! else {
! if(ix > 99)
! post("%s: Inlet index > 99 not allowed for float/int inlets",thisName());
! sym[2] = '0'+ix/10,sym[3] = '0'+ix%10;
! }
! }
! else
! sym[2] = '0'+ix,sym[3] = 0;
! if(ok) inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym));
! break;
! }
! case xlet::tp_sym:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol);
! break;
! case xlet::tp_list:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list);
! break;
! case xlet::tp_any:
! (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
! inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0);
! break;
! case xlet::tp_sig:
! if(compatibility && list[ix-1] != xlet::tp_sig) {
! post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
! ok = false;
! }
! else {
! // pd doesn't seem to be able to handle signals and messages into the same inlet...
!
! inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_signal, (t_symbol *)sym_signal);
! ++insigs;
! }
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
! ok = false;
! }
! }
! incnt = cnt;
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! {
! int ix,cnt;
! // count leftmost signal inlets
! while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
!
! for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
! if(ix == 0) {
! if(list[ix] != xlet::tp_any) {
! error("%s: Leftmost inlet must be of type signal or anything",thisName());
! ok = false;
! }
! }
! else {
! switch(list[ix]) {
! case xlet::tp_sig:
! error("%s: All signal inlets must be left-aligned",thisName());
! ok = false;
! break;
! case xlet::tp_float:
! if(ix >= 10) {
! post("%s: Only 9 float inlets possible",thisName());
! ok = false;
! }
! else
! floatin(x_obj,ix);
! break;
! case xlet::tp_int:
! if(ix >= 10) {
! post("%s: Only 9 int inlets possible",thisName());
! ok = false;
! }
! else
! intin(x_obj,ix);
! break;
! case xlet::tp_any: // non-leftmost
! case xlet::tp_sym:
! case xlet::tp_list:
! inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
! ok = false;
! }
! }
! }
! // incnt = cnt;
!
! if(insigs)
! // dsp_setup(thisHdr(),insigs); // signal inlets
! dsp_setupbox(thisHdr(),insigs); // signal inlets
! }
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! {
! t_class *cl = thisClass();
! int cnt = 0;
! for(int ix = 0; ix < incnt; ++ix,++cnt) {
! switch(list[ix]) {
! case xlet::tp_float:
! case xlet::tp_int:
! // fts_class_inlet_number(cl, ix, jmax_proxy);
! break;
! case xlet::tp_sym:
! // fts_class_inlet_symbol(cl, ix, jmax_proxy);
! break;
! case xlet::tp_sig:
! if(compatibility && list[ix-1] != xlet::tp_sig) {
! post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
! ok = false;
! }
! else {
! if(!insigs) fts_dsp_declare_inlet(cl,0);
! ++insigs;
! }
! // no break -> let a signal inlet also accept any messages
! case xlet::tp_list:
! case xlet::tp_any:
! // fts_class_inlet_varargs(cl,ix, jmax_proxy);
! break;
! default:
! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
! ok = false;
! }
! }
! incnt = cnt;
! fts_object_set_inlets_number((fts_object_t *)thisHdr(), incnt);
! }
#else
#error
#endif
! delete[] list;
! }
! return ok;
}
bool flext_base::InitOutlets()
{
! bool ok = true;
! // ----------------------------------
! // create outlets
! // ----------------------------------
! outcnt = outsigs = 0;
!
#if FLEXT_SYS == FLEXT_SYS_MAX
! // for Max/MSP the rightmost outlet has to be created first
! outlet *attrtmp = NULL;
! if(procattr)
! attrtmp = (outlet *)newout_anything(thisHdr());
#endif
// digest outlist
! {
! xlet *xi;
! // count outlets
! outcnt = 0;
! for(xi = outlist; xi; xi = xi->nxt) ++outcnt;
! xlet::type *list = new xlet::type[outcnt];
! int i;
! for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
! #if FLEXT_SYS == FLEXT_SYS_MAX
! // copy outlet descriptions
! outdesc = new char *[outcnt];
! for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) {
! int l = xi->desc?strlen(xi->desc):0;
! if(l) {
! outdesc[i] = new char[l+1];
! memcpy(outdesc[i],xi->desc,l);
! outdesc[i][l] = 0;
! }
! else
! outdesc[i] = NULL;
! }
#endif
! delete outlist; outlist = NULL;
!
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! outlets = new outlet *[outcnt+(procattr?1:0)];
! // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
! for(int ix = 0; ix < outcnt; ++ix)
#elif FLEXT_SYS == FLEXT_SYS_MAX
! for(int ix = outcnt-1; ix >= 0; --ix)
#else
#error
#endif
! {
! switch(list[ix]) {
! case xlet::tp_float:
! outlets[ix] = (outlet *)newout_float(&x_obj->obj);
! break;
! case xlet::tp_int:
! outlets[ix] = (outlet *)newout_flint(&x_obj->obj);
! break;
! case xlet::tp_sig:
! outlets[ix] = (outlet *)newout_signal(&x_obj->obj);
! ++outsigs;
! break;
! case xlet::tp_sym:
! outlets[ix] = (outlet *)newout_symbol(&x_obj->obj);
! break;
! case xlet::tp_list:
! outlets[ix] = (outlet *)newout_list(&x_obj->obj);
! break;
! case xlet::tp_any:
! outlets[ix] = (outlet *)newout_anything(&x_obj->obj);
! break;
#ifdef FLEXT_DEBUG
! default:
! ERRINTERNAL();
! ok = false;
#endif
! }
! }
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! t_class *cl = thisClass();
! for(int ix = 0; ix < outcnt; ++ix) {
! switch(list[ix]) {
! case xlet::tp_float:
! case xlet::tp_int:
! // fts_class_outlet_number(cl, ix);
! break;
! case xlet::tp_sym:
! // fts_class_outlet_symbol(cl, ix);
! break;
! case xlet::tp_list:
! case xlet::tp_any:
! // fts_class_outlet_anything(cl, ix);
! break;
! case xlet::tp_sig:
! if(!outsigs) fts_dsp_declare_outlet(cl,0);
! ++outsigs;
! break;
#ifdef FLEXT_DEBUG
! default:
! ERRINTERNAL();
! ok = false;
#endif
! }
! }
! fts_object_set_outlets_number((fts_object_t *)thisHdr(), outcnt+(procattr?1:0));
#endif
! delete[] list;
! }
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! if(procattr) {
! // attribute dump outlet is the last one
! outlets[outcnt] =
#if FLEXT_SYS == FLEXT_SYS_PD
! // attribute dump outlet is the last one
! (outlet *)newout_anything(&x_obj->obj);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! attrtmp;
#endif
! }
#endif
!
! return ok;
}
Index: flbase.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flbase.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** flbase.h 23 Apr 2004 02:32:55 -0000 1.25
--- flbase.h 21 Jun 2004 13:58:19 -0000 1.26
***************
*** 444,451 ****
--- 444,457 ----
#define FLEXTTYPE_int0 FLEXTTPN_DEFFLOAT
#define CALLBTYPE_int float
+ #define FLEXTTYPE_bool FLEXTTPN_FLOAT
+ #define FLEXTTYPE_bool0 FLEXTTPN_DEFFLOAT
+ #define CALLBTYPE_bool float
#elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX
#define FLEXTTYPE_int FLEXTTPN_INT
#define FLEXTTYPE_int0 FLEXTTPN_DEFINT
#define CALLBTYPE_int int
+ #define FLEXTTYPE_bool FLEXTTPN_INT
+ #define FLEXTTYPE_bool0 FLEXTTPN_DEFINT
+ #define CALLBTYPE_bool int
#else
#error
***************
*** 465,468 ****
--- 471,476 ----
+ #define ARGMEMBER_bool(a) GetBool(a)
+ #define ARGMEMBER_bool0(a) ARGMEMBER_bool(a)
#define ARGMEMBER_int(a) GetInt(a)
#define ARGMEMBER_int0(a) ARGMEMBER_int(a)
Index: flutil.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flutil.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** flutil.cpp 22 Jul 2003 02:32:51 -0000 1.14
--- flutil.cpp 21 Jun 2004 13:58:20 -0000 1.15
***************
*** 19,27 ****
#include <windows.h>
#elif FLEXT_OS == FLEXT_OS_MAC
! #if FLEXT_OSAPI != FLEXT_OSAPI_MAC_MACH
! #include <MacMemory.h>
! #else
! #include <Carbon/Carbon.h>
! #endif
#endif
--- 19,27 ----
#include <windows.h>
#elif FLEXT_OS == FLEXT_OS_MAC
! #if FLEXT_OSAPI != FLEXT_OSAPI_MAC_MACH
! #include <MacMemory.h>
! #else
! #include <Carbon/Carbon.h>
! #endif
#endif
***************
*** 31,37 ****
MoveMemory(dst,src,bytes);
#elif FLEXT_OS == FLEXT_OS_MAC
! BlockMoveData(src,dst,bytes);
#else
! memcpy(dst,src,bytes);
#endif
}
--- 31,37 ----
MoveMemory(dst,src,bytes);
#elif FLEXT_OS == FLEXT_OS_MAC
! BlockMoveData(src,dst,bytes);
#else
! memcpy(dst,src,bytes);
#endif
}
***************
*** 44,48 ****
BlockZero(dst,bytes);
#else
! memset(dst,0,bytes);
#endif
}
--- 44,48 ----
BlockZero(dst,bytes);
#else
! memset(dst,0,bytes);
#endif
}
***************
*** 51,64 ****
bool flext::Forward(const t_symbol *recv,const t_symbol *s,int argc,const t_atom *argv)
{
! void *cl = recv->s_thing;
! if(!cl) return false;
#if FLEXT_SYS == FLEXT_SYS_PD
! pd_typedmess((t_class **)cl,(t_symbol *)s,argc,(t_atom *)argv);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! typedmess(recv->s_thing,(t_symbol *)s,argc,(t_atom *)argv);
#else
#error Not implemented
#endif
! return true;
}
--- 51,64 ----
bool flext::Forward(const t_symbol *recv,const t_symbol *s,int argc,const t_atom *argv)
{
! void *cl = recv->s_thing;
! if(!cl) return false;
#if FLEXT_SYS == FLEXT_SYS_PD
! pd_typedmess((t_class **)cl,(t_symbol *)s,argc,(t_atom *)argv);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! typedmess(recv->s_thing,(t_symbol *)s,argc,(t_atom *)argv);
#else
#error Not implemented
#endif
! return true;
}
Index: fldefs_methadd.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldefs_methadd.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** fldefs_methadd.h 12 Dec 2003 03:32:56 -0000 1.2
--- fldefs_methadd.h 21 Jun 2004 13:58:19 -0000 1.3
***************
*** 18,25 ****
! /*! \defgroup FLEXT_D_CADDMETHOD Add flext methods within class scope
\ingroup FLEXT_D_METHOD
! \note These can only be used at class construction time
! @{
*/
--- 18,25 ----
! /*! \defgroup FLEXT_D_CADDMETHOD Add flext methods within class scope
\ingroup FLEXT_D_METHOD
! \note These can only be used at class construction time
! @{
*/
***************
*** 27,40 ****
#define FLEXT_CADDBANG(CL,IX,M_FUN) \
\
! AddMethod(CL,IX,"bang",FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with either no, list or anything arguments
#define FLEXT_CADDMETHOD(CL,IX,M_FUN) \
! AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
//! Add a a handler for a method with implicit arguments
#define FLEXT_CADDMETHOD_(CL,IX,M_TAG,M_FUN) \
\
! AddMethod(CL,IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with 1 enum type argument
--- 27,40 ----
#define FLEXT_CADDBANG(CL,IX,M_FUN) \
\
! AddMethod(CL,IX,"bang",FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with either no, list or anything arguments
#define FLEXT_CADDMETHOD(CL,IX,M_FUN) \
! AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
//! Add a a handler for a method with implicit arguments
#define FLEXT_CADDMETHOD_(CL,IX,M_TAG,M_FUN) \
\
! AddMethod(CL,IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with 1 enum type argument
***************
*** 46,50 ****
#define FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,TP1) \
\
! AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
//! Add a handler for a method with 2 arguments
--- 46,50 ----
#define FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,TP1) \
\
! AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
//! Add a handler for a method with 2 arguments
***************
*** 69,73 ****
! // Shortcuts
//! Add a handler for a method with a boolean argument
--- 69,73 ----
! // Shortcuts
//! Add a handler for a method with a boolean argument
***************
*** 109,117 ****
! /*! \defgroup FLEXT_D_ADDMETHOD Add flext methods
\ingroup FLEXT_D_METHOD
! \note These can only be used at object construction time
! \note (in constructor or in Init() function before call to parent's Init())
! @{
*/
--- 109,117 ----
! /*! \defgroup FLEXT_D_ADDMETHOD Add flext methods
\ingroup FLEXT_D_METHOD
! \note These can only be used at object construction time
! \note (in constructor or in Init() function before call to parent's Init())
! @{
*/
***************
*** 124,158 ****
#define FLEXT_ADDDIST() \
\
! SetDist(true)
//! Add a method handler for bang
#define FLEXT_ADDBANG(IX,M_FUN) \
\
! AddMethod(IX,"bang",FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with either no, list or anything arguments
#define FLEXT_ADDMETHOD(IX,M_FUN) \
! AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
/*! \brief Add a handler for a method with a (variable argument) list
! \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead
! \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity
*/
#define FLEXT_ADDMETHOD_V(IX,M_FUN) \
\
! AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
/*! \brief Add a handler for a method with an anything argument
! \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead
! \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity
*/
#define FLEXT_ADDMETHOD_A(IX,M_FUN) \
\
! AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
//! Add a a handler for a tagged method with implicit arguments
#define FLEXT_ADDMETHOD_(IX,M_TAG,M_FUN) \
\
! AddMethod(IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with 1 enum type argument
--- 124,158 ----
#define FLEXT_ADDDIST() \
\
! SetDist(true)
//! Add a method handler for bang
#define FLEXT_ADDBANG(IX,M_FUN) \
\
! AddMethod(IX,"bang",FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with either no, list or anything arguments
#define FLEXT_ADDMETHOD(IX,M_FUN) \
! AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
/*! \brief Add a handler for a method with a (variable argument) list
! \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead
! \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity
*/
#define FLEXT_ADDMETHOD_V(IX,M_FUN) \
\
! AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
/*! \brief Add a handler for a method with an anything argument
! \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead
! \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity
*/
#define FLEXT_ADDMETHOD_A(IX,M_FUN) \
\
! AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
//! Add a a handler for a tagged method with implicit arguments
#define FLEXT_ADDMETHOD_(IX,M_TAG,M_FUN) \
\
! AddMethod(IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with 1 enum type argument
***************
*** 164,168 ****
#define FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,TP1) \
\
! AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
//! Add a handler for a method with 2 arguments
--- 164,168 ----
#define FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,TP1) \
\
! AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
//! Add a handler for a method with 2 arguments
***************
*** 187,191 ****
! // Shortcuts
//! Add a handler for a method with a boolean argument
--- 187,191 ----
! // Shortcuts
//! Add a handler for a method with a boolean argument
Index: flmeth.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmeth.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** flmeth.cpp 6 Mar 2004 03:25:48 -0000 1.9
--- flmeth.cpp 21 Jun 2004 13:58:19 -0000 1.10
***************
*** 22,40 ****
flext_base::MethItem::MethItem(AttrItem *conn):
! Item(conn),index(0),
! argc(0),args(NULL)
! ,fun(NULL)
{}
flext_base::MethItem::~MethItem()
{
! if(args) delete[] args;
}
void flext_base::MethItem::SetArgs(methfun _fun,int _argc,metharg *_args)
{
! fun = _fun;
! if(args) delete[] args;
! argc = _argc,args = _args;
}
--- 22,40 ----
flext_base::MethItem::MethItem(AttrItem *conn):
! Item(conn),index(0),
! argc(0),args(NULL)
! ,fun(NULL)
{}
flext_base::MethItem::~MethItem()
{
! if(args) delete[] args;
}
void flext_base::MethItem::SetArgs(methfun _fun,int _argc,metharg *_args)
{
! fun = _fun;
! if(args) delete[] args;
! argc = _argc,args = _args;
}
***************
*** 43,47 ****
{
const t_symbol *t = tag?MakeSymbol(tag):NULL;
! methhead->Add(new MethItem,t,inlet);
}
--- 43,47 ----
{
const t_symbol *t = tag?MakeSymbol(tag):NULL;
! methhead->Add(new MethItem,t,inlet);
}
***************
*** 50,110 ****
void flext_base::AddMethod(ItemCont *ma,int inlet,const char *tag,methfun fun,metharg tp,...)
{
! va_list marker;
! // at first just count the arg type list (in argc)
! int argc = 0;
! va_start(marker,tp);
! metharg *args = NULL,arg = tp;
! for(; arg != a_null; ++argc) arg = (metharg)va_arg(marker,int); //metharg);
! va_end(marker);
!
! if(argc > 0) {
! if(argc > FLEXT_MAXMETHARGS) {
! error("flext - method %s: only %i arguments are type-checkable: use variable argument list for more",tag?tag:"?",FLEXT_MAXMETHARGS);
! argc = FLEXT_MAXMETHARGS;
! }
! args = new metharg[argc];
! va_start(marker,tp);
! metharg a = tp;
! for(int ix = 0; ix < argc; ++ix) {
#ifdef FLEXT_DEBUG
! if(a == a_list && ix > 0) {
! ERRINTERNAL();
! }
#endif
#if FLEXT_SYS == FLEXT_SYS_PD
! if(a == a_pointer && flext_base::compatibility) {
! post("Pointer arguments are not allowed in compatibility mode");
! }
#endif
! args[ix] = a;
! a = (metharg)va_arg(marker,int); //metharg);
! }
! va_end(marker);
! }
!
! MethItem *mi = new MethItem;
mi->index = ma->Members();
! mi->SetArgs(fun,argc,args);
! ma->Add(mi,MakeSymbol(tag),inlet);
}
void flext_base::ListMethods(AtomList &la,int inlet) const
{
! typedef DataMap<int,const t_symbol *> MethList;
! MethList list[2];
! int i;
! for(i = 0; i <= 1; ++i) {
! ItemCont *a = i?methhead:clmethhead;
! if(a && a->Contained(inlet)) {
ItemSet &ai = a->GetInlet(inlet);
for(ItemSet::iterator as = ai.begin(); as != ai.end(); ++as) {
for(Item *al = as.data(); al; al = al->nxt) {
! MethItem *aa = (MethItem *)al;
! // check it's not related to an attribute
if(!aa->IsAttr()) {
list[i][aa->index] = as.key();
--- 50,110 ----
void flext_base::AddMethod(ItemCont *ma,int inlet,const char *tag,methfun fun,metharg tp,...)
{
! va_list marker;
! // at first just count the arg type list (in argc)
! int argc = 0;
! va_start(marker,tp);
! metharg *args = NULL,arg = tp;
! for(; arg != a_null; ++argc) arg = (metharg)va_arg(marker,int); //metharg);
! va_end(marker);
!
! if(argc > 0) {
! if(argc > FLEXT_MAXMETHARGS) {
! error("flext - method %s: only %i arguments are type-checkable: use variable argument list for more",tag?tag:"?",FLEXT_MAXMETHARGS);
! argc = FLEXT_MAXMETHARGS;
! }
! args = new metharg[argc];
! va_start(marker,tp);
! metharg a = tp;
! for(int ix = 0; ix < argc; ++ix) {
#ifdef FLEXT_DEBUG
! if(a == a_list && ix > 0) {
! ERRINTERNAL();
! }
#endif
#if FLEXT_SYS == FLEXT_SYS_PD
! if(a == a_pointer && flext_base::compatibility) {
! post("Pointer arguments are not allowed in compatibility mode");
! }
#endif
! args[ix] = a;
! a = (metharg)va_arg(marker,int); //metharg);
! }
! va_end(marker);
! }
!
! MethItem *mi = new MethItem;
mi->index = ma->Members();
! mi->SetArgs(fun,argc,args);
! ma->Add(mi,MakeSymbol(tag),inlet);
}
void flext_base::ListMethods(AtomList &la,int inlet) const
{
! typedef DataMap<int,const t_symbol *> MethList;
! MethList list[2];
! int i;
! for(i = 0; i <= 1; ++i) {
! ItemCont *a = i?methhead:clmethhead;
! if(a && a->Contained(inlet)) {
ItemSet &ai = a->GetInlet(inlet);
for(ItemSet::iterator as = ai.begin(); as != ai.end(); ++as) {
for(Item *al = as.data(); al; al = al->nxt) {
! MethItem *aa = (MethItem *)al;
! // check it's not related to an attribute
if(!aa->IsAttr()) {
list[i][aa->index] = as.key();
***************
*** 112,145 ****
}
}
! }
! }
! }
! la(list[0].size()+list[1].size());
! int ix = 0;
! MethList::iterator it;
! for(i = 0; i <= 1; ++i)
! for(it = list[i].begin(); it != list[i].end(); ++it)
! SetSymbol(la[ix++],it.data());
}
bool flext_base::ListMethods(int inlet) const
{
! if(procattr) {
! AtomList la;
! ListMethods(la,inlet);
! ToOutAnything(GetOutAttr(),MakeSymbol("methods"),la.Count(),la.Atoms());
! return true;
! }
! else
! return false;
}
bool flext_base::cb_ListMethods(flext_base *c,int argc,const t_atom *argv)
{
! if(argc == 0 || (argc == 1 && CanbeInt(argv[0])))
! return c->ListMethods(argc?GetAInt(argv[0]):0);
! else
! return false;
}
--- 112,145 ----
}
}
! }
! }
! }
! la(list[0].size()+list[1].size());
! int ix = 0;
! MethList::iterator it;
! for(i = 0; i <= 1; ++i)
! for(it = list[i].begin(); it != list[i].end(); ++it)
! SetSymbol(la[ix++],it.data());
}
bool flext_base::ListMethods(int inlet) const
{
! if(procattr) {
! AtomList la;
! ListMethods(la,inlet);
! ToOutAnything(GetOutAttr(),MakeSymbol("methods"),la.Count(),la.Atoms());
! return true;
! }
! else
! return false;
}
bool flext_base::cb_ListMethods(flext_base *c,int argc,const t_atom *argv)
{
! if(argc == 0 || (argc == 1 && CanbeInt(argv[0])))
! return c->ListMethods(argc?GetAInt(argv[0]):0);
! else
! return false;
}
Index: fldefs.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldefs.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** fldefs.h 12 Dec 2003 03:32:56 -0000 1.17
--- fldefs.h 21 Jun 2004 13:58:19 -0000 1.18
***************
*** 16,26 ****
#define __FLEXT_DEFS_H
! /*! \defgroup FLEXT_DEFS Definitions for basic flext functionality
! @{
*/
/*! \brief Switch for compilation of derived virtual classes
! \remark These need dynamic type casts (and RTTI, naturally)
! \ingroup FLEXT_GLOBALS
*/
#ifdef FLEXT_VIRT
--- 16,26 ----
#define __FLEXT_DEFS_H
! /*! \defgroup FLEXT_DEFS Definitions for basic flext functionality
! @{
*/
/*! \brief Switch for compilation of derived virtual classes
! \remark These need dynamic type casts (and RTTI, naturally)
! \ingroup FLEXT_GLOBALS
*/
#ifdef FLEXT_VIRT
***************
*** 30,34 ****
#endif
! //! @} FLEXT_DEFS
#include "fldefs_hdr.h"
--- 30,34 ----
#endif
! //! @} FLEXT_DEFS
#include "fldefs_hdr.h"
***************
*** 39,44 ****
// ====================================================================================
! /*! \defgroup FLEXT_D_METHOD Declarations for flext methods
! @{
*/
--- 39,44 ----
// ====================================================================================
! /*! \defgroup FLEXT_D_METHOD Declarations for flext methods
! @{
*/
***************
*** 55,61 ****
#ifdef FLEXT_ATTRIBUTES
! /*! \defgroup FLEXT_D_ATTRIB Attribute definition
! \note These have to reside inside the class declaration
! @{
*/
--- 55,61 ----
#ifdef FLEXT_ATTRIBUTES
! /*! \defgroup FLEXT_D_ATTRIB Attribute definition
! \note These have to reside inside the class declaration
! @{
*/
Index: flatom_app.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flatom_app.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** flatom_app.cpp 1 Jan 2003 04:32:04 -0000 1.2
--- flatom_app.cpp 21 Jun 2004 13:58:19 -0000 1.3
***************
*** 18,76 ****
flext::AtomList &flext::AtomList::Append(const t_atom &a)
{
! t_atom *nlst = new t_atom[cnt+1];
! for(int i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
! SetAtom(nlst[cnt],a);
!
! if(lst) delete[] lst;
! lst = nlst;
! ++cnt;
! return *this;
}
flext::AtomList &flext::AtomList::Append(int argc,const t_atom *argv)
{
! if(argc) {
! t_atom *nlst = new t_atom[cnt+argc];
! int i;
! for(i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
! if(argv)
! for(i = 0; i < argc; ++i) SetAtom(nlst[cnt+i],argv[i]);
!
! if(lst) delete[] lst;
! lst = nlst;
! cnt += argc;
! }
! return *this;
}
flext::AtomList &flext::AtomList::Prepend(const t_atom &a)
{
! t_atom *nlst = new t_atom[cnt+1];
! for(int i = 0; i < cnt; ++i) SetAtom(nlst[i+1],lst[i]);
! SetAtom(nlst[0],a);
!
! if(lst) delete[] lst;
! lst = nlst;
! ++cnt;
! return *this;
}
flext::AtomList &flext::AtomList::Prepend(int argc,const t_atom *argv)
{
! if(argc) {
! t_atom *nlst = new t_atom[cnt+argc];
! int i;
! if(argv)
! for(i = 0; i < argc; ++i) SetAtom(nlst[i],argv[i]);
! for(i = 0; i < cnt; ++i) SetAtom(nlst[argc+i],lst[i]);
!
! if(lst) delete[] lst;
! lst = nlst;
! cnt += argc;
! }
! return *this;
}
--- 18,76 ----
flext::AtomList &flext::AtomList::Append(const t_atom &a)
{
! t_atom *nlst = new t_atom[cnt+1];
! for(int i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
! SetAtom(nlst[cnt],a);
!
! if(lst) delete[] lst;
! lst = nlst;
! ++cnt;
! return *this;
}
flext::AtomList &flext::AtomList::Append(int argc,const t_atom *argv)
{
! if(argc) {
! t_atom *nlst = new t_atom[cnt+argc];
! int i;
! for(i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
! if(argv)
! for(i = 0; i < argc; ++i) SetAtom(nlst[cnt+i],argv[i]);
!
! if(lst) delete[] lst;
! lst = nlst;
! cnt += argc;
! }
! return *this;
}
flext::AtomList &flext::AtomList::Prepend(const t_atom &a)
{
! t_atom *nlst = new t_atom[cnt+1];
! for(int i = 0; i < cnt; ++i) SetAtom(nlst[i+1],lst[i]);
! SetAtom(nlst[0],a);
!
! if(lst) delete[] lst;
! lst = nlst;
! ++cnt;
! return *this;
}
flext::AtomList &flext::AtomList::Prepend(int argc,const t_atom *argv)
{
! if(argc) {
! t_atom *nlst = new t_atom[cnt+argc];
! int i;
! if(argv)
! for(i = 0; i < argc; ++i) SetAtom(nlst[i],argv[i]);
! for(i = 0; i < cnt; ++i) SetAtom(nlst[argc+i],lst[i]);
!
! if(lst) delete[] lst;
! lst = nlst;
! cnt += argc;
! }
! return *this;
}
Index: flstk.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flstk.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** flstk.h 13 Feb 2003 04:31:41 -0000 1.5
--- flstk.h 21 Jun 2004 13:58:19 -0000 1.6
***************
*** 16,64 ****
class FLEXT_SHARE flext_stk:
! public flext_dsp
{
! FLEXT_HEADER(flext_stk,flext_dsp)
public:
! flext_stk();
! // these have to be overridden in child classes
! virtual bool NewObjs() { return true; }
! virtual void FreeObjs() {}
! virtual void ProcessObjs(int blocksize) {}
protected:
! virtual bool Init();
! virtual void Exit();
! //! STK object for reading from inlet buffer
! class Input:
! public Stk
! {
! public:
! Input(const t_sample *b,int vecsz);
! inline MY_FLOAT lastOut() const { return (MY_FLOAT)buf[index]; }
! inline MY_FLOAT tick() {
! if(++index >= vecsz) index = 0;
! return lastOut();
}
! MY_FLOAT *tick(MY_FLOAT *vector,unsigned int vectorSize);
! inline void SetBuf(const t_sample *b) { buf = b; }
! private:
! const t_sample *buf;
! int vecsz,index;
! };
! //! STK object for writing to outlet buffer
! class Output:
! public Stk
! {
! public:
! Output(t_sample *b,int vecsz);
inline void tick(MY_FLOAT s) {
--- 16,64 ----
class FLEXT_SHARE flext_stk:
! public flext_dsp
{
! FLEXT_HEADER(flext_stk,flext_dsp)
public:
! flext_stk();
! // these have to be overridden in child classes
! virtual bool NewObjs() { return true; }
! virtual void FreeObjs() {}
! virtual void ProcessObjs(int blocksize) {}
protected:
! virtual bool Init();
! virtual void Exit();
! //! STK object for reading from inlet buffer
! class Input:
! public Stk
! {
! public:
! Input(const t_sample *b,int vecsz);
! inline MY_FLOAT lastOut() const { return (MY_FLOAT)buf[index]; }
! inline MY_FLOAT tick() {
! if(++index >= vecsz) index = 0;
! return lastOut();
}
! MY_FLOAT *tick(MY_FLOAT *vector,unsigned int vectorSize);
! inline void SetBuf(const t_sample *b) { buf = b; }
! private:
! const t_sample *buf;
! int vecsz,index;
! };
! //! STK object for writing to outlet buffer
! class Output:
! public Stk
! {
! public:
! Output(t_sample *b,int vecsz);
inline void tick(MY_FLOAT s) {
***************
*** 67,94 ****
}
! void tick(const MY_FLOAT *vector,unsigned int vectorSize);
! inline void SetBuf(t_sample *b) { buf = b; }
! private:
! t_sample *buf;
! int vecsz,index;
! };
! Input &Inlet(int ix) { return *inobj[ix]; }
! Output &Outlet(int ix) { return *outobj[ix]; }
private:
! virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out);
! virtual void m_signal(int n,t_sample *const *in,t_sample *const *out);
! void ClearObjs();
! int inobjs,outobjs;
! Input **inobj;
! Output **outobj;
! float smprt;
! int blsz;
};
--- 67,94 ----
}
! void tick(const MY_FLOAT *vector,unsigned int vectorSize);
! inline void SetBuf(t_sample *b) { buf = b; }
! private:
! t_sample *buf;
! int vecsz,index;
! };
! Input &Inlet(int ix) { return *inobj[ix]; }
! Output &Outlet(int ix) { return *outobj[ix]; }
private:
! virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out);
! virtual void m_signal(int n,t_sample *const *in,t_sample *const *out);
! void ClearObjs();
! int inobjs,outobjs;
! Input **inobj;
! Output **outobj;
! float smprt;
! int blsz;
};
Index: flsupport.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsupport.h,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -d -r1.68 -r1.69
*** flsupport.h 23 Apr 2004 22:14:14 -0000 1.68
--- flsupport.h 21 Jun 2004 13:58:19 -0000 1.69
***************
*** 420,430 ****
static bool CanbeInt(const t_atom &a) { return IsFloat(a) || IsInt(a); }
- //! Set the atom to represent a boolean
- static void SetBool(t_atom &a,bool v) { SetInt(a,v?1:0); }
- //! Check whether the atom can be represented as a boolean
- static bool CanbeBool(const t_atom &a) { return CanbeInt(a); }
- //! Check for an boolean and get its value
- static bool GetABool(const t_atom &a) { return GetAInt(a) != 0; }
-
#if FLEXT_SYS == FLEXT_SYS_PD
//! Check for a float and get its value
--- 420,423 ----
***************
*** 501,504 ****
--- 494,506 ----
#endif
+ //! Set the atom to represent a boolean
+ static void SetBool(t_atom &a,bool v) { SetInt(a,v?1:0); }
+ //! Check whether the atom can be represented as a boolean
+ static bool CanbeBool(const t_atom &a) { return CanbeInt(a); }
+ //! Check for an boolean and get its value
+ static bool GetABool(const t_atom &a) { return GetAInt(a) != 0; }
+ //! Check for an boolean and get its value
+ static bool GetBool(const t_atom &a) { return GetInt(a) != 0; }
+
// --- atom list stuff -------------------------------------------
Index: flext.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flext.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** flext.cpp 22 Feb 2004 03:34:00 -0000 1.27
--- flext.cpp 21 Jun 2004 13:58:19 -0000 1.28
***************
*** 22,54 ****
flext_base::FLEXT_CLASSDEF(flext_base)():
! inlist(NULL),outlist(NULL),
! curtag(NULL),
! incnt(0),outcnt(0),
! insigs(0),outsigs(0),
! distmsgs(false)
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! ,outlets(NULL),inlets(NULL)
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
! ,indesc(NULL),outdesc(NULL)
#endif
{
! FLEXT_LOG1("%s - flext logging is on",thisName());
! t_classid clid = thisClassId();
! clmethhead = ClMeths(clid);
! methhead = new ItemCont;
! bindhead = NULL;
! if(procattr) {
! // initialize when attribute processing is enabled
! attrhead = new ItemCont;
! clattrhead = ClAttrs(clid);
! attrdata = new AttrDataCont;
! }
! else {
! attrhead = clattrhead = NULL;
! attrdata = NULL;
! }
}
--- 22,54 ----
flext_base::FLEXT_CLASSDEF(flext_base)():
! inlist(NULL),outlist(NULL),
! curtag(NULL),
! incnt(0),outcnt(0),
! insigs(0),outsigs(0),
! distmsgs(false)
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! ,outlets(NULL),inlets(NULL)
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
! ,indesc(NULL),outdesc(NULL)
#endif
{
! FLEXT_LOG1("%s - flext logging is on",thisName());
! t_classid clid = thisClassId();
! clmethhead = ClMeths(clid);
! methhead = new ItemCont;
! bindhead = NULL;
! if(procattr) {
! // initialize when attribute processing is enabled
! attrhead = new ItemCont;
! clattrhead = ClAttrs(clid);
! attrdata = new AttrDataCont;
! }
! else {
! attrhead = clattrhead = NULL;
! attrdata = NULL;
! }
}
***************
*** 57,179 ****
#if FLEXT_SYS == FLEXT_SYS_MAX
// according to David Z. one should do that first...
! // if(insigs) dsp_free(thisHdr());
! if(insigs) dsp_freebox(thisHdr());
#endif
#ifdef FLEXT_THREADS
! StopThreads();
#endif
! // send remaining pending messages for this object
! QFlush(this);
! // delete message lists
! if(methhead) delete methhead;
! if(bindhead) delete bindhead; // ATTENTION: the object must free all memory associated to bindings itself
! if(attrhead) delete attrhead;
! if(attrdata) delete attrdata;
!
! // destroy inlets and outlets and their proxy objects
! if(inlist) delete inlist;
! if(outlist) delete outlist;
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! if(outlets) delete[] outlets;
! if(inlets) {
! for(int ix = 0; ix < incnt; ++ix)
! if(inlets[ix]) {
! // release proxy object
#if FLEXT_SYS == FLEXT_SYS_PD
! pd_free(&inlets[ix]->obj.ob_pd);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! freeobject((object *)inlets[ix]);
#endif
! }
! delete[] inlets;
! }
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
! if(indesc) {
! for(int i = 0; i < incnt; ++i) if(indesc[i]) delete[] indesc[i];
! delete[] indesc;
! }
! if(outdesc) {
! for(int i = 0; i < outcnt; ++i) if(outdesc[i]) delete[] outdesc[i];
! delete[] outdesc;
! }
#endif
}
/*! This virtual function is called after the object has been created, that is,
! after the constructor has been processed.
! It creates the inlets and outlets and the message and attribute lists.
! \note You can override it in your own class, but be sure to call it,
! \note otherwise no inlets/outlets will be created
! \note All inlet, outlets, method and attribute declarations must be made before a call to Init!
! \remark Creation of inlets/outlets can't be done upon declaration, as Max/MSP needs creation
! \remark in reverse.
*/
bool flext_base::Init()
{
! bool ok = flext_obj::Init();
! if(ok) ok = InitInlets() && InitOutlets();
! if(ok) {
! if(procattr && m_holdaargc && m_holdaargv) {
! // initialize creation attributes
! ok = InitAttrib(m_holdaargc,m_holdaargv);
! }
! }
! return ok;
}
/*! Set up proxy classes and basic methods at class creation time
! This ensures that they are processed before the registered flext messages
*/
void flext_base::Setup(t_classid id)
{
! t_class *c = getClass(id);
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! add_method(c,cb_help,"help");
! add_loadbang(c,cb_loadbang);
#if FLEXT_SYS == FLEXT_SYS_MAX
! add_assist(c,cb_assist);
#endif
#else
! fts_class_message_varargs(c,MakeSymbol("help"),cb_help);
! #pragma message ("no implementation of loadbang or assist")
#endif
! if(process_attributes) {
! AddMethod(id,0,"getattributes",cb_ListAttrib);
! AddMethod(id,0,"getmethods",cb_ListMethods);
#if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_NOATTREDIT)
! AddMethod(id,0,"attributedialog",cb_AttrDialog);
! SetAttrEditor(id);
#endif
! }
! SetProxies(c);
! StartQueue();
}
#if FLEXT_SYS == FLEXT_SYS_JMAX
! void flext_base::cb_help(fts_object_t *c,int, fts_symbol_t, int, const fts_atom_t *) { thisObject(c)->m_help(); }
#else
! void flext_base::cb_help(t_class *c) { thisObject(c)->m_help(); }
! void flext_base::cb_loadbang(t_class *c) { thisObject(c)->m_loadbang(); }
#endif
void flext_base::m_help()
{
! // This should better be overloaded
! post("%s (using flext " FLEXT_VERSTR ") - compiled on %s %s",thisName(),__DATE__,__TIME__);
}
--- 57,179 ----
#if FLEXT_SYS == FLEXT_SYS_MAX
// according to David Z. one should do that first...
! // if(insigs) dsp_free(thisHdr());
! if(insigs) dsp_freebox(thisHdr());
#endif
#ifdef FLEXT_THREADS
! StopThreads();
#endif
! // send remaining pending messages for this object
! QFlush(this);
! // delete message lists
! if(methhead) delete methhead;
! if(bindhead) delete bindhead; // ATTENTION: the object must free all memory associated to bindings itself
! if(attrhead) delete attrhead;
! if(attrdata) delete attrdata;
!
! // destroy inlets and outlets and their proxy objects
! if(inlist) delete inlist;
! if(outlist) delete outlist;
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! if(outlets) delete[] outlets;
! if(inlets) {
! for(int ix = 0; ix < incnt; ++ix)
! if(inlets[ix]) {
! // release proxy object
#if FLEXT_SYS == FLEXT_SYS_PD
! pd_free(&inlets[ix]->obj.ob_pd);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! freeobject((object *)inlets[ix]);
#endif
! }
! delete[] inlets;
! }
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
! if(indesc) {
! for(int i = 0; i < incnt; ++i) if(indesc[i]) delete[] indesc[i];
! delete[] indesc;
! }
! if(outdesc) {
! for(int i = 0; i < outcnt; ++i) if(outdesc[i]) delete[] outdesc[i];
! delete[] outdesc;
! }
#endif
}
/*! This virtual function is called after the object has been created, that is,
! after the constructor has been processed.
! It creates the inlets and outlets and the message and attribute lists.
! \note You can override it in your own class, but be sure to call it,
! \note otherwise no inlets/outlets will be created
! \note All inlet, outlets, method and attribute declarations must be made before a call to Init!
! \remark Creation of inlets/outlets can't be done upon declaration, as Max/MSP needs creation
! \remark in reverse.
*/
bool flext_base::Init()
{
! bool ok = flext_obj::Init();
! if(ok) ok = InitInlets() && InitOutlets();
! if(ok) {
! if(procattr && m_holdaargc && m_holdaargv) {
! // initialize creation attributes
! ok = InitAttrib(m_holdaargc,m_holdaargv);
! }
! }
! return ok;
}
/*! Set up proxy classes and basic methods at class creation time
! This ensures that they are processed before the registered flext messages
*/
void flext_base::Setup(t_classid id)
{
! t_class *c = getClass(id);
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
! add_method(c,cb_help,"help");
! add_loadbang(c,cb_loadbang);
#if FLEXT_SYS == FLEXT_SYS_MAX
! add_assist(c,cb_assist);
#endif
#else
! fts_class_message_varargs(c,MakeSymbol("help"),cb_help);
! #pragma message ("no implementation of loadbang or assist")
#endif
! if(process_attributes) {
! AddMethod(id,0,"getattributes",cb_ListAttrib);
! AddMethod(id,0,"getmethods",cb_ListMethods);
#if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_NOATTREDIT)
! AddMethod(id,0,"attributedialog",cb_AttrDialog);
! SetAttrEditor(id);
#endif
! }
! SetProxies(c);
! StartQueue();
}
#if FLEXT_SYS == FLEXT_SYS_JMAX
! void flext_base::cb_help(fts_object_t *c,int, fts_symbol_t, int, const fts_atom_t *) { thisObject(c)->m_help(); }
#else
! void flext_base::cb_help(t_class *c) { thisObject(c)->m_help(); }
! void flext_base::cb_loadbang(t_class *c) { thisObject(c)->m_loadbang(); }
#endif
void flext_base::m_help()
{
! // This should better be overloaded
! post("%s (using flext " FLEXT_VERSTR ") - compiled on %s %s",thisName(),__DATE__,__TIME__);
}
***************
*** 187,201 ****
{
#if FLEXT_SYS == FLEXT_SYS_MAX
! switch(msg) {
! case 1: //ASSIST_INLET:
! strcpy(s,arg < incnt && indesc[arg]?indesc[arg]:"");
! break;
! case 2: //ASSIST_OUTLET:
! if(arg < outcnt)
! strcpy(s,outdesc[arg]?outdesc[arg]:"");
! else
! strcpy(s,arg == outcnt && procattr?"Attributes":"");
! break;
! }
#endif
}
--- 187,201 ----
{
#if FLEXT_SYS == FLEXT_SYS_MAX
! switch(msg) {
! case 1: //ASSIST_INLET:
! strcpy(s,arg < incnt && indesc[arg]?indesc[arg]:"");
! break;
! case 2: //ASSIST_OUTLET:
! if(arg < outcnt)
! strcpy(s,outdesc[arg]?outdesc[arg]:"");
! else
! strcpy(s,arg == outcnt && procattr?"Attributes":"");
! break;
! }
#endif
}
Index: fllib.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fllib.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** fllib.cpp 23 Apr 2004 02:32:55 -0000 1.24
--- fllib.cpp 21 Jun 2004 13:58:19 -0000 1.25
***************
*** 171,175 ****
#endif
process_attributes = attr;
! setupfun();
}
--- 171,187 ----
#endif
process_attributes = attr;
!
! try {
! setupfun();
! }
! catch(std::exception &x) {
! error("%s - Exception at library setup: %s",name,x.what());
! }
! catch(const char *txt) {
! error("%s - Exception at library setup: %s",name,txt);
! }
! catch(...) {
! error("%s - Unknown exception at library setup",name);
! }
}
***************
*** 288,293 ****
}
! // call class setup function
! setupfun(clid);
}
--- 300,316 ----
}
! try {
! // call class setup function
! setupfun(clid);
! }
! catch(std::exception &x) {
! error("%s - Exception while initializing class: %s",idname,x.what());
! }
! catch(const char *txt) {
! error("%s - Exception while initializing class: %s",idname,txt);
! }
! catch(...) {
! error("%s - Unknown exception while initializing class",idname);
! }
}
***************
*** 371,433 ****
}
if(ok) {
! t_classid clid;
#if FLEXT_SYS == FLEXT_SYS_PD
! clid = lo->clss;
! obj = (flext_hdr *)::pd_new(lo->clss);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clid = lo;
! obj = (flext_hdr *)::newobject(lo->clss);
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! clid = lo->clss;
#else
#error
#endif
! flext_obj::m_holder = obj;
! flext_obj::m_holdname = s;
! flext_obj::m_holdattr = lo->attr;
! // get actual flext object (newfun calls "new flext_obj()")
! if(lo->argc >= 0)
! obj->data = lo->newfun(lo->argc,args);
! else
! obj->data = lo->newfun(argc,argv);
!
! flext_obj::m_holder = NULL;
! flext_obj::m_holdname = NULL;
! flext_obj::m_holdattr = false;
! ok = obj->data &&
! // check constructor exit flag
! obj->data->InitOk();
! if(ok) {
! if(lo->attr) {
! // DON'T convert eventual patcher args here... this is done by the actual attribute stuff
! // so that the initial $- or #- be preserved!
! // store creation args for attribute initialization (inside flext_base::Init())
! flext_obj::m_holdaargc = _argc_-argc;
! flext_obj::m_holdaargv = argv+argc;
! }
! else {
! flext_obj::m_holdaargc = 0;
! flext_obj::m_holdaargv = NULL;
! }
! // call virtual init function
! // here, inlets, outlets, methods and attributes can be set up
! ok = obj->data->Init();
! // call another virtual init function
! if(ok) ok = obj->data->Finalize();
! flext_obj::m_holdaargc = 0;
! flext_obj::m_holdaargv = NULL;
! }
! if(!ok) {
// there was some init error, free object
lo->freefun(obj);
--- 394,472 ----
}
+
if(ok) {
! try {
! t_classid clid;
#if FLEXT_SYS == FLEXT_SYS_PD
! clid = lo->clss;
! obj = (flext_hdr *)::pd_new(lo->clss);
#elif FLEXT_SYS == FLEXT_SYS_MAX
! clid = lo;
! obj = (flext_hdr *)::newobject(lo->clss);
#elif FLEXT_SYS == FLEXT_SYS_JMAX
! clid = lo->clss;
#else
#error
#endif
! flext_obj::m_holder = obj;
! flext_obj::m_holdname = s;
! flext_obj::m_holdattr = lo->attr;
! // get actual flext object (newfun calls "new flext_obj()")
! if(lo->argc >= 0)
! obj->data = lo->newfun(lo->argc,args);
! else
! obj->data = lo->newfun(argc,argv);
!
! flext_obj::m_holder = NULL;
! flext_obj::m_holdname = NULL;
! flext_obj::m_holdattr = false;
! ok = obj->data &&
! // check constructor exit flag
! obj->data->InitOk();
! if(ok) {
! if(lo->attr) {
! // DON'T convert eventual patcher args here... this is done by the actual attribute stuff
! // so that the initial $- or #- be preserved!
! // store creation args for attribute initialization (inside flext_base::Init())
! flext_obj::m_holdaargc = _argc_-argc;
! flext_obj::m_holdaargv = argv+argc;
! }
! else {
! flext_obj::m_holdaargc = 0;
! flext_obj::m_holdaargv = NULL;
! }
! // call virtual init function
! // here, inlets, outlets, methods and attributes can be set up
! ok = obj->data->Init();
! // call another virtual init function
! if(ok) ok = obj->data->Finalize();
! flext_obj::m_holdaargc = 0;
! flext_obj::m_holdaargv = NULL;
! }
! } //try
! catch(std::exception &x) {
! error("%s - Exception while creating object: %s",GetString(s),x.what());
! ok = false;
! }
! catch(const char *txt) {
! error("%s - Exception while creating object: %s",GetString(s),txt);
! ok = false;
! }
! catch(...) {
! error("%s - Unknown exception while creating object",GetString(s));
! ok = false;
! }
!
! if(!ok) {
// there was some init error, free object
lo->freefun(obj);
***************
*** 461,469 ****
if(lcl) {
! // call virtual exit function
! hdr->data->Exit();
! // now call object destructor and deallocate
! lcl->freefun(hdr);
}
#ifdef FLEXT_DEBUG
--- 500,519 ----
if(lcl) {
! try {
! // call virtual exit function
! hdr->data->Exit();
! // now call object destructor and deallocate
! lcl->freefun(hdr);
! } //try
! catch(std::exception &x) {
! error("%s - Exception while destroying object: %s",GetString(name),x.what());
! }
! catch(const char *txt) {
! error("%s - Exception while destroying object: %s",GetString(name),txt);
! }
! catch(...) {
! error("%s - Unknown exception while destroying object",GetString(name));
! }
}
#ifdef FLEXT_DEBUG
Index: flstdc.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flstdc.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** flstdc.h 23 Apr 2004 02:32:55 -0000 1.22
--- flstdc.h 21 Jun 2004 13:58:19 -0000 1.23
***************
*** 100,107 ****
--- 100,112 ----
+ // necessary for the old OS9 SDK
+ extern "C" {
+
#include "ext.h"
#include "ext_user.h"
#include "z_dsp.h"
+ } // extern "C"
+
#undef WIN_VERSION
Index: flitem.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flitem.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** flitem.cpp 6 Mar 2004 03:25:48 -0000 1.11
--- flitem.cpp 21 Jun 2004 13:58:19 -0000 1.12
***************
*** 19,23 ****
flext_base::Item::~Item()
{
! if(nxt) delete nxt;
}
--- 19,23 ----
flext_base::Item::~Item()
{
! if(nxt) delete nxt;
}
***************
*** 26,60 ****
flext_base::ItemSet::~ItemSet()
{
! for(iterator it = begin(); it != end(); ++it)
! if(it.data()) delete it.data();
}
flext_base::ItemCont::ItemCont():
! memsize(0),size(0),members(0),cont(NULL)
{}
flext_base::ItemCont::~ItemCont()
{
! if(cont) {
! for(int i = 0; i < size; ++i) delete cont[i];
! delete[] cont;
! }
}
void flext_base::ItemCont::Resize(int nsz)
{
! if(nsz > memsize) {
! int nmemsz = nsz+10; // increment maximum allocation size
! ItemSet **ncont = new ItemSet *[nmemsz]; // make new array
! if(cont) {
! memcpy(ncont,cont,size*sizeof(*cont)); // copy existing entries
! delete[] cont;
! }
! cont = ncont; // set current array
! memsize = nmemsz; // set new allocation size
! }
! // make new items
! while(size < nsz) cont[size++] = new ItemSet;
}
--- 26,60 ----
flext_base::ItemSet::~ItemSet()
{
! for(iterator it = begin(); it != end(); ++it)
! if(it.data()) delete it.data();
}
flext_base::ItemCont::ItemCont():
! memsize(0),size(0),members(0),cont(NULL)
{}
flext_base::ItemCont::~ItemCont()
{
! if(cont) {
! for(int i = 0; i < size; ++i) delete cont[i];
! delete[] cont;
! }
}
void flext_base::ItemCont::Resize(int nsz)
{
! if(nsz > memsize) {
! int nmemsz = nsz+10; // increment maximum allocation size
! ItemSet **ncont = new ItemSet *[nmemsz]; // make new array
! if(cont) {
! memcpy(ncont,cont,size*sizeof(*cont)); // copy existing entries
! delete[] cont;
! }
! cont = ncont; // set current array
! memsize = nmemsz; // set new allocation size
! }
! // make new items
! while(size < nsz) cont[size++] = new ItemSet;
}
***************
*** 63,73 ****
if(!Contained(inlet)) Resize(inlet+2);
ItemSet &set = GetInlet(inlet);
! Item *&lst = set[tag];
! if(!lst)
! lst = item;
! else
! for(;;)
! if(!lst->nxt) { lst->nxt = item; break; }
! else lst = lst->nxt;
members++;
}
--- 63,73 ----
if(!Contained(inlet)) Resize(inlet+2);
ItemSet &set = GetInlet(inlet);
! Item *&lst = set[tag];
! if(!lst)
! lst = item;
! else
! for(;;)
! if(!lst->nxt) { lst->nxt = item; break; }
! else lst = lst->nxt;
members++;
}
***************
*** 81,87 ****
for(Item *lit = it.data(),*prv = NULL; lit; prv = lit,lit = lit->nxt) {
if(lit == item) {
! if(prv) prv->nxt = lit->nxt;
! else it.data() = lit->nxt;
!
lit->nxt = NULL; delete lit;
return true;
--- 81,87 ----
for(Item *lit = it.data(),*prv = NULL; lit; prv = lit,lit = lit->nxt) {
if(lit == item) {
! if(prv) prv->nxt = lit->nxt;
! else it.data() = lit->nxt;
!
lit->nxt = NULL; delete lit;
return true;
Index: flcwmax.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flcwmax.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** flcwmax.h 23 May 2003 18:34:12 -0000 1.7
--- flcwmax.h 21 Jun 2004 13:58:19 -0000 1.8
***************
*** 17,21 ****
#ifndef __MWERKS__
! #error "This header file is for CodeWarrior only."
#endif
--- 17,21 ----
#ifndef __MWERKS__
! #error "This header file is for CodeWarrior only."
#endif
***************
*** 24,33 ****
#ifndef _CW_NOPRECOMP
! #include <MacHeaders.h>
#endif
#if /*__option(sym) ||*/ !__option(opt_dead_code)
! #pragma message("Optimization disabled -> Compiling a debug version (with FLEXT_DEBUG)")
! #define FLEXT_DEBUG
#endif
--- 24,33 ----
#ifndef _CW_NOPRECOMP
! #include <MacHeaders.h>
#endif
#if /*__option(sym) ||*/ !__option(opt_dead_code)
! #pragma message("Optimization disabled -> Compiling a debug version (with FLEXT_DEBUG)")
! #define FLEXT_DEBUG
#endif
Index: flatom_pr.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flatom_pr.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** flatom_pr.cpp 26 Mar 2004 03:22:11 -0000 1.17
--- flatom_pr.cpp 21 Jun 2004 13:58:19 -0000 1.18
***************
*** 26,79 ****
bool flext::PrintAtom(const t_atom &a,char *buf,int bufsz)
{
! bool ok = true;
! if(IsFloat(a)) {
! STD::snprintf(buf,bufsz,"%g",GetFloat(a));
! }
! else if(IsInt(a)) {
! STD::snprintf(buf,bufsz,"%i",GetInt(a));
! }
! else if(IsSymbol(a)) {
if(!FLEXT_ASSERT(GetSymbol(a))) *buf = 0;
else
STD::strncpy(buf,GetString(a),bufsz);
! }
! else if(IsPointer(a)) {
! STD::snprintf(buf,bufsz,"%p",GetPointer(a));
! }
#if FLEXT_SYS == FLEXT_SYS_PD
! else if(a.a_type == A_DOLLAR) {
! STD::snprintf(buf,bufsz,"$%d",a.a_w.w_index);
! }
! else if(a.a_type == A_DOLLSYM) {
! STD::snprintf(buf,bufsz,"$%s",GetString(a));
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! else if(a.a_type == A_DOLLAR) {
! STD::snprintf(buf,bufsz,"$%d",a.a_w.w_long);
! }
#else
//#pragma message("Not implemented")
#endif
! else {
error("flext: atom type unknown");
! ok = false;
! }
! return ok;
}
bool flext::PrintList(int argc,const t_atom *argv,char *buf,int bufsz)
{
! bool ok = true;
for(int i = 0; ok && i < argc && bufsz > 0; ++i) {
! if(i) { *(buf++) = ' '; --bufsz; } // prepend space
! if(PrintAtom(argv[i],buf,bufsz)) {
! int len = strlen(buf);
! buf += len,bufsz -= len;
! }
! else
! ok = false;
}
! *buf = 0;
return ok;
}
--- 26,79 ----
bool flext::PrintAtom(const t_atom &a,char *buf,int bufsz)
{
! bool ok = true;
! if(IsFloat(a)) {
! STD::snprintf(buf,bufsz,"%g",GetFloat(a));
! }
! else if(IsInt(a)) {
! STD::snprintf(buf,bufsz,"%i",GetInt(a));
! }
! else if(IsSymbol(a)) {
if(!FLEXT_ASSERT(GetSymbol(a))) *buf = 0;
else
STD::strncpy(buf,GetString(a),bufsz);
! }
! else if(IsPointer(a)) {
! STD::snprintf(buf,bufsz,"%p",GetPointer(a));
! }
#if FLEXT_SYS == FLEXT_SYS_PD
! else if(a.a_type == A_DOLLAR) {
! STD::snprintf(buf,bufsz,"$%d",a.a_w.w_index);
! }
! else if(a.a_type == A_DOLLSYM) {
! STD::snprintf(buf,bufsz,"$%s",GetString(a));
! }
#elif FLEXT_SYS == FLEXT_SYS_MAX
! else if(a.a_type == A_DOLLAR) {
! STD::snprintf(buf,bufsz,"$%d",a.a_w.w_long);
! }
#else
//#pragma message("Not implemented")
#endif
! else {
error("flext: atom type unknown");
! ok = false;
! }
! return ok;
}
bool flext::PrintList(int argc,const t_atom *argv,char *buf,int bufsz)
{
! bool ok = true;
for(int i = 0; ok && i < argc && bufsz > 0; ++i) {
! if(i) { *(buf++) = ' '; --bufsz; } // prepend space
! if(PrintAtom(argv[i],buf,bufsz)) {
! int len = strlen(buf);
! buf += len,bufsz -= len;
! }
! else
! ok = false;
}
! *buf = 0;
return ok;
}
***************
*** 82,118 ****
bool flext::ScanAtom(t_atom &a,const char *buf)
{
! // skip whitespace
! while(*buf && isspace(*buf)) ++buf;
! if(!*buf) return false;
! char tmp[1024];
! strcpy(tmp,buf);
! char *c = tmp;
! // check for word type (s = 0,1,2 ... int,float,symbol)
! int s = 0;
! for(; *c && !isspace(*c); ++c) {
! if(!isdigit(*c))
! s = (*c != '.' || s == 1)?2:1;
! }
! switch(s) {
! case 0: // integer
#if FLEXT_SYS == FLEXT_SYS_MAX
! SetInt(a,atol(tmp));
! break;
#endif
! case 1: // float
! SetFloat(a,(float)atof(tmp));
! break;
! default: { // anything else is a symbol
! char t = *c; *c = 0;
! SetString(a,tmp);
! *c = t;
! break;
! }
! }
! return true;
}
--- 82,118 ----
bool flext::ScanAtom(t_atom &a,const char *buf)
{
! // skip whitespace
! while(*buf && isspace(*buf)) ++buf;
! if(!*buf) return false;
! char tmp[1024];
! strcpy(tmp,buf);
! char *c = tmp;
! // check for word type (s = 0,1,2 ... int,float,symbol)
! int s = 0;
! for(; *c && !isspace(*c); ++c) {
! if(!isdigit(*c))
! s = (*c != '.' || s == 1)?2:1;
! }
! switch(s) {
! case 0: // integer
#if FLEXT_SYS == FLEXT_SYS_MAX
! SetInt(a,atol(tmp));
! break;
#endif
! case 1: // float
! SetFloat(a,(float)atof(tmp));
! break;
! default: { // anything else is a symbol
! char t = *c; *c = 0;
! SetString(a,tmp);
! *c = t;
! break;
! }
! }
! return true;
}
Index: fldefs_methcall.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldefs_methcall.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** fldefs_methcall.h 12 Dec 2003 03:32:56 -0000 1.2
--- fldefs_methcall.h 21 Jun 2004 13:58:19 -0000 1.3
***************
*** 18,24 ****
! /*! \defgroup FLEXT_D_CALLMETHOD Call flext methods manually
\ingroup FLEXT_D_METHOD
! @{
*/
--- 18,24 ----
! /*! \defgroup FLEXT_D_CALLMETHOD Call flext methods manually
\ingroup FLEXT_D_METHOD
! @{
*/
Index: fldefs_attradd.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldefs_attradd.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** fldefs_attradd.h 12 Dec 2003 03:32:56 -0000 1.2
--- fldefs_attradd.h 21 Jun 2004 13:58:19 -0000 1.3
***************
*** 18,44 ****
! /*! \defgroup FLEXT_D_CADDATTR Announce object attributes at class scope
\ingroup FLEXT_D_ATTRIB
! \note These can only be used at class construction time
! @{
*/
//! Add handler for a gettable attribute
! #define FLEXT_CADDATTR_GET(CL,NAME,GFUN) \
\
AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable attribute
! #define FLEXT_CADDATTR_SET(CL,NAME,SFUN) \
\
AddAttrib(CL,NAME,NULL,(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
! #define FLEXT_CADDATTR_VAR(CL,NAME,GFUN,SFUN) \
\
AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
! #define FLEXT_CADDATTR_VAR1(CL,NAME,FUN) \
\
AddAttrib(CL,NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN)))
--- 18,44 ----
! /*! \defgroup FLEXT_D_CADDATTR Announce object attributes at class scope
\ingroup FLEXT_D_ATTRIB
! \note These can only be used at class construction time
! @{
*/
//! Add handler for a gettable attribute
! #define FLEXT_CADDATTR_GET(CL,NAME,GFUN) \
\
AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable attribute
! #define FLEXT_CADDATTR_SET(CL,NAME,SFUN) \
\
AddAttrib(CL,NAME,NULL,(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
! #define FLEXT_CADDATTR_VAR(CL,NAME,GFUN,SFUN) \
\
AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
! #define FLEXT_CADDATTR_VAR1(CL,NAME,FUN) \
\
AddAttrib(CL,NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN)))
***************
*** 46,65 ****
//! Add handler for a gettable enum attribute
! #define FLEXT_CADDATTR_GET_E(CL,NAME,GFUN) \
\
AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable enum attribute
! #define FLEXT_CADDATTR_SET_E(CL,NAME,SFUN) \
\
AddAttrib(CL,NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
! #define FLEXT_CADDATTR_VAR_E(CL,NAME,GFUN,SFUN) \
\
AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
! #define FLEXT_CADDATTR_VAR1_E(CL,NAME,FUN) \
\
AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN)))
--- 46,65 ----
//! Add handler for a gettable enum attribute
! #define FLEXT_CADDATTR_GET_E(CL,NAME,GFUN) \
\
AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable enum attribute
! #define FLEXT_CADDATTR_SET_E(CL,NAME,SFUN) \
\
AddAttrib(CL,NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
! #define FLEXT_CADDATTR_VAR_E(CL,NAME,GFUN,SFUN) \
\
AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
! #define FLEXT_CADDATTR_VAR1_E(CL,NAME,FUN) \
\
AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN)))
***************
*** 68,95 ****
! /*! \defgroup FLEXT_D_ADDATTR Announce object attributes
\ingroup FLEXT_D_ATTRIB
! \note These can only be used at object construction time
! \note (in constructor or in Init() function before call to parent's Init())
! @{
*/
//! Add handler for a gettable attribute
! #define FLEXT_ADDATTR_GET(NAME,GFUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable attribute
! #define FLEXT_ADDATTR_SET(NAME,SFUN) \
\
AddAttrib(NAME,NULL,(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
! #define FLEXT_ADDATTR_VAR(NAME,GFUN,SFUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
! #define FLEXT_ADDATTR_VAR1(NAME,FUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN)))
--- 68,95 ----
! /*! \defgroup FLEXT_D_ADDATTR Announce object attributes
\ingroup FLEXT_D_ATTRIB
! \note These can only be used at object construction time
! \note (in constructor or in Init() function before call to parent's Init())
! @{
*/
//! Add handler for a gettable attribute
! #define FLEXT_ADDATTR_GET(NAME,GFUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable attribute
! #define FLEXT_ADDATTR_SET(NAME,SFUN) \
\
AddAttrib(NAME,NULL,(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
! #define FLEXT_ADDATTR_VAR(NAME,GFUN,SFUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
! #define FLEXT_ADDATTR_VAR1(NAME,FUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN)))
***************
*** 97,116 ****
//! Add handler for a gettable enum attribute
! #define FLEXT_ADDATTR_GET_E(NAME,GFUN) \
\
AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable enum attribute
! #define FLEXT_ADDATTR_SET_E(NAME,SFUN) \
\
AddAttrib(NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
! #define FLEXT_ADDATTR_VAR_E(NAME,GFUN,SFUN) \
\
AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
! #define FLEXT_ADDATTR_VAR1_E(NAME,FUN) \
\
AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN)))
--- 97,116 ----
//! Add handler for a gettable enum attribute
! #define FLEXT_ADDATTR_GET_E(NAME,GFUN) \
\
AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable enum attribute
! #define FLEXT_ADDATTR_SET_E(NAME,SFUN) \
\
AddAttrib(NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
! #define FLEXT_ADDATTR_VAR_E(NAME,GFUN,SFUN) \
\
AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
! #define FLEXT_ADDATTR_VAR1_E(NAME,FUN) \
\
AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN)))