Commit 3888b6f8 authored by Thomas Grill's avatar Thomas Grill
Browse files

template fixes for Max SDK part

parent b6681af9
......@@ -152,9 +152,9 @@ FLEXT_TEMPIMPL(bool FLEXT_CLASSDEF(flext_obj))::GetParamSym(t_atom &dst,const t_
}
else
#else
#pragma message("Not implemented")
// #pragma message("Not implemented")
#endif
SetSymbol(dst,sym);
SetSymbol(dst,sym);
return true;
}
......@@ -178,21 +178,21 @@ FLEXT_TEMPIMPL(void FLEXT_CLASSDEF(flext_obj))::GetCanvasArgs(AtomList &args) co
canvas_getargs(&argc,&argv);
args(argc,argv);
#else
#pragma message("Not implemented")
// #pragma message("Not implemented")
args(0);
#endif
}
#if FLEXT_SYS == FLEXT_SYS_MAX
template<typename=void> short patcher_myvol(t_patcher *x)
FLEXT_TEMPLATE short patcher_myvol(t_patcher *x)
{
#ifndef MM_UNIFIED // Max5 check... we don't know what to do yet
t_box *w;
if(x->p_vol)
return x->p_vol;
else if((w = (t_box *)x->p_vnewobj) != NULL)
return patcher_myvol(w->b_patcher);
return FLEXT_TEMPINST(patcher_myvol)(w->b_patcher);
else
#endif
return 0;
......@@ -205,7 +205,7 @@ FLEXT_TEMPIMPL(void FLEXT_CLASSDEF(flext_obj))::GetCanvasDir(char *buf,size_t bu
const char *c = GetString(canvas_getdir(thisCanvas()));
strncpy(buf,c,bufsz);
#elif FLEXT_SYS == FLEXT_SYS_MAX
short path = patcher_myvol(thisCanvas());
short path = FLEXT_TEMPINST(patcher_myvol)(thisCanvas());
// \TODO dangerous!! no check for path length (got to be long enough... like 1024 chars)
path_topathname(path,NULL,buf);
#else
......
......@@ -26,8 +26,14 @@ $LastChangedBy$
FLEXT_TEMPIMPL(t_class *FLEXT_CLASSDEF(flext_base))::pxbnd_class = NULL;
#if FLEXT_SYS == FLEXT_SYS_MAX
t_object *px_freelist = NULL;
t_messlist px_messlist[3];
FLEXT_TEMPLATE
struct ProxyVars {
static t_object *px_freelist;
static t_messlist px_messlist[3];
};
FLEXT_TEMPIMPL(t_object *ProxyVars)::px_freelist = NULL;
FLEXT_TEMPIMPL(t_messlist ProxyVars)::px_messlist[3];
#endif
/*! \brief Set up the proxy class for symbol-bound methods
......@@ -43,19 +49,19 @@ FLEXT_TEMPIMPL(void FLEXT_CLASSDEF(flext_base))::SetupBindProxy()
pxbnd_class = new t_class;
pxbnd_class->c_sym = const_cast<t_symbol *>(sym__);
pxbnd_class->c_freelist = &px_freelist;
pxbnd_class->c_freelist = &FLEXT_TEMPINST(ProxyVars)::px_freelist;
pxbnd_class->c_freefun = NULL;
pxbnd_class->c_size = sizeof(pxbnd_object);
pxbnd_class->c_tiny = 0;
pxbnd_class->c_noinlet = 1;
px_messlist[0].m_sym = (t_symbol *)pxbnd_class;
FLEXT_TEMPINST(ProxyVars)::px_messlist[0].m_sym = (t_symbol *)pxbnd_class;
px_messlist[1].m_sym = const_cast<t_symbol *>(sym_anything);
px_messlist[1].m_fun = (method)pxbnd_object::px_method;
px_messlist[1].m_type[0] = A_GIMME;
px_messlist[1].m_type[1] = 0;
FLEXT_TEMPINST(ProxyVars)::px_messlist[1].m_sym = const_cast<t_symbol *>(sym_anything);
FLEXT_TEMPINST(ProxyVars)::px_messlist[1].m_fun = (method)pxbnd_object::px_method;
FLEXT_TEMPINST(ProxyVars)::px_messlist[1].m_type[0] = A_GIMME;
FLEXT_TEMPINST(ProxyVars)::px_messlist[1].m_type[1] = 0;
px_messlist[2].m_sym = 0;
FLEXT_TEMPINST(ProxyVars)::px_messlist[2].m_sym = 0;
#else
#pragma warning("Not implemented!")
#endif
......@@ -130,7 +136,7 @@ FLEXT_TEMPIMPL(bool FLEXT_CLASSDEF(flext_base))::BindMethod(const t_symbol *sym,
#if FLEXT_SYS == FLEXT_SYS_PD
pxbnd_object *px = (pxbnd_object *)object_new(pxbnd_class);
#elif FLEXT_SYS == FLEXT_SYS_MAX
pxbnd_object *px = (pxbnd_object *)newobject(px_messlist);
pxbnd_object *px = (pxbnd_object *)newobject(FLEXT_TEMPINST(ProxyVars)::px_messlist);
#else
#pragma warning("Not implemented!")
#endif
......
......@@ -318,7 +318,7 @@ FLEXT_TEMPIMPL(void FLEXT_CLASSDEF(flext))::buffer::SetRefrIntv(float intv)
}
}
#elif FLEXT_SYS == FLEXT_SYS_MAX
FLEXT_TEMIMPL(void flext)::buffer::SetRefrIntv(float) {}
FLEXT_TEMPIMPL(void FLEXT_CLASSDEF(flext))::buffer::SetRefrIntv(float) {}
#else
#error
#endif
......
......@@ -2,7 +2,7 @@
flext - C++ layer for Max/MSP and pd (pure data) externals
Copyright (c) 2001-2009 Thomas Grill (gr@grrrr.org)
Copyright (c) 2001-2015 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.
......@@ -78,7 +78,7 @@ typedef void t_outlet;
//#define object_new(clss) newobject(clss)
#define object_free(obj) freeobject((object *)(obj))
#define add_dsp(clss,meth) addmess((method)meth,"dsp",A_CANT,A_NOTHING)
#define add_dsp(clss,meth) addmess((method)meth,const_cast<char *>("dsp"),A_CANT,A_NOTHING)
#define add_bang(clss,meth) addbang((method)meth)
#define add_float(clss,meth) addfloat((method)meth)
#define add_floatn(clss,meth,n) addftx((method)meth,n)
......@@ -91,11 +91,11 @@ typedef void t_outlet;
#define add_method3(clss,meth,text,a1,a2,a3) addmess((method)meth, text, a1,a2,a3,A_NOTHING)
#define add_method4(clss,meth,text,a1,a2,a3,a4) addmess((method)meth, text, a1,a2,a3,a4,A_NOTHING)
#define add_method5(clss,meth,text,a1,a2,a3,a5) addmess((method)meth, text, a1,a2,a3,a4,a5,A_NOTHING)
#define add_anything(clss,meth) addmess((method)meth, "anything", A_GIMME,A_NOTHING)
#define add_anything(clss,meth) addmess((method)meth, const_cast<char *>("anything"), A_GIMME,A_NOTHING)
#define add_assist(clss,meth) addmess((method)meth, "assist", A_CANT, A_NULL)
#define add_loadbang(clss,meth) addmess((method)meth, "loadbang", A_CANT, A_NULL)
#define add_dblclick(clss,meth) addmess((method)meth, "dblclick", A_CANT, A_NULL)
#define add_assist(clss,meth) addmess((method)meth, const_cast<char *>("assist"), A_CANT, A_NULL)
#define add_loadbang(clss,meth) addmess((method)meth, const_cast<char *>("loadbang"), A_CANT, A_NULL)
#define add_dblclick(clss,meth) addmess((method)meth, const_cast<char *>("dblclick"), A_CANT, A_NULL)
#define newout_signal(clss) outlet_new(clss,"signal")
#define newout_float(clss) outlet_new(clss,"float")
......
......@@ -197,7 +197,7 @@ FLEXT_TEMPIMPL(bool FLEXT_CLASSDEF(flext_obj))::HasDSPIn() const { return !clss-
FLEXT_TEMPIMPL(bool FLEXT_CLASSDEF(flext_obj))::IsLib() const { return clss->lib != NULL; }
#if FLEXT_SYS == FLEXT_SYS_MAX
bool FLEXT_CLASSDEF(flext_obj)::NeedDSP() const { return clss->dsp || (clss->lib && clss->lib->dsp); }
FLEXT_TEMPIMPL(bool FLEXT_CLASSDEF(flext_obj))::NeedDSP() const { return clss->dsp || (clss->lib && clss->lib->dsp); }
#endif
......
......@@ -224,8 +224,8 @@ FLEXT_TEMPIMPL(void FLEXT_CLASSDEF(flext_base))::SetProxies(t_class *c,bool dsp)
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 distributed over inlets
addmess((method)cb_anything,"anything",A_GIMME,A_NOTHING);
addmess((method)cb_anything,const_cast<char *>("list"),A_GIMME,A_NOTHING); // must be explicitly given, otherwise list elements are distributed over inlets
addmess((method)cb_anything,const_cast<char *>("anything"),A_GIMME,A_NOTHING);
#else
#error Not implemented!
#endif
......
......@@ -479,11 +479,6 @@ public:
//! Symbol constant for "signal"
static const t_symbol *sym_signal;
#if FLEXT_SYS == FLEXT_SYS_MAX
static const t_symbol *sym_buffer;
static const t_symbol *sym_size;
#endif
//! \note This is used in macros where the type of the arg is not clear
static const t_symbol *MakeSymbol(const t_symbol *s) { return s; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment