From da9c21b096e47f09ab24279b17d293aead832ad2 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Fri, 18 Apr 2003 02:36:42 +0000 Subject: "" svn path=/trunk/; revision=577 --- externals/grill/flext/flext.cw | Bin 572167 -> 572167 bytes externals/grill/flext/readme.txt | 1 + externals/grill/flext/source/flbase.h | 4 --- externals/grill/flext/source/flbind.cpp | 46 +++++++++++++++++++++++++++++++- externals/grill/flext/source/flclass.h | 2 ++ externals/grill/flext/source/flext.h | 4 +-- externals/grill/flext/source/fllib.cpp | 26 ------------------ externals/grill/vasp/vasp.cw | Bin 356360 -> 356360 bytes 8 files changed, 50 insertions(+), 33 deletions(-) (limited to 'externals/grill') diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw index e35219e5..bf7ab642 100644 Binary files a/externals/grill/flext/flext.cw and b/externals/grill/flext/flext.cw differ diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt index 362d7a47..a97b98f2 100644 --- a/externals/grill/flext/readme.txt +++ b/externals/grill/flext/readme.txt @@ -115,6 +115,7 @@ see flext.h, fldefs.h and flclass.h for the documented base definitions and clas Version history: 0.4.4: +- fix deadly bug for Max/MSP method-to-symbol-binding proxies - some fixes for CodeWarrior Mach-O compilation 0.4.3: diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h index 18ba2ca1..b785e925 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -218,10 +218,6 @@ class FLEXT_SHARE flext_obj: //! Flag for successful object construction bool init_ok; - // --- proxy stuff for symbol-bound methods ---- - - static void SetupBindProxy(); - public: //! Creation callback diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp index 18297c61..80ba36fb 100644 --- a/externals/grill/flext/source/flbind.cpp +++ b/externals/grill/flext/source/flbind.cpp @@ -18,6 +18,44 @@ WARRANTIES, see the file, "license.txt," in this distribution. t_class *flext_base::pxbnd_class = NULL; +#if FLEXT_SYS == FLEXT_SYS_MAX +t_object *px_freelist = NULL; +t_messlist px_messlist[3]; +#endif + +/*! \brief Set up the proxy class for symbol-bound methods +*/ +void flext_base::SetupBindProxy() +{ + // already initialized? + if(!pxbnd_class) { +#if FLEXT_SYS == FLEXT_SYS_PD + pxbnd_class = class_new(gensym("flext_base bind proxy"),NULL,NULL,sizeof(pxbnd_object),CLASS_PD|CLASS_NOINLET, A_NULL); + add_anything(pxbnd_class,pxbnd_object::px_method); // for symbol-bound methods +#elif FLEXT_SYS == FLEXT_SYS_MAX + pxbnd_class = new t_class; + + pxbnd_class->c_sym = gensym(""); + pxbnd_class->c_freelist = &px_freelist; + pxbnd_class->c_freefun = NULL; + pxbnd_class->c_size = sizeof(pxbnd_object); + pxbnd_class->c_tiny = 0; + pxbnd_class->c_noinlet = 1; + px_messlist[0].m_sym = (t_symbol *)pxbnd_class; + + px_messlist[1].m_sym = gensym("anything"); + px_messlist[1].m_fun = (method)pxbnd_object::px_method; + px_messlist[1].m_type[0] = A_GIMME; + px_messlist[1].m_type[1] = 0; + + px_messlist[2].m_sym = 0; +#else +#pragma warning("Not implemented!") +#endif + } +} + + flext_base::binditem::binditem(int in,const t_symbol *sym,bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *data),pxbnd_object *p): item(sym,0,NULL),fun(f),px(p) {} @@ -35,9 +73,15 @@ bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbo } } - FLEXT_ASSERT(pxbnd_class); + SetupBindProxy(); +#if FLEXT_SYS == FLEXT_SYS_PD pxbnd_object *px = (pxbnd_object *)object_new(pxbnd_class); +#elif FLEXT_SYS == FLEXT_SYS_MAX + pxbnd_object *px = (pxbnd_object *)newobject(px_messlist); +#else +#pragma warning("Not implemented!") +#endif if(px) { binditem *mi = new binditem(0,sym,fun,px); diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 216c35fc..6e105551 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -774,6 +774,8 @@ private: static void px_method(pxbnd_object *c,const t_symbol *s,int argc,t_atom *argv); }; + static void SetupBindProxy(); + // --------- static void SetProxies(t_class *c); diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h index a60d4efb..34f80ab3 100644 --- a/externals/grill/flext/source/flext.h +++ b/externals/grill/flext/source/flext.h @@ -23,10 +23,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. */ //! \brief flext version number -#define FLEXT_VERSION 403 +#define FLEXT_VERSION 404 //! \brief flext version string -#define FLEXT_VERSTR "0.4.3" +#define FLEXT_VERSTR "0.4.4pre" //! @} diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp index 438f8bd0..242591b3 100755 --- a/externals/grill/flext/source/fllib.cpp +++ b/externals/grill/flext/source/fllib.cpp @@ -192,33 +192,10 @@ flext_obj::t_classid flext_obj::thisClassId() const { return libname::Find(thisN t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast(id)->clss; } #endif -/*! \brief Set up the proxy class for symbol-bound methods - \note This has to take place before the main class is set up because - \note Max does not know which class is the current one afterwards (when methods are added) -*/ -void flext_obj::SetupBindProxy() -{ - // already initialized? - if(!flext_base::pxbnd_class) { -#if FLEXT_SYS == FLEXT_SYS_PD - flext_base::pxbnd_class = class_new(gensym("flext_base bind proxy"),NULL,NULL,sizeof(flext_base::pxbnd_object),CLASS_PD|CLASS_NOINLET, A_NULL); - add_anything(flext_base::pxbnd_class,flext_base::pxbnd_object::px_method); // for symbol-bound methods -#elif FLEXT_SYS == FLEXT_SYS_MAX - ::setup((t_messlist **)&flext_base::pxbnd_class,NULL,NULL,sizeof(flext_base::pxbnd_object),NULL,A_NULL); - add_anything(flext_base::pxbnd_class,flext_base::pxbnd_object::px_method); // for symbol-bound methods -#else -#pragma warning("Not implemented!") -#endif - } -} - - void flext_obj::lib_init(const char *name,void setupfun(),bool attr) { flext::Setup(); - SetupBindProxy(); - #if FLEXT_SYS == FLEXT_SYS_MAX lib_name = MakeSymbol(name); ::setup( @@ -239,9 +216,6 @@ static void jmax_class_inst(t_class *cl) 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,...) { - // set up bind proxy - SetupBindProxy(); - // get first possible object name const t_symbol *nsym = MakeSymbol(extract(names)); diff --git a/externals/grill/vasp/vasp.cw b/externals/grill/vasp/vasp.cw index 18ee45f9..550f2cb6 100644 Binary files a/externals/grill/vasp/vasp.cw and b/externals/grill/vasp/vasp.cw differ -- cgit v1.2.1