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

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Apr 25 13:35:50 EDT 2008


Author: matju
Date: Fri Apr 25 13:35:49 2008
New Revision: 3652

Log:
add struct AttrDecl and bring back part of \attr

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

Modified: trunk/base/source_filter.rb
==============================================================================
--- trunk/base/source_filter.rb (original)
+++ trunk/base/source_filter.rb Fri Apr 25 13:35:49 2008
@@ -212,7 +212,7 @@
 	Out.print frame.methods.map {|foo,method| "{ \"#{method.selector}\",(RMethod)#{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) {t_atom a[1];"
+	get="void ___get(t_symbol *s=0) {t_atom a[1];"
 	frame.attrs.each {|name,attr|
 		virtual = if attr.virtual then "(0,0)" else "" end
 		get << "if (s==gensym(\"#{name})\")) set_atom(a,#{name}#{virtual}); else "
@@ -230,7 +230,9 @@
 	get << "RAISE(\"unknown attr %s\",s->s_name); outlet_anything(bself->outlets[bself->noutlets-1],s,1,a);}"
 	handle_def get if frame.attrs.size>0
 	# "IEVAL(rself,\"#{startup2}\");" # this means no support for attributes for a while.
-	Out.print "void #{frame.name}_startup (FClass *fclass) {"+line.chomp
+	Out.print "void #{frame.name}_startup (FClass *fclass) {"
+	frame.attrs.each {|name,attr| Out.print "fclass->attrs[\"#{name}\"] = new AttrDecl(\"#{name}\",\"#{attr.type}\");" }
+	Out.print line.chomp
 end
 
 def handle_grin(line)

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Fri Apr 25 13:35:49 2008
@@ -741,6 +741,11 @@
 #endif // HAVE_LITE
 #define MESSAGE t_symbol *sel, int argc, t_atom2 *argv
 #define MESSAGE2 sel,argc,argv
+struct AttrDecl {
+	string name;
+	string type;
+	AttrDecl(string name_, string type_) {name=name_; type=type_;}
+};
 struct FClass {
 	void *(*allocator)(MESSAGE); // returns a new C++ object
 	void (*startup)(FClass *);
@@ -752,6 +757,7 @@
 	t_class *bfclass;
 	string name;
 	size_t bytes;
+	std::map<string,AttrDecl *> attrs;
 };
 
 void fclass_install(FClass *fc, const char *super, size_t bytes);



More information about the Gridflow-cvs mailing list