Commit 14f5afbb authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@330 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent f212bae6
......@@ -39,17 +39,16 @@ void flext_base::AddAttrItem(attritem *m)
void flext_base::AddAttrib(const char *attr,metharg tp,methfun gfun,methfun sfun)
{
if(!procattr) {
error("%s - Attribute processing is not enabled",thisName());
return;
}
char tmp[1024];
sprintf(tmp,"get%s",attr);
AddAttrItem(new attritem(MakeSymbol(attr),MakeSymbol(tmp),tp,gfun,sfun));
if(procattr) {
char tmp[1024];
sprintf(tmp,"get%s",attr);
AddAttrItem(new attritem(MakeSymbol(attr),MakeSymbol(tmp),tp,gfun,sfun));
AddMethod(0,attr,(methfun)cb_SetAttrib,a_any,a_null);
AddMethod(0,tmp,(methfun)cb_GetAttrib,a_any,a_null);
AddMethod(0,attr,(methfun)cb_SetAttrib,a_any,a_null);
AddMethod(0,tmp,(methfun)cb_GetAttrib,a_any,a_null);
}
else
error("%s - attribute procession is not enabled!",thisName());
}
bool flext_base::InitAttrib(int argc,const t_atom *argv)
......@@ -73,12 +72,16 @@ bool flext_base::InitAttrib(int argc,const t_atom *argv)
bool flext_base::ListAttrib()
{
AtomList la(attrcnt);
attritem *a = attrhead;
for(int i = 0; i < attrcnt; ++i,a = a->nxt) SetSymbol(la[i],a->tag);
if(outattr) {
AtomList la(attrcnt);
attritem *a = attrhead;
for(int i = 0; i < attrcnt; ++i,a = a->nxt) SetSymbol(la[i],a->tag);
ToOutAnything(outattr,thisTag(),la.Count(),la.Atoms());
return true;
ToOutAnything(outattr,thisTag(),la.Count(),la.Atoms());
return true;
}
else
return false;
}
bool flext_base::SetAttrib(const t_symbol *tag,int argc,const t_atom *argv)
......
......@@ -201,10 +201,15 @@ class FLEXT_EXT flext_obj:
#define FLEXT_SET_PRE(F) flext_s_##F
#ifndef FLEXT_ATTRIBUTES
#define FLEXT_ATTRIBUTES 0
#endif
// ----------------------------------------
// These should be used in the header
// ----------------------------------------
#define FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS) \
public: \
typedef NEW_CLASS thisType; \
......@@ -212,8 +217,9 @@ static flext_obj *__init__(int argc,t_atom *argv); \
static void __free__(flext_hdr *hdr) \
{ flext_obj *mydata = hdr->data; delete mydata; \
hdr->flext_hdr::~flext_hdr(); } \
static void __setup__(t_class *classPtr) \
{ PARENT_CLASS::__setup__(classPtr); } \
static void __setup__(t_class *classPtr) { \
PARENT_CLASS::__setup__(classPtr); \
procattr = FLEXT_ATTRIBUTES; } \
protected: \
static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST<NEW_CLASS *>(((flext_hdr *)c)->data); }
......@@ -227,7 +233,8 @@ static void __free__(flext_hdr *hdr) \
hdr->flext_hdr::~flext_hdr(); } \
static void __setup__(t_class *classPtr) \
{ PARENT_CLASS::__setup__(classPtr); \
NEW_CLASS::SETUPFUN(classPtr); } \
procattr = FLEXT_ATTRIBUTES; \
NEW_CLASS::SETUPFUN(classPtr); } \
protected: \
static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST<NEW_CLASS *>(((flext_hdr *)c)->data); }
......
......@@ -67,6 +67,13 @@ public:
*/
static bool compatibility;
// --- attribute procession ----------------------------------------
/*! \brief Flag for attribute procession.
If set attributes are treated in the Max/Jitter way.
Set to false by default!
*/
static bool procattr;
//! @}
......@@ -394,7 +401,7 @@ protected:
protected:
flext_base(bool attr = false);
flext_base();
virtual ~flext_base();
// inlets and outlets
......@@ -488,9 +495,7 @@ private:
xlet *inlist,*outlist;
const t_symbol *curtag;
int incnt,outcnt,insigs,outsigs;
outlet **outlets;
bool procattr;
outlet *outattr;
outlet **outlets,*outattr;
bool distmsgs;
void AddXlet(xlet::type tp,int mult,const char *desc,xlet *&root);
......
......@@ -115,16 +115,15 @@ DEF_IN_FT(9)
// === flext_base ============================================
bool flext_base::compatibility = true;
bool flext_base::procattr = false;
flext_base::flext_base(bool attr):
flext_base::flext_base():
inlist(NULL),outlist(NULL),
incnt(0),outcnt(0),
insigs(0),outsigs(0),
curtag(NULL),
outlets(NULL),inlets(NULL),outattr(NULL),
methhead(NULL),attrhead(NULL),
procattr(attr),attrcnt(0),
methhead(NULL),attrhead(NULL),attrcnt(0),
distmsgs(false)
{
LOG1("%s - flext logging is on",thisName());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment