Commit 686f301a authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@279 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent 71eef8e7
No preview for this file type
......@@ -72,15 +72,20 @@ cons:
- overhead in object size (due to possibly unneeded code)
see flext.h for the documented base classes
see flext.h, fldefs.h and flclass.h for the documented base definitions and classes
----------------------------------------------------------------------------
Version history:
0.3.3:
- Bind/unbind functions for flext classes
- revisited priority stuff for detached threads
- Bind/unbind functions for flext classes (how to do in MaxMSP?)
- Made "t_symtype" another synonym for "t_symbol *"
- Added forgotten dsp_free function for MaxMSP
- Fixed forgotten __class__ member for MaxMSP libraries
- Changed basic MaxMSP object to t_pxbox (ok, a bit more memory is used....)
- MaxMSP library can now be loaded from startup folder
0.3.2:
- doxygen generated inline documentation / functional reference
......
......@@ -168,6 +168,7 @@ class FLEXT_EXT flext_obj
};
static t_class *lib_class;
static t_symbol *lib_name;
static void libfun_add(const char *name,t_method newfun,void (*freefun)(flext_hdr *),int argtp1,...);
static flext_hdr *libfun_new(t_symbol *s,int argc,t_atom *argv);
static void libfun_free(flext_hdr *o);
......@@ -203,7 +204,6 @@ protected: \
static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST<NEW_CLASS *>(((flext_hdr *)c)->data); }
#define FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS,SETUPFUN) \
public: \
static t_class *__class__; \
......@@ -220,9 +220,11 @@ static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST<NEW_CLASS *>(((
// generate name of dsp/non-dsp setup function
#define FLEXT_STPF_0(NAME) NAME##_setup
#define FLEXT_STPF_2(NAME) NAME##_setup
#define FLEXT_STPF_1(NAME) NAME##_tilde_setup
#define FLEXT_STPF_(DSP) FLEXT_STPF_##DSP
#define FLEXT_STPF(NAME,DSP) FLEXT_STPF_(DSP)(NAME)
#define FLEXT_STPF_3(NAME) NAME##_tilde_setup
#define FLEXT_STPF_(OTP) FLEXT_STPF_##OTP
#define FLEXT_STPF(NAME,OTP) FLEXT_STPF_(OTP)(NAME)
#define REAL_NEW(NAME,NEW_CLASS,DSP) REAL_INST(0,NAME,NEW_CLASS,DSP)
......@@ -276,6 +278,7 @@ cl##_tilde_setup()
#define FLEXT_LIB_SETUP(NAME,SETUPFUN) \
extern "C" FLEXT_EXT int main() { \
SETUPFUN(); \
flext_obj::lib_name = gensym(#NAME); \
::setup((t_messlist **)&flext_obj::lib_class,(t_newmethod)&flext_obj::libfun_new,(t_method)flext_obj::libfun_free,sizeof(flext_hdr), 0,A_GIMME,A_NULL); \
return 0; \
}
......@@ -383,9 +386,11 @@ return 0; \
#define FLEXT_HELPSTR_DSP(NAME) #NAME "~"
#ifdef PD
#define FLEXT_DEFHELP(THIS,NAME,NEW_CLASS,DSP) FLEXT_CAST<NEW_CLASS *>(THIS)->DefineHelp(DSP?FLEXT_HELPSTR_DSP(NEW_CLASS):FLEXT_HELPSTR(NEW_CLASS),flext::extract(NAME,-1))
#define FLEXT_DEFHELP(THIS,NAME,NEW_CLASS,OTP) FLEXT_CAST<NEW_CLASS *>(THIS)->DefineHelp((OTP&1)?FLEXT_HELPSTR_DSP(NEW_CLASS):FLEXT_HELPSTR(NEW_CLASS),flext::extract(NAME,-1))
#define FLEXT_CLOPTS(NEW_CLASS,OTP) CLNEW_OPTIONS
#else
#define FLEXT_DEFHELP(THIS,NAME,NEW_CLASS,DSP)
#define FLEXT_DEFHELP(THIS,NAME,NEW_CLASS,OTP)
#define FLEXT_CLOPTS(NEW_CLASS,OTP) NULL
#endif
// ----------------------------------------------------
......@@ -418,7 +423,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_CLREF(flext::extract(NAME),NEW_CLASS::__class__), \
(t_newmethod)class_ ## NEW_CLASS, \
(t_method)&NEW_CLASS::callb_free, \
sizeof(flext_hdr), CLNEW_OPTIONS, \
sizeof(flext_hdr), FLEXT_CLOPTS(NEW_CLASS,DSP), \
A_NULL); \
for(int ix = 1; ; ++ix) { \
const char *c = flext::extract(NAME,ix); if(!c) break; \
......@@ -428,6 +433,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
}
#define REAL_NEWLIB(NAME,NEW_CLASS, DSP) \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS () \
{ \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
......@@ -451,7 +457,7 @@ void FLEXT_STPF(NEW_CLASS,DSP)() \
// ----------------------------------------------------
// variable arg list
// ----------------------------------------------------
#define REAL_INST_V(LIB,NAME,NEW_CLASS, DSP) \
#define REAL_INST_V(LIB,NAME,NEW_CLASS, OTP) \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS (t_symbol *,int argc,t_atom *argv) \
{ \
......@@ -461,17 +467,17 @@ flext_hdr* class_ ## NEW_CLASS (t_symbol *,int argc,t_atom *argv) \
obj->data = new NEW_CLASS(argc,argv); \
flext_obj::m_holder = NULL; \
if(!obj->data->InitOk()) { NEW_CLASS::callb_free(obj); obj = NULL; } \
else FLEXT_DEFHELP(obj->data,NAME,NEW_CLASS,DSP); \
else FLEXT_DEFHELP(obj->data,NAME,NEW_CLASS,OTP); \
return(obj); \
} \
FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,OTP)() \
{ \
CHECK_TILDE(NAME,DSP); \
CHECK_TILDE(NAME,OTP&1); \
NEW_CLASS::__class__ = FLEXT_NEWFN( \
FLEXT_CLREF(flext::extract(NAME),NEW_CLASS::__class__), \
(t_newmethod)class_ ## NEW_CLASS, \
(t_method)&NEW_CLASS::callb_free, \
sizeof(flext_hdr), CLNEW_OPTIONS, \
sizeof(flext_hdr), FLEXT_CLOPTS(NEW_CLASS,OTP), \
A_GIMME, \
A_NULL); \
for(int ix = 1; ; ++ix) { \
......@@ -481,7 +487,8 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
NEW_CLASS::callb_setup(NEW_CLASS::__class__); \
}
#define REAL_NEWLIB_V(NAME,NEW_CLASS, DSP) \
#define REAL_NEWLIB_V(NAME,NEW_CLASS, OTP) \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS (t_symbol *,int argc,t_atom *argv) \
{ \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
......@@ -490,12 +497,12 @@ flext_hdr* class_ ## NEW_CLASS (t_symbol *,int argc,t_atom *argv) \
obj->data = new NEW_CLASS(argc,argv); \
flext_obj::m_holder = NULL; \
if(!obj->data->InitOk()) { NEW_CLASS::callb_free(obj); obj = NULL; } \
else FLEXT_DEFHELP(obj->data,NAME,NEW_CLASS,DSP); \
else FLEXT_DEFHELP(obj->data,NAME,NEW_CLASS,OTP); \
return(obj); \
} \
void FLEXT_STPF(NEW_CLASS,DSP)() \
void FLEXT_STPF(NEW_CLASS,OTP)() \
{ \
CHECK_TILDE(NAME,DSP); \
CHECK_TILDE(NAME,OTP&1); \
NEW_CLASS::__class__ = flext_obj::lib_class; \
flext_obj::libfun_add(NAME,(t_method)(class_ ## NEW_CLASS),&NEW_CLASS::callb_free,A_GIMME,A_NULL); \
NEW_CLASS::callb_setup(flext_obj::lib_class); \
......@@ -525,7 +532,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_CLREF(flext::extract(NAME),NEW_CLASS::__class__), \
(t_newmethod)class_ ## NEW_CLASS, \
(t_method)&NEW_CLASS::callb_free, \
sizeof(flext_hdr), CLNEW_OPTIONS, \
sizeof(flext_hdr), FLEXT_CLOPTS(NEW_CLASS,DSP), \
FLEXTTP(TYPE1), \
A_NULL); \
for(int ix = 1; ; ++ix) { \
......@@ -536,6 +543,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
}
#define REAL_NEWLIB_1(NAME,NEW_CLASS, DSP,TYPE1) \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS (const flext_obj::lib_arg &arg1) \
{ \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
......@@ -579,7 +587,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_CLREF(flext::extract(NAME),NEW_CLASS::__class__), \
(t_newmethod)class_ ## NEW_CLASS, \
(t_method)&NEW_CLASS::callb_free, \
sizeof(flext_hdr), CLNEW_OPTIONS, \
sizeof(flext_hdr), FLEXT_CLOPTS(NEW_CLASS,DSP), \
FLEXTTP(TYPE1), FLEXTTP(TYPE2), \
A_NULL); \
for(int ix = 1; ; ++ix) { \
......@@ -590,6 +598,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
}
#define REAL_NEWLIB_2(NAME,NEW_CLASS, DSP,TYPE1, TYPE2) \
t_class * NEW_CLASS::__class__ = NULL; \
flext_hdr* class_ ## NEW_CLASS (const flext_obj::lib_arg &arg1,const flext_obj::lib_arg &arg2) \
{ \
flext_hdr *obj = (flext_hdr *)newobject(flext_obj::lib_class); \
......@@ -633,7 +642,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_CLREF(flext::extract(NAME),NEW_CLASS::__class__), \
(t_newmethod)class_ ## NEW_CLASS, \
(t_method)&NEW_CLASS::callb_free, \
sizeof(flext_hdr), CLNEW_OPTIONS, \
sizeof(flext_hdr), FLEXT_CLOPTS(NEW_CLASS,DSP), \
FLEXTTP(TYPE1), FLEXTTP(TYPE2),FLEXTTP(TYPE3), \
A_NULL); \
for(int ix = 1; ; ++ix) { \
......@@ -644,6 +653,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
}
#define REAL_NEWLIB_3(NAME,NEW_CLASS, DSP,TYPE1,TYPE2,TYPE3) \
t_class * NEW_CLASS::__class__ = NULL; \
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 = (flext_hdr *)newobject(flext_obj::lib_class); \
......@@ -686,7 +696,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
FLEXT_CLREF(flext::extract(NAME),NEW_CLASS::__class__), \
(t_newmethod)class_ ## NEW_CLASS, \
(t_method)&NEW_CLASS::callb_free, \
sizeof(flext_hdr), CLNEW_OPTIONS, \
sizeof(flext_hdr), FLEXT_CLOPTS(NEW_CLASS,DSP), \
FLEXTTP(TYPE1), FLEXTTP(TYPE2),FLEXTTP(TYPE3),FLEXTTP(TYPE4), \
A_NULL); \
for(int ix = 1; ; ++ix) { \
......@@ -697,6 +707,7 @@ FLEXT_EXP(LIB) void FLEXT_STPF(NEW_CLASS,DSP)() \
}
#define REAL_NEWLIB_4(NAME,NEW_CLASS, DSP,TYPE1,TYPE2,TYPE3,TYPE4) \
t_class * NEW_CLASS::__class__ = NULL; \
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 = (flext_hdr *)newobject(flext_obj::lib_class); \
......
......@@ -382,7 +382,7 @@ public:
void Unbind(const t_symbol *s) { pd_unbind(&thisHdr()->ob_pd,const_cast<t_symbol *>(s)); }
void Unbind(const char *c) { Unbind(MakeSymbol(c)); }
#else
#pragma message("Bind/Unbind not implemented!);
//#pragma message("Bind/Unbind not implemented!");
#endif
......
......@@ -52,6 +52,7 @@ FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS)
\
FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS, SETUPFUN)
//! @}
......@@ -99,6 +100,13 @@ REAL_EXT(NEW_CLASS,0)
REAL_NEW(NAME,NEW_CLASS,1) \
REAL_EXT(NEW_CLASS,1)
/*! Implementation of a flext GUI class with no arguments
\ingroup FLEXT_NEW_GUI
*/
#define FLEXT_NEW_GUI(NAME,NEW_CLASS) \
REAL_NEW(NAME,NEW_CLASS,2) \
REAL_EXT(NEW_CLASS, 2)
/*! Implementation of a flext class (part of a library) with no arguments
\ingroup FLEXT_LIB
*/
......@@ -131,6 +139,13 @@ REAL_EXT(NEW_CLASS,0)
REAL_NEW_V(NAME,NEW_CLASS,1) \
REAL_EXT(NEW_CLASS, 1)
/*! Implementation of a flext GUI class with a variable argument list
\ingroup FLEXT_NEW_GUI
*/
#define FLEXT_NEW_GUI_V(NAME,NEW_CLASS) \
REAL_NEW_V(NAME,NEW_CLASS,2) \
REAL_EXT(NEW_CLASS, 2)
/*! Implementation of a flext class (part of a library) with a variable argument list
\ingroup FLEXT_LIB
*/
......
......@@ -23,7 +23,8 @@ void flext_dsp::Setup(t_class *c)
#ifdef PD
CLASS_MAINSIGNALIN(c,flext_hdr,defsig);
#elif defined(MAXMSP)
dsp_initclass();
// dsp_initclass();
dsp_initboxclass();
#endif
add_dsp(c,cb_dsp);
......
......@@ -200,6 +200,11 @@ flext_base::~flext_base()
}
delete[] inlets;
}
#ifdef MAXMSP
// if(insigs) dsp_free(thisHdr());
if(insigs) dsp_freebox(thisHdr());
#endif
if(mlst) delete mlst;
}
......@@ -412,7 +417,9 @@ bool flext_base::SetupInOut()
incnt = cnt;
if(insigs) dsp_setup(thisHdr(),insigs); // signal inlets
if(insigs)
// dsp_setup(thisHdr(),insigs); // signal inlets
dsp_setupbox(thisHdr(),insigs); // signal inlets
}
#endif
......
......@@ -33,6 +33,7 @@ public:
static libfunction *libfuncs = NULL;
t_class *flext_obj::lib_class = NULL;
t_symbol *flext_obj::lib_name = NULL;
libfunction::libfunction(t_symbol *n,t_newmethod newf,void (*freef)(flext_hdr *)): name(n),newfun(newf),freefun(freef),nxt(NULL),argc(0),argv(NULL) {}
libfunction::~libfunction() { if(argv) delete[] argv; if(nxt) delete nxt; }
......@@ -134,7 +135,7 @@ flext_hdr *flext_obj::libfun_new(t_symbol *s,int argc,t_atom *argv)
}
}
else {
error("Class %s not found in library!",s->s_name);
if(s != lib_name) error("Class %s not found in library!",s->s_name);
return NULL;
}
}
......@@ -149,7 +150,7 @@ void flext_obj::libfun_free(flext_hdr *hdr)
if(l)
l->freefun(hdr);
else
error("Class %s not found in library!",name);
if(name != lib_name) error("Class %s not found in library!",name);
}
#endif
......
......@@ -33,7 +33,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#ifdef PD
/*! PD definitions start here */
/* PD definitions start here */
#ifdef _MSC_VER
#pragma warning (push)
......@@ -44,7 +44,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
extern "C" {
#endif
//! Include the relevant PD header files
// Include the relevant PD header files
#ifdef _DEBUG
#include <m_imp.h> // for easier debugging
#else
......@@ -76,9 +76,9 @@ typedef t_clock t_qelem;
// MAX stuff
#elif defined(MAXMSP)
/*! MaxMSP definitions start here */
/* MaxMSP definitions start here */
//! Include the relevant MaxMSP header files
// Include the relevant MaxMSP header files
extern "C"
{
#include "ext.h"
......@@ -88,7 +88,7 @@ extern "C"
//#include "z_atom.h"
}
typedef t_pxobject t_sigobj;
typedef t_pxbox t_sigobj; // that's the all-in-one object type of MaxMSP (not very memory-efficent, i guess)
typedef t_patcher t_canvas;
typedef t_int t_flint;
......@@ -103,6 +103,7 @@ typedef method t_newmethod;
typedef int t_atomtype;
typedef struct clock t_clock;
typedef void t_binbuf;
#undef clock_free
#define clock_free(tick) freeobject((object *)tick)
......@@ -116,7 +117,7 @@ typedef struct clock t_clock;
#ifdef _LOG
/*! If _LOG is defined implement logging */
/* If _LOG is defined implement logging */
#define LOG(s) post(s)
#define LOG1(s,v1) post(s,v1)
#define LOG2(s,v1,v2) post(s,v1,v2)
......@@ -127,7 +128,7 @@ typedef struct clock t_clock;
#else
/*! If _LOG is not defined avoid logging */
/* If _LOG is not defined avoid logging */
#define LOG(s) ((void)0)
#define LOG1(s,v1) ((void)0)
#define LOG2(s,v1,v2) ((void)0)
......@@ -146,7 +147,7 @@ typedef struct clock t_clock;
#define ERRINTERNAL() error("flext: Internal error in file " __FILE__ ", line %i - please report",(int)__LINE__)
/*! Set the right calling convention (and exporting) for the OS */
/* Set the right calling convention (and exporting) for the OS */
#if defined(NT)
#define FLEXT_EXT __declspec(dllexport)
......
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