[Gridflow-cvs] [svn] commit: r3659 - in /trunk: gridflow.c gridflow.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Apr 25 17:15:31 EDT 2008


Author: matju
Date: Fri Apr 25 17:15:29 2008
New Revision: 3659

Log:
the "help" method is back, and the "get" method is on its way

Modified:
    trunk/gridflow.c
    trunk/gridflow.h

Modified: trunk/gridflow.c
==============================================================================
--- trunk/gridflow.c (original)
+++ trunk/gridflow.c Fri Apr 25 17:15:29 2008
@@ -743,11 +743,33 @@
 	return j;
 }
 
+// foreach macro from desiredata:
+#define foreach(ITER,COLL) for(typeof(COLL.begin()) ITER = COLL.begin(); ITER != (COLL).end(); ITER++)
+
 \class FObject
-
-\def 0 get (t_symbol *s=0) {RAISE("AAAAAAAAAAAAAAAAAAAAAAAAAAA");}
-
-
+\def 0 get (t_symbol *s=0) {
+	FClass *fc = fclasses_pd[pd_class(bself)];
+	if (!s) {
+		t_atom a[1];
+		foreach(attr,fc->attrs) {
+			SETSYMBOL(a,gensym((char *)attr->second->name.data()));
+			pd_typedmess((t_pd *)bself,gensym("get"),1,a);
+		}
+	} else {
+		//t_atom a[1];
+		//outlet_anything(bself->outlets[bself->noutlets-1],s,1,a);
+		Method m = funcall_lookup(bself,"___get");
+		t_atom2 a[1];
+		SETSYMBOL(a,s);
+		if (m) m(this,1,a);
+	}
+}
+\def 0 help () {
+	FClass *fc = fclasses_pd[pd_class(bself)];
+	post("attributes {");
+	foreach(attr,fc->attrs) post("    %s %s;",attr->second->type.data(),attr->second->name.data());
+	post("}");
+}
 \classinfo {}
 \end class
 

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Fri Apr 25 17:15:29 2008
@@ -853,6 +853,7 @@
 		return false;
 	}
 	\decl 0 get (t_symbol *s=0);
+	\decl 0 help ();
 };
 \end class
 



More information about the Gridflow-cvs mailing list