diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-07-19 13:17:50 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-07-19 13:17:50 +0000 |
commit | ad51a5256a81891061f4c1cc729c718029beb128 (patch) | |
tree | cc7472041e4f67c1d8f31b0d4c4981d27fbe5039 /externals/grill | |
parent | 35a59e7dbce7f5cd6fb8c26e40fc66dfd8384cce (diff) |
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
svn path=/trunk/; revision=3359
Diffstat (limited to 'externals/grill')
-rw-r--r-- | externals/grill/flext/buildsys/version.inc | 2 | ||||
-rw-r--r-- | externals/grill/flext/changes.txt | 3 | ||||
-rw-r--r-- | externals/grill/flext/readme.txt | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flclass.h | 13 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.cpp | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.h | 4 | ||||
-rwxr-xr-x | externals/grill/flext/source/flmeth.cpp | 8 | ||||
-rwxr-xr-x | externals/grill/flext/source/flmsg.cpp | 27 | ||||
-rwxr-xr-x | externals/grill/flext/source/flproxy.cpp | 67 |
9 files changed, 34 insertions, 94 deletions
diff --git a/externals/grill/flext/buildsys/version.inc b/externals/grill/flext/buildsys/version.inc index 90913585..c91ea283 100644 --- a/externals/grill/flext/buildsys/version.inc +++ b/externals/grill/flext/buildsys/version.inc @@ -1,3 +1,3 @@ FLEXTMAJOR=0 FLEXTMINOR=5 -FLEXTMICRO=0 +FLEXTMICRO=1 diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt index 78352f2f..46277b4a 100644 --- a/externals/grill/flext/changes.txt +++ b/externals/grill/flext/changes.txt @@ -8,6 +8,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. Version history: +0.5.1: +- optimizations for message handling and memory footprint + 0.5.0: - fixes for 64 bit builds (size_t is integer type of pointer size) - finally added a autoconf system (many many thanks to Tim Blechmann) diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt index fb6b21c5..76717fc1 100644 --- a/externals/grill/flext/readme.txt +++ b/externals/grill/flext/readme.txt @@ -8,7 +8,7 @@ This package seeks to encourage the development of open source software for the pd and Max/MSP platforms. Donations for further development of the package are highly appreciated. -https://www.paypal.com/xclick/business=t.grill%40gmx.net&item_name=flext&no_note=1&tax=0¤cy_code=EUR +https://www.paypal.com/xclick/business=gr%40grrrr.org&item_name=flext&no_note=1&tax=0¤cy_code=EUR ---------------------------------------------------------------------------- diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index ff9e8a26..d7158d3d 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -333,7 +333,7 @@ public: @{ */ - void AddMethodDef(int inlet,const t_symbol *tag = NULL); // call virtual function for tag && inlet + 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)); } void AddMethod(int inlet,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(ThMeths(),inlet,sym_list,(methfun)m,a_list,a_null); } @@ -496,7 +496,7 @@ public: */ //! 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); } + 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 bool StopThreads(); @@ -803,7 +803,7 @@ public: pxbnd_object *px; }; - ItemCont *ThMeths() { return &methhead; } + ItemCont *ThMeths() { if(!methhead) methhead = new ItemCont; return methhead; } static ItemCont *ClMeths(t_classid c); static void AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fun,metharg tp,...); @@ -866,7 +866,7 @@ private: typedef bool (*methfun_4)(flext_base *c,t_any &,t_any &,t_any &,t_any &); typedef bool (*methfun_5)(flext_base *c,t_any &,t_any &,t_any &,t_any &,t_any &); - mutable ItemCont methhead; + mutable ItemCont *methhead; mutable ItemCont *bindhead; bool FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv); @@ -1019,12 +1019,7 @@ private: // 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 static int cb_click(t_gobj *z, struct _glist *glist,int xpix, int ypix, int shift, int alt, int dbl, int doit); diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index 91228a1b..5eabb426 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -34,6 +34,7 @@ flext_base::FLEXT_CLASSDEF(flext_base)() { FLEXT_LOG1("%s - flext logging is on",thisName()); + methhead = NULL; bindhead = NULL; if(HasAttributes()) { @@ -69,6 +70,7 @@ flext_base::~FLEXT_CLASSDEF(flext_base)() // 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; diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h index a55e2b67..64db2b42 100644 --- a/externals/grill/flext/source/flext.h +++ b/externals/grill/flext/source/flext.h @@ -23,10 +23,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. */ //! \brief flext version number -#define FLEXT_VERSION 500 +#define FLEXT_VERSION 501 //! \brief flext version string -#define FLEXT_VERSTR "0.5.0" +#define FLEXT_VERSTR "0.5.1pre" //! @} diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp index 2da2b3a2..c391f950 100755 --- a/externals/grill/flext/source/flmeth.cpp +++ b/externals/grill/flext/source/flmeth.cpp @@ -35,12 +35,6 @@ void flext_base::MethItem::SetArgs(methfun _fun,int _argc,metharg *_args) argc = _argc,args = _args; } - -void flext_base::AddMethodDef(int inlet,const t_symbol *tag) -{ - methhead.Add(new MethItem,tag,inlet); -} - /*! \brief Add a method to the queue */ void flext_base::AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fun,metharg tp,...) @@ -95,7 +89,7 @@ void flext_base::ListMethods(AtomList &la,int inlet) const int i; for(i = 0; i <= 1; ++i) { - ItemCont *a = i?&methhead:clmethhead; + ItemCont *a = i?methhead:clmethhead; if(a && a->Contained(inlet)) { ItemSet &ai = a->GetInlet(inlet); for(ItemSet::iterator as(ai); as; ++as) { diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp index d8a893b1..1ab4b4a7 100755 --- a/externals/grill/flext/source/flmsg.cpp +++ b/externals/grill/flext/source/flmsg.cpp @@ -103,22 +103,6 @@ bool flext_base::TryMethTag(Item *lst,const t_symbol *tag,int argc,const t_atom return false; } -/* -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) { @@ -143,11 +127,11 @@ bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *arg ItemCont *clmethhead = ClMeths(thisClassId()); // search for exactly matching tag - if((lst = methhead.FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true; + 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((lst = methhead.FindList(s,-1)) != NULL && TryMethTag(lst,s,argc,argv)) return true; + 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; return false; @@ -158,11 +142,11 @@ bool flext_base::FindMethAny(int inlet,const t_symbol *s,int argc,const t_atom * Item *lst; ItemCont *clmethhead = ClMeths(thisClassId()); - if((lst = methhead.FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true; + 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((lst = methhead.FindList(sym_anything,-1)) != NULL && TryMethAny(lst,s,argc,argv)) return true; + 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; return false; @@ -285,13 +269,12 @@ end: 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; } 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); } diff --git a/externals/grill/flext/source/flproxy.cpp b/externals/grill/flext/source/flproxy.cpp index d650e42e..ffecd405 100755 --- a/externals/grill/flext/source/flproxy.cpp +++ b/externals/grill/flext/source/flproxy.cpp @@ -33,10 +33,7 @@ void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *ar } #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); \ -} +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) \ add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT) @@ -45,63 +42,38 @@ add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT) 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); + // check if inlet allows anything (or list) + int ci = ((flext_hdr *)c)->curinlet; + thisObject(c)->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); + t_atom atom; SetInt(atom,v); + int ci = ((flext_hdr *)c)->curinlet; + thisObject(c)->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); + 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_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 - void flext_base::cb_px_bang(t_class *c) { // check if inlet allows bang - cb_px_anything(c,sym_bang,0,NULL); + 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) { 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; } +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) \ add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \ @@ -139,11 +111,6 @@ void flext_base::SetProxies(t_class *c) #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); @@ -154,14 +121,12 @@ void flext_base::SetProxies(t_class *c) ADD_IN_FT(7); ADD_IN_FT(8); ADD_IN_FT(9); -#endif } #elif FLEXT_SYS == FLEXT_SYS_JMAX 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); + thisObject(c)->CbMethodHandler(winlet,s,argc,argv); } void flext_base::SetProxies(t_class *c) @@ -170,5 +135,3 @@ void flext_base::SetProxies(t_class *c) } #endif - - |