[Gridflow-cvs] [svn] commit: r3647 - /trunk/gridflow.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Apr 25 11:32:43 EDT 2008


Author: matju
Date: Fri Apr 25 11:32:43 2008
New Revision: 3647

Log:
better "method not found" messages

Modified:
    trunk/gridflow.c

Modified: trunk/gridflow.c
==============================================================================
--- trunk/gridflow.c (original)
+++ trunk/gridflow.c Fri Apr 25 11:32:43 2008
@@ -491,6 +491,10 @@
 
 /* **************************************************************** */
 
+#undef pd_class
+#define pd_class(x) (*(t_pd *)x)
+#define pd_classname(x) (fclasses_pd[pd_class(x)]->name.data())
+
 static RMethod funcall_lookup (BFObject *bself, const char *sel) {
 	FClass *fclass = fclasses_pd[*(t_class **)bself];
 	int n = fclass->methodsn;
@@ -503,7 +507,7 @@
 static void funcall (BFObject *bself, const char *sel, int argc, t_atom *argv, bool silent=false) {
 	RMethod method = funcall_lookup(bself,sel);
 	if (method) {method(bself->self,argc,(t_atom2 *)argv); return;}
-	if (!silent) pd_error((t_pd *)bself, "method not found: '%s'",sel);
+	if (!silent) pd_error((t_pd *)bself, "method '%s' not found in class '%s'",sel,pd_classname(bself));
 }
 
 static void funcall_rescue(BFObject *bself, const char *sel, int argc, t_atom *argv) {
@@ -535,10 +539,10 @@
 		sprintf(buf,"_%d_%s",winlet,selector->s_name);
 		if (funcall_lookup(bself,buf)) {
 			funcall_rescue(bself,buf,argc,argv+1);
-		} else {
+		} else if (funcall_lookup(bself,buf)) {
 			SETSYMBOL(argv+0,gensym(buf));
 			funcall_rescue(bself,"anything",argc+1,argv);
-		}
+		} else pd_error((t_pd *)bself, "method '%s' not found in class '%s'",selector->s_name,pd_classname(bself));
 	}
     } catch (Barf *oozy) {pd_error(bself,"%s",oozy->text);}
 }



More information about the Gridflow-cvs mailing list