[PD-cvs] externals/grill/flext/source flattr.cpp, 1.34, 1.35 flattr_ed.cpp, 1.40, 1.41 flbase.h, 1.34, 1.35 flclass.h, 1.64, 1.65 fldsp.cpp, 1.29, 1.30 fldsp.h, 1.18, 1.19 flext.cpp, 1.40, 1.41 fllib.cpp, 1.35, 1.36 flmeth.cpp, 1.20, 1.21 flproxy.cpp, 1.11, 1.12 flsupport.cpp, 1.53, 1.54 flsupport.h, 1.98, 1.99

Thomas Grill xovo at users.sourceforge.net
Wed Oct 12 00:22:50 CEST 2005


Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4211/source

Modified Files:
	flattr.cpp flattr_ed.cpp flbase.h flclass.h fldsp.cpp fldsp.h 
	flext.cpp fllib.cpp flmeth.cpp flproxy.cpp flsupport.cpp 
	flsupport.h 
Log Message:
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)


Index: fldsp.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldsp.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** fldsp.h	7 Oct 2005 12:58:48 -0000	1.18
--- fldsp.h	11 Oct 2005 22:22:48 -0000	1.19
***************
*** 34,37 ****
--- 34,39 ----
  	FLEXT_HEADER_S(FLEXT_CLASSDEF(flext_dsp),flext_base,Setup)
  	
+ 	friend class FLEXT_SHARE FLEXT_CLASSDEF(flext_base);
+ 
  public:
  
***************
*** 149,156 ****
  	FLEXT_CLASSDEF(flext_dsp)();
  
- #if FLEXT_SYS == FLEXT_SYS_MAX
-     virtual bool Init();
- #endif
- 
      virtual void Exit();
  
--- 151,154 ----
***************
*** 165,177 ****
  	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);
  	bool dspon;
  #endif
  
  	// dsp stuff
  	static t_int *dspmeth(t_int *w); 
--- 163,175 ----
  	static void Setup(t_classid c);
  
! #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); 

Index: flbase.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flbase.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** flbase.h	26 Sep 2005 13:59:34 -0000	1.34
--- flbase.h	11 Oct 2005 22:22:48 -0000	1.35
***************
*** 155,161 ****
  
  		//! Get class pointer from class id
! 		static t_class *getClass(t_classid);
  
          bool HasAttributes() const;
  
  	//!	@}  FLEXT_OBJ_INFO
--- 155,172 ----
  
  		//! Get class pointer from class id
! 		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
***************
*** 242,249 ****
  		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);
--- 253,256 ----
***************
*** 252,256 ****
  #endif
  		static void obj_free(flext_hdr *o);
- #endif
  
  		//! Convert $0 or #0 symbol into appropriate value
--- 259,262 ----
***************
*** 303,313 ****
  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); } 
  
  
--- 309,317 ----
  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); }
  
  
***************
*** 316,327 ****
  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); }
  
  // generate name of dsp/non-dsp setup function
--- 320,332 ----
  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); \
! }
! 
  
  // generate name of dsp/non-dsp setup function
***************
*** 330,335 ****
  	#define FLEXT_STPF_1(NAME) NAME##_tilde_setup
  #else
! 	#define FLEXT_STPF_0(NAME) NAME##_config
! 	#define FLEXT_STPF_1(NAME) signal_##NAME##_config
  #endif
  
--- 335,339 ----
  	#define FLEXT_STPF_1(NAME) NAME##_tilde_setup
  #else
! #error Platform not supported
  #endif
  
***************
*** 338,377 ****
  
  
- 
  // --------------------------------------------------------------------------------------
  
  
! 
! // 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)
  
  // 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
  #endif
  
--- 342,358 ----
  
  
  // --------------------------------------------------------------------------------------
  
  
! // 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; }
  #else
! #error Platform not supported
  #endif
  
***************
*** 384,388 ****
  #define FLEXT_EXP(LIB) FLEXT_EXP_##LIB
  
! #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_JMAX
  #define FLEXT_OBJ_SETUP_0(NEW_CLASS,DSP)
  #elif FLEXT_SYS == FLEXT_SYS_MAX
--- 365,369 ----
  #define FLEXT_EXP(LIB) FLEXT_EXP_##LIB
  
! #if FLEXT_SYS == FLEXT_SYS_PD
  #define FLEXT_OBJ_SETUP_0(NEW_CLASS,DSP)
  #elif FLEXT_SYS == FLEXT_SYS_MAX
***************
*** 444,448 ****
  #define FLEXTTYPE_bool0 FLEXTTPN_DEFFLOAT
  #define CALLBTYPE_bool float
! #elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX
  #define FLEXTTYPE_int FLEXTTPN_INT
  #define FLEXTTYPE_int0 FLEXTTPN_DEFINT
--- 425,429 ----
  #define FLEXTTYPE_bool0 FLEXTTPN_DEFFLOAT
  #define CALLBTYPE_bool float
! #elif FLEXT_SYS == FLEXT_SYS_MAX
  #define FLEXTTYPE_int FLEXTTPN_INT
  #define FLEXTTYPE_int0 FLEXTTPN_DEFINT
***************
*** 452,456 ****
  #define CALLBTYPE_bool int
  #else
! #error
  #endif
  
--- 433,437 ----
  #define CALLBTYPE_bool int
  #else
! #error Platform not supported
  #endif
  

Index: flsupport.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsupport.h,v
retrieving revision 1.98
retrieving revision 1.99
diff -C2 -d -r1.98 -r1.99
*** flsupport.h	6 Oct 2005 19:53:34 -0000	1.98
--- flsupport.h	11 Oct 2005 22:22:48 -0000	1.99
***************
*** 1190,1193 ****
--- 1190,1198 ----
  
  	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;
  };
  

Index: flext.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flext.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** flext.cpp	26 Sep 2005 13:59:34 -0000	1.40
--- flext.cpp	11 Oct 2005 22:22:48 -0000	1.41
***************
*** 15,18 ****
--- 15,19 ----
  #include "flext.h"
  #include "flinternal.h"
+ #include "fldsp.h"
  #include <string.h>
  
***************
*** 65,68 ****
--- 66,75 ----
  
      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
***************
*** 80,83 ****
--- 87,95 ----
  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
***************
*** 130,140 ****
  
  
! /*! 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);
- 
      add_loadbang(c,cb_loadbang);
  #if FLEXT_SYS == FLEXT_SYS_PD
--- 142,147 ----
  
  
! void flext_base::AddMessageMethods(t_class *c)
  {
      add_loadbang(c,cb_loadbang);
  #if FLEXT_SYS == FLEXT_SYS_PD
***************
*** 147,150 ****
--- 154,186 ----
  #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);
***************
*** 159,171 ****
      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::m_loadbang() {}
--- 195,201 ----
      SetGfx(id);
  #endif
  }
  
! void flext_base::cb_loadbang(flext_hdr *c) { thisObject(c)->CbLoadbang(); }   
  
  void flext_base::m_loadbang() {}
***************
*** 175,179 ****
  
  #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)
  {
      if(shift) thisObject(c)->CbClick();
--- 205,209 ----
  
  #if FLEXT_SYS == FLEXT_SYS_PD
! 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();
***************
*** 182,191 ****
  
  #if FLEXT_SYS == FLEXT_SYS_MAX
! void flext_base::cb_click(t_class *c, Point pt, short mods)
  {
      thisObject(c)->CbClick();
  }
  
! void flext_base::cb_assist(t_class *c,void * /*b*/,long msg,long arg,char *s) 
  { 
      flext_base *th = thisObject(c); 
--- 212,221 ----
  
  #if FLEXT_SYS == FLEXT_SYS_MAX
! void flext_base::cb_click(flext_hdr *c, Point pt, short mods)
  {
      thisObject(c)->CbClick();
  }
  
! void flext_base::cb_assist(flext_hdr *c,void * /*b*/,long msg,long arg,char *s) 
  { 
      flext_base *th = thisObject(c); 
***************
*** 205,206 ****
--- 235,261 ----
  }
  #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);
+ }
+ 

Index: flproxy.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flproxy.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** flproxy.cpp	26 Sep 2005 13:59:34 -0000	1.11
--- flproxy.cpp	11 Oct 2005 22:22:48 -0000	1.12
***************
*** 28,32 ****
  }
  
! void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
  {
      thisObject(c)->CbMethodHandler(0,s,argc,argv);
--- 28,32 ----
  }
  
! 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);
***************
*** 34,38 ****
  
  #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); }
  
  #define ADD_IN_FT(IX) \
--- 34,38 ----
  
  #define DEF_IN_FT(IX) \
! 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) \
***************
*** 41,45 ****
  #elif FLEXT_SYS == FLEXT_SYS_MAX
  
! void flext_base::cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *argv)
  {
      int ci = ((flext_hdr *)c)->curinlet;
--- 41,45 ----
  #elif FLEXT_SYS == FLEXT_SYS_MAX
  
! void flext_base::cb_px_anything(flext_hdr *c,const t_symbol *s,short argc,t_atom *argv)
  {
      int ci = ((flext_hdr *)c)->curinlet;
***************
*** 47,51 ****
  }
  
! void flext_base::cb_px_int(t_class *c,long v)
  {
      t_atom atom; SetInt(atom,v);  
--- 47,51 ----
  }
  
! void flext_base::cb_px_int(flext_hdr *c,long v)
  {
      t_atom atom; SetInt(atom,v);  
***************
*** 54,58 ****
  }
  
! void flext_base::cb_px_float(t_class *c,double v)
  {
      t_atom atom; SetFloat(atom,v);  
--- 54,58 ----
  }
  
! void flext_base::cb_px_float(flext_hdr *c,double v)
  {
      t_atom atom; SetFloat(atom,v);  
***************
*** 61,65 ****
  }
  
! void flext_base::cb_px_bang(t_class *c)
  {
      int ci = ((flext_hdr *)c)->curinlet;
--- 61,65 ----
  }
  
! void flext_base::cb_px_bang(flext_hdr *c)
  {
      int ci = ((flext_hdr *)c)->curinlet;
***************
*** 69,74 ****
  
  #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); }
  
  #define ADD_IN_FT(IX) \
--- 69,74 ----
  
  #define DEF_IN_FT(IX) \
! 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) \

Index: fldsp.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldsp.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** fldsp.cpp	26 Sep 2005 13:59:34 -0000	1.29
--- fldsp.cpp	11 Oct 2005 22:22:48 -0000	1.30
***************
*** 24,35 ****
  
  #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);
      add_method1(c,cb_enable,"enable",A_FLOAT);
- #else
- #error Platform not supported!
  #endif
  }
--- 24,33 ----
  
  #if FLEXT_SYS == FLEXT_SYS_MAX
! 	if(!IsLib(id)) 
! #endif
! 	AddSignalMethods(c);
! 
! #if FLEXT_SYS == FLEXT_SYS_PD
      add_method1(c,cb_enable,"enable",A_FLOAT);
  #endif
  }
***************
*** 43,66 ****
  {}
  
- #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();
      
--- 41,46 ----
***************
*** 86,100 ****
  }
  
! #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
  { 
-     flext_dsp *obj = thisObject(c); 
- 
      int i;
!     int in = obj->CntInSig();
!     int out = obj->CntOutSig();
  #if FLEXT_SYS == FLEXT_SYS_PD
      // min. 1 input channel! (CLASS_MAININLET in pd...)
--- 66,74 ----
  }
  
! void flext_dsp::SetupDsp(t_signal **sp) 
  { 
      int i;
!     int in = CntInSig();
!     int out = CntOutSig();
  #if FLEXT_SYS == FLEXT_SYS_PD
      // min. 1 input channel! (CLASS_MAININLET in pd...)
***************
*** 103,127 ****
  
      // 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() ?
  
      // store in and out signal vectors
  
!     if((in+out) && !obj->vecs)
!         obj->vecs = new t_signalvec[in+out];
  
      for(i = 0; i < in; ++i) 
!         obj->vecs[i] = sp[i]->s_vec;
      for(i = 0; i < out; ++i) 
!         obj->vecs[in+i] = sp[in+i]->s_vec;
  
      // with the following call derived classes can do their eventual DSP setup
!     if(obj->CbDsp()) {
          // set the DSP function
!         dsp_add((t_dspmethod)dspmeth,1,obj);  
      }
  }
  
- 
  void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const * /*outsigs*/) {}
  
--- 77,100 ----
  
      // store current dsp parameters
!     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) && !vecs)
!         vecs = new t_signalvec[in+out];
  
      for(i = 0; i < in; ++i) 
!         vecs[i] = sp[i]->s_vec;
      for(i = 0; i < out; ++i) 
!         vecs[in+i] = sp[in+i]->s_vec;
  
      // with the following call derived classes can do their eventual DSP setup
!     if(CbDsp()) {
          // set the DSP function
!         dsp_add((t_dspmethod)dspmeth,1,this);  
      }
  }
  
  void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const * /*outsigs*/) {}
  
***************
*** 147,150 ****
  
  #if FLEXT_SYS == FLEXT_SYS_PD
! void flext_dsp::cb_enable(t_class *c,t_float on) { thisObject(c)->dspon = on != 0; }
  #endif
--- 120,123 ----
  
  #if FLEXT_SYS == FLEXT_SYS_PD
! void flext_dsp::cb_enable(flext_hdr *c,t_float on) { thisObject(c)->dspon = on != 0; }
  #endif

Index: flattr.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flattr.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** flattr.cpp	23 May 2005 16:52:43 -0000	1.34
--- flattr.cpp	11 Oct 2005 22:22:48 -0000	1.35
***************
*** 195,200 ****
      if(HasAttributes()) {
          // defined in flsupport.cpp
-         extern const t_symbol *sym_attributes;
- 
  		AtomListStatic<32> la;
  		ListAttrib(la);
--- 195,198 ----

Index: fllib.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/fllib.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** fllib.cpp	11 Oct 2005 10:09:23 -0000	1.35
--- fllib.cpp	11 Oct 2005 22:22:48 -0000	1.36
***************
*** 101,104 ****
--- 101,122 ----
  }
  
+ // 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
***************
*** 115,119 ****
  
  	t_class *const &clss;
! 	bool lib,dsp,attr,dist;
  	int argc;
  	int *argv;
--- 133,138 ----
  
  	t_class *const &clss;
! 	flext_library *lib;
! 	bool dsp,attr,dist;
  	int argc;
  	int *argv;
***************
*** 144,172 ****
  
  
! // 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; }
  
  bool flext_obj::HasAttributes() const { return clss->attr; }
  
  
  void flext_obj::lib_init(const char *name,void setupfun(),bool attr)
  {
      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;
  
      try {
  	    setupfun();
--- 163,190 ----
  
  
! 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();
  
  	process_attributes = attr;
  
+ 	// first register all classes
      try {
  	    setupfun();
***************
*** 174,193 ****
      catch(std::exception &x) {
          error("%s - %s",name,x.what());
      }
      catch(char *txt) {
      	error("%s - %s",name,txt);
      }
      catch(...) {
      	error("%s - Unknown exception at library setup",name);
      }
! }
  
! #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);
! }
  #endif
  
  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,...)
  {
--- 192,224 ----
      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
  
! 	// 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,...)
  {
***************
*** 199,208 ****
  #endif
  
! 	if(!lib) process_attributes = attr;
  
  	// set dynamic class pointer
  	t_class **cl = 
  #if FLEXT_SYS == FLEXT_SYS_MAX
! 		lib?&lib_class:
  #endif
  		new t_class *;
--- 230,248 ----
  #endif
  
! 	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?&curlib->clss:
  #endif
  		new t_class *;
***************
*** 223,239 ****
       	// 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
  #endif
  
  	// make new dynamic object
  	flext_class *lo = new flext_class(*cl,newfun,freefun);
! 	lo->lib = lib;
  	lo->dsp = dsp;
  	lo->attr = process_attributes;
  
! //	post("ADDCLASS %p -> LIBOBJ %p -> %p",*cl,lo,lo->clss);
  
  	// parse the argument type list and store it with the object
--- 263,277 ----
       	// just the address is stored, the initialization then occurs with the first object instance!
  	}
  #else
! #error Platform not implemented
  #endif
  
  	// make new dynamic object
  	flext_class *lo = new flext_class(*cl,newfun,freefun);
! 	lo->lib = curlib;
  	lo->dsp = dsp;
  	lo->attr = process_attributes;
  
! //	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
***************
*** 285,290 ****
  			// 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
--- 323,326 ----
***************
*** 312,320 ****
  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)
--- 348,351 ----
***************
*** 324,330 ****
  {
  	flext_hdr *obj = NULL;
- #endif
  	flext_class *lo = FindName(s);
  	if(lo) {
  		bool ok = true;
  		t_atom args[NEWARGS]; 
--- 355,362 ----
  {
  	flext_hdr *obj = NULL;
  	flext_class *lo = FindName(s);
  	if(lo) {
+ //		post("NEWOBJ %s = %p -> %p",GetString(s),lo,lo->clss);
+ 
  		bool ok = true;
  		t_atom args[NEWARGS]; 
***************
*** 471,489 ****
  #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) 
  #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;
--- 503,515 ----
  #if FLEXT_SYS == FLEXT_SYS_MAX
  		// in Max/MSP an object with the name of the library exists, even if not explicitly declared!
! //		if(!lo->lib || s != lo->lib->name) 
  #endif
  		error("Class %s not found in library!",s->s_name);
  #endif
  
  	return obj;
  }
  
  void flext_obj::obj_free(flext_hdr *h)
  {
  	flext_hdr *hdr = (flext_hdr *)h;
***************
*** 517,521 ****
  #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) 
  #endif
  		error("Class %s not found in library!",name);
--- 543,547 ----
  #if FLEXT_SYS == FLEXT_SYS_MAX
  		// in Max/MSP an object with the name of the library exists, even if not explicitely declared!
! //		if(!lo->lib || s != lo->lib->name) 
  #endif
  		error("Class %s not found in library!",name);

Index: flmeth.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmeth.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** flmeth.cpp	19 Jul 2005 13:17:50 -0000	1.20
--- flmeth.cpp	11 Oct 2005 22:22:48 -0000	1.21
***************
*** 117,122 ****
      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;
--- 117,120 ----

Index: flattr_ed.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flattr_ed.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** flattr_ed.cpp	30 Jul 2005 21:59:31 -0000	1.40
--- flattr_ed.cpp	11 Oct 2005 22:22:48 -0000	1.41
***************
*** 479,483 ****
  
  #if PD_MINOR_VERSION >= 37
!     class_setsavefn(cl,cb_GfxSave);
  #else
      widgetbehavior.w_savefn =       cb_GfxSave;
--- 479,483 ----
  
  #if PD_MINOR_VERSION >= 37
!     class_setsavefn(cl,(t_savefn)cb_GfxSave);
  #else
      widgetbehavior.w_savefn =       cb_GfxSave;
***************
*** 490,494 ****
  
  #if PD_MINOR_VERSION >= 37
!     class_setpropertiesfn(cl,cb_GfxProperties);
  #else
      widgetbehavior.w_propertiesfn = cb_GfxProperties;
--- 490,494 ----
  
  #if PD_MINOR_VERSION >= 37
!     class_setpropertiesfn(cl,(t_propertiesfn)cb_GfxProperties);
  #else
      widgetbehavior.w_propertiesfn = cb_GfxProperties;
***************
*** 519,523 ****
  }
  
! void flext_base::cb_GfxProperties(t_gobj *c, t_glist *)
  {
      flext_base *th = thisObject(c);
--- 519,523 ----
  }
  
! void flext_base::cb_GfxProperties(flext_hdr *c, t_glist *)
  {
      flext_base *th = thisObject(c);
***************
*** 785,789 ****
  
  //! Strip the attributes off the object command line
! void flext_base::cb_GfxVis(t_gobj *c, t_glist *gl, int vis)
  {
      if(!gl->gl_isgraph || gl->gl_havewindow) {
--- 785,789 ----
  
  //! Strip the attributes off the object command line
! void flext_base::cb_GfxVis(flext_hdr *c, t_glist *gl, int vis)
  {
      if(!gl->gl_isgraph || gl->gl_havewindow) {
***************
*** 815,819 ****
  }
  
! void flext_base::cb_GfxSelect(t_gobj *c,t_glist *gl,int state)
  {
      t_text *x = (t_text *)c;
--- 815,819 ----
  }
  
! void flext_base::cb_GfxSelect(flext_hdr *c,t_glist *gl,int state)
  {
      t_text *x = (t_text *)c;
***************
*** 854,858 ****
  }
  
! void flext_base::cb_GfxSave(t_gobj *c, t_binbuf *b)
  {
      flext_base *th = thisObject(c);
--- 854,858 ----
  }
  
! void flext_base::cb_GfxSave(flext_hdr *c, t_binbuf *b)
  {
      flext_base *th = thisObject(c);

Index: flsupport.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsupport.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** flsupport.cpp	1 May 2005 03:12:05 -0000	1.53
--- flsupport.cpp	11 Oct 2005 22:22:48 -0000	1.54
***************
*** 35,47 ****
  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 *sym_attributes = NULL;
! const t_symbol *sym_methods = NULL;
  
  
--- 35,45 ----
  const t_symbol *flext::sym_signal = NULL;
  
  const t_symbol *flext::sym_anything = NULL;
  
! const t_symbol *flext::sym_buffer = NULL;
! const t_symbol *flext::sym_size = NULL;
  
! const t_symbol *flext::sym_attributes = NULL;
! const t_symbol *flext::sym_methods = NULL;
  
  
***************
*** 79,91 ****
      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
  
--- 77,80 ----
***************
*** 139,145 ****
          SYSLOCK();
  
! #if FLEXT_SYS == FLEXT_SYS_JMAX
!     	blk = (char *)::fts_malloc(bytes);
! #elif defined(FLEXT_USECMEM)
  	    blk = (char *)::malloc(bytes);
  #else
--- 128,132 ----
          SYSLOCK();
  
! #if defined(FLEXT_USECMEM)
  	    blk = (char *)::malloc(bytes);
  #else
***************
*** 185,191 ****
          SYSLOCK();
  
! #if FLEXT_SYS == FLEXT_SYS_JMAX
!         ::fts_free(ori);
! #elif defined(FLEXT_USECMEM)
  	    ::free(ori);
  #else
--- 172,176 ----
          SYSLOCK();
  
! #if defined(FLEXT_USECMEM)
  	    ::free(ori);
  #else
***************
*** 227,233 ****
          SYSLOCK();
  
! #if FLEXT_SYS == FLEXT_SYS_JMAX
!     	blk = (char *)::fts_malloc(bytes);
! #elif defined(FLEXT_USECMEM)
  	    blk = (char *)::malloc(bytes);
  #else
--- 212,216 ----
          SYSLOCK();
  
! #if defined(FLEXT_USECMEM)
  	    blk = (char *)::malloc(bytes);
  #else
***************
*** 263,269 ****
          SYSLOCK();
  
! #if FLEXT_SYS == FLEXT_SYS_JMAX
!         ::fts_free(ori);
! #elif defined(FLEXT_USECMEM)
  	    ::free(ori);
  #else
--- 246,250 ----
          SYSLOCK();
  
! #if defined(FLEXT_USECMEM)
  	    ::free(ori);
  #else

Index: flclass.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flclass.h,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** flclass.h	26 Sep 2005 13:59:34 -0000	1.64
--- flclass.h	11 Oct 2005 22:22:48 -0000	1.65
***************
*** 199,208 ****
  	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; }
  
--- 199,207 ----
  	static const t_symbol *thisTag() { return curtag; }
  
  	class outlet;
  
  	//! Get pointer to outlet (not in the constructor!)
  	outlet *GetOut(int ix) const { return outlets[ix]; }
! 
  	int GetOutAttr() const { return HasAttributes()?CntOut():0; }
  
***************
*** 350,357 ****
  #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
  #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
--- 349,354 ----
  #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
  #else
! 	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
***************
*** 400,407 ****
  #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
  #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
--- 397,402 ----
  #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
  #else
! 	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
***************
*** 433,454 ****
  	*/
  
- #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
--- 428,440 ----
***************
*** 769,773 ****
  
  	// 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(); } }
--- 755,758 ----
***************
*** 776,792 ****
      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;
  
  private:
  	class pxbnd_object;
--- 761,772 ----
      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(); } }
! 
  	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;
***************
*** 824,827 ****
--- 804,809 ----
  private:
  
+ 	static inline flext_base *thisObject(flext_hdr *c) { return FLEXT_CAST<flext_base *>(c->data); } 
+ 
  	static void Setup(t_classid c);
  
***************
*** 846,852 ****
  	unsigned char incnt,outcnt,insigs,outsigs;
  
- #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
  	outlet **outlets;
- #endif
  
  	union t_any {
--- 828,832 ----
***************
*** 919,929 ****
  	// attribute editor
  	static bool cb_AttrDialog(flext_base *c,int argc,const t_atom *argv);
! 	static void cb_GfxProperties(t_gobj *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);
  
      void BinbufArgs(t_binbuf *b,t_binbuf *args,bool withname,bool transdoll);
--- 899,909 ----
  	// attribute editor
  	static bool cb_AttrDialog(flext_base *c,int argc,const t_atom *argv);
! 	static void cb_GfxProperties(flext_hdr *c, t_glist *);
  #endif
  
  #ifdef FLEXT_ATTRHIDE
! 	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);
***************
*** 944,993 ****
  	};
  
! 	static void cb_px_anything(t_class *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);
  
  #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);
  #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
--- 924,969 ----
  	};
  
! 	static void cb_px_anything(flext_hdr *c,const t_symbol *s,int argc,t_atom *argv);
  
! 	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(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
  
  	px_object **inlets;
  
  	// --------- symbol-bound proxy
***************
*** 1025,1039 ****
  	// 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
  
  #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);
  #endif
  };
--- 1001,1017 ----
  	// callback functions
  
! 	static void cb_loadbang(flext_hdr *c);
  
  #if FLEXT_SYS == FLEXT_SYS_MAX
  	char **indesc,**outdesc;
  
! 	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
  };





More information about the Pd-cvs mailing list