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

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Fri Jul 18 12:44:51 EDT 2008


Author: matju
Date: Fri Jul 18 12:44:51 2008
New Revision: 4050

Log:
pass in->dex as just dex in GridHandler

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

Modified: trunk/base/grid.c
==============================================================================
--- trunk/base/grid.c (original)
+++ trunk/base/grid.c Fri Jul 18 12:44:51 2008
@@ -117,7 +117,7 @@
 	dex=0;
 	buf=0;
 	try {
-#define FOO(T) gh->flow(this,-1,(T *)0); break;
+#define FOO(T) gh->flow(this,dex,-1,(T *)0); break;
 		TYPESWITCH(sender->nt,FOO,)
 #undef FOO
 	} catch (Barf &barf) {this->dim=0; throw;}
@@ -149,7 +149,7 @@
 		if (bufi==bufn) {
 			long newdex = dex+bufn;
 			CHECK_ALIGN(bufd,sender->nt);
-			try {gh->flow(this,bufn,bufd);} CATCH_IT;
+			try {gh->flow(this,dex,bufn,bufd);} CATCH_IT;
 			dex = newdex;
 			bufi = 0;
 		}
@@ -157,7 +157,7 @@
 	int m = (n/bufn)*bufn;
 	if (m) {
 		int newdex = dex + m;
-		try {gh->flow(this,m,data);} CATCH_IT;
+		try {gh->flow(this,dex,m,data);} CATCH_IT;
 		dex = newdex;
 	}
 	data += m;
@@ -168,7 +168,7 @@
 void GridInlet::finish() {
 	if (!dim) RAISE("inlet not busy");
 	if (dim->prod() != dex) post("%s: incomplete grid: %d of %d from [%s] to [%s]",ARGS(parent),dex,dim->prod(),ARGS(sender->parent));
-#define FOO(T) try {gh->flow(this,-2,(T *)0);} CATCH_IT;
+#define FOO(T) try {gh->flow(this,dex,-2,(T *)0);} CATCH_IT;
 	TYPESWITCH(sender->nt,FOO,)
 #undef FOO
 	dim=0; buf=0; dex=0;

Modified: trunk/base/source_filter.rb
==============================================================================
--- trunk/base/source_filter.rb (original)
+++ trunk/base/source_filter.rb Fri Jul 18 12:44:51 2008
@@ -241,8 +241,8 @@
 	i = fields[0].to_i
 	c = $stack[-1].name
 	frame = $stack[-1]
-	Out.print "template <class T> void grin_#{i}(GridInlet *in, long n, T *data);"
-	Out.print "template <class T> static void grinw_#{i} (GridInlet *in, long n, T *data);"
+	Out.print "template <class T> void grin_#{i}(GRIDHANDLER_ARGS(T));"
+	Out.print "template <class T> static void grinw_#{i} (GRIDHANDLER_ARGS(T));"
 	Out.print "static GridHandler grid_#{i}_hand;"
 	handle_decl "#{i} grid(GridOutlet *foo);"
 	handle_decl "#{i} list(...);"

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Fri Jul 18 12:44:51 2008
@@ -677,13 +677,14 @@
 //****************************************************************
 // GridInlet represents a grid-aware inlet
 
+#define GRIDHANDLER_ARGS(T) GridInlet *in, long dex, long n, T *data
+
 // four-part macro for defining the behaviour of a gridinlet in a class
 // C:Class I:Inlet
 #define GRID_INLET(I) \
-	template <class T> void THISCLASS::grinw_##I (GridInlet *in, long n, T *data) { \
-		((THISCLASS*)in->parent)->grin_##I(in,n,data);} \
-	template <class T> void THISCLASS::grin_##I (GridInlet *in, long n, T *data) { \
-	if (n==-1)
+	template <class T> void THISCLASS::grinw_##I (GRIDHANDLER_ARGS(T)) {\
+		((THISCLASS*)in->parent)->grin_##I(in,dex,n,data);}\
+	template <class T> void THISCLASS::grin_##I  (GRIDHANDLER_ARGS(T)) {if (n==-1)
 #define GRID_FLOW   else if (n>=0)
 #define GRID_FINISH else if (n==-2)
 #define GRID_END }
@@ -700,9 +701,8 @@
 
 typedef struct GridInlet GridInlet;
 typedef struct GridHandler {
-#define FOO(T) \
-	void (*flow_##T)(GridInlet *in, long n, T *data); \
-	void flow(GridInlet *in, long n, T *data) const {flow_##T(in,n,data);}
+#define FOO(T) void (*flow_##T)(GRIDHANDLER_ARGS(T)); \
+	       void   flow     (GRIDHANDLER_ARGS(T)) const {flow_##T(in,dex,n,data);}
 EACH_NUMBER_TYPE(FOO)
 #undef FOO
 } GridHandler;
@@ -713,7 +713,7 @@
 	const GridHandler *gh;
 	GridOutlet *sender;
 	P<Dim> dim;
-	NumberTypeE nt;
+	NumberTypeE nt; // kill this
 	long dex;
 	int chunk;
 	PtrGrid buf;// factor-chunk buffer



More information about the Gridflow-cvs mailing list