diff options
Diffstat (limited to 'externals/grill/flext/source')
-rw-r--r-- | externals/grill/flext/source/flatom_pr.cpp | 6 | ||||
-rw-r--r-- | externals/grill/flext/source/flattr_ed.cpp | 4 | ||||
-rw-r--r-- | externals/grill/flext/source/flbase.h | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flclass.h | 64 | ||||
-rw-r--r-- | externals/grill/flext/source/fldsp.cpp | 15 | ||||
-rw-r--r-- | externals/grill/flext/source/fldsp.h | 4 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.cpp | 28 | ||||
-rw-r--r-- | externals/grill/flext/source/flext.h | 2 | ||||
-rwxr-xr-x | externals/grill/flext/source/fllib.cpp | 5 | ||||
-rwxr-xr-x | externals/grill/flext/source/flmeth.cpp | 6 | ||||
-rwxr-xr-x | externals/grill/flext/source/flmsg.cpp | 8 | ||||
-rw-r--r-- | externals/grill/flext/source/flout.cpp | 38 | ||||
-rwxr-xr-x | externals/grill/flext/source/flproxy.cpp | 167 | ||||
-rwxr-xr-x | externals/grill/flext/source/flsimd.cpp | 2 | ||||
-rw-r--r-- | externals/grill/flext/source/flsupport.h | 15 |
15 files changed, 211 insertions, 155 deletions
diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp index d589f657..303be710 100644 --- a/externals/grill/flext/source/flatom_pr.cpp +++ b/externals/grill/flext/source/flatom_pr.cpp @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -46,10 +46,12 @@ bool flext::PrintAtom(const t_atom &a,char *buf,size_t bufsz) ok = false; } } +#if FLEXT_SYS == FLEXT_SYS_PD +#ifndef FLEXT_COMPATIBLE else if(IsPointer(a)) { ok = STD::snprintf(buf,bufsz,"%p",GetPointer(a)) > 0; } -#if FLEXT_SYS == FLEXT_SYS_PD +#endif else if(a.a_type == A_DOLLAR) { ok = STD::snprintf(buf,bufsz,"$%d",a.a_w.w_index) > 0; } diff --git a/externals/grill/flext/source/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp index 74ac30a7..115dad13 100644 --- a/externals/grill/flext/source/flattr_ed.cpp +++ b/externals/grill/flext/source/flattr_ed.cpp @@ -52,8 +52,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. #ifdef FLEXT_ATTRHIDE #ifndef __FLEXT_CLONEWIDGET -static void (*ori_vis)(t_gobj *c, t_glist *, int vis) = NULL; -static void (*ori_select)(t_gobj *c, t_glist *, int state) = NULL; +static t_visfn ori_vis = NULL; +static t_selectfn ori_select = NULL; #endif #endif diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h index b0155b1c..b696ea68 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index e7a16957..25284f01 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -62,20 +62,6 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_base): public: - /*! \defgroup FLEXT_C_BASE Basic class functionality - @{ - */ - -// --- compatibility mode ---------------------------------------- - - /*! \brief Cross-platform compatibility flag. - If set flext allows only operations valid for all platforms. - Set to true by default! - */ - static bool compatibility; - -//! @} FLEXT_C_BASE - // --- inheritable virtual methods -------------------------------- /*! \defgroup FLEXT_C_VIRTUAL Virtual base class functions @@ -840,8 +826,7 @@ protected: static void ToSysMsg(MsgBundle *mb); // add class method handlers - static void AddMessageMethods(t_class *c); - static void AddSignalMethods(t_class *c); + static void AddMessageMethods(t_class *c,bool dsp); private: class pxbnd_object; @@ -982,6 +967,12 @@ private: void BinbufAttr(t_binbuf *b,bool transdoll); #endif + static void cb_bang(flext_hdr *c); + static void cb_float(flext_hdr *c,t_float f); + static void cb_symbol(flext_hdr *c,const t_symbol *s); +// static void cb_pointer(fltext_hdr *c,const t_gpointer *p); + static void cb_anything(flext_hdr *c,const t_symbol *s,int argc,t_atom *argv); + // proxy object (for additional inlets) static t_class *px_class; @@ -992,26 +983,29 @@ private: int index; void init(flext_base *b,int ix) { base = b; index = ix; } - static void px_method(px_object *c,const t_symbol *s,int argc,t_atom *argv); + static void px_bang(px_object *c); + static void px_float(px_object *c,t_float f); + static void px_symbol(px_object *c,const t_symbol *s); +// static void px_pointer(px_object *c,const t_gpointer *p); + static void px_anything(px_object *c,const t_symbol *s,int argc,t_atom *argv); }; - static void cb_px_anything(flext_hdr *c,const t_symbol *s,int argc,t_atom *argv); - - static void cb_px_ft1(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); - + static void cb_px_ft1(flext_hdr *c,t_float f); + static void cb_px_ft2(flext_hdr *c,t_float f); + static void cb_px_ft3(flext_hdr *c,t_float f); + static void cb_px_ft4(flext_hdr *c,t_float f); + static void cb_px_ft5(flext_hdr *c,t_float f); + static void cb_px_ft6(flext_hdr *c,t_float f); + static void cb_px_ft7(flext_hdr *c,t_float f); + static void cb_px_ft8(flext_hdr *c,t_float f); + static void cb_px_ft9(flext_hdr *c,t_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_bang(flext_hdr *c); + static void cb_float(flext_hdr *c,double f); + static void cb_int(flext_hdr *c,long v); + static void cb_anything(flext_hdr *c,const t_symbol *s,short argc,t_atom *argv); static void cb_px_in1(flext_hdr *c,long v); static void cb_px_in2(flext_hdr *c,long v); @@ -1032,8 +1026,6 @@ private: 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; @@ -1062,7 +1054,7 @@ private: // --------- //! set up inlet proxies - static void SetProxies(t_class *c); + static void SetProxies(t_class *c,bool dsp); //! initialize inlets (according to class or object constructor definitions) bool InitInlets(); diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index 753779cc..5eb81ea7 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -20,15 +20,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. void flext_dsp::Setup(t_classid id) { - t_class *c = getClass(id); - -#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); +// add_method1(c,cb_enable,"enable",A_FLOAT); + AddMethod(id,0,MakeSymbol("enable"),&cb_enable); #endif } @@ -119,5 +113,6 @@ void flext_dsp::CbSignal() #if FLEXT_SYS == FLEXT_SYS_PD -void flext_dsp::cb_enable(flext_hdr *c,t_float on) { thisObject(c)->dspon = on != 0; } +//void flext_dsp::cb_enable(flext_hdr *c,t_float on) { thisObject(c)->dspon = on != 0; } +bool flext_dsp::cb_enable(flext_base *b,float &on) { static_cast<flext_dsp *>(b)->dspon = on != 0; return true; } #endif diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h index b766ed8d..7004b891 100644 --- a/externals/grill/flext/source/fldsp.h +++ b/externals/grill/flext/source/fldsp.h @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -163,7 +163,7 @@ private: static void Setup(t_classid c); #if FLEXT_SYS == FLEXT_SYS_PD - static void cb_enable(flext_hdr *c,t_float on); + static bool cb_enable(flext_base *c,float &on); bool dspon; #endif diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index df0f0b61..acbbf2ad 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -19,7 +19,6 @@ WARRANTIES, see the file, "license.txt," in this distribution. // === flext_base ============================================ -bool flext_base::compatibility = true; const t_symbol *flext_base::curtag = NULL; flext_base::FLEXT_CLASSDEF(flext_base)() @@ -141,35 +140,34 @@ void flext_base::Exit() } -void flext_base::AddMessageMethods(t_class *c) +void flext_base::AddMessageMethods(t_class *c,bool dsp) { add_loadbang(c,cb_loadbang); + #if FLEXT_SYS == FLEXT_SYS_PD class_addmethod(c,(t_method)cb_click,gensym("click"),A_FLOAT,A_FLOAT,A_FLOAT,A_FLOAT,A_FLOAT,A_NULL); #elif FLEXT_SYS == FLEXT_SYS_MAX add_assist(c,cb_assist); add_dblclick(c,cb_click); -#else - #pragma message ("no implementation of loadbang or assist") #endif - SetProxies(c); + SetProxies(c,dsp); StartQueue(); -} - -void flext_base::AddSignalMethods(t_class *c) -{ + + if(dsp) { #if FLEXT_SYS == FLEXT_SYS_MAX - add_dsp(c,cb_dsp); - dsp_initclass(); + 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); + 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 */ @@ -180,7 +178,7 @@ void flext_base::Setup(t_classid id) #if FLEXT_SYS == FLEXT_SYS_MAX if(!IsLib(id)) #endif - AddMessageMethods(c); + AddMessageMethods(c,IsDSP(id)); if(process_attributes) { AddMethod(id,0,"getattributes",cb_ListAttrib); diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h index 64db2b42..7fb2be89 100644 --- a/externals/grill/flext/source/flext.h +++ b/externals/grill/flext/source/flext.h @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp index 4f837aff..4670858b 100755 --- a/externals/grill/flext/source/fllib.cpp +++ b/externals/grill/flext/source/fllib.cpp @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -213,8 +213,7 @@ void flext_obj::lib_init(const char *name,void setupfun(),bool attr) 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); + flext_base::AddMessageMethods(curlib->clss,curlib->dsp); #endif curlib = NULL; diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp index 69b1e640..c538922b 100755 --- a/externals/grill/flext/source/flmeth.cpp +++ b/externals/grill/flext/source/flmeth.cpp @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -64,8 +64,8 @@ void flext_base::AddMethod(ItemCont *ma,int inlet,const t_symbol *tag,methfun fu ERRINTERNAL(); } #endif -#if FLEXT_SYS == FLEXT_SYS_PD - if(a == a_pointer && flext_base::compatibility) { +#if FLEXT_SYS == FLEXT_SYS_PD && defined(FLEXT_COMPATIBLE) + if(a == a_pointer) { post("Pointer arguments are not allowed in compatibility mode"); } #endif diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp index 640c90cd..ffde9bf2 100755 --- a/externals/grill/flext/source/flmsg.cpp +++ b/externals/grill/flext/source/flmsg.cpp @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -177,8 +177,10 @@ bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_at ret = FindMeth(inlet,sym_int,1,argv); else if(IsSymbol(argv[0])) ret = FindMeth(inlet,sym_symbol,1,argv); + #if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_COMPATIBLE) else if(IsPointer(argv[0])) ret = FindMeth(inlet,sym_pointer,1,argv); + #endif if(ret) goto end; } else { @@ -210,7 +212,7 @@ bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_at ret = FindMeth(inlet,sym_list,1,argv); if(ret) goto end; } - #if FLEXT_SYS == FLEXT_SYS_PD + #if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_COMPATIBLE) else if(s == sym_pointer) { ret = FindMeth(inlet,sym_list,1,argv); if(ret) goto end; @@ -235,7 +237,9 @@ bool flext_base::CbMethodHandler(int inlet,const t_symbol *s,int argc,const t_at if(IsFloat(argv[i])) sym = sym_float; else if(IsInt(argv[i])) sym = sym_int; else if(IsSymbol(argv[i])) sym = sym_symbol; + #if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_COMPATIBLE) else if(IsPointer(argv[i])) sym = sym_pointer; // can pointer atoms occur here? + #endif if(sym) { trap = true; diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp index 67ab40c0..3933d5f1 100644 --- a/externals/grill/flext/source/flout.cpp +++ b/externals/grill/flext/source/flout.cpp @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -119,23 +119,17 @@ bool flext_base::InitInlets() switch(xi.tp) { case xlet_float: case xlet_int: { - inlets[ix-1] = NULL; - char sym[] = "ft??"; - if(ix >= 10) { - if(compatibility) { - // Max allows max. 9 inlets - post("%s: Only 9 float/int inlets allowed in compatibility mode",thisName()); - ok = false; - } - else { - if(ix > 99) - post("%s: Inlet index > 99 not allowed for float/int inlets",thisName()); - sym[2] = '0'+ix/10,sym[3] = '0'+ix%10; - } + if(ix > 9) { + // proxy inlet needed + (inlets[ix-1] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages + in = inlet_new(&x_obj->obj,&inlets[ix-1]->obj.ob_pd, (t_symbol *)sym_float, (t_symbol *)sym_float); + } + else { + inlets[ix-1] = NULL; + static char sym[] = " ft ?"; + sym[4] = '0'+ix; + in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym)); } - else - sym[2] = '0'+ix,sym[3] = 0; - if(ok) in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym)); break; } case xlet_sym: @@ -152,13 +146,15 @@ bool flext_base::InitInlets() break; case xlet_sig: inlets[ix-1] = NULL; - if(compatibility && inlist[ix-1].tp != xlet_sig) { +#ifdef FLEXT_COMPATIBLE + if(inlist[ix-1].tp != xlet_sig) { post("%s: All signal inlets must be left-aligned in compatibility mode",thisName()); ok = false; } - else { - // pd doesn't seem to be able to handle signals and messages into the same inlet... - + else +#endif + { + // pd is not able to handle signals and messages into the same inlet... in = inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_signal, (t_symbol *)sym_signal); ++insigs; } diff --git a/externals/grill/flext/source/flproxy.cpp b/externals/grill/flext/source/flproxy.cpp index 7b964db5..d542fe66 100755 --- a/externals/grill/flext/source/flproxy.cpp +++ b/externals/grill/flext/source/flproxy.cpp @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -22,100 +22,179 @@ WARRANTIES, see the file, "license.txt," in this distribution. t_class *flext_base::px_class = NULL; -void flext_base::px_object::px_method(px_object *obj,const t_symbol *s,int argc,t_atom *argv) +void flext_base::px_object::px_bang(px_object *obj) +{ + obj->base->CbMethodHandler(obj->index,sym_bang,0,NULL); +} + +void flext_base::px_object::px_float(px_object *obj,t_float f) +{ + t_atom a; SetFloat(a,f); + obj->base->CbMethodHandler(obj->index,sym_float,1,&a); +} + +void flext_base::px_object::px_symbol(px_object *obj,const t_symbol *s) +{ + t_atom a; SetSymbol(a,s); + obj->base->CbMethodHandler(obj->index,sym_symbol,1,&a); +} + +/* +void flext_base::px_object::px_pointer(px_object *obj,const t_gpointer *p) +{ + t_atom a; SetPointer(a,p); + obj->base->CbMethodHandler(obj->index,sym_pointer,1,&a); +} +*/ + +void flext_base::px_object::px_anything(px_object *obj,const t_symbol *s,int argc,t_atom *argv) { obj->base->CbMethodHandler(obj->index,s,argc,argv); } -void flext_base::cb_px_anything(flext_hdr *c,const t_symbol *s,int argc,t_atom *argv) +void flext_base::cb_bang(flext_hdr *c) +{ + thisObject(c)->CbMethodHandler(0,sym_bang,0,NULL); +} + +void flext_base::cb_float(flext_hdr *c,t_float f) +{ + t_atom a; SetFloat(a,f); + thisObject(c)->CbMethodHandler(0,sym_float,1,&a); +} + +void flext_base::cb_symbol(flext_hdr *c,const t_symbol *s) +{ + t_atom a; SetSymbol(a,s); + thisObject(c)->CbMethodHandler(0,sym_symbol,1,&a); +} + +/* +void flext_base::cb_pointer(flext_hdr *c,const t_gpointer *p) +{ + t_atom a; SetPointer(a,p); + thisObject(c)->CbMethodHandler(0,sym_pointer,1,&a); +} +*/ + +void flext_base::cb_anything(flext_hdr *c,const t_symbol *s,int argc,t_atom *argv) { thisObject(c)->CbMethodHandler(0,s,argc,argv); } -#define DEF_IN_FT(IX) \ -void flext_base::cb_px_ft ## IX(flext_hdr *c,float v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); } +#define DEF_PROXYMSG(IX) \ +void flext_base::cb_px_ft ## IX(flext_hdr *c,t_float v) { t_atom atom; SetFloat(atom,v); thisObject(c)->CbMethodHandler(IX,sym_float,1,&atom); } + +#define ADD_PROXYMSG(c,IX) \ +add_method1(c,cb_px_ft ## IX," ft " #IX,A_FLOAT) + +//AddMethod(c,0,flext::MakeSymbol("ft" #IX),cb_px_ft ## IX) -#define ADD_IN_FT(IX) \ -add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT) #elif FLEXT_SYS == FLEXT_SYS_MAX -void flext_base::cb_px_anything(flext_hdr *c,const t_symbol *s,short argc,t_atom *argv) +void flext_base::cb_anything(flext_hdr *c,const t_symbol *s,short argc,t_atom *argv) { int ci = ((flext_hdr *)c)->curinlet; thisObject(c)->CbMethodHandler(ci,s,argc,argv); } -void flext_base::cb_px_int(flext_hdr *c,long v) +void flext_base::cb_int(flext_hdr *c,long v) { t_atom atom; SetInt(atom,v); int ci = ((flext_hdr *)c)->curinlet; thisObject(c)->CbMethodHandler(ci,sym_int,1,&atom); } -void flext_base::cb_px_float(flext_hdr *c,double v) +void flext_base::cb_float(flext_hdr *c,double v) { t_atom atom; SetFloat(atom,v); int ci = ((flext_hdr *)c)->curinlet; thisObject(c)->CbMethodHandler(ci,sym_float,1,&atom); } -void flext_base::cb_px_bang(flext_hdr *c) +void flext_base::cb_bang(flext_hdr *c) { int ci = ((flext_hdr *)c)->curinlet; thisObject(c)->CbMethodHandler(ci,sym_bang,0,NULL); } -#define DEF_IN_FT(IX) \ +#define DEF_PROXYMSG(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) \ -add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \ -add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT) +//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_PROXYMSG(c,IX) \ +addinx((method)(cb_px_in ## IX),IX); \ +addftx((method)(cb_px_ft ## IX),IX) + +//add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \ +//add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT) + +//AddMethod(c,0,flext::MakeSymbol("in" #IX),cb_px_in ## IX); \ +//AddMethod(c,0,flext::MakeSymbol("ft" #IX),cb_px_ft ## IX) + #endif #if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX -DEF_IN_FT(1) -DEF_IN_FT(2) -DEF_IN_FT(3) -DEF_IN_FT(4) -DEF_IN_FT(5) -DEF_IN_FT(6) -DEF_IN_FT(7) -DEF_IN_FT(8) -DEF_IN_FT(9) - -void flext_base::SetProxies(t_class *c) +DEF_PROXYMSG(1) +DEF_PROXYMSG(2) +DEF_PROXYMSG(3) +DEF_PROXYMSG(4) +DEF_PROXYMSG(5) +DEF_PROXYMSG(6) +DEF_PROXYMSG(7) +DEF_PROXYMSG(8) +DEF_PROXYMSG(9) + + +void flext_base::SetProxies(t_class *c,bool dsp) { - // proxy for extra inlets #if FLEXT_SYS == FLEXT_SYS_PD - add_anything(c,cb_px_anything); // for leftmost inlet - px_class = class_new(gensym("flext_base proxy"),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL); - add_anything(px_class,px_object::px_method); // for other inlets + // for leftmost inlet + class_addbang(c,cb_bang); + if(!dsp) class_addfloat(c,cb_float); + class_addsymbol(c,cb_symbol); +// class_addpointer(c,cb_pointer); + class_addlist(c,cb_anything); + class_addanything(c,cb_anything); + // proxy for extra inlets + if(!px_class) { + // only once + px_class = class_new(gensym(" flext_base proxy "),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL); + class_addbang(px_class,px_object::px_bang); // for other inlets + class_addfloat(px_class,px_object::px_float); // for other inlets + class_addsymbol(px_class,px_object::px_symbol); // for other inlets +// class_addpointer(px_class,px_object::px_pointer); // for other inlets + class_addlist(px_class,px_object::px_anything); // for other inlets + class_addanything(px_class,px_object::px_anything); // for other inlets + } #elif FLEXT_SYS == FLEXT_SYS_MAX - add_bang(c,cb_px_bang); - add_method1(c,cb_px_int,"int",A_INT); - add_method1(c,cb_px_float,"float",A_FLOAT); -// add_methodG(c,cb_px_anything,"list"); - add_anything(c,cb_px_anything); + addbang((method)cb_bang); + addint((method)cb_int); + addfloat((method)cb_float); + addmess((method)cb_anything,"list",A_GIMME,A_NOTHING); // must be explicitly given, otherwise list elements are distributes over inlets + addmess((method)cb_anything,"anything",A_GIMME,A_NOTHING); #else #error Not implemented! #endif // setup non-leftmost ints and floats - ADD_IN_FT(1); - ADD_IN_FT(2); - ADD_IN_FT(3); - ADD_IN_FT(4); - ADD_IN_FT(5); - ADD_IN_FT(6); - ADD_IN_FT(7); - ADD_IN_FT(8); - ADD_IN_FT(9); + ADD_PROXYMSG(c,1); + ADD_PROXYMSG(c,2); + ADD_PROXYMSG(c,3); + ADD_PROXYMSG(c,4); + ADD_PROXYMSG(c,5); + ADD_PROXYMSG(c,6); + ADD_PROXYMSG(c,7); + ADD_PROXYMSG(c,8); + ADD_PROXYMSG(c,9); } #endif diff --git a/externals/grill/flext/source/flsimd.cpp b/externals/grill/flext/source/flsimd.cpp index cd3b19e0..8ed13a4a 100755 --- a/externals/grill/flext/source/flsimd.cpp +++ b/externals/grill/flext/source/flsimd.cpp @@ -301,7 +301,7 @@ static unsigned long setsimdcaps() if(cpuinfo.os_support&_CPU_FEATURE_3DNOW) simdflags += flext::simd_3dnow; if(cpuinfo.os_support&_CPU_FEATURE_SSE) simdflags += flext::simd_sse; if(cpuinfo.os_support&_CPU_FEATURE_SSE2) simdflags += flext::simd_sse2; -#elif FLEXT_CPU == FLEXT_CPU_PPC +#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__) #if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH int selectors[2] = { CTL_HW, HW_VECTORUNIT }; diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index 526a60af..772347f0 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -2,7 +2,7 @@ flext - C++ layer for Max/MSP and pd (pure data) externals -Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org) +Copyright (c) 2001-2006 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -488,6 +488,7 @@ public: //! Set the atom to represent a integer (depending on the system) static void SetInt(t_atom &a,int v) { a.a_type = A_FLOAT; a.a_w.w_float = (float)v; } +#ifndef FLEXT_COMPATIBLE //! Check whether the atom strictly is a pointer static bool IsPointer(const t_atom &a) { return a.a_type == A_POINTER; } //! Check whether the atom can be a pointer @@ -498,6 +499,7 @@ public: static t_gpointer *GetAPointer(const t_atom &a,t_gpointer *def = NULL) { return IsPointer(a)?GetPointer(a):def; } //! Set the atom to represent a pointer static void SetPointer(t_atom &a,t_gpointer *p) { a.a_type = A_POINTER; a.a_w.w_gpointer = (t_gpointer *)p; } +#endif #elif FLEXT_SYS == FLEXT_SYS_MAX //! Check for a float and get its value @@ -511,17 +513,6 @@ public: static int GetAInt(const t_atom &a,int def = 0) { return IsInt(a)?GetInt(a):(IsFloat(a)?(int)GetFloat(a):def); } //! Set the atom to represent an integer static void SetInt(t_atom &a,int v) { a.a_type = A_INT; a.a_w.w_long = v; } - - //! Check whether the atom strictly is a pointer - static bool IsPointer(const t_atom &) { return false; } - //! Check whether the atom can be a pointer - static bool CanbePointer(const t_atom &a) { return IsInt(a); } - //! Access the pointer value (without type check) - static void *GetPointer(const t_atom &) { return NULL; } - //! Check for a pointer and get its value - static void *GetAPointer(const t_atom &a,void *def = NULL) { return IsInt(a)?(void *)GetInt(a):def; } - //! Set the atom to represent a pointer - static void SetPointer(t_atom &a,void *p) { SetInt(a,(int)p); } #else #error "Platform not supported" #endif |