From 5aeb36ec9e7aaee34ce8f5f248029d39047e2918 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 5 Aug 2003 02:37:17 +0000 Subject: "" svn path=/trunk/; revision=823 --- externals/grill/flext/source/flbase.h | 4 +++ externals/grill/flext/source/flclass.h | 48 +++++++++++++++++++----------- externals/grill/flext/source/fldsp.cpp | 2 ++ externals/grill/flext/source/fldsp.h | 2 ++ externals/grill/flext/source/flext.h | 14 +++++++-- externals/grill/flext/source/fllib.cpp | 8 ++++- externals/grill/flext/source/flproxy.cpp | 41 +++++++++++++++++++++---- externals/grill/flext/source/flsupport.cpp | 18 +++++++++-- 8 files changed, 108 insertions(+), 29 deletions(-) (limited to 'externals/grill/flext/source') diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h index 795c0673..0587f919 100644 --- a/externals/grill/flext/source/flbase.h +++ b/externals/grill/flext/source/flbase.h @@ -249,8 +249,12 @@ class FLEXT_SHARE FLEXT_CLASSDEF(flext_obj): #if FLEXT_SYS == FLEXT_SYS_JMAX static void obj_new(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); static void obj_free(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); +#else +#if FLEXT_SYS == FLEXT_SYS_MAX + static flext_hdr *obj_new(const t_symbol *s,short argc,t_atom *argv); #else static flext_hdr *obj_new(const t_symbol *s,int argc,t_atom *argv); +#endif static void obj_free(flext_hdr *o); #endif diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 11661d67..20f5117c 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -849,24 +849,6 @@ private: static void px_method(px_object *c,const t_symbol *s,int argc,t_atom *argv); }; -#elif FLEXT_SYS == FLEXT_SYS_MAX - typedef object px_object; - static void cb_px_float(t_class *c,float f); - static void cb_px_int(t_class *c,int v); - static void cb_px_bang(t_class *c); - - static void cb_px_in1(t_class *c,int v); - static void cb_px_in2(t_class *c,int v); - static void cb_px_in3(t_class *c,int v); - static void cb_px_in4(t_class *c,int v); - static void cb_px_in5(t_class *c,int v); - static void cb_px_in6(t_class *c,int v); - static void cb_px_in7(t_class *c,int v); - static void cb_px_in8(t_class *c,int v); - static void cb_px_in9(t_class *c,int v); -#endif - -#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX 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); @@ -879,6 +861,36 @@ private: 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); diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index 6d3298b2..9985464a 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -122,6 +122,8 @@ t_int *flext_dsp::dspmeth(t_int *w) #if FLEXT_SYS == FLEXT_SYS_JMAX void flext_dsp::cb_dsp(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) +#elif 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 diff --git a/externals/grill/flext/source/fldsp.h b/externals/grill/flext/source/fldsp.h index ee94973d..21a3aadb 100644 --- a/externals/grill/flext/source/fldsp.h +++ b/externals/grill/flext/source/fldsp.h @@ -155,6 +155,8 @@ private: static void cb_dsp(fts_object_t *o, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at); // static void cb_dsp_init(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at); // static void cb_dsp_delete(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at); +#elif 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); #endif diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h index 1a87e2bf..9fd63487 100644 --- a/externals/grill/flext/source/flext.h +++ b/externals/grill/flext/source/flext.h @@ -50,6 +50,13 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #endif + +#if FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN +// for wmax alignment must be 2 bytes! +#pragma pack(2) +#endif + + // include all the flext interface definitions #include "fldefs.h" @@ -59,6 +66,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. // include the flext dsp class #include "fldsp.h" +/* +#if FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN +#pragma pack(pop) +#endif +*/ #endif // FLEXT_H - - diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp index a6d95895..e1fc89c1 100755 --- a/externals/grill/flext/source/fllib.cpp +++ b/externals/grill/flext/source/fllib.cpp @@ -27,8 +27,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. #elif FLEXT_OS == FLEXT_OS_WIN #if FLEXT_SYS == FLEXT_SYS_PD #define ALIASSLASH '/' + #elif FLEXT_SYS == FLEXT_SYS_MAX + #define ALIASSLASH '/' #else - #error "Undefined" + #error "Undefined" #endif #else // default to "/" @@ -332,7 +334,11 @@ void flext_obj::obj_new(fts_object_t *o, int, fts_symbol_t s, int _argc_, const { flext_hdr *obj = (flext_hdr *)o; #else +#if FLEXT_SYS == FLEXT_SYS_MAX +flext_hdr *flext_obj::obj_new(const t_symbol *s,short _argc_,t_atom *argv) +#else flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv) +#endif { flext_hdr *obj = NULL; #endif diff --git a/externals/grill/flext/source/flproxy.cpp b/externals/grill/flext/source/flproxy.cpp index 2edcd4c9..85981130 100755 --- a/externals/grill/flext/source/flproxy.cpp +++ b/externals/grill/flext/source/flproxy.cpp @@ -43,17 +43,39 @@ add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT) #elif FLEXT_SYS == FLEXT_SYS_MAX -void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv) +void flext_base::cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *argv) { // check if inlet allows anything (or list) flext_base *o = thisObject(c); int ci = ((flext_hdr *)o->x_obj)->curinlet; - o->m_methodmain(ci,s,argc,argv); } -void flext_base::cb_px_int(t_class *c,int v) +#if 0 //FLEXT_OS == FLEXT_OS_WIN +// could also work for OSX! + +void flext_base::cb_px_int(t_class *c,long v) +{ + flext_base *o = thisObject(c); + int ci = proxy_getinlet((t_object *)o->x_obj); + // check if inlet allows int type + t_atom atom; + SetInt(atom,v); + o->m_methodmain(ci,sym_int,1,&atom); +} + +void flext_base::cb_px_float(t_class *c,double v) +{ + flext_base *o = thisObject(c); + int ci = proxy_getinlet((t_object *)o->x_obj); + // check if inlet allows float type + t_atom atom; + SetFloat(atom,v); + o->m_methodmain(ci,sym_float,1,&atom); +} +#else +void flext_base::cb_px_int(t_class *c,long v) { // check if inlet allows int type t_atom atom; @@ -61,13 +83,14 @@ void flext_base::cb_px_int(t_class *c,int v) cb_px_anything(c,sym_int,1,&atom); } -void flext_base::cb_px_float(t_class *c,float v) +void flext_base::cb_px_float(t_class *c,double v) { // check if inlet allows float type t_atom atom; SetFloat(atom,v); cb_px_anything(c,sym_float,1,&atom); } +#endif void flext_base::cb_px_bang(t_class *c) { @@ -77,8 +100,8 @@ void flext_base::cb_px_bang(t_class *c) #define DEF_IN_FT(IX) \ -void flext_base::cb_px_in ## IX(t_class *c,int v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_int(c,v); ci = 0; } \ -void flext_base::cb_px_ft ## IX(t_class *c,float v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_float(c,v); ci = 0; } +void flext_base::cb_px_in ## IX(t_class *c,long v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_int(c,v); ci = 0; } \ +void flext_base::cb_px_ft ## IX(t_class *c,double v) { long &ci = ((flext_hdr *)thisObject(c)->x_obj)->curinlet; ci = IX; cb_px_float(c,v); ci = 0; } #define ADD_IN_FT(IX) \ add_method1(c,cb_px_in ## IX,"in" #IX,A_INT); \ @@ -116,6 +139,11 @@ void flext_base::SetProxies(t_class *c) #error Not implemented! #endif +#if 0 //FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN + // could also work for OSX! + addint((method)cb_px_int); + addfloat((method)cb_px_float); +#else // setup non-leftmost ints and floats ADD_IN_FT(1); ADD_IN_FT(2); @@ -126,6 +154,7 @@ void flext_base::SetProxies(t_class *c) ADD_IN_FT(7); ADD_IN_FT(8); ADD_IN_FT(9); +#endif } #elif FLEXT_SYS == FLEXT_SYS_JMAX diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index 14b9bea5..b27196b8 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -174,6 +174,7 @@ int flext::Int2Bits(unsigned long n) return b; } + void flext::post(const char *fmt, ...) { #ifdef FLEXT_THREADS @@ -182,9 +183,15 @@ void flext::post(const char *fmt, ...) #endif va_list ap; va_start(ap, fmt); +#if FLEXT_SYS == FLEXT_SYS_MAX + char buf[1024]; // \TODO this is quite unsafe..... + vsprintf(buf, fmt, ap); + ::post(buf); +#else vfprintf(stderr, fmt, ap); + ::post(""); +#endif va_end(ap); - putc('\n', stderr); #ifdef FLEXT_THREADS mutex.Unlock(); #endif @@ -198,10 +205,17 @@ void flext::error(const char *fmt,...) #endif va_list ap; va_start(ap, fmt); +#if FLEXT_SYS == FLEXT_SYS_MAX + char buf[1024]; // \TODO this is quite unsafe..... + sprintf(buf,"error: "); + vsprintf(buf+7, fmt, ap); + ::post(buf); +#else fprintf(stderr, "error: "); vfprintf(stderr, fmt, ap); + ::post(""); +#endif va_end(ap); - putc('\n', stderr); #ifdef FLEXT_THREADS mutex.Unlock(); #endif -- cgit v1.2.1