Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2622/source
Modified Files:
flclass.h flext.cpp flext.h flmeth.cpp flmsg.cpp flproxy.cpp
Log Message:
upped version number
optimizations for message handling and memory footprint
made flext::Forward threadsafe
digest one-element list messages as single atoms
simplified message analysis
Index: flext.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flext.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** flext.h 6 Jul 2005 16:08:19 -0000 1.26
--- flext.h 19 Jul 2005 13:17:50 -0000 1.27
***************
*** 24,31 ****
//! \brief flext version number
! #define FLEXT_VERSION 500
//! \brief flext version string
! #define FLEXT_VERSTR "0.5.0"
//! @}
--- 24,31 ----
//! \brief flext version number
! #define FLEXT_VERSION 501
//! \brief flext version string
! #define FLEXT_VERSTR "0.5.1pre"
//! @}
Index: flext.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flext.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** flext.cpp 23 May 2005 16:52:44 -0000 1.36
--- flext.cpp 19 Jul 2005 13:17:50 -0000 1.37
***************
*** 35,38 ****
--- 35,39 ----
FLEXT_LOG1("%s - flext logging is on",thisName());
+ methhead = NULL;
bindhead = NULL;
***************
*** 70,73 ****
--- 71,75 ----
// delete message lists
if(bindhead) delete bindhead; // ATTENTION: the object must free all memory associated to bindings itself
+ if(methhead) delete methhead;
if(attrhead) delete attrhead;
if(attrdata) delete attrdata;
Index: flproxy.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flproxy.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** flproxy.cpp 13 Mar 2005 04:56:39 -0000 1.9
--- flproxy.cpp 19 Jul 2005 13:17:50 -0000 1.10
***************
*** 34,41 ****
#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)->CbMethodHandler(IX,sym_float,1,&atom); \
! }
#define ADD_IN_FT(IX) \
--- 34,38 ----
#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)->CbMethodHandler(IX,sym_float,1,&atom); }
#define ADD_IN_FT(IX) \
***************
*** 46,85 ****
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->CbMethodHandler(ci,s,argc,argv);
}
- #if 0 //FLEXT_OS == FLEXT_OS_WIN
- // could also work for OSX!
-
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->CbMethodHandler(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->CbMethodHandler(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);
}
--- 43,57 ----
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)
! int ci = ((flext_hdr *)c)->curinlet;
! thisObject(c)->CbMethodHandler(ci,s,argc,argv);
}
void flext_base::cb_px_int(t_class *c,long v)
{
// check if inlet allows int type
! t_atom atom; SetInt(atom,v);
! int ci = ((flext_hdr *)c)->curinlet;
! thisObject(c)->CbMethodHandler(ci,sym_int,1,&atom);
}
***************
*** 87,106 ****
{
// check if inlet allows float type
! t_atom atom;
! SetFloat(atom,v);
! cb_px_anything(c,sym_float,1,&atom);
}
- #endif
void flext_base::cb_px_bang(t_class *c)
{
// check if inlet allows bang
! cb_px_anything(c,sym_bang,0,NULL);
}
#define DEF_IN_FT(IX) \
! void flext_base::cb_px_in ## IX(t_class *c,long v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_int(c,v); ci = 0; } \
! void flext_base::cb_px_ft ## IX(t_class *c,double v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_float(c,v); ci = 0; }
#define ADD_IN_FT(IX) \
--- 59,78 ----
{
// check if inlet allows float type
! t_atom atom; SetFloat(atom,v);
! int ci = ((flext_hdr *)c)->curinlet;
! thisObject(c)->CbMethodHandler(ci,sym_float,1,&atom);
}
void flext_base::cb_px_bang(t_class *c)
{
// check if inlet allows bang
! int ci = ((flext_hdr *)c)->curinlet;
! thisObject(c)->CbMethodHandler(ci,sym_bang,0,NULL);
}
#define DEF_IN_FT(IX) \
! void flext_base::cb_px_in ## IX(t_class *c,long v) { t_atom atom; SetInt(atom,v); thisObject(c)->CbMethodHandler(IX,sym_int,1,&atom); } \
! void flext_base::cb_px_ft ## IX(t_class *c,double v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); }
#define ADD_IN_FT(IX) \
***************
*** 140,148 ****
#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);
--- 112,115 ----
***************
*** 155,159 ****
ADD_IN_FT(8);
ADD_IN_FT(9);
- #endif
}
--- 122,125 ----
***************
*** 161,166 ****
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->CbMethodHandler(winlet,s,argc,argv);
}
--- 127,131 ----
void flext_base::jmax_proxy(fts_object_t *c, int winlet, fts_symbol_t s, int argc, const fts_atom_t *argv)
{
! thisObject(c)->CbMethodHandler(winlet,s,argc,argv);
}
***************
*** 171,174 ****
#endif
-
-
--- 136,137 ----
Index: flmsg.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmsg.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** flmsg.cpp 7 Jun 2005 14:13:43 -0000 1.17
--- flmsg.cpp 19 Jul 2005 13:17:50 -0000 1.18
***************
*** 104,123 ****
}
- /*
- bool flext_base::TryMethSym(Item *lst,const t_symbol *s)
- {
- for(; lst; lst = lst->nxt) {
- 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;
- }
- */
bool flext_base::TryMethAny(Item *lst,const t_symbol *s,int argc,const t_atom *argv)
--- 104,107 ----
***************
*** 144,152 ****
// 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 nothing found try any inlet
! if((lst = methhead.FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
if((lst = clmethhead->FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
--- 128,136 ----
// search for exactly matching tag
! if(methhead && (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 nothing found try any inlet
! if(methhead && (lst = methhead->FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
if((lst = clmethhead->FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
***************
*** 159,167 ****
ItemCont *clmethhead = ClMeths(thisClassId());
! 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
! if((lst = methhead.FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
if((lst = clmethhead->FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
--- 143,151 ----
ItemCont *clmethhead = ClMeths(thisClassId());
! if(methhead && (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
! if(methhead && (lst = methhead->FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
if((lst = clmethhead->FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
***************
*** 286,292 ****
bool flext_base::m_method_(int inlet,const t_symbol *s,int argc,const t_atom *argv)
{
- //#ifdef FLEXT_DEBUG
post("%s: message unhandled - inlet:%i args:%i symbol:%s",thisName(),inlet,argc,s?GetString(s):"");
- //#endif
return false;
}
--- 270,274 ----
***************
*** 294,297 ****
--- 276,280 ----
bool flext_base::CbMethodResort(int inlet,const t_symbol *s,int argc,const t_atom *argv)
{
+ // call deprecated version
return m_method_(inlet,s,argc,argv);
}
Index: flmeth.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmeth.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** flmeth.cpp 23 May 2005 16:52:45 -0000 1.19
--- flmeth.cpp 19 Jul 2005 13:17:50 -0000 1.20
***************
*** 36,45 ****
}
-
- void flext_base::AddMethodDef(int inlet,const t_symbol *tag)
- {
- methhead.Add(new MethItem,tag,inlet);
- }
-
/*! \brief Add a method to the queue
*/
--- 36,39 ----
***************
*** 96,100 ****
int i;
for(i = 0; i <= 1; ++i) {
! ItemCont *a = i?&methhead:clmethhead;
if(a && a->Contained(inlet)) {
ItemSet &ai = a->GetInlet(inlet);
--- 90,94 ----
int i;
for(i = 0; i <= 1; ++i) {
! ItemCont *a = i?methhead:clmethhead;
if(a && a->Contained(inlet)) {
ItemSet &ai = a->GetInlet(inlet);
Index: flclass.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flclass.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** flclass.h 6 Jul 2005 16:08:19 -0000 1.61
--- flclass.h 19 Jul 2005 13:17:50 -0000 1.62
***************
*** 334,338 ****
*/
! void AddMethodDef(int inlet,const t_symbol *tag = NULL); // call virtual function for tag && inlet
void AddMethodDef(int inlet,const char *tag = NULL) { AddMethodDef(inlet,MakeSymbol(tag)); }
--- 334,338 ----
*/
! void AddMethodDef(int inlet,const t_symbol *tag = NULL) { ThMeths()->Add(new MethItem,tag,inlet); }
void AddMethodDef(int inlet,const char *tag = NULL) { AddMethodDef(inlet,MakeSymbol(tag)); }
***************
*** 497,501 ****
//! Start a thread for this object
! bool StartThread(void (*meth)(thr_params *p),thr_params *p,const char *) { p->cl = this; return flext::LaunchThread(meth,p); }
//! Terminate all threads of this object
--- 497,501 ----
//! Start a thread for this object
! bool StartThread(void (*meth)(thr_params *p),thr_params *p,const char * = NULL) { p->cl = this; return flext::LaunchThread(meth,p); }
//! Terminate all threads of this object
***************
*** 804,808 ****
};
! ItemCont *ThMeths() { return &methhead; }
static ItemCont *ClMeths(t_classid c);
--- 804,808 ----
};
! ItemCont *ThMeths() { if(!methhead) methhead = new ItemCont; return methhead; }
static ItemCont *ClMeths(t_classid c);
***************
*** 867,871 ****
typedef bool (*methfun_5)(flext_base *c,t_any &,t_any &,t_any &,t_any &,t_any &);
! mutable ItemCont methhead;
mutable ItemCont *bindhead;
--- 867,871 ----
typedef bool (*methfun_5)(flext_base *c,t_any &,t_any &,t_any &,t_any &,t_any &);
! mutable ItemCont *methhead;
mutable ItemCont *bindhead;
***************
*** 1020,1029 ****
// callback functions
- #if FLEXT_SYS == FLEXT_SYS_JMAX
- static void cb_help(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at);
- #else
- static void cb_help(t_class *c);
static void cb_loadbang(t_class *c);
- #endif
#if FLEXT_SYS == FLEXT_SYS_PD
--- 1020,1024 ----