Commit da3d04c6 authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@256 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 86a1f926
......@@ -80,8 +80,11 @@ Version history:
0.3.2:
- doxygen generated inline documentation / functional reference
- added FLEXT_ADDMETHOD_V (for var arg lists) and FLEXT_ADDMETHOD_A (anythings)... just for clarity
// - added FLEXT_ADDMETHOD_V (for var arg lists) and FLEXT_ADDMETHOD_A (anythings)... just for clarity
- added some more functionality to the AtomAnything class
- bugfix for threaded methods with var list or anything arguments
- added threaded method for arbitrary (void *) data structs
- ThrMutex: added lock count functions Push() and Pop()
0.3.1:
- added some more functionality to the AtomList class
......
......@@ -60,7 +60,7 @@ flext_obj :: ~flext_obj()
// overloaded new/delete memory allocation methods
//
/////////////////////////////////////////////////////////
/*
void *flext_obj::operator new(size_t bytes)
{
bytes += sizeof(size_t);
......@@ -75,7 +75,7 @@ void flext_obj::operator delete(void *blk)
size_t bytes = *(size_t *)ori;
freebytes(ori,bytes);
}
*/
void *flext_obj::NewAligned(size_t bytes,int bitalign)
{
......
......@@ -90,7 +90,7 @@ class FLEXT_EXT flext_obj
// --- overloading of new/delete memory allocation methods ----
// MaxMSP allows only 16K in overdrive mode!
/*
void *operator new(size_t bytes);
void operator delete(void *blk);
......@@ -98,7 +98,7 @@ class FLEXT_EXT flext_obj
void *operator new[](size_t bytes) { return operator new(bytes); }
void operator delete[](void *blk) { operator delete(blk); }
#endif
*/
// these are aligned
static void *NewAligned(size_t bytes,int bitalign = 128);
static void FreeAligned(void *blk);
......@@ -175,8 +175,6 @@ class FLEXT_EXT flext_obj
#endif
};
//! \remark This has a dummy arg so that NT won't complain
inline void *operator new(size_t, void *location, void *) { return location; }
//@{
//! Some utility functions for class setup
......@@ -189,8 +187,6 @@ bool fl_chktilde(const char *name);
// These should be used in the header
// ----------------------------------------
//#define FLEXT_CLASSNAME(NEW_CLASS) __class__
#define FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS) \
public: \
static t_class *__class__; \
......@@ -203,8 +199,6 @@ static void callb_setup(t_class *classPtr) \
protected: \
static inline NEW_CLASS *thisObject(void *c) { return (NEW_CLASS *)((flext_hdr *)c)->data; }
//static inline t_class *thisClass() { return __class__; }
#define FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS,SETUPFUN) \
......@@ -220,8 +214,6 @@ static void callb_setup(t_class *classPtr) \
protected: \
static inline NEW_CLASS *thisObject(void *c) { return (NEW_CLASS *)((flext_hdr *)c)->data; }
//static inline t_class *thisClass() { return __class__; }
// generate name of dsp/non-dsp setup function
#define FLEXT_STPF_0(NAME) NAME##_setup
......@@ -396,6 +388,7 @@ return 0; \
//
// ----------------------------------------------------
// ----------------------------------------------------
// no args
// ----------------------------------------------------
......@@ -403,7 +396,7 @@ return 0; \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS () \
{ \
flext_hdr *obj = new (newobject(NEW_CLASS::__class__),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(NEW_CLASS::__class__); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS; \
......@@ -431,7 +424,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
#define REAL_NEWLIB(NAME,NEW_CLASS, DSP) \
flext_hdr* class_ ## NEW_CLASS () \
{ \
flext_hdr *obj = new (newobject(flext_obj::lib_class),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS; \
......@@ -456,7 +449,7 @@ void FLEXT_STPF(NEW_CLASS,DSP)() \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS (t_symbol *,int argc,t_atom *argv) \
{ \
flext_hdr *obj = new (newobject(NEW_CLASS::__class__),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(NEW_CLASS::__class__); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS(argc,argv); \
......@@ -485,7 +478,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
#define REAL_NEWLIB_V(NAME,NEW_CLASS, DSP) \
flext_hdr* class_ ## NEW_CLASS (t_symbol *,int argc,t_atom *argv) \
{ \
flext_hdr *obj = new (newobject(flext_obj::lib_class),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS(argc,argv); \
......@@ -510,7 +503,7 @@ void FLEXT_STPF(NEW_CLASS,DSP)() \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS (CALLBTP(TYPE1) arg1) \
{ \
flext_hdr *obj = new (newobject(NEW_CLASS::__class__),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(NEW_CLASS::__class__); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS((TYPE1)arg1); \
......@@ -539,7 +532,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
#define REAL_NEWLIB_1(NAME,NEW_CLASS, DSP,TYPE1) \
flext_hdr* class_ ## NEW_CLASS (const flext_obj::lib_arg &arg1) \
{ \
flext_hdr *obj = new (newobject(flext_obj::lib_class),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS(ARGCAST(arg1,TYPE1)); \
......@@ -564,7 +557,7 @@ void FLEXT_STPF(NEW_CLASS,DSP)() \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS (CALLBTP(TYPE1) arg1, CALLBTP(TYPE2) arg2) \
{ \
flext_hdr *obj = new (newobject(NEW_CLASS::__class__),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(NEW_CLASS::__class__); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS((TYPE1)arg1, (TYPE2)arg2); \
......@@ -593,7 +586,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
#define REAL_NEWLIB_2(NAME,NEW_CLASS, DSP,TYPE1, TYPE2) \
flext_hdr* class_ ## NEW_CLASS (const flext_obj::lib_arg &arg1,const flext_obj::lib_arg &arg2) \
{ \
flext_hdr *obj = new (newobject(flext_obj::lib_class),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS(ARGCAST(arg1,TYPE1),ARGCAST(arg2,TYPE2)); \
......@@ -618,7 +611,7 @@ void FLEXT_STPF(NEW_CLASS,DSP)() \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS (CALLBTP(TYPE1) arg1,CALLBTP(TYPE2) arg2,CALLBTP(TYPE3) arg3) \
{ \
flext_hdr *obj = new (newobject(NEW_CLASS::__class__),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(NEW_CLASS::__class__); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS((TYPE1)arg1,(TYPE2)arg2,(TYPE3)arg3); \
......@@ -647,7 +640,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
#define REAL_NEWLIB_3(NAME,NEW_CLASS, DSP,TYPE1,TYPE2,TYPE3) \
flext_hdr* class_ ## NEW_CLASS (const flext_obj::lib_arg &arg1,const flext_obj::lib_arg &arg2,const flext_obj::lib_arg &arg3) \
{ \
flext_hdr *obj = new (newobject(flext_obj::lib_class),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS(ARGCAST(arg1,TYPE1),ARGCAST(arg2,TYPE2),ARGCAST(arg3,TYPE3)); \
......@@ -671,7 +664,7 @@ void FLEXT_STPF(NEW_CLASS,DSP)() \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS (CALLBTP(TYPE1) arg1,CALLBTP(TYPE2) arg2,CALLBTP(TYPE3) arg3,CALLBTP(TYPE4) arg4) \
{ \
flext_hdr *obj = new (newobject(NEW_CLASS::__class__),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(NEW_CLASS::__class__); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS((TYPE1)arg1,(TYPE2)arg2,(TYPE3)arg3,(TYPE4)arg4); \
......@@ -700,7 +693,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
#define REAL_NEWLIB_4(NAME,NEW_CLASS, DSP,TYPE1,TYPE2,TYPE3,TYPE4) \
flext_hdr* class_ ## NEW_CLASS (const flext_obj::lib_arg &arg1,const flext_obj::lib_arg &arg2,const flext_obj::lib_arg &arg3,const flext_obj::lib_arg &arg4) \
{ \
flext_hdr *obj = new (newobject(flext_obj::lib_class),(void *)NULL) flext_hdr; \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
flext_obj::m_holder = obj; \
flext_obj::m_holdname = fl_extract(NAME); \
obj->data = new NEW_CLASS(ARGCAST(arg1,TYPE1),ARGCAST(arg2,TYPE2),ARGCAST(arg3,TYPE3),ARGCAST(arg4,TYPE4)); \
......
......@@ -305,7 +305,7 @@ public:
void AddMethod(int inlet,void (*m)(flext_base *,int,t_atom *)) { AddMethod(inlet,"list",(methfun)m,a_gimme,a_null); }
void AddMethod(int inlet,const char *tag,void (*m)(flext_base *)) { AddMethod(inlet,tag,(methfun)m,a_null); } // pure method
void AddMethod(int inlet,void (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(inlet,"anything",(methfun)m,a_xgimme,a_null); } // anything
void AddMethod(int inlet,void (*m)(flext_base *,const t_symbol *,int,t_atom *)) { AddMethod(inlet,"anything",(methfun)m,a_xgimme,a_null); } // anything
void AddMethod(int inlet,void (*m)(flext_base *,t_symbol *&)) { AddMethod(inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol
void AddMethod(int inlet,void (*m)(flext_base *,float &)) { AddMethod(inlet,"float",(methfun)m,a_float,a_null); } // single float
void AddMethod(int inlet,void (*m)(flext_base *,float &,float &)) { AddMethod(inlet,"list",(methfun)m,a_float,a_float,a_null); } // list of 2 floats
......@@ -318,7 +318,7 @@ public:
void AddMethod(int inlet,void (*m)(flext_base *,int &,int &)) { AddMethod(inlet,"list",(methfun)m,a_int,a_int,a_null); } // list of 2 floats
void AddMethod(int inlet,void (*m)(flext_base *,int &,int &,int &)) { AddMethod(inlet,"list",(methfun)m,a_int,a_int,a_int,a_null); } // list of 3 floats
void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,int,t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_gimme,a_null); } // method+gimme
void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_xgimme,a_null); } // method+gimme
void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,const t_symbol *,int,t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_xgimme,a_null); } // method+gimme
void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,t_symbol *&)) { AddMethod(inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,float &)) { AddMethod(inlet,tag,(methfun)m,a_float,a_null); } // method+float
void AddMethod(int inlet,const char *tag,void (*m)(flext_base *,int &)) { AddMethod(inlet,tag,(methfun)m,a_int,a_null); } // method+int
......@@ -503,18 +503,24 @@ public:
{
public:
//! Construct thread mutex
ThrMutex() { pthread_mutex_init(&mutex,NULL); }
ThrMutex(): cnt(0) { pthread_mutex_init(&mutex,NULL); }
//! Destroy thread mutex
~ThrMutex() { pthread_mutex_destroy(&mutex); }
//! Lock thread mutex
int Lock() { return pthread_mutex_lock(&mutex); }
int Lock() { cnt = 1; return pthread_mutex_lock(&mutex); }
//! Try if thread mutex is locked
int TryLock() { return pthread_mutex_trylock(&mutex); }
//! Unlock thread mutex
int Unlock() { return pthread_mutex_unlock(&mutex); }
int Unlock() { cnt = 0; return pthread_mutex_unlock(&mutex); }
//! Lock thread mutex (increase lock count by one)
void Push() { if(!cnt++) Lock(); }
//! Unlock thread mutex if lock count reaches zero
void Pop() { if(!--cnt) Unlock(); }
protected:
pthread_mutex_t mutex;
int cnt;
};
/*! \brief Thread conditional
......
......@@ -273,7 +273,7 @@ static void cb_ ## M_FUN(flext_base *c) \
//! Set up a method callback for an anything argument
#define FLEXT_CALLBACK_A(M_FUN) \
static void cb_ ## M_FUN(flext_base *c,t_symbol *s,int argc,t_atom *argv) \
static void cb_ ## M_FUN(flext_base *c,const t_symbol *s,int argc,t_atom *argv) \
{ static_cast<thisType *>(c)->M_FUN(s,argc,argv); }
//! Set up a method callback for a variable argument list
......@@ -281,6 +281,11 @@ static void cb_ ## M_FUN(flext_base *c,t_symbol *s,int argc,t_atom *argv) \
static void cb_ ## M_FUN(flext_base *c,int argc,t_atom *argv) \
{ static_cast<thisType *>(c)->M_FUN(argc,argv); }
//! Set up a method callback for a data package (void *) argument
#define FLEXT_CALLBACK_X(M_FUN) \
static void cb_ ## M_FUN(flext_base *c,void *data) \
{ static_cast<thisType *>(c)->M_FUN(data); }
//! Set up a method callback for a boolean argument
#define FLEXT_CALLBACK_B(M_FUN) \
static void cb_ ## M_FUN(flext_base *c,int &arg1) \
......@@ -383,35 +388,58 @@ static void *thr_ ## M_FUN(thr_params *p) { \
//! Set up a threaded method callback for an anything argument
#define FLEXT_THREAD_A(M_FUN) \
static void cb_ ## M_FUN(flext_base *c,t_symbol *s,int argc,t_atom *argv) { \
static void cb_ ## M_FUN(flext_base *c,const t_symbol *s,int argc,t_atom *argv) { \
thr_params *p = new thr_params(c); p->set_any(s,argc,argv); \
StartThread(thr_ ## M_FUN,p,#M_FUN); \
} \
static void *thr_ ## M_FUN(thr_params *p) { \
thisType *th = static_cast<thisType *>(p->cl); \
bool ok = th->PushThread(); \
t_symbol *s; int argc; t_atom argv; p->get_any(s,argc,argv); \
AtomAnything *args = p->var[0]._any.args; \
delete p; \
if(ok) { \
th->M_FUN(s,argc,argv); \
th->M_FUN(args->Header(),args->Count(),args->Atoms()); \
th->PopThread(); \
} \
delete args; \
return NULL; \
}
//! Set up a threaded method callback for a variable argument list
#define FLEXT_THREAD_V(M_FUN) \
static void cb_ ## M_FUN(flext_base *c,int argc,t_atom *argv) { \
thr_params *p = new thr_params(c); p->set_gimme(argc,argv); \
thr_params *p = new thr_params(c); p->set_list(argc,argv); \
StartThread(thr_ ## M_FUN,p,#M_FUN); \
} \
static void *thr_ ## M_FUN(thr_params *p) { \
thisType *th = static_cast<thisType *>(p->cl); \
bool ok = th->PushThread(); \
int argc; t_atom argv; p->get_gimme(argc,argv); \
AtomList *args = p->var[0]._list.args; \
delete p; \
if(ok) { \
th->M_FUN(argc,argv); \
th->M_FUN(args->Count(),args->Atoms()); \
th->PopThread(); \
} \
delete args; \
return NULL; \
}
/*! \brief Set up a threaded method callback for an arbitrary data struct
\note Pointer of data struct is only borrowed ... no destruction is done
\note This can be done in the called method
*/
#define FLEXT_THREAD_X(M_FUN) \
static void cb_ ## M_FUN(flext_base *c,void *data) { \
thr_params *p = new thr_params(c); p->var[0]._ext.data = data; \
StartThread(thr_ ## M_FUN,p,#M_FUN); \
} \
static void *thr_ ## M_FUN(thr_params *p) { \
thisType *th = static_cast<thisType *>(p->cl); \
bool ok = th->PushThread(); \
void *data = p->var[0]._ext.data; \
delete p; \
if(ok) { \
th->M_FUN(data); \
th->PopThread(); \
} \
return NULL; \
......@@ -438,7 +466,7 @@ static void *thr_ ## M_FUN(thr_params *p) { \
//! Set up a threaded method callback for 1 argument
#define FLEXT_THREAD_1(M_FUN,TP1) \
static void cb_ ## M_FUN(flext_base *c,TP1 &arg1) { \
thr_params *p = new thr_params(c); \
thr_params *p = new thr_params(c,1); \
p->var[0]._ ## TP1 = arg1; \
StartThread(thr_ ## M_FUN,p,#M_FUN); \
} \
......@@ -457,7 +485,7 @@ static void *thr_ ## M_FUN(thr_params *p) { \
//! Set up a threaded method callback for 2 arguments
#define FLEXT_THREAD_2(M_FUN,TP1,TP2) \
static void cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2) { \
thr_params *p = new thr_params(c); \
thr_params *p = new thr_params(c,2); \
p->var[0]._ ## TP1 = arg1; \
p->var[1]._ ## TP2 = arg2; \
StartThread(thr_ ## M_FUN,p,#M_FUN); \
......@@ -478,7 +506,7 @@ static void *thr_ ## M_FUN(thr_params *p) { \
//! Set up a threaded method callback for 3 arguments
#define FLEXT_THREAD_3(M_FUN,TP1,TP2,TP3) \
static void cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3) { \
thr_params *p = new thr_params(c); \
thr_params *p = new thr_params(c,3); \
p->var[0]._ ## TP1 = arg1; \
p->var[1]._ ## TP2 = arg2; \
p->var[2]._ ## TP3 = arg3; \
......@@ -501,7 +529,7 @@ static void *thr_ ## M_FUN(thr_params *p) { \
//! Set up a threaded method callback for 4 arguments
#define FLEXT_THREAD_4(M_FUN,TP1,TP2,TP3,TP4) \
static void cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4) { \
thr_params *p = new thr_params(c); \
thr_params *p = new thr_params(c,4); \
p->var[0]._ ## TP1 = arg1; \
p->var[1]._ ## TP2 = arg2; \
p->var[2]._ ## TP3 = arg3; \
......@@ -526,7 +554,7 @@ static void *thr_ ## M_FUN(thr_params *p) { \
//! Set up a threaded method callback for 5 arguments
#define FLEXT_THREAD_5(M_FUN,TP1,TP2,TP3,TP4,TP5) \
static void cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4,TP5 &arg5) { \
thr_params *p = new thr_params(c); \
thr_params *p = new thr_params(c,5); \
p->var[0]._ ## TP1 = arg1; \
p->var[1]._ ## TP2 = arg2; \
p->var[2]._ ## TP3 = arg3; \
......@@ -719,6 +747,21 @@ FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,int,int,int)
\
cb_ ## M_FUN(this)
//! Call a (already defined) method with variable list arguments
#define FLEXT_CALLMETHOD_V(M_FUN,ARGC,ARGV) \
\
cb_ ## M_FUN(this,ARGC,ARGV)
//! Call a (already defined) method with anything arguments
#define FLEXT_CALLMETHOD_A(M_FUN,HDR,ARGC,ARGV) \
\
cb_ ## M_FUN(this,HDR,ARGC,ARGV)
//! Call a (already defined) method with a data package (void *)
#define FLEXT_CALLMETHOD_X(M_FUN,DATA) \
\
cb_ ## M_FUN(this,DATA)
//! Call a (already defined) method with 1 enum type argument
#define FLEXT_CALLMETHOD_E(M_FUN,ARG) \
\
......
......@@ -23,10 +23,10 @@ WARRANTIES, see the file, "license.txt," in this distribution.
*/
//! \brief flext version number
#define FLEXT_VERSION 301
#define FLEXT_VERSION 302
//! \brief flext version string
#define FLEXT_VERSTR "0.3.1"
#define FLEXT_VERSTR "0.3.2"
//! @}
......
......@@ -297,4 +297,13 @@ void flext_base::QueueAnything(outlet *o,const t_symbol *s,int argc,t_atom *argv
Queue(m);
}
flext_base::thr_params::thr_params(flext_base *c,int n): cl(c),var(new _data[n]) {}
flext_base::thr_params::~thr_params() { delete[] var; }
void flext_base::thr_params::set_any(const t_symbol *s,int argc,t_atom *argv) { var[0]._any.args = new AtomAnything(s,argc,argv); }
void flext_base::thr_params::set_list(int argc,t_atom *argv) { var[0]._list.args = new AtomList(argc,argv); }
#endif // FLEXT_THREADS
......@@ -24,23 +24,22 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class flext_base::thr_params
{
public:
thr_params(flext_base *c): cl(c) {}
thr_params(flext_base *c,int n = 1);
~thr_params();
void set_any(t_symbol *s,int argc,t_atom *argv) { var[0]._any.s = s; var[0]._any.argc = argc; var[0]._any.argv = argv; }
void get_any(t_symbol *&s,int &argc,t_atom *&argv) { s = var[0]._any.s; argc = var[0]._any.argc; argv = var[0]._any.argv; }
void set_gimme(int argc,t_atom *argv) { var[0]._gimme.argc = argc; var[0]._gimme.argv = argv; }
void get_gimme(int &argc,t_atom *&argv) { argc = var[0]._gimme.argc; argv = var[0]._gimme.argv; }
void set_any(const t_symbol *s,int argc,t_atom *argv);
void set_list(int argc,t_atom *argv);
flext_base *cl;
union {
union _data {
bool _bool;
float _float;
int _int;
t_symptr _t_symptr;
struct { t_symbol *s; int argc; t_atom *argv; } _any;
struct { int argc; t_atom *argv; } _gimme;
} var[5];
struct { AtomAnything *args; } _any;
struct { AtomList *args; } _list;
struct { void *data; } _ext;
} *var;
};
class flext_base::thr_entry
......
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