aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-10-11 22:22:48 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-10-11 22:22:48 +0000
commit8edeb549041f2adce5d83ae071499f5a72e5db40 (patch)
treef624083d336434f88c3ba7796eec7c9dc12cc5b2 /externals
parent887f305d37cef754d3a50104b9e312ce01e2815c (diff)
bugfixes and optimizations, especially for DSP under Max/MSP
fixed and cleaned up library related stuff, especially co-existance of Max message and DSP library objects eliminate jmax code fixed dsp vector offset bug better separation between build styles - better handling of click callback - more compatible handling of attributes in patcher (hiding is now an option - define FLEXT_ATTRHIDE) svn path=/trunk/; revision=3695
Diffstat (limited to 'externals')
-rw-r--r--externals/grill/flext/changes.txt2
-rw-r--r--externals/grill/flext/source/flattr.cpp2
-rw-r--r--externals/grill/flext/source/flattr_ed.cpp12
-rw-r--r--externals/grill/flext/source/flbase.h85
-rw-r--r--externals/grill/flext/source/flclass.h138
-rw-r--r--externals/grill/flext/source/fldsp.cpp61
-rw-r--r--externals/grill/flext/source/fldsp.h18
-rw-r--r--externals/grill/flext/source/flext.cpp87
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp116
-rwxr-xr-xexternals/grill/flext/source/flmeth.cpp2
-rwxr-xr-xexternals/grill/flext/source/flproxy.cpp16
-rw-r--r--externals/grill/flext/source/flsupport.cpp35
-rw-r--r--externals/grill/flext/source/flsupport.h5
13 files changed, 287 insertions, 292 deletions
diff --git a/externals/grill/flext/changes.txt b/externals/grill/flext/changes.txt
index 8e85e7c5..05dad4b0 100644
--- a/externals/grill/flext/changes.txt
+++ b/externals/grill/flext/changes.txt
@@ -19,6 +19,8 @@ Version history:
- fixed severe Altivec bug (load unaligned)... thanks to Ian Ollmann
- restructured initialization and finalization (esp. Max DSP stuff)
- real class names now also reflect debug mode (like in flext_base_shared_d)
+- cleaned up internals (like Max/MSP typedefs)
+- fixed coexistence of message and signal objects in Max/MSP object libraries
0.5.0:
- fixes for 64 bit builds (size_t is integer type of pointer size)
diff --git a/externals/grill/flext/source/flattr.cpp b/externals/grill/flext/source/flattr.cpp
index 57b2a919..68791894 100644
--- a/externals/grill/flext/source/flattr.cpp
+++ b/externals/grill/flext/source/flattr.cpp
@@ -194,8 +194,6 @@ bool flext_base::ListAttrib() const
{
if(HasAttributes()) {
// defined in flsupport.cpp
- extern const t_symbol *sym_attributes;
-
AtomListStatic<32> la;
ListAttrib(la);
ToOutAnything(GetOutAttr(),sym_attributes,la.Count(),la.Atoms());
diff --git a/externals/grill/flext/source/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp
index bbbacbc3..fb2edaa7 100644
--- a/externals/grill/flext/source/flattr_ed.cpp
+++ b/externals/grill/flext/source/flattr_ed.cpp
@@ -478,7 +478,7 @@ void flext_base::SetGfx(t_classid c)
widgetbehavior.w_selectfn = cb_GfxSelect;
#if PD_MINOR_VERSION >= 37
- class_setsavefn(cl,cb_GfxSave);
+ class_setsavefn(cl,(t_savefn)cb_GfxSave);
#else
widgetbehavior.w_savefn = cb_GfxSave;
#endif
@@ -489,7 +489,7 @@ void flext_base::SetGfx(t_classid c)
#ifndef FLEXT_NOATTREDIT
#if PD_MINOR_VERSION >= 37
- class_setpropertiesfn(cl,cb_GfxProperties);
+ class_setpropertiesfn(cl,(t_propertiesfn)cb_GfxProperties);
#else
widgetbehavior.w_propertiesfn = cb_GfxProperties;
#endif
@@ -518,7 +518,7 @@ static size_t escapeit(char *dst,size_t maxlen,const char *src)
return d-dst;
}
-void flext_base::cb_GfxProperties(t_gobj *c, t_glist *)
+void flext_base::cb_GfxProperties(flext_hdr *c, t_glist *)
{
flext_base *th = thisObject(c);
char buf[1000];
@@ -784,7 +784,7 @@ void flext_base::BinbufAttr(t_binbuf *b,bool transdoll)
}
//! Strip the attributes off the object command line
-void flext_base::cb_GfxVis(t_gobj *c, t_glist *gl, int vis)
+void flext_base::cb_GfxVis(flext_hdr *c, t_glist *gl, int vis)
{
if(!gl->gl_isgraph || gl->gl_havewindow) {
// show object if it's not inside a GOP
@@ -814,7 +814,7 @@ void flext_base::cb_GfxVis(t_gobj *c, t_glist *gl, int vis)
// else don't show
}
-void flext_base::cb_GfxSelect(t_gobj *c,t_glist *gl,int state)
+void flext_base::cb_GfxSelect(flext_hdr *c,t_glist *gl,int state)
{
t_text *x = (t_text *)c;
flext_base *th = thisObject(c);
@@ -853,7 +853,7 @@ void flext_base::cb_GfxSelect(t_gobj *c,t_glist *gl,int state)
}
}
-void flext_base::cb_GfxSave(t_gobj *c, t_binbuf *b)
+void flext_base::cb_GfxSave(flext_hdr *c, t_binbuf *b)
{
flext_base *th = thisObject(c);
t_text *t = (t_text *)c;
diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
index 46c53949..5560e74a 100644
--- a/externals/grill/flext/source/flbase.h
+++ b/externals/grill/flext/source/flbase.h
@@ -154,9 +154,20 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
t_classid thisClassId() const { return clss; }
//! Get class pointer from class id
- static t_class *getClass(t_classid);
+ static t_class *getClass(t_classid id);
+
+ static bool IsDSP(t_classid id);
+ static bool IsLib(t_classid id);
bool HasAttributes() const;
+ bool IsDSP() const;
+ bool IsLib() const;
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ // under Max/MSP it could be necessary to activate DSP also for message objects
+ // namely for those coexisting with DSP objects in a library
+ bool NeedDSP() const;
+#endif
//! @} FLEXT_OBJ_INFO
@@ -241,17 +252,12 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
// Definitions for library objects
static void lib_init(const char *name,void setupfun(),bool attr);
static void obj_add(bool lib,bool dsp,bool attr,const char *idname,const char *names,void setupfun(t_classid),FLEXT_CLASSDEF(flext_obj) *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...);
-#if FLEXT_SYS == FLEXT_SYS_JMAX
- static void obj_new(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at);
- static void obj_free(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at);
-#else
#if FLEXT_SYS == FLEXT_SYS_MAX
static flext_hdr *obj_new(const t_symbol *s,short argc,t_atom *argv);
#else
static flext_hdr *obj_new(const t_symbol *s,int argc,t_atom *argv);
#endif
static void obj_free(flext_hdr *o);
-#endif
//! Convert $0 or #0 symbol into appropriate value
static bool GetParamSym(t_atom &dst,const t_symbol *s,t_canvas *c);
@@ -302,77 +308,52 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj):
public: \
typedef NEW_CLASS thisType; \
static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \
-static void __free__(flext_hdr *hdr) \
-{ FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \
- hdr->flext_hdr::~flext_hdr(); } \
-static void __setup__(t_classid classid) { \
- PARENT_CLASS::__setup__(classid); } \
-protected: \
-static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST<NEW_CLASS *>(((flext_hdr *)c)->data); }
+static void __free__(flext_hdr *hdr) { \
+ FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \
+ hdr->flext_hdr::~flext_hdr(); \
+} \
+static void __setup__(t_classid classid) { PARENT_CLASS::__setup__(classid); }
#define FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS,SETUPFUN) \
public: \
typedef NEW_CLASS thisType; \
static FLEXT_CLASSDEF(flext_obj) *__init__(int argc,t_atom *argv); \
-static void __free__(flext_hdr *hdr) \
-{ FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \
- hdr->flext_hdr::~flext_hdr(); } \
-static void __setup__(t_classid classid) \
-{ PARENT_CLASS::__setup__(classid); \
- NEW_CLASS::SETUPFUN(classid); } \
-protected: \
-static inline NEW_CLASS *thisObject(void *c) { return FLEXT_CAST<NEW_CLASS *>(((flext_hdr *)c)->data); }
+static void __free__(flext_hdr *hdr) { \
+ FLEXT_CLASSDEF(flext_obj) *mydata = hdr->data; delete mydata; \
+ hdr->flext_hdr::~flext_hdr(); \
+} \
+static void __setup__(t_classid classid) { \
+ PARENT_CLASS::__setup__(classid); \
+ NEW_CLASS::SETUPFUN(classid); \
+}
+
// generate name of dsp/non-dsp setup function
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
#define FLEXT_STPF_0(NAME) NAME##_setup
#define FLEXT_STPF_1(NAME) NAME##_tilde_setup
#else
- #define FLEXT_STPF_0(NAME) NAME##_config
- #define FLEXT_STPF_1(NAME) signal_##NAME##_config
+#error Platform not supported
#endif
#define FLEXT_STPF_(DSP) FLEXT_STPF_##DSP
#define FLEXT_STPF(NAME,DSP) FLEXT_STPF_(DSP)(NAME)
-
// --------------------------------------------------------------------------------------
-
-// these can be used in library setup functions
-// to register the individual objects in the library
-
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- #define REAL_SETUP_0(cl) \
- extern void cl##_setup(); cl##_setup()
-
- #define REAL_SETUP_1(cl) \
- extern void cl##_tilde_setup(); cl##_tilde_setup()
-#else
- #define REAL_SETUP_0(cl) \
- extern void cl##_config(); cl##_config()
-
- #define REAL_SETUP_1(cl) \
- extern void signal_##cl##_config(); signal_##cl##_config()
-#endif
-
-#define REAL_SETUP(cl,DSP) REAL_SETUP_##DSP(cl)
+// used in library setup functions to register the individual objects in the library
+#define REAL_SETUP(cl,DSP) extern void FLEXT_STPF(cl,DSP)(); FLEXT_STPF(cl,DSP)();
// specify that to define the library itself
-
#if FLEXT_SYS == FLEXT_SYS_PD
#define REAL_LIB_SETUP(NAME,SETUPFUN) extern "C" FLEXT_EXT void NAME##_setup() { flext_obj::lib_init(#NAME,SETUPFUN,FLEXT_ATTRIBUTES); }
#elif FLEXT_SYS == FLEXT_SYS_MAX
#define REAL_LIB_SETUP(NAME,SETUPFUN) extern "C" FLEXT_EXT int main() { flext_obj::lib_init(#NAME,SETUPFUN,FLEXT_ATTRIBUTES); return 0; }
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
-#define REAL_LIB_SETUP(NAME,SETUPFUN) \
-static void __##NAME##_initfun() { flext_obj::lib_init(#NAME,SETUPFUN,FLEXT_ATTRIBUTES); } \
-fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0};
#else
-#error
+#error Platform not supported
#endif
@@ -383,7 +364,7 @@ fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0};
#define FLEXT_EXP_1
#define FLEXT_EXP(LIB) FLEXT_EXP_##LIB
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_JMAX
+#if FLEXT_SYS == FLEXT_SYS_PD
#define FLEXT_OBJ_SETUP_0(NEW_CLASS,DSP)
#elif FLEXT_SYS == FLEXT_SYS_MAX
#define FLEXT_OBJ_SETUP_0(NEW_CLASS,DSP) extern "C" FLEXT_EXT int main() { FLEXT_STPF(NEW_CLASS,DSP)(); return 0; }
@@ -443,7 +424,7 @@ fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0};
#define FLEXTTYPE_bool FLEXTTPN_FLOAT
#define FLEXTTYPE_bool0 FLEXTTPN_DEFFLOAT
#define CALLBTYPE_bool float
-#elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX
+#elif FLEXT_SYS == FLEXT_SYS_MAX
#define FLEXTTYPE_int FLEXTTPN_INT
#define FLEXTTYPE_int0 FLEXTTPN_DEFINT
#define CALLBTYPE_int int
@@ -451,7 +432,7 @@ fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0};
#define FLEXTTYPE_bool0 FLEXTTPN_DEFINT
#define CALLBTYPE_bool int
#else
-#error
+#error Platform not supported
#endif
#define FLEXTTYPE_t_symptr FLEXTTPN_SYM
diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h
index 63dbc4d1..d01fbfc8 100644
--- a/externals/grill/flext/source/flclass.h
+++ b/externals/grill/flext/source/flclass.h
@@ -198,12 +198,11 @@ public:
//! Retrieve currently processed message tag (NULL if no message processing)
static const t_symbol *thisTag() { return curtag; }
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
class outlet;
//! Get pointer to outlet (not in the constructor!)
outlet *GetOut(int ix) const { return outlets[ix]; }
-#endif
+
int GetOutAttr() const { return HasAttributes()?CntOut():0; }
//! @} FLEXT_C_IO_MISC
@@ -349,10 +348,8 @@ public:
void AddMethod(int inlet,bool (*m)(flext_base *,float &,float &,float &)) { AddMethod(ThMeths(),inlet,sym_list,(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats
#if FLEXT_SYS == FLEXT_SYS_PD
void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,sym_float,(methfun)m,a_int,a_null); } // single float
-#elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX
- void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,sym_int,(methfun)m,a_int,a_null); } // single float
#else
-#error
+ void AddMethod(int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ThMeths(),inlet,sym_int,(methfun)m,a_int,a_null); } // single float
#endif
void AddMethod(int inlet,bool (*m)(flext_base *,int &,int &)) { AddMethod(ThMeths(),inlet,sym_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(ThMeths(),inlet,sym_list,(methfun)m,a_int,a_int,a_int,a_null); } // list of 3 floats
@@ -399,10 +396,8 @@ public:
static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,float &,float &,float &)) { AddMethod(ClMeths(c),inlet,sym_list,(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats
#if FLEXT_SYS == FLEXT_SYS_PD
static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,sym_float,(methfun)m,a_int,a_null); } // single integer
-#elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX
- static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,sym_int,(methfun)m,a_int,a_null); } // single integer
#else
-#error
+ static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &)) { AddMethod(ClMeths(c),inlet,sym_int,(methfun)m,a_int,a_null); } // single integer
#endif
static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &,int &)) { AddMethod(ClMeths(c),inlet,sym_list,(methfun)m,a_int,a_int,a_null); } // list of 2 floats
static void AddMethod(t_classid c,int inlet,bool (*m)(flext_base *,int &,int &,int &)) { AddMethod(ClMeths(c),inlet,sym_list,(methfun)m,a_int,a_int,a_int,a_null); } // list of 3 floats
@@ -432,24 +427,15 @@ public:
@{
*/
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
//! Bind object to a symbol
bool Bind(const t_symbol *sym);
//! Unbind object from a symbol
bool Unbind(const t_symbol *sym);
-#endif
-#if FLEXT_SYS == FLEXT_SYS_JMAX
- //! Bind object to a symbol (as string)
- bool Bind(const char *sym); // ** TODO **
- //! Unbind object from a symbol (as string)
- bool Unbind(const char *sym); // ** TODO **
-#else
//! Bind object to a symbol (as string)
bool Bind(const char *sym) { return Bind(MakeSymbol(sym)); }
//! Unbind object from a symbol (as string)
bool Unbind(const char *sym) { return Unbind(MakeSymbol(sym)); }
-#endif
/*! \brief Bind a method to a symbol
\param sym Symbol to bind to
@@ -768,26 +754,20 @@ protected:
};
// these outlet functions don't check for thread but send directly to the real-time system
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
void ToSysBang(int n) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_bang((t_outlet *)o); CRITOFF(); } }
void ToSysFloat(int n,float f) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_float((t_outlet *)o,f); CRITOFF(); } }
void ToSysInt(int n,int f) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_flint((t_outlet *)o,f); CRITOFF(); } }
void ToSysSymbol(int n,const t_symbol *s) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_symbol((t_outlet *)o,const_cast<t_symbol *>(s)); CRITOFF(); } }
void ToSysList(int n,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_list((t_outlet *)o,const_cast<t_symbol *>(sym_list),argc,(t_atom *)argv); CRITOFF(); } }
void ToSysAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { outlet *o = GetOut(n); if(o) { CRITON(); outlet_anything((t_outlet *)o,const_cast<t_symbol *>(s),argc,(t_atom *)argv); CRITOFF(); } }
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
- void ToSysBang(int n) const { fts_outlet_bang((fts_object *)thisHdr(),n); }
- void ToSysFloat(int n,float f) const { fts_outlet_float((fts_object *)thisHdr(),n,f); }
- void ToSysInt(int n,int f) const { fts_outlet_int((fts_object *)thisHdr(),n,f); }
- void ToSysSymbol(int n,const t_symbol *s) const { fts_outlet_symbol((fts_object *)thisHdr(),n,s); }
- void ToSysList(int n,int argc,const t_atom *argv) const { fts_outlet_send((fts_object *)thisHdr(),n,sym_list,argc,(t_atom *)argv); }
- void ToSysAnything(int n,const t_symbol *s,int argc,const t_atom *argv) const { fts_outlet_send((fts_object *)thisHdr(),n,const_cast<t_symbol *>(s),argc,(t_atom *)argv); }
-#else
-#error Not implemented
-#endif
+
void ToSysBool(int n,bool f) const { ToSysInt(n,f?1:0); }
void ToSysAtom(int n,const t_atom &at) const;
+ // add class method handlers
+ static void AddMessageMethods(t_class *c);
+ static void AddSignalMethods(t_class *c);
+
private:
class pxbnd_object;
public:
@@ -823,6 +803,8 @@ public:
private:
+ static inline flext_base *thisObject(flext_hdr *c) { return FLEXT_CAST<flext_base *>(c->data); }
+
static void Setup(t_classid c);
//! \brief This represents either an inlet or outlet during construction
@@ -845,9 +827,7 @@ private:
//! number of message and signal inlets/outlets
unsigned char incnt,outcnt,insigs,outsigs;
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
outlet **outlets;
-#endif
union t_any {
float ft;
@@ -918,13 +898,13 @@ private:
#ifndef FLEXT_NOATTREDIT
// attribute editor
static bool cb_AttrDialog(flext_base *c,int argc,const t_atom *argv);
- static void cb_GfxProperties(t_gobj *c, t_glist *);
+ static void cb_GfxProperties(flext_hdr *c, t_glist *);
#endif
#ifdef FLEXT_ATTRHIDE
- static void cb_GfxVis(t_gobj *c, t_glist *gl, int vis);
- static void cb_GfxSave(t_gobj *c, t_binbuf *b);
- static void cb_GfxSelect(t_gobj *x, struct _glist *glist, int state);
+ static void cb_GfxVis(flext_hdr *c, t_glist *gl, int vis);
+ static void cb_GfxSave(flext_hdr *c, t_binbuf *b);
+ static void cb_GfxSelect(flext_hdr *x, struct _glist *glist, int state);
void BinbufArgs(t_binbuf *b,t_binbuf *args,bool withname,bool transdoll);
void BinbufAttr(t_binbuf *b,bool transdoll);
@@ -943,52 +923,48 @@ private:
static void px_method(px_object *c,const t_symbol *s,int argc,t_atom *argv);
};
- static void cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv);
+ static void cb_px_anything(flext_hdr *c,const t_symbol *s,int argc,t_atom *argv);
- static void cb_px_ft1(t_class *c,float f);
- static void cb_px_ft2(t_class *c,float f);
- static void cb_px_ft3(t_class *c,float f);
- static void cb_px_ft4(t_class *c,float f);
- static void cb_px_ft5(t_class *c,float f);
- static void cb_px_ft6(t_class *c,float f);
- static void cb_px_ft7(t_class *c,float f);
- static void cb_px_ft8(t_class *c,float f);
- static void cb_px_ft9(t_class *c,float f);
+ static void cb_px_ft1(flext_hdr *c,float f);
+ static void cb_px_ft2(flext_hdr *c,float f);
+ static void cb_px_ft3(flext_hdr *c,float f);
+ static void cb_px_ft4(flext_hdr *c,float f);
+ static void cb_px_ft5(flext_hdr *c,float f);
+ static void cb_px_ft6(flext_hdr *c,float f);
+ static void cb_px_ft7(flext_hdr *c,float f);
+ static void cb_px_ft8(flext_hdr *c,float f);
+ static void cb_px_ft9(flext_hdr *c,float f);
#elif FLEXT_SYS == FLEXT_SYS_MAX
typedef object px_object;
- static void cb_px_float(t_class *c,double f);
- static void cb_px_int(t_class *c,long v);
- static void cb_px_bang(t_class *c);
-
- static void cb_px_in1(t_class *c,long v);
- static void cb_px_in2(t_class *c,long v);
- static void cb_px_in3(t_class *c,long v);
- static void cb_px_in4(t_class *c,long v);
- static void cb_px_in5(t_class *c,long v);
- static void cb_px_in6(t_class *c,long v);
- static void cb_px_in7(t_class *c,long v);
- static void cb_px_in8(t_class *c,long v);
- static void cb_px_in9(t_class *c,long v);
-
- static void cb_px_ft1(t_class *c,double f);
- static void cb_px_ft2(t_class *c,double f);
- static void cb_px_ft3(t_class *c,double f);
- static void cb_px_ft4(t_class *c,double f);
- static void cb_px_ft5(t_class *c,double f);
- static void cb_px_ft6(t_class *c,double f);
- static void cb_px_ft7(t_class *c,double f);
- static void cb_px_ft8(t_class *c,double f);
- static void cb_px_ft9(t_class *c,double f);
-
- static void cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *argv);
+ static void cb_px_float(flext_hdr *c,double f);
+ static void cb_px_int(flext_hdr *c,long v);
+ static void cb_px_bang(flext_hdr *c);
+
+ static void cb_px_in1(flext_hdr *c,long v);
+ static void cb_px_in2(flext_hdr *c,long v);
+ static void cb_px_in3(flext_hdr *c,long v);
+ static void cb_px_in4(flext_hdr *c,long v);
+ static void cb_px_in5(flext_hdr *c,long v);
+ static void cb_px_in6(flext_hdr *c,long v);
+ static void cb_px_in7(flext_hdr *c,long v);
+ static void cb_px_in8(flext_hdr *c,long v);
+ static void cb_px_in9(flext_hdr *c,long v);
+
+ static void cb_px_ft1(flext_hdr *c,double f);
+ static void cb_px_ft2(flext_hdr *c,double f);
+ static void cb_px_ft3(flext_hdr *c,double f);
+ static void cb_px_ft4(flext_hdr *c,double f);
+ static void cb_px_ft5(flext_hdr *c,double f);
+ static void cb_px_ft6(flext_hdr *c,double f);
+ static void cb_px_ft7(flext_hdr *c,double f);
+ static void cb_px_ft8(flext_hdr *c,double f);
+ static void cb_px_ft9(flext_hdr *c,double f);
+
+ static void cb_px_anything(flext_hdr *c,const t_symbol *s,short argc,t_atom *argv);
#endif
-#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
px_object **inlets;
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
- static void jmax_proxy(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at);
-#endif
// --------- symbol-bound proxy
@@ -1024,17 +1000,19 @@ private:
// callback functions
- static void cb_loadbang(t_class *c);
-
-#if FLEXT_SYS == FLEXT_SYS_PD
- static void cb_click(t_gobj *z,t_floatarg xpos,t_floatarg ypos,t_floatarg shift,t_floatarg ctrl,t_floatarg alt);
-#endif
+ static void cb_loadbang(flext_hdr *c);
#if FLEXT_SYS == FLEXT_SYS_MAX
char **indesc,**outdesc;
- static void cb_assist(t_class *c,void *b,long msg,long arg,char *s);
- static void cb_click (t_class *c, Point pt, short mods);
+ static void cb_assist(flext_hdr *c,void *b,long msg,long arg,char *s);
+ static void cb_click (flext_hdr *c, Point pt, short mods);
+
+ static void cb_dsp(flext_hdr *c,t_signal **s,short *count);
+#elif FLEXT_SYS == FLEXT_SYS_PD
+ static void cb_click(flext_hdr *z,t_floatarg xpos,t_floatarg ypos,t_floatarg shift,t_floatarg ctrl,t_floatarg alt);
+
+ static void cb_dsp(flext_hdr *c,t_signal **s);
#endif
};
diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp
index f6f109ad..753779cc 100644
--- a/externals/grill/flext/source/fldsp.cpp
+++ b/externals/grill/flext/source/fldsp.cpp
@@ -23,14 +23,12 @@ void flext_dsp::Setup(t_classid id)
t_class *c = getClass(id);
#if FLEXT_SYS == FLEXT_SYS_MAX
- dsp_initclass();
- add_dsp(c,cb_dsp);
-#elif FLEXT_SYS == FLEXT_SYS_PD
- CLASS_MAINSIGNALIN(c,flext_hdr,defsig); // float messages going into the left inlet are converted to signal
- add_dsp(c,cb_dsp);
+ if(!IsLib(id))
+#endif
+ AddSignalMethods(c);
+
+#if FLEXT_SYS == FLEXT_SYS_PD
add_method1(c,cb_enable,"enable",A_FLOAT);
-#else
-#error Platform not supported!
#endif
}
@@ -42,26 +40,8 @@ flext_dsp::FLEXT_CLASSDEF(flext_dsp)()
#endif
{}
-#if FLEXT_SYS == FLEXT_SYS_MAX
-bool flext_dsp::Init()
-{
- if(!flext_base::Init())
- return false;
-
- // according to the Max/MSP SDK this should be prior to any inlet creation, BUT
- // that doesn't seem to be true... multiple signal ins and additional inlets don't seem to work then
- dsp_setup(thisHdr(),CntInSig()); // signal inlets
- return true;
-}
-#endif
-
void flext_dsp::Exit()
{
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // according to David Z. one should do that first...
- dsp_free(thisHdr());
-#endif
-
flext_base::Exit();
if(vecs) delete[] vecs;
@@ -85,44 +65,37 @@ t_int *flext_dsp::dspmeth(t_int *w)
return w+2;
}
-#if FLEXT_SYS == FLEXT_SYS_MAX
-void flext_dsp::cb_dsp(t_class *c,t_signal **sp,short *count)
-#else
-void flext_dsp::cb_dsp(t_class *c,t_signal **sp)
-#endif
+void flext_dsp::SetupDsp(t_signal **sp)
{
- flext_dsp *obj = thisObject(c);
-
int i;
- int in = obj->CntInSig();
- int out = obj->CntOutSig();
+ int in = CntInSig();
+ int out = CntOutSig();
#if FLEXT_SYS == FLEXT_SYS_PD
// min. 1 input channel! (CLASS_MAININLET in pd...)
if(!in) in = 1;
#endif
// store current dsp parameters
- obj->srate = sp[0]->s_sr;
- obj->blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ?
+ srate = sp[0]->s_sr;
+ blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ?
// store in and out signal vectors
- if((in+out) && !obj->vecs)
- obj->vecs = new t_signalvec[in+out];
+ if((in+out) && !vecs)
+ vecs = new t_signalvec[in+out];
for(i = 0; i < in; ++i)
- obj->vecs[i] = sp[i]->s_vec;
+ vecs[i] = sp[i]->s_vec;
for(i = 0; i < out; ++i)
- obj->vecs[in+i] = sp[in+i]->s_vec;
+ vecs[in+i] = sp[in+i]->s_vec;
// with the following call derived classes can do their eventual DSP setup
- if(obj->CbDsp()) {
+ if(CbDsp()) {
// set the DSP function
- dsp_add((t_dspmethod)dspmeth,1,obj);
+ dsp_add((t_dspmethod)dspmeth,1,this);
}
}
-
void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const * /*outsigs*/) {}
bool flext_dsp::CbDsp()
@@ -146,5 +119,5 @@ void flext_dsp::CbSignal()
#if FLEXT_SYS == FLEXT_SYS_PD
-void flext_dsp::cb_enable(t_class *c,t_float on) { thisObject(c)->dspon = on != 0; }
+void flext_dsp::cb_enable(flext_hdr *c,t_float on) { thisObject(c)->dspon = on != 0; }
#endif
diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h
index b85bbe07..b766ed8d 100644
--- a/externals/grill/flext/source/fldsp.h
+++ b/externals/grill/flext/source/fldsp.h
@@ -33,6 +33,8 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_dsp):
{
FLEXT_HEADER_S(FLEXT_CLASSDEF(flext_dsp),flext_base,Setup)
+ friend class FLEXT_SHARE FLEXT_CLASSDEF(flext_base);
+
public:
/*! \defgroup FLEXT_DSP Flext dsp class
@@ -148,10 +150,6 @@ protected:
FLEXT_CLASSDEF(flext_dsp)();
-#if FLEXT_SYS == FLEXT_SYS_MAX
- virtual bool Init();
-#endif
-
virtual void Exit();
private:
@@ -164,15 +162,15 @@ private:
// setup function
static void Setup(t_classid c);
- // callback functions
-#if FLEXT_SYS == FLEXT_SYS_MAX
- static void cb_dsp(t_class *c,t_signal **s,short *count);
-#else
- static void cb_dsp(t_class *c,t_signal **s);
- static void cb_enable(t_class *c,t_float on);
+#if FLEXT_SYS == FLEXT_SYS_PD
+ static void cb_enable(flext_hdr *c,t_float on);
bool dspon;
#endif
+ static inline flext_dsp *thisObject(flext_hdr *c) { return FLEXT_CAST<flext_dsp *>(c->data); }
+
+ void SetupDsp(t_signal **sp);
+
// dsp stuff
static t_int *dspmeth(t_int *w);
};
diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp
index 4d62633e..6c598500 100644
--- a/externals/grill/flext/source/flext.cpp
+++ b/externals/grill/flext/source/flext.cpp
@@ -14,6 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flext.h"
#include "flinternal.h"
+#include "fldsp.h"
#include <string.h>
// === flext_base ============================================
@@ -64,6 +65,12 @@ bool flext_base::Init()
if(ok) ok = InitInlets() && InitOutlets();
if(ok) {
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ // according to the Max/MSP SDK this should be prior to any inlet creation, BUT
+ // that doesn't seem to be true... multiple signal ins and additional inlets don't seem to work then
+ if(NeedDSP()) dsp_setup(thisHdr(),CntInSig()); // signal inlets
+#endif
+
if(HasAttributes() && m_holdaargc && m_holdaargv) {
// initialize creation attributes
ok = InitAttrib(m_holdaargc,m_holdaargv);
@@ -79,6 +86,11 @@ bool flext_base::Init()
*/
void flext_base::Exit()
{
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ // according to David Z. one should do that first...
+ if(NeedDSP()) dsp_free(thisHdr());
+#endif
+
#if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_NOATTREDIT)
// attribute editor window may still be open -> close it
gfxstub_deleteforkey(thisHdr());
@@ -129,13 +141,8 @@ void flext_base::Exit()
}
-/*! Set up proxy classes and basic methods at class creation time
- This ensures that they are processed before the registered flext messages
-*/
-void flext_base::Setup(t_classid id)
+void flext_base::AddMessageMethods(t_class *c)
{
- t_class *c = getClass(id);
-
add_loadbang(c,cb_loadbang);
#if FLEXT_SYS == FLEXT_SYS_PD
class_addmethod(c,(t_method)cb_click,gensym("click"),A_FLOAT,A_FLOAT,A_FLOAT,A_FLOAT,A_FLOAT,A_NULL);
@@ -146,6 +153,35 @@ void flext_base::Setup(t_classid id)
#pragma message ("no implementation of loadbang or assist")
#endif
+ SetProxies(c);
+ StartQueue();
+}
+
+void flext_base::AddSignalMethods(t_class *c)
+{
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ add_dsp(c,cb_dsp);
+ dsp_initclass();
+#elif FLEXT_SYS == FLEXT_SYS_PD
+ CLASS_MAINSIGNALIN(c,flext_hdr,defsig); // float messages going into the left inlet are converted to signal
+ add_dsp(c,cb_dsp);
+#else
+#error Platform not supported!
+#endif
+}
+
+/*! Set up proxy classes and basic methods at class creation time
+ This ensures that they are processed before the registered flext messages
+*/
+void flext_base::Setup(t_classid id)
+{
+ t_class *c = getClass(id);
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ if(!IsLib(id))
+#endif
+ AddMessageMethods(c);
+
if(process_attributes) {
AddMethod(id,0,"getattributes",cb_ListAttrib);
AddMethod(id,0,"getmethods",cb_ListMethods);
@@ -158,15 +194,9 @@ void flext_base::Setup(t_classid id)
#if FLEXT_SYS == FLEXT_SYS_PD
SetGfx(id);
#endif
-
- SetProxies(c);
-
- StartQueue();
}
-#if FLEXT_SYS != FLEXT_SYS_JMAX
-void flext_base::cb_loadbang(t_class *c) { thisObject(c)->CbLoadbang(); }
-#endif
+void flext_base::cb_loadbang(flext_hdr *c) { thisObject(c)->CbLoadbang(); }
void flext_base::m_loadbang() {}
void flext_base::CbLoadbang() { m_loadbang(); }
@@ -174,19 +204,19 @@ void flext_base::CbLoadbang() { m_loadbang(); }
void flext_base::CbClick() {}
#if FLEXT_SYS == FLEXT_SYS_PD
-void flext_base::cb_click(t_gobj *c,t_floatarg xpos,t_floatarg ypos,t_floatarg shift,t_floatarg ctrl,t_floatarg alt)
+void flext_base::cb_click(flext_hdr *c,t_floatarg xpos,t_floatarg ypos,t_floatarg shift,t_floatarg ctrl,t_floatarg alt)
{
if(shift) thisObject(c)->CbClick();
}
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
-void flext_base::cb_click(t_class *c, Point pt, short mods)
+void flext_base::cb_click(flext_hdr *c, Point pt, short mods)
{
thisObject(c)->CbClick();
}
-void flext_base::cb_assist(t_class *c,void * /*b*/,long msg,long arg,char *s)
+void flext_base::cb_assist(flext_hdr *c,void * /*b*/,long msg,long arg,char *s)
{
flext_base *th = thisObject(c);
@@ -204,3 +234,28 @@ void flext_base::cb_assist(t_class *c,void * /*b*/,long msg,long arg,char *s)
}
}
#endif
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+void flext_base::cb_dsp(flext_hdr *c,t_signal **sp,short *count)
+#else
+void flext_base::cb_dsp(flext_hdr *c,t_signal **sp)
+#endif
+{
+ flext_base *bobj = thisObject(c);
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ // we must extra-check here if it is really a DSP object
+ // obviously, for objects that are part of a library, one dsp_initclass enables DSP for all
+ if(!bobj->IsDSP()) return;
+#endif
+
+ flext_dsp *obj;
+#ifdef FLEXT_DEBUG
+ obj = dynamic_cast<flext_dsp *>(bobj);
+#else
+ obj = static_cast<flext_dsp *>(bobj);
+#endif
+
+ obj->SetupDsp(sp);
+}
+
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index b41a744e..4f837aff 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -100,6 +100,24 @@ bool flext::chktilde(const char *objname)
return false;
}
+// this class stands for one library of objects
+// there can be more if flext is a shared library
+class flext_library
+{
+public:
+ flext_library(const t_symbol *nm)
+ : name(nm)
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ , clss(NULL),dsp(false)
+#endif
+ {}
+
+ const t_symbol *name;
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ t_class *clss;
+ bool dsp;
+#endif
+};
// this class stands for one registered object
// it holds the class, type flags, constructor and destructor of the object and the creation arg types
@@ -114,7 +132,8 @@ public:
void (*freefun)(flext_hdr *c);
t_class *const &clss;
- bool lib,dsp,attr,dist;
+ flext_library *lib;
+ bool dsp,attr,dist;
int argc;
int *argv;
@@ -143,52 +162,64 @@ static flext_class *FindName(const t_symbol *s,flext_class *o = NULL)
}
-// for Max/MSP, the library is represented by a special object (class) registered at startup
-// all objects in the library are clones of that library object - they share the same class
-#if FLEXT_SYS == FLEXT_SYS_MAX
-static t_class *lib_class = NULL;
-static const t_symbol *lib_name = NULL;
-#endif
-
-t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast<flext_class *>(id)->clss; }
+t_class *flext_obj::getClass(t_classid cl) { return cl->clss; }
+bool flext_obj::IsDSP(t_classid cl) { return cl->dsp; }
+bool flext_obj::IsLib(t_classid cl) { return cl->lib != NULL; }
bool flext_obj::HasAttributes() const { return clss->attr; }
+bool flext_obj::IsDSP() const { return clss->dsp; }
+bool flext_obj::IsLib() const { return clss->lib != NULL; }
+#if FLEXT_SYS == FLEXT_SYS_MAX
+bool flext_obj::NeedDSP() const { return clss->dsp || (clss->lib && clss->lib->dsp); }
+#endif
+
+static flext_library *curlib = NULL;
void flext_obj::lib_init(const char *name,void setupfun(),bool attr)
{
+ // make new library instance
+ curlib = new flext_library(MakeSymbol(name));
+
flext::Setup();
-#if FLEXT_SYS == FLEXT_SYS_MAX
- lib_name = MakeSymbol(name);
- ::setup(
- (t_messlist **)&lib_class,
- (t_newmethod)obj_new,(t_method)obj_free,
- sizeof(flext_hdr),NULL,A_GIMME,A_NULL);
-#endif
process_attributes = attr;
+ // first register all classes
try {
setupfun();
}
catch(std::exception &x) {
error("%s - %s",name,x.what());
+ return;
}
catch(char *txt) {
error("%s - %s",name,txt);
+ return;
}
catch(...) {
error("%s - Unknown exception at library setup",name);
+ return;
}
-}
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ // then see if we got DSP classes
-#if FLEXT_SYS == FLEXT_SYS_JMAX
-static void jmax_class_inst(t_class *cl)
-{
- fts_class_init(cl, sizeof(flext_hdr),flext_obj::obj_new,flext_obj::obj_free);
-}
+ // for Max/MSP, the library is represented by a special object (class) registered at startup
+ // all objects in the library are clones of that library object - they share the same class
+ ::setup(
+ (t_messlist **)&curlib->clss,
+ (t_newmethod)obj_new,(t_method)obj_free,
+ sizeof(flext_hdr),NULL,A_GIMME,A_NULL);
+
+ // for all classes in library add methods
+ flext_base::AddMessageMethods(curlib->clss);
+ if(curlib->dsp) flext_base::AddSignalMethods(curlib->clss);
#endif
+ curlib = NULL;
+}
+
void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const char *names,void setupfun(t_classid),flext_obj *(*newfun)(int,t_atom *),void (*freefun)(flext_hdr *),int argtp1,...)
{
// get first possible object name
@@ -198,12 +229,21 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha
if(dsp) chktilde(GetString(nsym));
#endif
- if(!lib) process_attributes = attr;
+ if(lib) {
+ FLEXT_ASSERT(curlib);
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ curlib->dsp |= dsp;
+#endif
+ }
+ else {
+ FLEXT_ASSERT(!curlib);
+ process_attributes = attr;
+ }
// set dynamic class pointer
t_class **cl =
#if FLEXT_SYS == FLEXT_SYS_MAX
- lib?&lib_class:
+ lib?&curlib->clss:
#endif
new t_class *;
@@ -222,19 +262,17 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha
// attention: in Max/MSP the *cl variable is not initialized after that call.
// just the address is stored, the initialization then occurs with the first object instance!
}
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
- *cl = fts_class_install(nsym, jmax_class_inst);
#else
-#error
+#error Platform not implemented
#endif
// make new dynamic object
flext_class *lo = new flext_class(*cl,newfun,freefun);
- lo->lib = lib;
+ lo->lib = curlib;
lo->dsp = dsp;
lo->attr = process_attributes;
-// post("ADDCLASS %p -> LIBOBJ %p -> %p",*cl,lo,lo->clss);
+// post("ADDCLASS %s,%s = %p -> LIBOBJ %p -> %p (lib=%i,dsp=%i)",idname,names,*cl,lo,lo->clss,lib?1:0,dsp?1:0);
// parse the argument type list and store it with the object
if(argtp1 == FLEXTTPN_VAR)
@@ -284,8 +322,6 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha
// in Max/MSP the first alias gets its name from the name of the object file,
// unless it is a library (then the name can be different)
::alias(const_cast<char *>(c));
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
- if(ix > 0) fts_class_alias(lo->clss,lsym);
#else
#error
#endif
@@ -311,11 +347,6 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha
typedef flext_obj *(*libfun)(int,t_atom *);
-#if FLEXT_SYS == FLEXT_SYS_JMAX
-void flext_obj::obj_new(fts_object_t *o, int, fts_symbol_t s, int _argc_, const fts_atom_t *argv)
-{
- flext_hdr *obj = (flext_hdr *)o;
-#else
#if FLEXT_SYS == FLEXT_SYS_MAX
flext_hdr *flext_obj::obj_new(const t_symbol *s,short _argc_,t_atom *argv)
#else
@@ -323,9 +354,10 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
#endif
{
flext_hdr *obj = NULL;
-#endif
flext_class *lo = FindName(s);
if(lo) {
+// post("NEWOBJ %s = %p -> %p",GetString(s),lo,lo->clss);
+
bool ok = true;
t_atom args[NEWARGS];
@@ -470,21 +502,15 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
else
#if FLEXT_SYS == FLEXT_SYS_MAX
// in Max/MSP an object with the name of the library exists, even if not explicitly declared!
- if(s != lib_name)
+// if(!lo->lib || s != lo->lib->name)
#endif
error("Class %s not found in library!",s->s_name);
#endif
-#if FLEXT_SYS != FLEXT_SYS_JMAX
return obj;
-#endif
}
-#if FLEXT_SYS == FLEXT_SYS_JMAX
-void flext_obj::obj_free(fts_object_t *h, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at)
-#else
void flext_obj::obj_free(flext_hdr *h)
-#endif
{
flext_hdr *hdr = (flext_hdr *)h;
const t_symbol *name = hdr->data->thisNameSym();
@@ -516,7 +542,7 @@ void flext_obj::obj_free(flext_hdr *h)
else
#if FLEXT_SYS == FLEXT_SYS_MAX
// in Max/MSP an object with the name of the library exists, even if not explicitely declared!
- if(name != lib_name)
+// if(!lo->lib || s != lo->lib->name)
#endif
error("Class %s not found in library!",name);
#endif
diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp
index c391f950..69b1e640 100755
--- a/externals/grill/flext/source/flmeth.cpp
+++ b/externals/grill/flext/source/flmeth.cpp
@@ -116,8 +116,6 @@ bool flext_base::cb_ListMethods(flext_base *c,int argc,const t_atom *argv)
{
if(c->HasAttributes() && (argc == 0 || (argc == 1 && CanbeInt(argv[0])))) {
// defined in flsupport.cpp
- extern const t_symbol *sym_methods;
-
int inlet = argc?GetAInt(argv[0]):0;
AtomListStatic<32> la;
c->ListMethods(la,inlet);
diff --git a/externals/grill/flext/source/flproxy.cpp b/externals/grill/flext/source/flproxy.cpp
index b25fb0fd..7b964db5 100755
--- a/externals/grill/flext/source/flproxy.cpp
+++ b/externals/grill/flext/source/flproxy.cpp
@@ -27,40 +27,40 @@ void flext_base::px_object::px_method(px_object *obj,const t_symbol *s,int argc,
obj->base->CbMethodHandler(obj->index,s,argc,argv);
}
-void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
+void flext_base::cb_px_anything(flext_hdr *c,const t_symbol *s,int argc,t_atom *argv)
{
thisObject(c)->CbMethodHandler(0,s,argc,argv);
}
#define DEF_IN_FT(IX) \
-void flext_base::cb_px_ft ## IX(t_class *c,float v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); }
+void flext_base::cb_px_ft ## IX(flext_hdr *c,float v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); }
#define ADD_IN_FT(IX) \
add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT)
#elif FLEXT_SYS == FLEXT_SYS_MAX
-void flext_base::cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *argv)
+void flext_base::cb_px_anything(flext_hdr *c,const t_symbol *s,short argc,t_atom *argv)
{
int ci = ((flext_hdr *)c)->curinlet;
thisObject(c)->CbMethodHandler(ci,s,argc,argv);
}
-void flext_base::cb_px_int(t_class *c,long v)
+void flext_base::cb_px_int(flext_hdr *c,long v)
{
t_atom atom; SetInt(atom,v);
int ci = ((flext_hdr *)c)->curinlet;
thisObject(c)->CbMethodHandler(ci,sym_int,1,&atom);
}
-void flext_base::cb_px_float(t_class *c,double v)
+void flext_base::cb_px_float(flext_hdr *c,double v)
{
t_atom atom; SetFloat(atom,v);
int ci = ((flext_hdr *)c)->curinlet;
thisObject(c)->CbMethodHandler(ci,sym_float,1,&atom);
}
-void flext_base::cb_px_bang(t_class *c)
+void flext_base::cb_px_bang(flext_hdr *c)
{
int ci = ((flext_hdr *)c)->curinlet;
thisObject(c)->CbMethodHandler(ci,sym_bang,0,NULL);
@@ -68,8 +68,8 @@ void flext_base::cb_px_bang(t_class *c)
#define DEF_IN_FT(IX) \
-void flext_base::cb_px_in ## IX(t_class *c,long v) { t_atom atom; SetInt(atom,v); thisObject(c)->CbMethodHandler(IX,sym_int,1,&atom); } \
-void flext_base::cb_px_ft ## IX(t_class *c,double v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); }
+void flext_base::cb_px_in ## IX(flext_hdr *c,long v) { t_atom atom; SetInt(atom,v); thisObject(c)->CbMethodHandler(IX,sym_int,1,&atom); } \
+void flext_base::cb_px_ft ## IX(flext_hdr *c,double v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); }
#define ADD_IN_FT(IX) \
add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index d2a30e07..a05f2b04 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -34,15 +34,13 @@ const t_symbol *flext::sym_pointer = NULL;
const t_symbol *flext::sym_int = NULL;
const t_symbol *flext::sym_signal = NULL;
-#if FLEXT_SYS != FLEXT_SYS_JMAX
const t_symbol *flext::sym_anything = NULL;
-const t_symbol *sym_buffer = NULL;
-const t_symbol *sym_size = NULL;
-#endif
+const t_symbol *flext::sym_buffer = NULL;
+const t_symbol *flext::sym_size = NULL;
-const t_symbol *sym_attributes = NULL;
-const t_symbol *sym_methods = NULL;
+const t_symbol *flext::sym_attributes = NULL;
+const t_symbol *flext::sym_methods = NULL;
int flext::Version() { return FLEXT_VERSION; }
@@ -78,15 +76,6 @@ void flext::Setup()
sym_buffer = flext::MakeSymbol("buffer~");
sym_size = flext::MakeSymbol("size");
-#elif FLEXT_SYS == FLEXT_SYS_JMAX
- sym__ = fts_new_symbol("");; // is there a static symbol for that?
- sym_int = fts_s_int;
- sym_float = fts_s_float;
- sym_symbol = fts_s_symbol;
- sym_bang = fts_s_bang;
- sym_list = fts_s_list;
- sym_pointer = fts_s_pointer;
-#else
#endif
sym_attributes = flext::MakeSymbol("attributes");
@@ -138,9 +127,7 @@ void *flext_root::operator new(size_t bytes)
//! We need system locking here for secondary threads!
SYSLOCK();
-#if FLEXT_SYS == FLEXT_SYS_JMAX
- blk = (char *)::fts_malloc(bytes);
-#elif defined(FLEXT_USECMEM)
+#if defined(FLEXT_USECMEM)
blk = (char *)::malloc(bytes);
#else
blk = (char *)::getbytes(bytes);
@@ -184,9 +171,7 @@ void flext_root::operator delete(void *blk)
//! We need system locking here for secondary threads!
SYSLOCK();
-#if FLEXT_SYS == FLEXT_SYS_JMAX
- ::fts_free(ori);
-#elif defined(FLEXT_USECMEM)
+#if defined(FLEXT_USECMEM)
::free(ori);
#else
::freebytes(ori,bytes);
@@ -226,9 +211,7 @@ void *flext_root::NewAligned(size_t bytes,int bitalign)
//! We need system locking here for secondary threads!
SYSLOCK();
-#if FLEXT_SYS == FLEXT_SYS_JMAX
- blk = (char *)::fts_malloc(bytes);
-#elif defined(FLEXT_USECMEM)
+#if defined(FLEXT_USECMEM)
blk = (char *)::malloc(bytes);
#else
blk = (char *)::getbytes(bytes);
@@ -262,9 +245,7 @@ void flext_root::FreeAligned(void *blk)
//! We need system locking here for secondary threads!
SYSLOCK();
-#if FLEXT_SYS == FLEXT_SYS_JMAX
- ::fts_free(ori);
-#elif defined(FLEXT_USECMEM)
+#if defined(FLEXT_USECMEM)
::free(ori);
#else
::freebytes(ori,bytes);
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index 3d96ebef..da9a19ae 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -1189,6 +1189,11 @@ protected:
static bool chktilde(const char *objname);
static unsigned long simdcaps;
+
+ static const t_symbol *sym_buffer;
+ static const t_symbol *sym_size;
+ static const t_symbol *sym_attributes;
+ static const t_symbol *sym_methods;
};