Commit 26a4c7b7 authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@359 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 5881e283
No preview for this file type
...@@ -81,6 +81,8 @@ see flext.h, fldefs.h and flclass.h for the documented base definitions and clas ...@@ -81,6 +81,8 @@ see flext.h, fldefs.h and flclass.h for the documented base definitions and clas
Version history: Version history:
0.4.0: 0.4.0:
- the use of the const keyword is enforced (e.g. the preferred type for symbols is now "const t_symbol *")
- there _might_ be some problems with sensitive compilers
- introduced Max/Jitter-like attribute functionality ("@value" command line, "getvalue" get and "value" set functions) - introduced Max/Jitter-like attribute functionality ("@value" command line, "getvalue" get and "value" set functions)
- introduced a flext static class for general flext functions (to clean up the flext_base class) - introduced a flext static class for general flext functions (to clean up the flext_base class)
- creation argument handling is now done by flext - creation argument handling is now done by flext
......
...@@ -397,7 +397,6 @@ cl##_tilde_setup() ...@@ -397,7 +397,6 @@ cl##_tilde_setup()
#define REAL_NEW(NAME,NEW_CLASS,DSP,LIB) \ #define REAL_NEW(NAME,NEW_CLASS,DSP,LIB) \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) \
flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
{ \ { \
return new NEW_CLASS; \ return new NEW_CLASS; \
...@@ -405,10 +404,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ ...@@ -405,10 +404,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
{ \ { \
flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,A_NULL); \ flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,A_NULL); \
} } \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#define REAL_NEW_V(NAME,NEW_CLASS,DSP,LIB) \ #define REAL_NEW_V(NAME,NEW_CLASS,DSP,LIB) \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) \
flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
{ \ { \
return new NEW_CLASS(argc,argv); \ return new NEW_CLASS(argc,argv); \
...@@ -416,10 +415,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ ...@@ -416,10 +415,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
{ \ { \
flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,A_GIMME,A_NULL); \ flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,&NEW_CLASS::__free__,A_GIMME,A_NULL); \
} } \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#define REAL_NEW_1(NAME,NEW_CLASS,DSP,LIB, TYPE1) \ #define REAL_NEW_1(NAME,NEW_CLASS,DSP,LIB, TYPE1) \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) \
flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
{ \ { \
return new NEW_CLASS(ARGCAST(argv[0],TYPE1)); \ return new NEW_CLASS(ARGCAST(argv[0],TYPE1)); \
...@@ -427,10 +426,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ ...@@ -427,10 +426,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
{ \ { \
flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),A_NULL); \ flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),A_NULL); \
} } \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#define REAL_NEW_2(NAME,NEW_CLASS,DSP,LIB, TYPE1,TYPE2) \ #define REAL_NEW_2(NAME,NEW_CLASS,DSP,LIB, TYPE1,TYPE2) \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) \
flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
{ \ { \
return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2)); \ return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2)); \
...@@ -438,10 +437,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ ...@@ -438,10 +437,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
{ \ { \
flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),A_NULL); \ flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),A_NULL); \
} } \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#define REAL_NEW_3(NAME,NEW_CLASS,DSP,LIB, TYPE1, TYPE2, TYPE3) \ #define REAL_NEW_3(NAME,NEW_CLASS,DSP,LIB, TYPE1, TYPE2, TYPE3) \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) \
flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
{ \ { \
return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2),ARGCAST(argv[2],TYPE3)); \ return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2),ARGCAST(argv[2],TYPE3)); \
...@@ -449,10 +448,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ ...@@ -449,10 +448,10 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
{ \ { \
flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),A_NULL); \ flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),A_NULL); \
} } \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
#define REAL_NEW_4(NAME,NEW_CLASS,DSP,LIB, TYPE1,TYPE2, TYPE3, TYPE4) \ #define REAL_NEW_4(NAME,NEW_CLASS,DSP,LIB, TYPE1,TYPE2, TYPE3, TYPE4) \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB) \
flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
{ \ { \
return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2),ARGCAST(argv[2],TYPE3),ARGCAST(argv[3],TYPE4)); \ return new NEW_CLASS(ARGCAST(argv[0],TYPE1),ARGCAST(argv[1],TYPE2),ARGCAST(argv[2],TYPE3),ARGCAST(argv[3],TYPE4)); \
...@@ -460,7 +459,8 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \ ...@@ -460,7 +459,8 @@ flext_obj *NEW_CLASS::__init__(int argc,t_atom *argv) \
FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
{ \ { \
flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),FLEXTTP(TYPE4),A_NULL); \ flext_obj::obj_add(LIB,DSP,FLEXT_ATTRIBUTES,#NEW_CLASS,NAME,NEW_CLASS::__setup__,NEW_CLASS::__init__,NEW_CLASS::__free__,FLEXTTP(TYPE1),FLEXTTP(TYPE2),FLEXTTP(TYPE3),FLEXTTP(TYPE4),A_NULL); \
} } \
FLEXT_OBJ_SETUP(NEW_CLASS,DSP,LIB)
// Shortcuts for method arguments: // Shortcuts for method arguments:
......
...@@ -318,9 +318,12 @@ public: ...@@ -318,9 +318,12 @@ public:
void AddMethod(int inlet,const char *tag,methfun fun,metharg tp,...); void AddMethod(int inlet,const char *tag,methfun fun,metharg tp,...);
void AddMethod(int inlet,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(inlet,"list",(methfun)m,a_list,a_null); } void AddMethod(int inlet,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(inlet,"list",(methfun)m,a_list,a_null); }
void AddMethod(int inlet,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(inlet,"list",(methfun)m,a_list,a_null); }
void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *)) { AddMethod(inlet,tag,(methfun)m,a_null); } // pure method void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *)) { AddMethod(inlet,tag,(methfun)m,a_null); } // pure method
void AddMethod(int inlet,bool (*m)(flext_base *,const t_symbol *,int,t_atom *)) { AddMethod(inlet,"anything",(methfun)m,a_any,a_null); } // anything void AddMethod(int inlet,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(inlet,"anything",(methfun)m,a_any,a_null); } // anything
void AddMethod(int inlet,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(inlet,"anything",(methfun)m,a_any,a_null); } // anything
void AddMethod(int inlet,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol void AddMethod(int inlet,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol
void AddMethod(int inlet,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(inlet,"symbol",(methfun)m,a_symbol,a_null); } // single symbol
void AddMethod(int inlet,bool (*m)(flext_base *,float &)) { AddMethod(inlet,"float",(methfun)m,a_float,a_null); } // single float void AddMethod(int inlet,bool (*m)(flext_base *,float &)) { AddMethod(inlet,"float",(methfun)m,a_float,a_null); } // single float
void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &)) { AddMethod(inlet,"list",(methfun)m,a_float,a_float,a_null); } // list of 2 floats void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &)) { AddMethod(inlet,"list",(methfun)m,a_float,a_float,a_null); } // list of 2 floats
void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &,float &)) { AddMethod(inlet,"list",(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &,float &)) { AddMethod(inlet,"list",(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats
...@@ -332,8 +335,11 @@ public: ...@@ -332,8 +335,11 @@ public:
void AddMethod(int inlet,bool (*m)(flext_base *,int &,int &)) { AddMethod(inlet,"list",(methfun)m,a_int,a_int,a_null); } // list of 2 floats void AddMethod(int inlet,bool (*m)(flext_base *,int &,int &)) { AddMethod(inlet,"list",(methfun)m,a_int,a_int,a_null); } // list of 2 floats
void AddMethod(int inlet,bool (*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,bool (*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,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_list,a_null); } // method+gimme void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int,t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_list,a_null); } // method+gimme
void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,const t_symbol *,int,t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_any,a_null); } // method+gimme void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int,const t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_list,a_null); } // method+gimme
void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *,int,t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_any,a_null); } // method+gimme
void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,const t_symbol *,int,const t_atom *)) { AddMethod(inlet,tag,(methfun)m,a_any,a_null); } // method+gimme
void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,t_symbol *&)) { AddMethod(inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,const t_symbol *&)) { AddMethod(inlet,tag,(methfun)m,a_symbol,a_null); } // method+symbol
void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,float &)) { AddMethod(inlet,tag,(methfun)m,a_float,a_null); } // method+float void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,float &)) { AddMethod(inlet,tag,(methfun)m,a_float,a_null); } // method+float
void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int &)) { AddMethod(inlet,tag,(methfun)m,a_int,a_null); } // method+int void AddMethod(int inlet,const char *tag,bool (*m)(flext_base *,int &)) { AddMethod(inlet,tag,(methfun)m,a_int,a_null); } // method+int
...@@ -525,7 +531,6 @@ protected: ...@@ -525,7 +531,6 @@ protected:
void AddAttrib(const char *attr,bool (*get)(flext_base *,bool &),bool (*set)(flext_base *,bool &)) { AddAttrib(attr,a_int,(methfun)get,(methfun)set); } void AddAttrib(const char *attr,bool (*get)(flext_base *,bool &),bool (*set)(flext_base *,bool &)) { AddAttrib(attr,a_int,(methfun)get,(methfun)set); }
void AddAttrib(const char *attr,bool (*get)(flext_base *,const t_symbol *&),bool (*set)(flext_base *,const t_symbol *&)) { AddAttrib(attr,a_symbol,(methfun)get,(methfun)set); } void AddAttrib(const char *attr,bool (*get)(flext_base *,const t_symbol *&),bool (*set)(flext_base *,const t_symbol *&)) { AddAttrib(attr,a_symbol,(methfun)get,(methfun)set); }
void AddAttrib(const char *attr,bool (*get)(flext_base *,t_symbol *&),bool (*set)(flext_base *,t_symbol *&)) { AddAttrib(attr,a_symbol,(methfun)get,(methfun)set); } void AddAttrib(const char *attr,bool (*get)(flext_base *,t_symbol *&),bool (*set)(flext_base *,t_symbol *&)) { AddAttrib(attr,a_symbol,(methfun)get,(methfun)set); }
void AddAttrib(const char *attr,bool (*get)(flext_base *,const t_symptr &),bool (*set)(flext_base *,const t_symptr &)) { AddAttrib(attr,a_symbol,(methfun)get,(methfun)set); }
void AddAttrib(const char *attr,bool (*get)(flext_base *,AtomList *&),bool (*set)(flext_base *,AtomList *&)) { AddAttrib(attr,a_LIST,(methfun)get,(methfun)set); } void AddAttrib(const char *attr,bool (*get)(flext_base *,AtomList *&),bool (*set)(flext_base *,AtomList *&)) { AddAttrib(attr,a_LIST,(methfun)get,(methfun)set); }
void AddAttrib(const char *attr,bool (*get)(flext_base *,AtomAnything *&),bool (*set)(flext_base *,AtomAnything *&)) { AddAttrib(attr,a_ANY,(methfun)get,(methfun)set); } void AddAttrib(const char *attr,bool (*get)(flext_base *,AtomAnything *&),bool (*set)(flext_base *,AtomAnything *&)) { AddAttrib(attr,a_ANY,(methfun)get,(methfun)set); }
......
...@@ -312,7 +312,7 @@ static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c) \ ...@@ -312,7 +312,7 @@ static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c) \
//! Set up a method callback for an anything argument //! Set up a method callback for an anything argument
#define FLEXT_CALLBACK_A(M_FUN) \ #define FLEXT_CALLBACK_A(M_FUN) \
static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,const t_symbol *s,int argc,t_atom *argv) \ static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,t_symbol *s,int argc,t_atom *argv) \
{ FLEXT_CAST<thisType *>(c)->M_FUN(s,argc,argv); return true; } { FLEXT_CAST<thisType *>(c)->M_FUN(s,argc,argv); return true; }
//! Set up a method callback for a variable argument list //! Set up a method callback for a variable argument list
...@@ -426,7 +426,7 @@ static void *FLEXT_THR_PRE(M_FUN)(thr_params *p) { \ ...@@ -426,7 +426,7 @@ static void *FLEXT_THR_PRE(M_FUN)(thr_params *p) { \
//! Set up a threaded method callback for an anything argument //! Set up a threaded method callback for an anything argument
#define FLEXT_THREAD_A(M_FUN) \ #define FLEXT_THREAD_A(M_FUN) \
static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,const t_symbol *s,int argc,t_atom *argv) { \ static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,t_symbol *s,int argc,t_atom *argv) { \
thr_params *p = new thr_params(c); p->set_any(s,argc,argv); \ thr_params *p = new thr_params(c); p->set_any(s,argc,argv); \
return StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \ return StartThread(FLEXT_THR_PRE(M_FUN),p,#M_FUN); \
} \ } \
......
...@@ -92,8 +92,8 @@ typedef t_pxbox t_sigobj; // that's the all-in-one object type of MaxMSP (not v ...@@ -92,8 +92,8 @@ typedef t_pxbox t_sigobj; // that's the all-in-one object type of MaxMSP (not v
typedef t_patcher t_canvas; typedef t_patcher t_canvas;
typedef t_int t_flint; typedef t_int t_flint;
typedef const t_symbol *t_symptr; typedef t_symbol *t_symptr;
typedef const t_symbol *t_symtype; typedef t_symbol *t_symtype;
typedef t_object *t_thing; typedef t_object *t_thing;
typedef qelem t_qelem; typedef qelem t_qelem;
......
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