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

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Apr 18 23:22:01 EDT 2008


Author: matju
Date: Fri Apr 18 23:22:00 2008
New Revision: 3635

Log:
move GridInlet creation to gridflow.h

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 18 23:22:00 2008
@@ -266,17 +266,11 @@
 		else raise 'BORK BORK BORK' end
 		ks = k.map{|ke| if ke==0 then 0 else cli end}.join(",")
 		Out.print "static GridHandler #{cl}_grid_#{i}_hand = GRIN(#{ks});"
-		handle_def "#{i} grid(void *foo) {"+
-			"if (in.size()<=#{i}) in.resize(#{i}+1);"+
-			"if (!in[#{i}]) in[#{i}]=new GridInlet((GridObject *)this,&#{cl}_grid_#{i}_hand);"+
+		handle_def "#{i} grid(void *foo) {CHECK_GRIN(#{cl},#{i});"+
 			"in[#{i}]->begin(argc,argv);}"
-		handle_def "#{i} list(...) {"+
-			"if (in.size()<=#{i}) in.resize(#{i}+1);"+
-			"if (!in[#{i}]) in[#{i}]=new GridInlet((GridObject *)this,&#{cl}_grid_#{i}_hand);"+
+		handle_def "#{i} list(...) {CHECK_GRIN(#{cl},#{i});"+
 			"in[#{i}]->from_list(argc,argv,int32_e);}" if not frame.methods["_#{i}_list"].done
-		handle_def "#{i} float(float f) {"+
-			"if (in.size()<=#{i}) in.resize(#{i}+1);"+
-			"if (!in[#{i}]) in[#{i}]=new GridInlet((GridObject *)this,&#{cl}_grid_#{i}_hand);"+
+		handle_def "#{i} float(float f) {CHECK_GRIN(#{cl},#{i});"+
 			"t_atom2 a[1]; SETFLOAT(a,f);"+
 			"in[#{i}]->from_atom(1,a);}" if not frame.methods["_#{i}_float"].done
 	}

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Fri Apr 18 23:22:00 2008
@@ -808,6 +808,10 @@
 
 //****************************************************************
 
+#define CHECK_GRIN(class,i) \
+	if (in.size()<=i) in.resize(i+1); \
+	if (!in[i]) in[i]=new GridInlet((GridObject *)this,&class##_grid_##i##_hand);
+
 struct BFProxy;
 struct BFObject : t_object {
 #ifdef HAVE_GEM
@@ -840,8 +844,7 @@
 	GridObject(MESSAGE) : FObject(MESSAGE2) {}
 	~GridObject() {}
 	bool is_busy_except(P<GridInlet> gin) {
-		for (uint32 i=0; i<in.size(); i++)
-			if (in[i] && in[i]!=gin && in[i]->dim) return true;
+		for (uint32 i=0; i<in.size(); i++) if (in[i] && in[i]!=gin && in[i]->dim) return true;
 		return false;
 	}
 };



More information about the Gridflow-cvs mailing list