[Gridflow-cvs] [svn] commit: r3654 - in /trunk: base/source_filter.rb gridflow.c gridflow.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Apr 25 14:10:57 EDT 2008


Author: matju
Date: Fri Apr 25 14:10:57 2008
New Revision: 3654

Log:
rename RMethod to Method; remove funcall_rescue

Modified:
    trunk/base/source_filter.rb
    trunk/gridflow.c
    trunk/gridflow.h

Modified: trunk/base/source_filter.rb
==============================================================================
--- trunk/base/source_filter.rb (original)
+++ trunk/base/source_filter.rb Fri Apr 25 14:10:57 2008
@@ -209,7 +209,7 @@
 	Out.print "static void #{cl}_startup (FClass *fclass);"
 	Out.print "static void *#{cl}_allocator (MESSAGE) {return new #{cl}(sel,argc,argv);}"
 	Out.print "static MethodDecl #{cl}_methods[] = {"
-	Out.print frame.methods.map {|foo,method| "{ \"#{method.selector}\",(RMethod)#{frame.name}::#{method.selector}_wrap }" }.join(",")
+	Out.print frame.methods.map {|foo,method| "{ \"#{method.selector}\",(Method)#{frame.name}::#{method.selector}_wrap }" }.join(",")
 	Out.print "}; static FClass ci#{cl} = { #{cl}_allocator, #{cl}_startup,"
 	Out.print "#{cl.inspect}, COUNT(#{cl}_methods), #{cl}_methods };"
 	get="void ___get(t_symbol *s=0) {t_atom a[1];"

Modified: trunk/gridflow.c
==============================================================================
--- trunk/gridflow.c (original)
+++ trunk/gridflow.c Fri Apr 25 14:10:57 2008
@@ -495,23 +495,22 @@
 #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];
+static Method funcall_lookup (FClass *fclass, const char *sel) {
 	int n = fclass->methodsn;
 	for (int i=0; i<n; i++) if (strcmp(fclass->methods[i].selector,sel)==0) return fclass->methods[i].method;
+	if (fclass->super) return funcall_lookup(fclass->super,sel);
 	return 0;
 }
+static Method funcall_lookup (BFObject *bself, const char *sel) {
+	return funcall_lookup(fclasses_pd[pd_class(bself)],sel);
+}
 
 void call_super(int argc, t_atom *argv) {/* unimplemented */}
 
 static void funcall (BFObject *bself, const char *sel, int argc, t_atom *argv, bool silent=false) {
-	RMethod method = funcall_lookup(bself,sel);
+	Method method = funcall_lookup(bself,sel);
 	if (method) {method(bself->self,argc,(t_atom2 *)argv); return;}
 	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) {
-	try {funcall(bself,sel,argc,argv);} catch (Barf *oozy) {pd_error(bself,"%s",oozy->text);}
 }
 
 //****************************************************************
@@ -534,14 +533,14 @@
 	char buf[256];
 	sprintf(buf,"_n_%s",selector->s_name);
 	if (funcall_lookup(bself,buf)) {
-		funcall_rescue(bself,buf,argc+1,argv);
+		funcall(bself,buf,argc+1,argv);
 	} else {
 		sprintf(buf,"_%d_%s",winlet,selector->s_name);
 		if (funcall_lookup(bself,buf)) {
-			funcall_rescue(bself,buf,argc,argv+1);
+			funcall(bself,buf,argc,argv+1);
 		} else if (funcall_lookup(bself,"anything")) {
 			SETSYMBOL(argv+0,gensym(buf));
-			funcall_rescue(bself,"anything",argc+1,argv);
+			funcall(bself,"anything",argc+1,argv);
 		} else pd_error((t_pd *)bself, "method '%s' not found for inlet %d in class '%s'",selector->s_name,winlet,pd_classname(bself));
 	}
     } catch (Barf *oozy) {pd_error(bself,"%s",oozy->text);}
@@ -610,8 +609,6 @@
 }
 
 //****************************************************************
-
-\class FObject
 
 // from pd/src/g_canvas.c
 struct _canvasenvironment {
@@ -760,6 +757,11 @@
 	return j;
 }
 
+\class FObject
+
+\def 0 get (t_symbol *s=0) {RAISE("AAAAAAAAAAAAAAAAAAAAAAAAAAA");}
+
+
 \classinfo {}
 \end class
 
@@ -803,6 +805,7 @@
 BUILTIN_SYMBOLS(FOO)
 #undef FOO
 	startup_number();
+	\startall
 	startup_flow_objects();
 	startup_format();
 	STARTUP_LIST()

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Fri Apr 25 14:10:57 2008
@@ -208,7 +208,7 @@
 
 struct FObject;
 struct t_atom2;
-typedef void (*RMethod)(FObject *, int, t_atom2 *);
+typedef void (*Method)(FObject *, int, t_atom2 *);
 typedef std::string string;
 
 #define BUILTIN_SYMBOLS(MACRO) \
@@ -332,7 +332,7 @@
 };
 
 // you shouldn't use MethodDecl directly (used by source_filter.rb)
-struct MethodDecl {const char *selector; RMethod method;};
+struct MethodDecl {const char *selector; Method method;};
 
 #undef check
 
@@ -835,7 +835,7 @@
 };
 
 // represents objects that have inlets/outlets
-struct FObject : CObject {
+\class FObject : CObject {
 	BFObject *bself; // point to PD peer
 	std::vector<P<GridInlet> > in;
 	P<GridOutlet> out;
@@ -849,7 +849,9 @@
 		for (uint32 i=0; i<in.size(); i++) if (in[i] && in[i]!=gin && in[i]->dim) return true;
 		return false;
 	}
-};
+	\decl 0 get (t_symbol *s=0);
+};
+\end class
 
 uint64 gf_timeofday();
 extern "C" void Init_gridflow ();



More information about the Gridflow-cvs mailing list