aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r--externals/grill/flext/source/flclass.h13
-rw-r--r--externals/grill/flext/source/flext.cpp2
-rw-r--r--externals/grill/flext/source/flext.h4
-rwxr-xr-xexternals/grill/flext/source/flmeth.cpp8
-rwxr-xr-xexternals/grill/flext/source/flmsg.cpp27
-rwxr-xr-xexternals/grill/flext/source/flproxy.cpp67
6 files changed, 29 insertions, 92 deletions
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
-
-