Commit b7528b83 authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@444 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 74692d65
......@@ -101,8 +101,8 @@ Version history:
0.4.1:
- full port for Max@OSX
- totally redesigned message and attribute handling: now hashed and a much more efficient
- introduced "Finalize" virtual method, called after all "Init" methods... does inlet/outlet/method/attribute setup
- completely redesigned message and attribute handling: now hashed and a much more efficient
- introduced "Finalize" virtual method, called after all "Init" methods
- fixed crash issue in flext_dsp when there are NO signal inlets or outlets defined
(this is possibly only a problem for the signal2 tutorial example)
- added flext::GetType(t_atom &), flext::ZeroMem
......
......@@ -21,10 +21,9 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define STD
#endif
flext_base::attritem::attritem(const t_symbol *t,metharg tp,methfun gf,methfun sf):
item(t),argtp(tp),
gfun(gf),sfun(sf)
// ,nxt(NULL)
flext_base::attritem::attritem(const t_symbol *t,metharg tp,methfun f,bool g):
item(t,0,NULL),argtp(tp),
fun(f),isget(g)
{
}
......@@ -54,13 +53,31 @@ void flext_base::AddAttrItem(attritem *m)
//! Add get and set attributes
void flext_base::AddAttrib(itemarr *aa,itemarr *ma,const char *attr,metharg tp,methfun gfun,methfun sfun)
{
aa->Add(new attritem(MakeSymbol(attr),tp,gfun,sfun));
if(sfun) AddMethod(ma,0,attr,(methfun)cb_SetAttrib,a_any,a_null); // SET
if(gfun) {
const t_symbol *asym = MakeSymbol(attr);
// if(sfun) // if commented out, there will be a warning at run-time (more user-friendly)
{
attritem *a = new attritem(asym,tp,sfun,false);
aa->Add(a);
// bind attribute to a method
methitem *mi = new methitem(0,asym,a);
mi->SetArgs(sfun,1,&tp);
ma->Add(mi);
}
// if(gfun) // if commented out, there will be a warning at run-time (more user-friendly)
{
attritem *a = new attritem(asym,tp,gfun,true);
aa->Add(a);
static char tmp[256] = "get";
strcpy(tmp+3,attr);
AddMethod(ma,0,tmp,(methfun)cb_GetAttrib,a_any,a_null); // GET
// bind attribute to a method
methitem *mi = new methitem(0,MakeSymbol(tmp),a);
mi->SetArgs(gfun,0,NULL);
ma->Add(mi);
}
}
......@@ -126,58 +143,69 @@ bool flext_base::ListAttrib()
bool flext_base::SetAttrib(const t_symbol *tag,int argc,const t_atom *argv)
{
// search for attribute
// search for matching attribute
attritem *a = (attritem *)attrhead->Find(tag);
if(!a) a = (attritem *)clattrhead->Find(tag);
if(a) {
if(a->sfun) {
bool ok = true;
while(a && (a->tag != tag || a->inlet != 0 || a->isget)) a = (attritem *)a->nxt;
if(!a) {
a = (attritem *)clattrhead->Find(tag);
while(a && (a->tag != tag || a->inlet != 0 || a->isget)) a = (attritem *)a->nxt;
}
AtomList la;
t_any any;
switch(a->argtp) {
case a_float:
if(argc == 1 && CanbeFloat(argv[0])) {
any.ft = GetAFloat(argv[0]);
((methfun_1)a->sfun)(this,any);
}
else ok = false;
break;
case a_int:
if(argc == 1 && CanbeInt(argv[0])) {
any.it = GetAInt(argv[0]);
((methfun_1)a->sfun)(this,any);
}
else ok = false;
break;
case a_symbol:
if(argc == 1 && IsSymbol(argv[0])) {
any.st = GetSymbol(argv[0]);
((methfun_1)a->sfun)(this,any);
}
else ok = false;
break;
case a_LIST:
any.vt = &(la(argc,argv));
((methfun_1)a->sfun)(this,any);
break;
default:
ERRINTERNAL();
}
if(a)
return SetAttrib(a,argc,argv);
else {
error("%s - %s: attribute not found",thisName(),GetString(tag));
return true;
}
}
if(!ok)
post("%s - wrong arguments for attribute %s",thisName(),GetString(tag));
bool flext_base::SetAttrib(attritem *a,int argc,const t_atom *argv)
{
if(a->fun) {
bool ok = true;
AtomList la;
t_any any;
switch(a->argtp) {
case a_float:
if(argc == 1 && CanbeFloat(argv[0])) {
any.ft = GetAFloat(argv[0]);
((methfun_1)a->fun)(this,any);
}
else ok = false;
break;
case a_int:
if(argc == 1 && CanbeInt(argv[0])) {
any.it = GetAInt(argv[0]);
((methfun_1)a->fun)(this,any);
}
else ok = false;
break;
case a_symbol:
if(argc == 1 && IsSymbol(argv[0])) {
any.st = GetSymbol(argv[0]);
((methfun_1)a->fun)(this,any);
}
else ok = false;
break;
case a_LIST:
any.vt = &(la(argc,argv));
((methfun_1)a->fun)(this,any);
break;
default:
ERRINTERNAL();
}
else
post("%s - attribute %s has no get method",thisName(),GetString(tag));
if(!ok)
post("%s - wrong arguments for attribute %s",thisName(),GetString(a->tag));
}
else
error("%s - %s: attribute not found",thisName(),GetString(tag));
post("%s - attribute %s has no get method",thisName(),GetString(a->tag));
return true;
}
bool flext_base::GetAttrib(const t_symbol *tag,int argc,const t_atom *argv)
/*
bool flext_base::GetAttrib(const t_symbol *tag)
{
if(argc)
post("%s - %s: arguments ignored",thisName(),GetString(tag));
......@@ -188,51 +216,56 @@ bool flext_base::GetAttrib(const t_symbol *tag,int argc,const t_atom *argv)
return false;
}
#endif
// main attribute tag
const t_symbol *mtag = MakeSymbol(GetString(tag)+3);
const t_symbol *mtag = MakeSymbol(GetString(a->tag)+3);
// search for attribute
attritem *a = (attritem *)attrhead->Find(mtag);
if(!a) a = (attritem *)clattrhead->Find(mtag);
}
*/
bool flext_base::GetAttrib(attritem *a)
{
// main attribute tag
if(a) {
if(a->gfun) {
if(a->fun) {
AtomList la;
t_any any;
switch(a->argtp) {
case a_float: {
((methfun_1)a->gfun)(this,any);
((methfun_1)a->fun)(this,any);
la(1);
SetFloat(la[0],any.ft);
break;
}
case a_int: {
((methfun_1)a->gfun)(this,any);
((methfun_1)a->fun)(this,any);
la(1);
SetInt(la[0],any.it);
break;
}
case a_symbol: {
((methfun_1)a->gfun)(this,any);
((methfun_1)a->fun)(this,any);
la(1);
SetSymbol(la[0],any.st);
break;
}
case a_LIST: {
any.vt = &la;
((methfun_1)a->gfun)(this,any);
((methfun_1)a->fun)(this,any);
break;
}
default:
ERRINTERNAL();
}
ToOutAnything(outattr,mtag,la.Count(),la.Atoms());
ToOutAnything(outattr,a->tag,la.Count(),la.Atoms());
}
else
post("%s - attribute %s has no set method",thisName(),GetString(mtag));
post("%s - attribute %s has no set method",thisName(),GetString(a->tag));
}
else
error("%s - %s: attribute not found",thisName(),GetString(mtag));
error("%s - %s: attribute not found",thisName(),GetString(a->tag));
return true;
}
......@@ -516,13 +516,18 @@ protected:
public:
class attritem;
class item {
public:
item(const t_symbol *t,int inl = 0);
item(const t_symbol *t,int inl,attritem *a);
~item();
bool IsAttr() const { return attr != NULL; }
const t_symbol *tag;
int inlet;
attritem *attr;
item *nxt;
};
......@@ -551,7 +556,7 @@ protected:
class methitem:
public item {
public:
methitem(int inlet,const t_symbol *tg);
methitem(int inlet,const t_symbol *tg,attritem *conn = NULL);
~methitem();
void SetArgs(methfun fun,int argc,metharg *args);
......@@ -565,11 +570,12 @@ protected:
class attritem:
public item {
public:
attritem(const t_symbol *tag,metharg tp,methfun gfun,methfun sfun);
attritem(const t_symbol *tag,metharg tp,methfun fun,bool get);
~attritem();
bool isget;
metharg argtp;
methfun gfun,sfun;
methfun fun;
};
//! @} FLEXT_CLASS
......@@ -634,12 +640,14 @@ private:
bool InitAttrib(int argc,const t_atom *argv);
bool ListAttrib();
bool GetAttrib(const t_symbol *s,int argc,const t_atom *argv);
// bool GetAttrib(const t_symbol *s);
bool GetAttrib(attritem *a);
bool SetAttrib(const t_symbol *s,int argc,const t_atom *argv);
bool SetAttrib(attritem *a,int argc,const t_atom *argv);
static bool cb_ListAttrib(flext_base *c) { return c->ListAttrib(); }
static bool cb_GetAttrib(flext_base *c,const t_symbol *s,int argc,const t_atom *argv) { return c->GetAttrib(s,argc,argv); }
static bool cb_SetAttrib(flext_base *c,const t_symbol *s,int argc,const t_atom *argv) { return c->SetAttrib(s,argc,argv); }
// static bool cb_GetAttrib(flext_base *c,const t_symbol *s,int argc,const t_atom *argv) { return c->GetAttrib(s,argc,argv); }
// static bool cb_SetAttrib(flext_base *c,const t_symbol *s,int argc,const t_atom *argv) { return c->SetAttrib(s,argc,argv); }
// queue stuff
......
......@@ -251,6 +251,9 @@ REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
// deprecated stuff
/*! \defgroup FLEXT_D_DEPRECATED Deprecated definitions
@{
#define FLEXT_NEW_G FLEXT_NEW_V
#define FLEXT_NEW_TILDE FLEXT_NEW_DSP
......@@ -268,6 +271,10 @@ REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
#define FLEXT_LIB_TILDE_3 FLEXT_LIB_DSP_3
#define FLEXT_TILDE_SETUP FLEXT_DSP_SETUP
//! @} FLEXT_D_DEPRECATED
/*! \defgroup FLEXT_D_LIBRARY Definitions for library objects
@{
......@@ -288,9 +295,6 @@ REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
*/
#define FLEXT_DSP_SETUP(cl) REAL_SETUP(cl,1)
//! \deprecated
#define FLEXT_TILDE_SETUP FLEXT_DSP_SETUP
//! @} FLEXT_D_LIBRARY
......@@ -657,128 +661,170 @@ FLEXT_THREAD_1(M_FUN,t_symptr)
// ====================================================================================
/*! \defgroup FLEXT_D_ADDMETHOD Add flext methods
/*! \defgroup FLEXT_D_CADDMETHOD Add flext methods within class scope
\note These can only be used at class construction time
@{
*/
//! Enable list element distribution over inlets (if no better handler found)
#define FLEXT_ADDDIST() \
\
SetDist(true)
//! Add a method handler for bang
#define FLEXT_ADDBANG(IX,M_FUN) \
#define FLEXT_CADDBANG(CL,IX,M_FUN) \
\
AddMethod(IX,"bang",FLEXT_CALL_PRE(M_FUN))
AddMethod(CL,IX,"bang",FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with no arguments
#define FLEXT_ADDMETHOD(IX,M_FUN) \
AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
#define FLEXT_CADDMETHOD(CL,IX,M_FUN) \
AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with a (variable argument) list
#define FLEXT_ADDMETHOD_V(IX,M_FUN) \
#define FLEXT_CADDMETHOD_V(CL,IX,M_FUN) \
\
AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with an anything argument
#define FLEXT_ADDMETHOD_A(IX,M_FUN) \
#define FLEXT_CADDMETHOD_A(CL,IX,M_FUN) \
\
AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
//! Add a a handler for a method with implicit arguments
#define FLEXT_ADDMETHOD_(IX,M_TAG,M_FUN) \
#define FLEXT_CADDMETHOD_(CL,IX,M_TAG,M_FUN) \
\
AddMethod(IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
AddMethod(CL,IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with 1 enum type argument
#define FLEXT_ADDMETHOD_E(IX,M_TAG,M_FUN) \
#define FLEXT_CADDMETHOD_E(CL,IX,M_TAG,M_FUN) \
\
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null)
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null)
//! Add a handler for a method with 1 argument
#define FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,TP1) \
#define FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,TP1) \
\
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
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
#define FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,TP1,TP2) \
#define FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,TP1,TP2) \
\
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null)
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null)
//! Add a handler for a method with 3 arguments
#define FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,TP1,TP2,TP3) \
#define FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3) \
\
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null)
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null)
//! Add a handler for a method with 4 arguments
#define FLEXT_ADDMETHOD_4(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \
#define FLEXT_CADDMETHOD_4(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \
\
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null)
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null)
//! Add a handler for a method with 5 arguments
#define FLEXT_ADDMETHOD_5(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \
#define FLEXT_CADDMETHOD_5(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \
\
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
// Now the same in class scope
// Shortcuts
//! Add a handler for a method with a boolean argument
#define FLEXT_CADDMETHOD_B(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,bool)
//! Add a handler for a method with 1 float argument
#define FLEXT_CADDMETHOD_F(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,float)
//! Add a handler for a method with 2 float arguments
#define FLEXT_CADDMETHOD_FF(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,float,float)
//! Add a handler for a method with 3 float arguments
#define FLEXT_CADDMETHOD_FFF(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,float,float,float)
//! Add a handler for a method with 1 integer argument
#define FLEXT_CADDMETHOD_I(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,int)
//! Add a handler for a method with 2 integer arguments
#define FLEXT_CADDMETHOD_II(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,int,int)
//! Add a handler for a method with 3 integer arguments
#define FLEXT_CADDMETHOD_III(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,int,int,int)
//! @} FLEXT_D_CADDMETHOD
/*! \defgroup FLEXT_D_ADDMETHOD Add flext methods
\note These can only be used at object construction time
\note (in constructor or in Init() function before call to parent's Init())
@{
*/
//! Enable list element distribution over inlets (if no better handler found)
#define FLEXT_ADDDIST() \
\
SetDist(true)
//! Add a method handler for bang
#define FLEXT_CADDBANG(CL,IX,M_FUN) \
#define FLEXT_ADDBANG(IX,M_FUN) \
\
AddMethod(CL,IX,"bang",FLEXT_CALL_PRE(M_FUN))
AddMethod(IX,"bang",FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with no arguments
#define FLEXT_CADDMETHOD(CL,IX,M_FUN) \
AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
#define FLEXT_ADDMETHOD(IX,M_FUN) \
AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with a (variable argument) list
#define FLEXT_CADDMETHOD_V(CL,IX,M_FUN) \
#define FLEXT_ADDMETHOD_V(IX,M_FUN) \
\
AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with an anything argument
#define FLEXT_CADDMETHOD_A(CL,IX,M_FUN) \
#define FLEXT_ADDMETHOD_A(IX,M_FUN) \
\
AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
AddMethod(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) \
#define FLEXT_ADDMETHOD_(IX,M_TAG,M_FUN) \
\
AddMethod(CL,IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
AddMethod(IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with 1 enum type argument
#define FLEXT_CADDMETHOD_E(CL,IX,M_TAG,M_FUN) \
#define FLEXT_ADDMETHOD_E(IX,M_TAG,M_FUN) \
\
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null)
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null)
//! Add a handler for a method with 1 argument
#define FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,TP1) \
#define FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,TP1) \
\
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
//! Add a handler for a method with 2 arguments
#define FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,TP1,TP2) \
#define FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,TP1,TP2) \
\
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null)
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),a_null)
//! Add a handler for a method with 3 arguments
#define FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3) \
#define FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,TP1,TP2,TP3) \
\
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null)
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null)
//! Add a handler for a method with 4 arguments
#define FLEXT_CADDMETHOD_4(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \
#define FLEXT_ADDMETHOD_4(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \
\
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null)
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null)
//! Add a handler for a method with 5 arguments
#define FLEXT_CADDMETHOD_5(CL,IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \
#define FLEXT_ADDMETHOD_5(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \
\
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
// Shortcuts
......@@ -819,47 +865,9 @@ FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,int,int)
FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,int,int,int)
// again, the same with class scope
//! Add a handler for a method with a boolean argument
#define FLEXT_CADDMETHOD_B(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,bool)
//! Add a handler for a method with 1 float argument
#define FLEXT_CADDMETHOD_F(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,float)
//! Add a handler for a method with 2 float arguments
#define FLEXT_CADDMETHOD_FF(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,float,float)
//! Add a handler for a method with 3 float arguments
#define FLEXT_CADDMETHOD_FFF(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,float,float,float)
//! Add a handler for a method with 1 integer argument
#define FLEXT_CADDMETHOD_I(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,int)
//! Add a handler for a method with 2 integer arguments
#define FLEXT_CADDMETHOD_II(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,int,int)
//! Add a handler for a method with 3 integer arguments
#define FLEXT_CADDMETHOD_III(CL,IX,M_TAG,M_FUN) \
\
FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,int,int,int)
//! @} FLEXT_D_ADDMETHOD
/*! \defgroup FLEXT_D_CALLMETHOD Call flext methods manually
@{
*/
......@@ -1177,96 +1185,101 @@ FLEXT_ATTRGET_V(VAR) FLEXT_ATTRSET_V(VAR)
//! @} FLEXT_DA_ATTRVAR
/*! \defgroup FLEXT_D_ADDATTR Announce object attributes
/*! \defgroup FLEXT_D_CADDATTR Announce object attributes at class scope
\note These can only be used at class construction time
@{
*/
//! Add handler for a gettable attribute
#define FLEXT_ADDATTR_GET(NAME,GFUN) \
#define FLEXT_CADDATTR_GET(CL,NAME,GFUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),NULL)
AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable attribute
#define FLEXT_ADDATTR_SET(NAME,SFUN) \
#define FLEXT_CADDATTR_SET(CL,NAME,SFUN) \
\
AddAttrib(NAME,NULL,(FLEXT_SET_PRE(SFUN)))
AddAttrib(CL,NAME,NULL,(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
#define FLEXT_ADDATTR_VAR(NAME,GFUN,SFUN) \
#define FLEXT_CADDATTR_VAR(CL,NAME,GFUN,SFUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN)))
AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN)))