Update of /cvsroot/pure-data/externals/grill/flext/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28365/source
Modified Files: flattr.cpp flattr_ed.cpp flbase.cpp flbase.h flclass.h fldsp.cpp fldsp.h flext.cpp flext.h flitem.cpp fllib.cpp flmap.cpp flmap.h flmeth.cpp flmsg.cpp flout.cpp fltimer.cpp flxlet.cpp Log Message: oops, fix Max/MSP has its own check.... changed initialization functions accordingly better timers for Windows fixed timer bug changed template parameter of TableMap compiler flag for MinGW binary compatibility (thanks to GG) enable WIN2000/XP API features with definition in build system fix for symbol messages into non-left inlets restructured TableMap type (doesn't own pointers any more) no sanity check for iterator fixes for MSVC6 slimmed object data structures better c++ compliance fixed problems with symbol binding
Index: flmap.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmap.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** flmap.h 10 May 2005 10:56:47 -0000 1.20 --- flmap.h 23 May 2005 16:52:45 -0000 1.21 *************** *** 53,57 **** void check(int tsize) { if(n) _check(tsize); } #else ! void check(int tsize) {} #endif
--- 53,57 ---- void check(int tsize) { if(n) _check(tsize); } #else ! // void check(int tsize) {} #endif
*************** *** 65,69 **** r = 0; } ! check(tsize); return r; } --- 65,69 ---- r = 0; } ! // check(tsize); return r; } *************** *** 74,78 **** { void *r = n?_remove(tsize,k):0; ! check(tsize); return r; } --- 74,78 ---- { void *r = n?_remove(tsize,k):0; ! // check(tsize); return r; }
Index: flout.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flout.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** flout.cpp 26 Jan 2005 05:01:59 -0000 1.21 --- flout.cpp 23 May 2005 16:52:45 -0000 1.22 *************** *** 67,97 **** bool ok = true;
// ---------------------------------- // create inlets // ----------------------------------
- incnt = insigs = 0; - - // digest inlist - - xlet *xi; - incnt = 0; - for(xi = inlist; xi; xi = xi->nxt) ++incnt; - xlet::type *list = new xlet::type[incnt]; - int i; - for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp; - #if FLEXT_SYS == FLEXT_SYS_MAX // copy inlet descriptions indesc = new char *[incnt]; ! for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) { ! int l = xi->desc?strlen(xi->desc):0; ! if(l) { ! indesc[i] = new char[l+1]; ! memcpy(indesc[i],xi->desc,l); ! indesc[i][l] = 0; ! } ! else ! indesc[i] = NULL; } #endif --- 67,86 ---- bool ok = true;
+ // incnt has number of inlets (any type) + // insigs should be 0 + + FLEXT_ASSERT(!insigs && !inlets); + // ---------------------------------- // create inlets // ----------------------------------
#if FLEXT_SYS == FLEXT_SYS_MAX // copy inlet descriptions indesc = new char *[incnt]; ! for(int i = 0; i < incnt; ++i) { ! xlet &x = inlist[i]; ! indesc[i] = x.desc; ! x.desc = NULL; } #endif *************** *** 99,103 **** #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX inlets = new px_object *[incnt]; - for(i = 0; i < incnt; ++i) inlets[i] = NULL; #endif
--- 88,91 ---- *************** *** 106,135 **** { int cnt = 0; - xi = inlist; // points to first inlet - if(incnt >= 1) { ! switch(list[0]) { ! case xlet::tp_sig: ! ++insigs; ! break; ! default: ! // leftmost inlet is already there... ! break; ! } ++cnt;
#if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION) // set tooltip ! if(xi->desc && *xi->desc) class_settip(thisClass(),gensym(xi->desc)); #endif }
for(int ix = 1; ix < incnt; ++ix,++cnt) { ! xi = xi->nxt; // points to next inlet ! t_inlet *in = NULL; ! switch(list[ix]) { ! case xlet::tp_float: ! case xlet::tp_int: { char sym[] = "ft??"; if(ix >= 10) { --- 94,116 ---- { int cnt = 0; if(incnt >= 1) { ! xlet &xi = inlist[0]; // points to first inlet ! if(xi.tp == xlet_sig) ++insigs; ! // else leftmost inlet is already there... ++cnt;
#if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION) // set tooltip ! if(xi.desc && *xi.desc) class_settip(thisClass(),gensym(xi.desc)); #endif }
for(int ix = 1; ix < incnt; ++ix,++cnt) { ! xlet &xi = inlist[ix]; // points to first inlet t_inlet *in = NULL; ! switch(xi.tp) { ! case xlet_float: ! case xlet_int: { ! inlets[ix] = NULL; char sym[] = "ft??"; if(ix >= 10) { *************** *** 150,167 **** break; } ! case xlet::tp_sym: (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol); break; ! case xlet::tp_list: (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list); break; ! case xlet::tp_any: (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0); break; ! case xlet::tp_sig: ! if(compatibility && list[ix-1] != xlet::tp_sig) { post("%s: All signal inlets must be left-aligned in compatibility mode",thisName()); ok = false; --- 131,149 ---- break; } ! case xlet_sym: (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol); break; ! case xlet_list: (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list); break; ! case xlet_any: (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages in = inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0); break; ! case xlet_sig: ! inlets[ix] = NULL; ! if(compatibility && inlist[ix-1].tp != xlet_sig) { post("%s: All signal inlets must be left-aligned in compatibility mode",thisName()); ok = false; *************** *** 175,179 **** break; default: ! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]); ok = false; } --- 157,162 ---- break; default: ! inlets[ix] = NULL; ! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)inlist[ix].tp); ok = false; } *************** *** 181,185 **** #if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION) // set tooltip ! if(in && xi->desc && *xi->desc) inlet_settip(in,gensym(xi->desc)); #endif } --- 164,168 ---- #if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION) // set tooltip ! if(in && xi.desc && *xi.desc) inlet_settip(in,gensym(xi.desc)); #endif } *************** *** 191,199 **** int ix,cnt; // count leftmost signal inlets ! while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) { if(ix == 0) { ! if(list[ix] != xlet::tp_any) { error("%s: Leftmost inlet must be of type signal or anything",thisName()); ok = false; --- 174,184 ---- int ix,cnt; // count leftmost signal inlets ! while(insigs < incnt && inlist[insigs].tp == xlet_sig) ++insigs;
for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) { + xlet &xi = inlist[ix]; if(ix == 0) { ! inlets[ix] = NULL; ! if(xi.tp != xlet_any) { error("%s: Leftmost inlet must be of type signal or anything",thisName()); ok = false; *************** *** 201,210 **** } else { ! switch(list[ix]) { ! case xlet::tp_sig: error("%s: All signal inlets must be left-aligned",thisName()); ok = false; break; ! case xlet::tp_float: if(ix >= 10) { post("%s: Only 9 float inlets possible",thisName()); --- 186,197 ---- } else { ! switch(xi.tp) { ! case xlet_sig: ! inlets[ix] = NULL; error("%s: All signal inlets must be left-aligned",thisName()); ok = false; break; ! case xlet_float: ! inlets[ix] = NULL; if(ix >= 10) { post("%s: Only 9 float inlets possible",thisName()); *************** *** 214,218 **** floatin(x_obj,ix); break; ! case xlet::tp_int: if(ix >= 10) { post("%s: Only 9 int inlets possible",thisName()); --- 201,206 ---- floatin(x_obj,ix); break; ! case xlet_int: ! inlets[ix] = NULL; if(ix >= 10) { post("%s: Only 9 int inlets possible",thisName()); *************** *** 222,232 **** intin(x_obj,ix); break; ! case xlet::tp_any: // non-leftmost ! case xlet::tp_sym: ! case xlet::tp_list: inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet); break; default: ! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]); ok = false; } --- 210,221 ---- intin(x_obj,ix); break; ! case xlet_any: // non-leftmost ! case xlet_sym: ! case xlet_list: inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet); break; default: ! inlets[ix] = NULL; ! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)xi.tp); ok = false; } *************** *** 237,279 ****
if(insigs) ! dsp_setup(thisHdr(),insigs); // signal inlets ! // dsp_setupbox(thisHdr(),insigs); // signal inlets ! } ! #elif FLEXT_SYS == FLEXT_SYS_JMAX ! { ! t_class *cl = thisClass(); ! int cnt = 0; ! for(int ix = 0; ix < incnt; ++ix,++cnt) { ! switch(list[ix]) { ! case xlet::tp_float: ! case xlet::tp_int: ! // fts_class_inlet_number(cl, ix, jmax_proxy); ! break; ! case xlet::tp_sym: ! // fts_class_inlet_symbol(cl, ix, jmax_proxy); ! break; ! case xlet::tp_sig: ! if(compatibility && list[ix-1] != xlet::tp_sig) { ! post("%s: All signal inlets must be left-aligned in compatibility mode",thisName()); ! ok = false; ! } ! else { ! if(!insigs) fts_dsp_declare_inlet(cl,0); ! ++insigs; ! } ! // no break -> let a signal inlet also accept any messages ! case xlet::tp_list: ! case xlet::tp_any: ! // fts_class_inlet_varargs(cl,ix, jmax_proxy); ! break; ! default: ! error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]); ! ok = false; ! } ! } ! ! incnt = cnt; ! ! fts_object_set_inlets_number((fts_object_t *)thisHdr(), incnt); } #else --- 226,230 ----
if(insigs) ! dsp_setup(thisHdr(),insigs); // signal inlets } #else *************** *** 281,288 **** #endif
- delete inlist; inlist = NULL; - - delete[] list; - return ok; } --- 232,235 ---- *************** *** 291,294 **** --- 238,247 ---- { bool ok = true; + int procattr = HasAttributes()?1:0; + + // outcnt has number of inlets (any type) + // outsigs should be 0 + + FLEXT_ASSERT(outsigs == 0);
// ---------------------------------- *************** *** 296,301 **** // ----------------------------------
- outcnt = outsigs = 0; - #if FLEXT_SYS == FLEXT_SYS_MAX // for Max/MSP the rightmost outlet has to be created first --- 249,252 ---- *************** *** 305,406 **** #endif
- // digest outlist - { - xlet *xi; - - // count outlets - outcnt = 0; - for(xi = outlist; xi; xi = xi->nxt) ++outcnt; - - xlet::type *list = new xlet::type[outcnt]; - int i; - for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp; - #if FLEXT_SYS == FLEXT_SYS_MAX ! // copy outlet descriptions ! outdesc = new char *[outcnt]; ! for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) { ! int l = xi->desc?strlen(xi->desc):0; ! if(l) { ! outdesc[i] = new char[l+1]; ! memcpy(outdesc[i],xi->desc,l); ! outdesc[i][l] = 0; ! } ! else ! outdesc[i] = NULL; ! } #endif
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX ! outlets = new outlet *[outcnt+(procattr?1:0)];
! // type info is now in list array #if FLEXT_SYS == FLEXT_SYS_PD ! for(int ix = 0; ix < outcnt; ++ix) #elif FLEXT_SYS == FLEXT_SYS_MAX ! for(int ix = outcnt-1; ix >= 0; --ix) #else #error #endif ! { ! switch(list[ix]) { ! case xlet::tp_float: ! outlets[ix] = (outlet *)newout_float(&x_obj->obj); ! break; ! case xlet::tp_int: ! outlets[ix] = (outlet *)newout_flint(&x_obj->obj); ! break; ! case xlet::tp_sig: ! outlets[ix] = (outlet *)newout_signal(&x_obj->obj); ! ++outsigs; ! break; ! case xlet::tp_sym: ! outlets[ix] = (outlet *)newout_symbol(&x_obj->obj); ! break; ! case xlet::tp_list: ! outlets[ix] = (outlet *)newout_list(&x_obj->obj); ! break; ! case xlet::tp_any: ! outlets[ix] = (outlet *)newout_anything(&x_obj->obj); ! break; ! #ifdef FLEXT_DEBUG ! default: ! ERRINTERNAL(); ! ok = false; ! #endif ! } ! } ! #elif FLEXT_SYS == FLEXT_SYS_JMAX ! t_class *cl = thisClass(); ! for(int ix = 0; ix < outcnt; ++ix) { ! switch(list[ix]) { ! case xlet::tp_float: ! case xlet::tp_int: ! // fts_class_outlet_number(cl, ix); ! break; ! case xlet::tp_sym: ! // fts_class_outlet_symbol(cl, ix); ! break; ! case xlet::tp_list: ! case xlet::tp_any: ! // fts_class_outlet_anything(cl, ix); ! break; ! case xlet::tp_sig: ! if(!outsigs) fts_dsp_declare_outlet(cl,0); ! ++outsigs; ! break; #ifdef FLEXT_DEBUG ! default: ! ERRINTERNAL(); ! ok = false; ! #endif ! } ! } ! ! fts_object_set_outlets_number((fts_object_t *)thisHdr(), outcnt+(procattr?1:0)); #endif ! ! delete[] list; }
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX --- 256,311 ---- #endif
#if FLEXT_SYS == FLEXT_SYS_MAX ! // copy outlet descriptions ! outdesc = new char *[outcnt]; ! for(int i = 0; i < outcnt; ++i) { ! xlet &xi = outlist[i]; ! outdesc[i] = xi.desc; ! xi.desc = NULL; ! } #endif
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX ! outlets = new outlet *[outcnt+procattr];
! // type info is now in list array #if FLEXT_SYS == FLEXT_SYS_PD ! for(int ix = 0; ix < outcnt; ++ix) #elif FLEXT_SYS == FLEXT_SYS_MAX ! for(int ix = outcnt-1; ix >= 0; --ix) #else #error #endif ! { ! switch(outlist[ix].tp) { ! case xlet_float: ! outlets[ix] = (outlet *)newout_float(&x_obj->obj); ! break; ! case xlet_int: ! outlets[ix] = (outlet *)newout_flint(&x_obj->obj); ! break; ! case xlet_sig: ! outlets[ix] = (outlet *)newout_signal(&x_obj->obj); ! ++outsigs; ! break; ! case xlet_sym: ! outlets[ix] = (outlet *)newout_symbol(&x_obj->obj); ! break; ! case xlet_list: ! outlets[ix] = (outlet *)newout_list(&x_obj->obj); ! break; ! case xlet_any: ! outlets[ix] = (outlet *)newout_anything(&x_obj->obj); ! break; #ifdef FLEXT_DEBUG ! default: ! ERRINTERNAL(); ! ok = false; #endif ! } } + #else + #error + #endif
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX *************** *** 418,423 **** #endif
- delete outlist; outlist = NULL; - return ok; } --- 323,326 ----
Index: flbase.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flbase.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** flbase.h 26 Jan 2005 05:01:38 -0000 1.30 --- flbase.h 23 May 2005 16:52:44 -0000 1.31 *************** *** 65,68 **** --- 65,70 ----
+ class flext_class; + // ---------------------------------------------------------------------------- /*! \brief The mother of base classes for all flext external objects *************** *** 111,115 **** \note This should only be used in the constructor. Object creation will be aborted. */ ! void InitProblem() { init_ok = false; }
/*! \brief Enable/disable attribute procession (default = false) --- 113,117 ---- \note This should only be used in the constructor. Object creation will be aborted. */ ! static void InitProblem() { init_ok = false; }
/*! \brief Enable/disable attribute procession (default = false) *************** *** 146,177 **** //! Get the class name (as a symbol) const t_symbol *thisNameSym() const { return m_name; } - - //! Get the class pointer ! #if FLEXT_SYS == FLEXT_SYS_PD ! t_class *thisClass() const { FLEXT_ASSERT(x_obj); return (t_class *)((t_object *)(x_obj))->te_g.g_pd; } ! #elif FLEXT_SYS == FLEXT_SYS_MAX ! t_class *thisClass() const { FLEXT_ASSERT(x_obj); return (t_class *)(((t_tinyobject *)x_obj)->t_messlist-1); } ! #elif FLEXT_SYS == FLEXT_SYS_JMAX ! t_class *thisClass() const { return fts_object_get_class((fts_object_t *)thisHdr()); } ! #else ! #error ! #endif ! ! #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_JMAX //! Typedef for unique class identifier ! typedef t_class *t_classid; //! Get unique id for object class ! t_classid thisClassId() const { return thisClass(); } ! //! Get class pointer from class id ! static t_class *getClass(t_classid c) { return c; } ! #else ! //! Typedef for unique class identifier ! typedef void *t_classid; ! //! Get unique id for object class (for Max/MSP library object share the same (t_class *)!) ! t_classid thisClassId() const; //! Get class pointer from class id static t_class *getClass(t_classid); ! #endif
//! @} FLEXT_O_INFO --- 148,164 ---- //! Get the class name (as a symbol) const t_symbol *thisNameSym() const { return m_name; } //! Get the class pointer ! t_class *thisClass() const; ! //! Typedef for unique class identifier ! typedef flext_class *t_classid; ! //! Get unique id for object class ! t_classid thisClassId() const { return clss; } ! //! Get class pointer from class id static t_class *getClass(t_classid); ! ! bool HasAttributes() const;
//! @} FLEXT_O_INFO *************** *** 203,214 ****
protected: - - //! The object header - mutable flext_hdr *x_obj;
! //! Flag for attribute procession ! bool procattr;
! static bool process_attributes;
private: --- 190,201 ----
protected:
! //! pointer to flext class definition ! flext_class *clss;
! //! backpointer to object header ! mutable flext_hdr *x_obj; ! ! static bool process_attributes;
private: *************** *** 218,222 ****
//! Flag for successful object construction ! bool init_ok;
// flags for init and exit procedure; --- 205,209 ----
//! Flag for successful object construction ! static bool init_ok;
// flags for init and exit procedure; *************** *** 233,250 **** */ static flext_hdr *m_holder; //! Hold object's name during construction static const t_symbol *m_holdname;
//! Holders for attribute procession flag - static bool m_holdattr; static int m_holdaargc; static const t_atom *m_holdaargv;
! //! The object's name in the patcher const t_symbol *m_name;
- //! Check whether construction was successful - bool InitOk() const { return init_ok; } - /*! Return true if in object initialization phase true when in constructor or Init, false when in Finalize --- 220,237 ---- */ static flext_hdr *m_holder; + //! Hold object's class during construction + static flext_class *m_holdclass; //! Hold object's name during construction static const t_symbol *m_holdname;
//! Holders for attribute procession flag static int m_holdaargc; static const t_atom *m_holdaargv;
! /*! The object's name in the patcher ! \note objects of the same class can have various alias names! ! */ const t_symbol *m_name;
/*! Return true if in object initialization phase true when in constructor or Init, false when in Finalize *************** *** 576,581 ****
#endif - - - - --- 563,564 ----
Index: flbase.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flbase.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** flbase.cpp 15 Mar 2005 04:56:35 -0000 1.22 --- flbase.cpp 23 May 2005 16:52:44 -0000 1.23 *************** *** 41,45 **** flext_hdr *flext_obj::m_holder = NULL; const t_symbol *flext_obj::m_holdname = NULL; ! bool flext_obj::m_holdattr = false; int flext_obj::m_holdaargc = 0; const t_atom *flext_obj::m_holdaargv = NULL; --- 41,45 ---- flext_hdr *flext_obj::m_holder = NULL; const t_symbol *flext_obj::m_holdname = NULL; ! flext_class *flext_obj::m_holdclass = NULL; int flext_obj::m_holdaargc = 0; const t_atom *flext_obj::m_holdaargv = NULL; *************** *** 48,51 **** --- 48,52 ---- bool flext_obj::initing = false; bool flext_obj::exiting = false; + bool flext_obj::init_ok;
void flext_obj::ProcessAttributes(bool attr) { process_attributes = attr; } *************** *** 57,62 **** flext_obj :: FLEXT_CLASSDEF(flext_obj)() : x_obj(m_holder) ! , procattr(m_holdattr) ! , init_ok(true) , m_name(m_holdname) { --- 58,62 ---- flext_obj :: FLEXT_CLASSDEF(flext_obj)() : x_obj(m_holder) ! , clss(m_holdclass) , m_name(m_holdname) { *************** *** 73,77 **** // ///////////////////////////////////////////////////////// ! flext_obj :: ~FLEXT_CLASSDEF(flext_obj)() { x_obj = NULL; } --- 73,78 ---- // ///////////////////////////////////////////////////////// ! flext_obj :: ~FLEXT_CLASSDEF(flext_obj)() ! { x_obj = NULL; }
Index: flext.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flext.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** flext.cpp 25 Apr 2005 12:50:35 -0000 1.35 --- flext.cpp 23 May 2005 16:52:44 -0000 1.36 *************** *** 20,31 ****
bool flext_base::compatibility = true;
! flext_base::FLEXT_CLASSDEF(flext_base)(): ! indsp(false), ! inlist(NULL),outlist(NULL), ! curtag(NULL), ! incnt(0),outcnt(0), ! insigs(0),outsigs(0), ! distmsgs(false) #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX ,outlets(NULL),inlets(NULL) --- 20,29 ----
bool flext_base::compatibility = true; + bool flext_base::indsp = false; + const t_symbol *flext_base::curtag = NULL;
! flext_base::FLEXT_CLASSDEF(flext_base)() ! : incnt(0),outcnt(0) ! , insigs(0),outsigs(0) #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX ,outlets(NULL),inlets(NULL) *************** *** 37,52 **** FLEXT_LOG1("%s - flext logging is on",thisName());
- t_classid clid = thisClassId(); - clmethhead = ClMeths(clid); bindhead = NULL;
! if(procattr) { // initialize when attribute processing is enabled attrhead = new ItemCont; - clattrhead = ClAttrs(clid); attrdata = new AttrDataCont; } else { ! attrhead = clattrhead = NULL; attrdata = NULL; } --- 35,47 ---- FLEXT_LOG1("%s - flext logging is on",thisName());
bindhead = NULL;
! if(HasAttributes()) { // initialize when attribute processing is enabled attrhead = new ItemCont; attrdata = new AttrDataCont; } else { ! attrhead = NULL; attrdata = NULL; } *************** *** 78,85 **** if(attrdata) delete attrdata;
- // destroy inlets and outlets and their proxy objects - if(inlist) delete inlist; - if(outlist) delete outlist; - #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX if(outlets) delete[] outlets; --- 73,76 ---- *************** *** 127,131 ****
if(ok) { ! if(procattr && m_holdaargc && m_holdaargv) { // initialize creation attributes ok = InitAttrib(m_holdaargc,m_holdaargv); --- 118,122 ----
if(ok) { ! if(HasAttributes() && m_holdaargc && m_holdaargv) { // initialize creation attributes ok = InitAttrib(m_holdaargc,m_holdaargv); *************** *** 211,215 **** } else ! if(arg == th->outcnt && th->procattr) strcpy(s,"Attributes"); break; } --- 202,206 ---- } else ! if(arg == th->outcnt && th->HasAttributes()) strcpy(s,"Attributes"); break; }
Index: flmsg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmsg.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** flmsg.cpp 16 Mar 2005 04:56:30 -0000 1.15 --- flmsg.cpp 23 May 2005 16:52:45 -0000 1.16 *************** *** 139,142 **** --- 139,143 ---- { Item *lst; + ItemCont *clmethhead = ClMeths(thisClassId());
// search for exactly matching tag *************** *** 197,201 ****
// If float or int message is not explicitly handled: try list handler instead ! if(!trap && argc == 1 && (s == sym_float #if FLEXT_SYS == FLEXT_SYS_MAX || s == sym_int --- 198,202 ----
// If float or int message is not explicitly handled: try list handler instead ! if(!trap && argc == 1 && (s == sym_float || s == sym_symbol #if FLEXT_SYS == FLEXT_SYS_MAX || s == sym_int *************** *** 209,212 **** --- 210,215 ---- SetInt(list,GetInt(argv[0])); #endif + else if(s == sym_symbol) + SetSymbol(list,GetSymbol(argv[0]));
trap = true; *************** *** 227,231 ****
// if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior) ! if(distmsgs && !trap && inlet == 0 && s == sym_list && insigs <= 1) { int i = incnt; if(i > argc) i = argc; --- 230,234 ----
// if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior) ! if(DoDist() && !trap && inlet == 0 && s == sym_list && insigs <= 1) { int i = incnt; if(i > argc) i = argc;
Index: flxlet.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flxlet.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** flxlet.cpp 26 Jan 2005 05:02:06 -0000 1.8 --- flxlet.cpp 23 May 2005 16:52:46 -0000 1.9 *************** *** 18,65 **** #include <stdarg.h>
! flext_base::xlet::xlet(type t,const char *d): ! tp(t),nxt(NULL) ! { ! if(d) { ! size_t ln = strlen(d); ! desc = new char[ln+1]; ! memcpy(desc,d,ln); ! desc[ln] = 0; } ! else desc = NULL; }
! flext_base::xlet::~xlet() ! { ! if(desc) delete[] desc; ! if(nxt) delete nxt; }
! void flext_base::AddXlet(xlet::type tp,int mult,const char *desc,xlet *&root) { ! if(!root && mult) { root = new xlet(tp,desc); --mult; } ! if(mult) { ! xlet *xi = root; ! while(xi->nxt) xi = xi->nxt; ! while(mult--) xi = xi->nxt = new xlet(tp,desc); ! } }
! void flext_base::DescXlet(int ix,const char *d,xlet *&root) { ! xlet *xi = root; ! for(int i = 0; xi && i < ix; xi = xi->nxt,++i) {}
! if(xi) { ! if(xi->desc) delete[] xi->desc; ! size_t ln = strlen(d); ! xi->desc = new char[ln+1]; ! memcpy(xi->desc,d,ln); ! xi->desc[ln] = 0; ! } }
! unsigned long flext_base::XletCode(xlet::type tp,...) { unsigned long code = 0; --- 18,79 ---- #include <stdarg.h>
+ #define MAXLETS 256
! flext_base::xlet flext_base::inlist[MAXLETS],flext_base::outlist[MAXLETS]; ! ! ! void flext_base::xlet::Desc(const char *c) ! { ! if(desc) delete[] desc; ! if(c) { ! size_t l = strlen(c); ! desc = new char[l+1]; ! memcpy(desc,c,l+1); } ! else ! desc = NULL; }
! void flext_base::AddInlet(xlettype tp,int mult,const char *desc) ! { ! if(incnt+mult >= MAXLETS) ! post("%s - too many inlets",thisName()); ! else ! for(int i = 0; i < mult; ++i) { ! xlet &x = inlist[incnt++]; ! x.tp = tp; ! x.Desc(desc); ! } }
! void flext_base::AddOutlet(xlettype tp,int mult,const char *desc) { ! if(outcnt+mult >= MAXLETS) ! post("%s - too many outlets",thisName()); ! else ! for(int i = 0; i < mult; ++i) { ! xlet &x = outlist[outcnt++]; ! x.tp = tp; ! x.Desc(desc); ! } }
! void flext_base::DescInlet(int ix,const char *d) { ! if(ix >= incnt) ! post("%s - inlet %i not found",thisName(),ix); ! else ! inlist[ix].Desc(d); ! }
! void flext_base::DescOutlet(int ix,const char *d) ! { ! if(ix >= outcnt) ! post("%s - outlet %i not found",thisName(),ix); ! else ! outlist[ix].Desc(d); }
! unsigned long flext_base::XletCode(xlettype tp,...) { unsigned long code = 0; *************** *** 68,72 **** va_start(marker,tp); int cnt = 0; ! xlet::type arg = tp; for(; arg; ++cnt) { #ifdef FLEXT_DEBUG --- 82,86 ---- va_start(marker,tp); int cnt = 0; ! xlettype arg = tp; for(; arg; ++cnt) { #ifdef FLEXT_DEBUG *************** *** 78,82 ****
code = code*10+(int)arg; ! arg = (xlet::type)va_arg(marker,int); } va_end(marker); --- 92,96 ----
code = code*10+(int)arg; ! arg = (xlettype)va_arg(marker,int); } va_end(marker); *************** *** 87,96 **** void flext_base::AddInlets(unsigned long code) { ! for(; code; code /= 10) AddInlet((xlet::type)(code%10)); }
void flext_base::AddOutlets(unsigned long code) { ! for(; code; code /= 10) AddOutlet((xlet::type)(code%10)); }
--- 101,110 ---- void flext_base::AddInlets(unsigned long code) { ! for(; code; code /= 10) AddInlet((xlettype)(code%10)); }
void flext_base::AddOutlets(unsigned long code) { ! for(; code; code /= 10) AddOutlet((xlettype)(code%10)); }
Index: fltimer.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/fltimer.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** fltimer.cpp 12 Mar 2005 04:56:36 -0000 1.8 --- fltimer.cpp 23 May 2005 16:52:45 -0000 1.9 *************** *** 51,54 **** --- 51,58 ---- }
+ #if FLEXT_OS == FLEXT_OS_WIN + static double perffrq = 0; + #endif + static double getstarttime(); static double starttime = getstarttime(); *************** *** 56,59 **** --- 60,68 ---- static double getstarttime() { + #if FLEXT_OS == FLEXT_OS_WIN + LARGE_INTEGER frq; + if(QueryPerformanceFrequency(&frq)) perffrq = (double)frq.QuadPart; + #endif + starttime = 0; return flext::GetOSTime(); *************** *** 65,71 ****
#if FLEXT_OS == FLEXT_OS_WIN ! LARGE_INTEGER frq,cnt; ! if(QueryPerformanceFrequency(&frq) && QueryPerformanceCounter(&cnt)) ! tm = (double)(cnt.QuadPart)/frq.QuadPart; else { SYSTEMTIME systm; --- 74,80 ----
#if FLEXT_OS == FLEXT_OS_WIN ! LARGE_INTEGER cnt; ! if(perffrq && QueryPerformanceCounter(&cnt)) ! tm = cnt.QuadPart/perffrq; else { SYSTEMTIME systm; *************** *** 73,77 **** GetSystemTime(&systm); SystemTimeToFileTime(&systm,&fltm); ! tm = (double)((LARGE_INTEGER *)&fltm)->QuadPart*0.001; } #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX --- 82,86 ---- GetSystemTime(&systm); SystemTimeToFileTime(&systm,&fltm); ! tm = ((LARGE_INTEGER *)&fltm)->QuadPart*1.e-7; } #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX *************** *** 91,96 **** void flext::Sleep(double s) { #if FLEXT_OS == FLEXT_OS_WIN ! ::Sleep((long)(s*1000.)); #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX usleep((long)(s*1000000.)); --- 100,136 ---- void flext::Sleep(double s) { + if(s <= 0) return; #if FLEXT_OS == FLEXT_OS_WIN ! #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x400 ! #if 0 ! LARGE_INTEGER liDueTime; ! liDueTime.QuadPart = (LONGLONG)(-1.e7*s); ! ! // Create a waitable timer. ! HANDLE hTimer = CreateWaitableTimer(NULL,TRUE,NULL); ! if(hTimer) { ! if(SetWaitableTimer(hTimer,&liDueTime,0,NULL,NULL,0)) ! // Wait for the timer. ! WaitForSingleObject(hTimer,INFINITE); // != WAIT_OBJECT_0) ! else ! ::Sleep((long)(s*1000.)); ! CloseHandle(hTimer); ! } ! else ! #else ! LARGE_INTEGER cnt; ! if(perffrq && QueryPerformanceCounter(&cnt)) { ! LONGLONG dst = (LONGLONG)(cnt.QuadPart+perffrq*s); ! for(;;) { ! SwitchToThread(); // while waiting switch to another thread ! QueryPerformanceCounter(&cnt); ! if(cnt.QuadPart > dst) break; ! } ! } ! else ! #endif ! #endif ! // last resort.... ! ::Sleep((long)(s*1000.)); #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX usleep((long)(s*1000000.)); *************** *** 235,246 **** }
- if(tmr->cback) { #if FLEXT_SYS == FLEXT_SYS_MAX ! if(tmr->queued) ! qelem_set(tmr->qelem); ! else #endif ! tmr->Work(); ! } }
--- 275,284 ---- }
#if FLEXT_SYS == FLEXT_SYS_MAX ! if(tmr->queued) ! qelem_set(tmr->qelem); ! else #endif ! tmr->Work(); }
*************** *** 256,263 **** void flext::Timer::Work() { ! if(clss) ! ((bool (*)(flext_base *,void *))cback)(clss,userdata); ! else ! cback(userdata); }
--- 294,303 ---- void flext::Timer::Work() { ! if(cback) { ! if(clss) ! ((bool (*)(flext_base *,void *))cback)(clss,userdata); ! else ! cback(userdata); ! } }
Index: flattr.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flattr.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** flattr.cpp 18 Apr 2005 15:07:39 -0000 1.33 --- flattr.cpp 23 May 2005 16:52:43 -0000 1.34 *************** *** 98,102 **** void flext_base::AddAttrib(const t_symbol *attr,metharg tp,methfun gfun,methfun sfun) { ! if(procattr) AddAttrib(ThAttrs(),ThMeths(),attr,tp,gfun,sfun); else --- 98,102 ---- void flext_base::AddAttrib(const t_symbol *attr,metharg tp,methfun gfun,methfun sfun) { ! if(HasAttributes()) AddAttrib(ThAttrs(),ThMeths(),attr,tp,gfun,sfun); else *************** *** 113,116 **** --- 113,117 ---- typedef TablePtrMap<int,const t_symbol *,32> AttrList; AttrList list[2]; + ItemCont *clattrhead = ClAttrs(thisClassId());
int i; *************** *** 192,196 **** bool flext_base::ListAttrib() const { ! if(procattr) { // defined in flsupport.cpp extern const t_symbol *sym_attributes; --- 193,197 ---- bool flext_base::ListAttrib() const { ! if(HasAttributes()) { // defined in flsupport.cpp extern const t_symbol *sym_attributes; *************** *** 207,210 **** --- 208,213 ---- flext_base::AttrItem *flext_base::FindAttrib(const t_symbol *tag,bool get,bool msg) const { + ItemCont *clattrhead = ClAttrs(thisClassId()); + // first search within object scope AttrItem *a = NULL; *************** *** 402,405 **** --- 405,410 ---- bool flext_base::BangAttribAll() { + ItemCont *clattrhead = ClAttrs(thisClassId()); + for(int i = 0; i <= 1; ++i) { ItemCont *a = i?attrhead:clattrhead;
Index: fldsp.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldsp.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** fldsp.h 13 Mar 2005 04:56:39 -0000 1.14 --- fldsp.h 23 May 2005 16:52:44 -0000 1.15 *************** *** 116,135 **** \param m Number of inlets to add */ ! void AddInSignal(int m = 1) { AddInlet(xlet::tp_sig,m); }
/*! \brief Add signal inlet (with description) \param desc Description of inlet */ ! void AddInSignal(const char *desc) { AddInlet(xlet::tp_sig,1,desc); }
/*! \brief Add signal outlet(s) \param m Number of inlets to add */ ! void AddOutSignal(int m = 1) { AddOutlet(xlet::tp_sig,m); }
/*! \brief Add signal outlet (with description) \param desc Description of outlet */ ! void AddOutSignal(const char *desc) { AddOutlet(xlet::tp_sig,1,desc); }
//! @} --- 116,135 ---- \param m Number of inlets to add */ ! void AddInSignal(int m = 1) { AddInlet(xlet_sig,m); }
/*! \brief Add signal inlet (with description) \param desc Description of inlet */ ! void AddInSignal(const char *desc) { AddInlet(xlet_sig,1,desc); }
/*! \brief Add signal outlet(s) \param m Number of inlets to add */ ! void AddOutSignal(int m = 1) { AddOutlet(xlet_sig,m); }
/*! \brief Add signal outlet (with description) \param desc Description of outlet */ ! void AddOutSignal(const char *desc) { AddOutlet(xlet_sig,1,desc); }
//! @}
Index: flattr_ed.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flattr_ed.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** flattr_ed.cpp 1 May 2005 03:12:05 -0000 1.38 --- flattr_ed.cpp 23 May 2005 16:52:43 -0000 1.39 *************** *** 42,55 **** void flext_base::SetGfx(t_classid c) { // widgetbehavior struct MUST be resident... (static is just ok here)
#ifndef FLEXT_CLONEWIDGET ! widgetbehavior.w_visfn = c->c_wb->w_visfn; ! widgetbehavior.w_selectfn = c->c_wb->w_selectfn; ! widgetbehavior.w_getrectfn = c->c_wb->w_getrectfn; ! widgetbehavior.w_displacefn = c->c_wb->w_displacefn; ! widgetbehavior.w_activatefn = c->c_wb->w_activatefn; ! widgetbehavior.w_deletefn = c->c_wb->w_deletefn; ! widgetbehavior.w_selectfn = c->c_wb->w_selectfn; #else widgetbehavior.w_visfn = text_widgetbehavior.w_visfn; --- 42,56 ---- void flext_base::SetGfx(t_classid c) { + t_class *cl = getClass(c); // widgetbehavior struct MUST be resident... (static is just ok here)
#ifndef FLEXT_CLONEWIDGET ! widgetbehavior.w_visfn = cl->c_wb->w_visfn; ! widgetbehavior.w_selectfn = cl->c_wb->w_selectfn; ! widgetbehavior.w_getrectfn = cl->c_wb->w_getrectfn; ! widgetbehavior.w_displacefn = cl->c_wb->w_displacefn; ! widgetbehavior.w_activatefn = cl->c_wb->w_activatefn; ! widgetbehavior.w_deletefn = cl->c_wb->w_deletefn; ! widgetbehavior.w_selectfn = cl->c_wb->w_selectfn; #else widgetbehavior.w_visfn = text_widgetbehavior.w_visfn; *************** *** 67,71 ****
widgetbehavior.w_clickfn = cb_click; ! class_setwidget(c, &widgetbehavior); }
--- 68,72 ----
widgetbehavior.w_clickfn = cb_click; ! class_setwidget(cl, &widgetbehavior); }
*************** *** 447,453 **** void flext_base::attrsetup(t_classid c) { #ifndef FLEXT_CLONEWIDGET ! ori_vis = c->c_wb->w_visfn; ! ori_select = c->c_wb->w_selectfn; #endif
--- 448,455 ---- void flext_base::attrsetup(t_classid c) { + t_class *cl = getClass(c); #ifndef FLEXT_CLONEWIDGET ! ori_vis = cl->c_wb->w_visfn; ! ori_select = cl->c_wb->w_selectfn; #endif
*************** *** 456,461 ****
#if PD_MINOR_VERSION >= 37 ! class_setpropertiesfn(c,cb_GfxProperties); ! class_setsavefn(c,cb_GfxSave); #else widgetbehavior.w_propertiesfn = cb_GfxProperties; --- 458,463 ----
#if PD_MINOR_VERSION >= 37 ! class_setpropertiesfn(cl,cb_GfxProperties); ! class_setsavefn(cl,cb_GfxSave); #else widgetbehavior.w_propertiesfn = cb_GfxProperties;
Index: fllib.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/fllib.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** fllib.cpp 16 Apr 2005 21:35:06 -0000 1.33 --- fllib.cpp 23 May 2005 16:52:45 -0000 1.34 *************** *** 101,113 ****
- // this class stands for one registered object // it holds the class, type flags, constructor and destructor of the object and the creation arg types // it will never be destroyed ! class libclass: public flext_root { public: ! libclass(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *)); flext_obj *(*newfun)(int,t_atom *); --- 101,112 ----
// this class stands for one registered object // it holds the class, type flags, constructor and destructor of the object and the creation arg types // it will never be destroyed ! class flext_class: public flext_root { public: ! flext_class(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *)); flext_obj *(*newfun)(int,t_atom *); *************** *** 115,138 ****
t_class *const &clss; ! bool lib,dsp,attr; int argc; int *argv; };
! libclass::libclass(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *)): ! newfun(newf),freefun(freef), clss(cl), argc(0),argv(NULL) {}
! typedef TablePtrMap<const t_symbol *,libclass *,8> LibMap;
static LibMap libnames;
//! Store or retrieve registered classes ! static libclass *FindName(const t_symbol *s,libclass *o = NULL) { ! libclass *cl = libnames.find(s); if(!cl) libnames.insert(s,cl = o); return cl; --- 114,140 ----
t_class *const &clss; ! bool lib,dsp,attr,dist; int argc; int *argv; + + flext_base::ItemCont meths,attrs; };
! flext_class::flext_class(t_class *&cl,flext_obj *(*newf)(int,t_atom *),void (*freef)(flext_hdr *)): clss(cl), + newfun(newf),freefun(freef), argc(0),argv(NULL) + , dist(false) {}
! typedef TablePtrMap<const t_symbol *,flext_class *,8> LibMap;
static LibMap libnames;
//! Store or retrieve registered classes ! static flext_class *FindName(const t_symbol *s,flext_class *o = NULL) { ! flext_class *cl = libnames.find(s); if(!cl) libnames.insert(s,cl = o); return cl; *************** *** 145,156 **** static t_class *lib_class = NULL; static const t_symbol *lib_name = NULL;
! flext_obj::t_classid flext_obj::thisClassId() const ! { ! return FindName(thisNameSym()); ! }
- t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast<libclass *>(id)->clss; } - #endif
void flext_obj::lib_init(const char *name,void setupfun(),bool attr) --- 147,156 ---- 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; } ! ! bool flext_obj::HasAttributes() const { return clss->attr; }
void flext_obj::lib_init(const char *name,void setupfun(),bool attr) *************** *** 228,232 ****
// make new dynamic object ! libclass *lo = new libclass(*cl,newfun,freefun); lo->lib = lib; lo->dsp = dsp; --- 228,232 ----
// make new dynamic object ! flext_class *lo = new flext_class(*cl,newfun,freefun); lo->lib = lib; lo->dsp = dsp; *************** *** 259,268 ****
// get unique class id - #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_JMAX - t_classid clid = lo->clss; - #else - // in Max/MSP the t_class *value can't be used because it's possible that's it's not yet set!! t_classid clid = lo; - #endif
// make help reference --- 259,263 ---- *************** *** 277,281 **** // add to name list const t_symbol *lsym = MakeSymbol(c); ! /*libclass *lcl =*/ FindName(lsym,lo); #if FLEXT_SYS == FLEXT_SYS_PD --- 272,276 ---- // add to name list const t_symbol *lsym = MakeSymbol(c); ! FindName(lsym,lo); #if FLEXT_SYS == FLEXT_SYS_PD *************** *** 328,332 **** flext_hdr *obj = NULL; #endif ! libclass *lo = FindName(s); if(lo) { bool ok = true; --- 323,327 ---- flext_hdr *obj = NULL; #endif ! flext_class *lo = FindName(s); if(lo) { bool ok = true; *************** *** 392,405 **** if(ok) { try { - t_classid clid; - #if FLEXT_SYS == FLEXT_SYS_PD - clid = lo->clss; obj = (flext_hdr *)::pd_new(lo->clss); #elif FLEXT_SYS == FLEXT_SYS_MAX - clid = lo; obj = (flext_hdr *)::newobject(lo->clss); - #elif FLEXT_SYS == FLEXT_SYS_JMAX - clid = lo->clss; #else #error --- 387,394 ---- *************** *** 407,413 ****
flext_obj::m_holder = obj; flext_obj::m_holdname = s; - flext_obj::m_holdattr = lo->attr; flext_obj::initing = true;
// get actual flext object (newfun calls "new flext_obj()") --- 396,403 ----
flext_obj::m_holder = obj; + flext_obj::m_holdclass = lo; flext_obj::m_holdname = s; flext_obj::initing = true; + flext_obj::init_ok = true;
// get actual flext object (newfun calls "new flext_obj()") *************** *** 418,427 **** flext_obj::m_holder = NULL; flext_obj::m_holdname = NULL; - flext_obj::m_holdattr = false;
ok = obj->data && // check constructor exit flag ! obj->data->InitOk();
if(ok) { --- 408,417 ---- flext_obj::m_holder = NULL; + flext_obj::m_holdclass = NULL; flext_obj::m_holdname = NULL;
ok = obj->data && // check constructor exit flag ! flext_obj::init_ok;
if(ok) { *************** *** 497,501 **** flext_hdr *hdr = (flext_hdr *)h; const t_symbol *name = hdr->data->thisNameSym(); ! libclass *lcl = FindName(name);
if(lcl) { --- 487,491 ---- flext_hdr *hdr = (flext_hdr *)h; const t_symbol *name = hdr->data->thisNameSym(); ! flext_class *lcl = FindName(name);
if(lcl) { *************** *** 532,533 **** --- 522,530 ----
+ t_class *flext_obj::thisClass() const { FLEXT_ASSERT(x_obj); return thisClassId()->clss; } + + void flext_base::SetDist(t_classid c,bool d) { c->dist = d; } + bool flext_base::DoDist() const { return thisClassId()->dist; } + + flext_base::ItemCont *flext_base::ClMeths(t_classid c) { return &c->meths; } + flext_base::ItemCont *flext_base::ClAttrs(t_classid c) { return &c->attrs; }
Index: flext.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flext.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** flext.h 5 Jan 2005 05:04:13 -0000 1.24 --- flext.h 23 May 2005 16:52:45 -0000 1.25 *************** *** 45,51 **** #include <multiprocessing.h> #elif FLEXT_THREADS == FLEXT_THR_WIN32 ! #define _WIN32_WINNT 0x500 // must be WIN2000 at least! ! #include <windows.h> ! #include <process.h> #else #error "Thread model not supported" --- 45,54 ---- #include <multiprocessing.h> #elif FLEXT_THREADS == FLEXT_THR_WIN32 ! #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x500 ! #include <windows.h> ! #include <process.h> ! #else ! #error "Win32 threading model only supported for Win2000/XP or newer" ! #endif #else #error "Thread model not supported"
Index: flitem.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flitem.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** flitem.cpp 18 Apr 2005 15:07:40 -0000 1.19 --- flitem.cpp 23 May 2005 16:52:45 -0000 1.20 *************** *** 113,117 **** // --- class item lists (methods and attributes) ----------------
! typedef TablePtrMap<flext_base::t_classid,flext_base::ItemCont *,64> ClassMap;
static ClassMap classarr[2]; --- 113,118 ---- // --- class item lists (methods and attributes) ----------------
! /* ! typedef TablePtrMap<flext_base::t_classid,flext_base::ItemCont *,8> ClassMap;
static ClassMap classarr[2]; *************** *** 124,125 **** --- 125,127 ---- return cont; } + */ \ No newline at end of file
Index: flmeth.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmeth.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** flmeth.cpp 16 Apr 2005 21:35:06 -0000 1.18 --- flmeth.cpp 23 May 2005 16:52:45 -0000 1.19 *************** *** 92,95 **** --- 92,96 ---- typedef TablePtrMap<int,const t_symbol *,32> MethList; MethList list[2]; + ItemCont *clmethhead = ClMeths(thisClassId());
int i; *************** *** 120,124 **** bool flext_base::cb_ListMethods(flext_base *c,int argc,const t_atom *argv) { ! if(c->procattr && (argc == 0 || (argc == 1 && CanbeInt(argv[0])))) { // defined in flsupport.cpp extern const t_symbol *sym_methods; --- 121,125 ---- 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;
Index: fldsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldsp.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** fldsp.cpp 13 Mar 2005 04:56:33 -0000 1.27 --- fldsp.cpp 23 May 2005 16:52:44 -0000 1.28 *************** *** 90,96 **** #endif { ! obj->indsp = true; obj->CbSignal(); ! obj->indsp = false; } return w+2; --- 90,96 ---- #endif { ! flext_base::indsp = true; obj->CbSignal(); ! flext_base::indsp = false; } return w+2;
Index: flmap.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmap.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** flmap.cpp 23 Apr 2005 08:58:05 -0000 1.3 --- flmap.cpp 23 May 2005 16:52:45 -0000 1.4 *************** *** 217,249 **** void TableAnyMap::iterator::forward() { ! if(map || ix >= map->n) { ! if(++ix >= map->n) { ! TableAnyMap *nmap;
! // we reached the end of the slots ! if(map->right) { ! // climb up one ! map = map->right; ! leftmost(); ! ix = 0; ! } ! else { ! // fall back ! for(;;) { ! nmap = map->parent; ! if(!nmap) break; // no parent ! if(nmap->left == map) { ! // ok, we are in front of the slots now ! ix = 0; ! map = nmap; ! break; ! } ! else { ! FLEXT_ASSERT(nmap->right == map); ! ix = (map = nmap)->n; ! } ! } ! } ! } ! } } --- 217,249 ---- void TableAnyMap::iterator::forward() { ! FLEXT_ASSERT(map || ix >= map->n); ! ! if(++ix >= map->n) { ! TableAnyMap *nmap;
! // we reached the end of the slots ! if(map->right) { ! // climb up one ! map = map->right; ! leftmost(); ! ix = 0; ! } ! else { ! // fall back ! for(;;) { ! nmap = map->parent; ! if(!nmap) break; // no parent ! if(nmap->left == map) { ! // ok, we are in front of the slots now ! ix = 0; ! map = nmap; ! break; ! } ! else { ! FLEXT_ASSERT(nmap->right == map); ! ix = (map = nmap)->n; ! } ! } ! } ! } }
Index: flclass.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flclass.h,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** flclass.h 18 Apr 2005 15:07:40 -0000 1.57 --- flclass.h 23 May 2005 16:52:44 -0000 1.58 *************** *** 61,67 **** friend class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj);
- /*! \defgroup FLEXT_CLASS Flext base class - @{ - */ public:
--- 61,64 ---- *************** *** 122,180 **** // argument m specifies multiple inlet/outlet count ! // void AddInDef() { AddInlet(xlet::tp_def,1); }
/*! \brief Add inlet(s) for anythings \remark That's the one to choose for the left-most (first) inlet unless it's a signal inlet. */ ! void AddInAnything(int m = 1) { AddInlet(xlet::tp_any,m); } /*! \brief Add inlet(s) for anythings (with description) \remark That's the one to choose for the left-most (first) inlet unless it's a signal inlet. */ ! void AddInAnything(const char *desc,int m = 1) { AddInlet(xlet::tp_any,m,desc); } //! Add inlet(s) for floats ! void AddInFloat(int m = 1) { AddInlet(xlet::tp_float,m); } //! Add inlet(s) for floats (with description) ! void AddInFloat(const char *desc,int m = 1) { AddInlet(xlet::tp_float,m,desc); } //! Add inlet(s) for integers ! void AddInInt(int m = 1) { AddInlet(xlet::tp_int,m); } //! Add inlet(s) for integers (with description) ! void AddInInt(const char *desc,int m = 1) { AddInlet(xlet::tp_int,m,desc); } //! Add inlet(s) for symbols ! void AddInSymbol(int m = 1) { AddInlet(xlet::tp_sym,m); } //! Add inlet(s) for symbol (with description) ! void AddInSymbol(const char *desc,int m = 1) { AddInlet(xlet::tp_sym,m,desc); } //! Add inlet(s) for bang ! void AddInBang(int m = 1) { AddInlet(xlet::tp_sym,m); } //! Add inlet(s) for bangs (with description) ! void AddInBang(const char *desc,int m = 1) { AddInlet(xlet::tp_sym,m,desc); } //! Add inlet(s) for lists ! void AddInList(int m = 1) { AddInlet(xlet::tp_list,m); } //! Add inlet(s) for lists (with description) ! void AddInList(const char *desc,int m = 1) { AddInlet(xlet::tp_list,m,desc); } //! Add outlet(s) for anythings ! void AddOutAnything(int m = 1) { AddOutlet(xlet::tp_any,m); } //! Add outlet(s) for anythings (with description) ! void AddOutAnything(const char *desc,int m = 1) { AddOutlet(xlet::tp_any,m,desc); } //! Add outlet(s) for floats ! void AddOutFloat(int m = 1) { AddOutlet(xlet::tp_float,m); } //! Add outlet(s) for floats (with description) ! void AddOutFloat(const char *desc,int m = 1) { AddOutlet(xlet::tp_float,m,desc); } //! Add outlet(s) for integers ! void AddOutInt(int m = 1) { AddOutlet(xlet::tp_int,m); } //! Add outlet(s) for integers (with description) ! void AddOutInt(const char *desc,int m = 1) { AddOutlet(xlet::tp_int,m,desc); } //! Add outlet(s) for symbols ! void AddOutSymbol(int m = 1) { AddOutlet(xlet::tp_sym,m); } //! Add outlet(s) for symbols (with description) ! void AddOutSymbol(const char *desc,int m = 1) { AddOutlet(xlet::tp_sym,m,desc); } //! Add outlet(s) for bangs ! void AddOutBang(int m = 1) { AddOutlet(xlet::tp_sym,m); } //! Add outlet(s) for bangs (with description) ! void AddOutBang(const char *desc,int m = 1) { AddOutlet(xlet::tp_sym,m,desc); } //! Add outlet(s) for lists ! void AddOutList(int m = 1) { AddOutlet(xlet::tp_list,m); } //! Add outlet(s) for lists (with description) ! void AddOutList(const char *desc,int m = 1) { AddOutlet(xlet::tp_list,m,desc); }
//! \deprecated inlets and outlets are now set up automatically --- 119,177 ---- // argument m specifies multiple inlet/outlet count ! // void AddInDef() { AddInlet(xlet_def,1); }
/*! \brief Add inlet(s) for anythings \remark That's the one to choose for the left-most (first) inlet unless it's a signal inlet. */ ! void AddInAnything(int m = 1) { AddInlet(xlet_any,m); } /*! \brief Add inlet(s) for anythings (with description) \remark That's the one to choose for the left-most (first) inlet unless it's a signal inlet. */ ! void AddInAnything(const char *desc,int m = 1) { AddInlet(xlet_any,m,desc); } //! Add inlet(s) for floats ! void AddInFloat(int m = 1) { AddInlet(xlet_float,m); } //! Add inlet(s) for floats (with description) ! void AddInFloat(const char *desc,int m = 1) { AddInlet(xlet_float,m,desc); } //! Add inlet(s) for integers ! void AddInInt(int m = 1) { AddInlet(xlet_int,m); } //! Add inlet(s) for integers (with description) ! void AddInInt(const char *desc,int m = 1) { AddInlet(xlet_int,m,desc); } //! Add inlet(s) for symbols ! void AddInSymbol(int m = 1) { AddInlet(xlet_sym,m); } //! Add inlet(s) for symbol (with description) ! void AddInSymbol(const char *desc,int m = 1) { AddInlet(xlet_sym,m,desc); } //! Add inlet(s) for bang ! void AddInBang(int m = 1) { AddInlet(xlet_sym,m); } //! Add inlet(s) for bangs (with description) ! void AddInBang(const char *desc,int m = 1) { AddInlet(xlet_sym,m,desc); } //! Add inlet(s) for lists ! void AddInList(int m = 1) { AddInlet(xlet_list,m); } //! Add inlet(s) for lists (with description) ! void AddInList(const char *desc,int m = 1) { AddInlet(xlet_list,m,desc); } //! Add outlet(s) for anythings ! void AddOutAnything(int m = 1) { AddOutlet(xlet_any,m); } //! Add outlet(s) for anythings (with description) ! void AddOutAnything(const char *desc,int m = 1) { AddOutlet(xlet_any,m,desc); } //! Add outlet(s) for floats ! void AddOutFloat(int m = 1) { AddOutlet(xlet_float,m); } //! Add outlet(s) for floats (with description) ! void AddOutFloat(const char *desc,int m = 1) { AddOutlet(xlet_float,m,desc); } //! Add outlet(s) for integers ! void AddOutInt(int m = 1) { AddOutlet(xlet_int,m); } //! Add outlet(s) for integers (with description) ! void AddOutInt(const char *desc,int m = 1) { AddOutlet(xlet_int,m,desc); } //! Add outlet(s) for symbols ! void AddOutSymbol(int m = 1) { AddOutlet(xlet_sym,m); } //! Add outlet(s) for symbols (with description) ! void AddOutSymbol(const char *desc,int m = 1) { AddOutlet(xlet_sym,m,desc); } //! Add outlet(s) for bangs ! void AddOutBang(int m = 1) { AddOutlet(xlet_sym,m); } //! Add outlet(s) for bangs (with description) ! void AddOutBang(const char *desc,int m = 1) { AddOutlet(xlet_sym,m,desc); } //! Add outlet(s) for lists ! void AddOutList(int m = 1) { AddOutlet(xlet_list,m); } //! Add outlet(s) for lists (with description) ! void AddOutList(const char *desc,int m = 1) { AddOutlet(xlet_list,m,desc); }
//! \deprecated inlets and outlets are now set up automatically *************** *** 197,204 ****
//! Check if we are in DSP time ! bool InDsp() const { return indsp; }
//! Retrieve currently processed message tag (NULL if no message processing) ! const t_symbol *thisTag() const { return curtag; }
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX --- 194,201 ----
//! Check if we are in DSP time ! static bool InDsp() { return indsp; }
//! 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 *************** *** 208,212 **** outlet *GetOut(int ix) const { return outlets[ix]; } #endif ! int GetOutAttr() const { return procattr?CntOut():0; }
//! @} FLEXT_C_IO_MISC --- 205,209 ---- outlet *GetOut(int ix) const { return outlets[ix]; } #endif ! int GetOutAttr() const { return HasAttributes()?CntOut():0; }
//! @} FLEXT_C_IO_MISC *************** *** 378,382 ****
//! Set Max/MSP style of distributing list elements over (message) inlets ! void SetDist(bool d = true) { distmsgs = d; }
//! @} FLEXT_C_ADDMETHOD --- 375,382 ----
//! Set Max/MSP style of distributing list elements over (message) inlets ! static void SetDist(t_classid c,bool d = true); ! //! Query whether lists are distributed ! bool DoDist() const; !
//! @} FLEXT_C_ADDMETHOD *************** *** 516,535 **** virtual bool Init(); - //! \brief This represents either an inlet or outlet - struct xlet { - enum type { - tp_none = 0, - tp_float,tp_int,tp_sym,tp_list,tp_any, - tp_LIST,tp_ANY, // use AtomList and AtomAnything - tp_sig - };
! xlet(type t,const char *desc = NULL); ! ~xlet(); ! ! char *desc; ! type tp; ! xlet *nxt; ! };
/*! \defgroup FLEXT_C_ATTR Attribute handling methods (object scope) --- 516,526 ---- virtual bool Init();
! enum xlettype { ! xlet_none = 0, ! xlet_float,xlet_int,xlet_sym,xlet_list,xlet_any, ! xlet_LIST,xlet_ANY, // use AtomList and AtomAnything ! xlet_sig ! };
/*! \defgroup FLEXT_C_ATTR Attribute handling methods (object scope) *************** *** 606,610 ****
//! \brief get a code for a list of inlets or outlets ! unsigned long XletCode(xlet::type tp = xlet::tp_none,...); // end list with 0 (= tp_none) !!
/*! \brief Add some inlets by a special code representing the types --- 597,601 ----
//! \brief get a code for a list of inlets or outlets ! unsigned long XletCode(xlettype tp = xlettype::xlet_none,...); // end list with 0 (= tp_none) !!
/*! \brief Add some inlets by a special code representing the types *************** *** 614,618 ****
//! \brief Add one or more inlet(s) ! void AddInlet(xlet::type tp,int mult = 1,const char *desc = NULL) { AddXlet(tp,mult,desc,inlist); }
/*! \brief Add some inlets by a special code representing the types --- 605,609 ----
//! \brief Add one or more inlet(s) ! void AddInlet(xlettype tp,int mult = 1,const char *desc = NULL);
/*! \brief Add some inlets by a special code representing the types *************** *** 622,632 ****
//! \brief Add one or more outlet(s) ! void AddOutlet(xlet::type tp,int mult = 1,const char *desc = NULL) { AddXlet(tp,mult,desc,outlist); }
//! \brief Set the description of an indexed inlet ! void DescInlet(int ix,const char *desc) { DescXlet(ix,desc,inlist); }
//! \brief Set the description of an indexed outlet ! void DescOutlet(int ix,const char *desc) { DescXlet(ix,desc,outlist); }
//! @} FLEXT_C_INOUT --- 613,623 ----
//! \brief Add one or more outlet(s) ! void AddOutlet(xlettype tp,int mult = 1,const char *desc = NULL);
//! \brief Set the description of an indexed inlet ! void DescInlet(int ix,const char *desc);
//! \brief Set the description of an indexed outlet ! void DescOutlet(int ix,const char *desc);
//! @} FLEXT_C_INOUT *************** *** 651,663 **** };
- /* - class ItemSet: - public DataMap<const t_symbol *,Item *> - { - public: - ItemSet(); - ~ItemSet(); - }; - */ class ItemSet :public TablePtrMap<const t_symbol *,Item *,8> --- 642,645 ---- *************** *** 773,785 **** };
- /* - class AttrDataCont: - public DataMap<const t_symbol *,AttrData *> - { - public: - AttrDataCont(); - ~AttrDataCont(); - }; - */ class AttrDataCont :public TablePtrMap<const t_symbol *,AttrData *,8> --- 755,758 ---- *************** *** 811,817 **** void ToSysAtom(int n,const t_atom &at) const;
- // flag if we are within DSP - bool indsp; - private: class pxbnd_object; --- 784,787 ---- *************** *** 832,844 **** }; - //! @} FLEXT_CLASS - ItemCont *ThMeths() { return &methhead; } ! static ItemCont *ClMeths(t_classid c) { return GetClassArr(c,0); }
static void AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fun,metharg tp,...);
ItemCont *ThAttrs() { return attrhead; } ! static ItemCont *ClAttrs(t_classid c) { return GetClassArr(c,1); }
static void AddAttrib(ItemCont *aa,ItemCont *ma,const t_symbol *attr,metharg tp,methfun gfun,methfun sfun); --- 802,812 ---- }; ItemCont *ThMeths() { return &methhead; } ! static ItemCont *ClMeths(t_classid c);
static void AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fun,metharg tp,...);
ItemCont *ThAttrs() { return attrhead; } ! static ItemCont *ClAttrs(t_classid c);
static void AddAttrib(ItemCont *aa,ItemCont *ma,const t_symbol *attr,metharg tp,methfun gfun,methfun sfun); *************** *** 846,864 **** static void AddAttrib(t_classid c,const t_symbol *attr,metharg tp,methfun gfun,methfun sfun);
private:
static void Setup(t_classid c);
! xlet *inlist,*outlist; ! const t_symbol *curtag; ! int incnt,outcnt,insigs,outsigs; ! bool distmsgs; #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX outlet **outlets; #endif
- void AddXlet(xlet::type tp,int mult,const char *desc,xlet *&root); - void DescXlet(int ix,const char *desc,xlet *&root); - union t_any { float ft; --- 814,848 ---- static void AddAttrib(t_classid c,const t_symbol *attr,metharg tp,methfun gfun,methfun sfun);
+ //! flag if we are within DSP + static bool indsp; + private:
static void Setup(t_classid c);
! //! \brief This represents either an inlet or outlet during construction ! class FLEXT_SHARE xlet { ! public: ! xlet(): tp(xlet_none),desc(NULL) {} ! ~xlet() { if(desc) delete[] desc; } ! ! xlettype tp; ! char *desc; ! ! void Desc(const char *c); ! }; ! ! static xlet inlist[]; ! static xlet outlist[]; ! ! //! current message tag ! static const t_symbol *curtag; ! //! 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; *************** *** 881,887 **** typedef bool (*methfun_5)(flext_base *c,t_any &,t_any &,t_any &,t_any &,t_any &);
! static ItemCont *GetClassArr(t_classid,int ix); ! ! mutable ItemCont methhead,*clmethhead; mutable ItemCont *bindhead; --- 865,869 ---- typedef bool (*methfun_5)(flext_base *c,t_any &,t_any &,t_any &,t_any &,t_any &);
! mutable ItemCont methhead; mutable ItemCont *bindhead; *************** *** 892,896 **** bool TryMethAny(Item *lst,const t_symbol *s,int argc,const t_atom *argv);
! mutable ItemCont *attrhead,*clattrhead; mutable AttrDataCont *attrdata;
--- 874,878 ---- bool TryMethAny(Item *lst,const t_symbol *s,int argc,const t_atom *argv);
! mutable ItemCont *attrhead; mutable AttrDataCont *attrdata;