aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py/source/pyext.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-01-10 05:00:56 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-01-10 05:00:56 +0000
commit4651f8a117cd663ddd77355055b0580cce636da3 (patch)
tree155faf09847ac1a0c5d10f131053946ffcd0a8ab /externals/grill/py/source/pyext.cpp
parent97492d5628f603856df9a3dd2abd55d33918dc4f (diff)
closed multi-interpreter branch (no chance to have several interpreters in the same thread!)
other thread-related cleanups py: added ability to choose function from message tag enabled int-tags for pyext class methods svn path=/trunk/; revision=2487
Diffstat (limited to 'externals/grill/py/source/pyext.cpp')
-rw-r--r--externals/grill/py/source/pyext.cpp56
1 files changed, 35 insertions, 21 deletions
diff --git a/externals/grill/py/source/pyext.cpp b/externals/grill/py/source/pyext.cpp
index f0fc25ba..fed6c89e 100644
--- a/externals/grill/py/source/pyext.cpp
+++ b/externals/grill/py/source/pyext.cpp
@@ -99,20 +99,6 @@ void pyext::SetThis()
}
-#if FLEXT_SYS == FLEXT_SYS_MAX
-static short patcher_myvol(t_patcher *x)
-{
- t_box *w;
- if (x->p_vol)
- return x->p_vol;
- else if (w = (t_box *)x->p_vnewobj)
- return patcher_myvol(w->b_patcher);
- else
- return 0;
-}
-#endif
-
-
PyObject *pyext::class_obj = NULL;
PyObject *pyext::class_dict = NULL;
@@ -509,14 +495,29 @@ bool pyext::work(int n,const t_symbol *s,int argc,const t_atom *argv)
// should be enough...
char str[256];
- {
- // try tag/inlet
+ bool isfloat = s == sym_float && argc == 1;
+
+ // if float equals an integer, try int_* method
+ if(isfloat && GetAFloat(argv[0]) == GetAInt(argv[0])) {
+ sprintf(str,"int_%i",n);
+ ret = call(str,0,NULL,1,argv);
+ }
+
+ // try tag/inlet
+ if(!ret) {
sprintf(str,"%s_%i",GetString(s),n);
ret = call(str,0,NULL,argc,argv);
}
- if(!ret) {
- // try anything/inlet
+ // try truncated int
+ if(!ret && isfloat) {
+ t_atom at; SetInt(at,GetAInt(argv[0]));
+ sprintf(str,"int_%i",n);
+ ret = call(str,0,NULL,1,&at);
+ }
+
+ // try anything/inlet
+ if(!ret) {
sprintf(str,"_anything_%i",n);
if(s == sym_bang && !argc) {
t_atom argv;
@@ -526,12 +527,25 @@ bool pyext::work(int n,const t_symbol *s,int argc,const t_atom *argv)
else
ret = call(str,0,s,argc,argv);
}
- if(!ret) {
- // try tag at any inlet
+
+ // try int at any inlet
+ if(!ret && isfloat && GetAFloat(argv[0]) == GetAInt(argv[0])) {
+ ret = call("int_",0,NULL,1,argv);
+ }
+
+ // try tag at any inlet
+ if(!ret) {
sprintf(str,"%s_",GetString(s));
ret = call(str,n,NULL,argc,argv);
}
- if(!ret) {
+
+ // try truncated int at any inlet
+ if(!ret && isfloat) {
+ t_atom at; SetInt(at,GetAInt(argv[0]));
+ ret = call("int_",0,NULL,1,&at);
+ }
+
+ if(!ret) {
// try anything at any inlet
const char *str1 = "_anything_";
if(s == sym_bang && !argc) {