Commit a2042280 authored by thomas's avatar thomas
Browse files

no message


git-svn-id: https://svn.grrrr.org/ext/trunk@89 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent d412fa28
No preview for this file type
......@@ -10,7 +10,6 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <flext.h>
#include <stdarg.h>
#include <assert.h>
// === proxy class for flext_base ============================
......@@ -456,7 +455,9 @@ BL flext_base::m_methodmain(I inlet,const t_symbol *s,I argc,t_atom *argv)
if(!m) break;
if(m->tag == sym_anything && m->argc == 1 && m->args[0] == a_gimme) {
// any
// ((methfun_A)m->fun)(this,s,argc,argv);
LOG4("found any method for %s: inlet=%i, symbol=%s, argc=%i",m->tag->s_name,inlet,s->s_name,argc);
((methfun_A)m->fun)(this,s,argc,argv);
ret = true;
}
else
......@@ -465,7 +466,7 @@ BL flext_base::m_methodmain(I inlet,const t_symbol *s,I argc,t_atom *argv)
LOG4("found method tag %s: inlet=%i, symbol=%s, argc=%i",m->tag->s_name,inlet,s->s_name,argc);
if(m->argc == 1 && m->args[0] == a_gimme) {
// ((methfun_G)m->fun)(this,argc,argv);
((methfun_G)m->fun)(this,argc,argv);
ret = true;
}
else if(argc == m->argc) {
......@@ -474,21 +475,21 @@ BL flext_base::m_methodmain(I inlet,const t_symbol *s,I argc,t_atom *argv)
for(ix = 0; ix < argc && ok; ++ix) {
switch(m->args[ix]) {
case a_float: {
assert(sizeof(F) == sizeof(I));
ASSERT(sizeof(F) == sizeof(I));
F a;
if(ISFLOAT(argv[ix])) iargs[ix] = *(I *)&(a = argv[ix].a_w.w_float);
if(ISFLOAT(argv[ix])) iargs[ix] = *(I *)&(a = GETFLOAT(argv[ix]));
#ifdef MAXMSP
else if(ISINT(argv[ix])) iargs[ix] = *(I *)&(a = argv[ix].a_w.w_int);
else if(ISINT(argv[ix])) iargs[ix] = *(I *)&(a = GETINT(argv[ix]));
#endif
else ok = false;
break;
}
case a_int: {
I a;
if(ISFLOAT(argv[ix])) iargs[ix] = *(I *)&(a = argv[ix].a_w.w_float);
if(ISFLOAT(argv[ix])) iargs[ix] = *(I *)&(a = GETFLOAT(argv[ix]));
#ifdef MAXMSP
else if(ISINT(argv[ix])) iargs[ix] = *(I *)&(a = argv[ix].a_w.w_int);
else if(ISINT(argv[ix])) iargs[ix] = *(I *)&(a = GETINT(argv[ix]));
#endif
else ok = false;
break;
......@@ -505,19 +506,19 @@ BL flext_base::m_methodmain(I inlet,const t_symbol *s,I argc,t_atom *argv)
}
*/
case a_symbol: {
assert(sizeof(t_symbol *) == sizeof(I));
ASSERT(sizeof(t_symbol *) == sizeof(I));
t_symbol *a;
if(ISSYMBOL(argv[ix])) iargs[ix] = *(I *)&(a = argv[ix].a_w.w_symbol);
if(ISSYMBOL(argv[ix])) iargs[ix] = *(I *)&(a = GETSYMBOL(argv[ix]));
else ok = false;
break;
}
#ifdef PD
case a_pointer: {
assert(sizeof(t_gpointer *) == sizeof(I));
ASSERT(sizeof(t_gpointer *) == sizeof(I));
t_gpointer *a;
if(ISPOINTER(argv[ix])) iargs[ix] = *(I *)&(a = argv[ix].a_w.w_gpointer);
if(ISPOINTER(argv[ix])) iargs[ix] = *(I *)&(a = GETPOINTER(argv[ix]));
else ok = false;
break;
}
......@@ -527,7 +528,7 @@ BL flext_base::m_methodmain(I inlet,const t_symbol *s,I argc,t_atom *argv)
ok = false;
}
}
/*
if(ix == argc) {
switch(argc) {
case 0: ((methfun_0)m->fun)(this); break;
......@@ -539,7 +540,6 @@ BL flext_base::m_methodmain(I inlet,const t_symbol *s,I argc,t_atom *argv)
}
ret = true;
}
*/
}
}
if(it == mlst.end()) break;
......
......@@ -183,6 +183,9 @@ public:
V add_meth(I inlet,V (*m)(flext_base *,F)) { add_meth_one(inlet,"float",(methfun)m,a_float,a_null); } // single float
V add_meth(I inlet,V (*m)(flext_base *,F,F)) { add_meth_one(inlet,"list",(methfun)m,a_float,a_float,a_null); } // list of 2 floats
V add_meth(I inlet,V (*m)(flext_base *,F,F,F)) { add_meth_one(inlet,"list",(methfun)m,a_float,a_float,a_float,a_null); } // list of 3 floats
V add_meth(I inlet,V (*m)(flext_base *,I)) { add_meth_one(inlet,"int",(methfun)m,a_int,a_null); } // single float
V add_meth(I inlet,V (*m)(flext_base *,I,I)) { add_meth_one(inlet,"list",(methfun)m,a_int,a_int,a_null); } // list of 2 floats
V add_meth(I inlet,V (*m)(flext_base *,I,I,I)) { add_meth_one(inlet,"list",(methfun)m,a_int,a_int,a_int,a_null); } // list of 3 floats
V add_meth(I inlet,const C *tag,V (*m)(flext_base *,I argc,t_atom *argv)) { add_meth_one(inlet,tag,(methfun)m,a_gimme,a_null); } // method+gimme
// V add_meth(I inlet,const C *tag,V (*m)(flext_base *,BL b)) { add_meth_one(inlet,tag,(methfun)m,a_bool,a_gimme,a_null); } // method+boolean
V add_meth(I inlet,const C *tag,V (*m)(flext_base *,I i)) { add_meth_one(inlet,tag,(methfun)m,a_int,a_gimme,a_null); } // method+int
......
......@@ -129,7 +129,6 @@ typedef int t_atomtype;
#define atom_getflintarg atom_getintarg
#define atom_getsymbolarg atom_getsymarg
#define SETFLINT(atom,value) SETINT(atom,(int)(value))
#define ISINT(atom) ((atom).a_type == A_INT)
#define ISFLINT(atom) ISINT(atom)
#define add_dsp(clss,meth) addmess((method)meth,"dsp",A_CANT,A_NOTHING)
......@@ -175,9 +174,19 @@ extern const t_symbol *const sym_anything;
typedef t_symbol *t_symtype;
#define ISFLOAT(atom) ((atom).a_type == A_FLOAT)
#define GETFLOAT(atom) (atom.a_w.w_float)
#define ISSYMBOL(atom) ((atom).a_type == A_SYMBOL)
#define GETSYMBOL(atom) (atom.a_w.w_symbol)
#ifdef PD
#define ISPOINTER(atom) ((atom).a_type == A_POINTER)
#define GETPOINTER(atom) (atom.a_w.w_gpointer)
#endif
#ifdef MAXMSP
#define ISINT(atom) ((atom).a_type == A_INT)
#define GETINT(atom) (atom.a_w.w_long)
#endif
#ifdef _LOG
#define LOG(s) post(s)
......@@ -186,6 +195,7 @@ typedef t_symbol *t_symtype;
#define LOG3(s,v1,v2,v3) post(s,v1,v2,v3)
#define LOG4(s,v1,v2,v3,v4) post(s,v1,v2,v3,v4)
#define LOG5(s,v1,v2,v3,v4,v5) post(s,v1,v2,v3,v4,v5)
#define ASSERT(b) ((void)(!(b)?(error("Assertion failed: " #b " - in " __FILE__ " line %i",(I)__LINE__),0):0))
#else
#define LOG(s) ((void)0)
#define LOG1(s,v1) ((void)0)
......@@ -193,6 +203,7 @@ typedef t_symbol *t_symtype;
#define LOG3(s,v1,v2,v3) ((void)0)
#define LOG4(s,v1,v2,v3,v4) ((void)0)
#define LOG5(s,v1,v2,v3,v4,v5) ((void)0)
#define ASSERT(b) ((void)0)
#endif
......
Supports Markdown
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