[Gridflow-cvs] [svn] commit: r5676 - in /trunk/src: aalib.cxx classes1.cxx classes2.cxx classes3.cxx gem.cxx grid.cxx gridflow.hxx sdl.cxx x11.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Wed May 12 21:30:28 EDT 2010


Author: matju
Date: Wed May 12 21:30:27 2010
New Revision: 5676

Log:
remove dex from GRID_FLOW blocks (replace by in.dex)

Modified:
    trunk/src/aalib.cxx
    trunk/src/classes1.cxx
    trunk/src/classes2.cxx
    trunk/src/classes3.cxx
    trunk/src/gem.cxx
    trunk/src/grid.cxx
    trunk/src/gridflow.hxx
    trunk/src/sdl.cxx
    trunk/src/x11.cxx

Modified: trunk/src/aalib.cxx
==============================================================================
--- trunk/src/aalib.cxx (original)
+++ trunk/src/aalib.cxx Wed May 12 21:30:27 2010
@@ -78,7 +78,7 @@
 	int f = in.dim.prod(1);
 	if (raw_mode) {
 		int sx = min(f,aa_scrwidth(context));
-		int y = dex/f;
+		int y = in.dex/f;
 		while (n) {
 			if (y>=aa_scrheight(context)) return;
 			for (int x=0; x<sx; x++) {
@@ -91,7 +91,7 @@
 		}
 	} else {
 		int sx = min(f,context->imgwidth);
-		int y = dex/f;
+		int y = in.dex/f;
 		while (n) {
 			if (y>=context->imgheight) return;
 			for (int x=0; x<sx; x++) aa_putpixel(context,x,y,data[x]);

Modified: trunk/src/classes1.cxx
==============================================================================
--- trunk/src/classes1.cxx (original)
+++ trunk/src/classes1.cxx Wed May 12 21:30:27 2010
@@ -510,7 +510,7 @@
 	cs = in.dim.prod(chunk);
 } GRID_FLOW {
 	if (!put_at) { // reassign
-		COPY(((T *)*(r.next ? r.next.p : &*r.p))+dex, data, n);
+		COPY(((T *)*(r.next ? r.next.p : &*r.p))+in.dex, data, n);
 		return;
 	}
 	// put_at (...)
@@ -573,7 +573,7 @@
 		T tada[pn];
 		COPY(tada,data,pn);
 		if (loop>1) {
-			if (dex+pn <= loop) op->zip(pn/op->size,tada,rdata+out->dex); else {
+			if (in.dex+pn <= loop) op->zip(pn/op->size,tada,rdata+out->dex); else {
 				// !@#$ should prebuild and reuse this array when "loop" is small
 				T data2[pn];
 				long ii = mod(out->dex,loop);
@@ -985,7 +985,7 @@
 	if (a<b) temp=new Grid(Dim(a),in.nt);
 	out=new GridOutlet(this,0,dim,in.nt);
 } GRID_FLOW {
-	long i = dex;
+	long i = in.dex;
 	if (!temp) {long n2 = min(n,   dim.prod()-i);                             if (n2>0) out->send(n2,data);}
 	else       {long n2 = min(n,in.dim.prod()-i); COPY((T *)*temp+i,data,n2); if (n2>0) out->send(n2,data);}
 } GRID_FINISH {

Modified: trunk/src/classes2.cxx
==============================================================================
--- trunk/src/classes2.cxx (original)
+++ trunk/src/classes2.cxx Wed May 12 21:30:27 2010
@@ -738,7 +738,7 @@
 	in.set_chunk(0);
 	buf=new Grid(in.dim,NumberTypeE_type_of(data));
 } GRID_FLOW {
-	COPY((T *)*buf+dex,data,n);
+	COPY((T *)*buf+in.dex,data,n);
 	changed();
 } GRID_END
 \end class {
@@ -1114,7 +1114,6 @@
 }
 \end class {install("gf.error",1,0);}
 
-//****************************************************************
 \class ForEach : FObject {
 	\constructor () {}
 	\decl 0 list (...) {for (int i=0; i<argc; i++) outlet_atom(outlets[0],&argv[i]);}

Modified: trunk/src/classes3.cxx
==============================================================================
--- trunk/src/classes3.cxx (original)
+++ trunk/src/classes3.cxx Wed May 12 21:30:27 2010
@@ -123,7 +123,7 @@
 	if (w<0) w+=in.dim.n;
 	long a = in.dim.prod(w);
 	long b = r->dim.prod(w);
-	T *data2 = (T *)*r + dex*b/a;
+	T *data2 = (T *)*r + in.dex*b/a;
 	if (a==3 && b==1) {
 		int m = n+n*b/a;
 		T data3[m];
@@ -645,7 +645,7 @@
 	if (!wrap) {v[0]-=db[0]-1; v[1]-=db[1]-1;}
 	out=new GridOutlet(this,0,Dim(da.n,v),in.nt);
 } GRID_FLOW {
-	COPY((T *)*a+dex, data, n);
+	COPY((T *)*a+in.dex, data, n);
 } GRID_FINISH {
 	make_plan((T)0);
 	long dbx = b->dim[1];
@@ -776,7 +776,7 @@
 	int rowsize2 = temp->dim.prod(1);
 	T *buf = (T *)*temp; //!@#$ maybe should be something else than T ?
 	int xinc = in.dim[2]*scalex;
-	int y = dex / rowsize;
+	int y = in.dex / rowsize;
 	int chans=in.dim[2];
 	#define Z(z) buf[p+z]+=data[i+z]
 	if (smoothly) {
@@ -843,7 +843,7 @@
 	in.set_chunk(2);
 	out=new GridOutlet(this,0,r->dim);
 } GRID_FLOW {
-	T *rr = ((T *)*r) + dex*3/4;
+	T *rr = ((T *)*r) + in.dex*3/4;
 	T foo[n*3/4];
 #define COMPUTE_ALPHA(c,a) \
 	foo[j+c] = (data[i+c]*data[i+a] + rr[j+c]*(256-data[i+a])) >> 8
@@ -949,7 +949,7 @@
 	int nl = lines->dim[0];
 	Line *ld = (Line *)(int32 *)*lines;
 	int f = in.dim.prod(1);
-	int y = dex/f;
+	int y = in.dex/f;
 	int cn = color->dim.prod();
 	T *cd = (T *)*color2;
 	while (n) {
@@ -1099,7 +1099,7 @@
 	in.set_chunk(1);
 } GRID_FLOW {
 	int f = in.dim.prod(1);
-	int y = dex/f;
+	int y = in.dex/f;
 	if (position->nt != int32_e) RAISE("position has to be int32");
 	int py = ((int32*)*position)[0], rsy = image->dim[0];
 	int px = ((int32*)*position)[1], rsx = image->dim[1], sx=in.dim[1];

Modified: trunk/src/gem.cxx
==============================================================================
--- trunk/src/gem.cxx (original)
+++ trunk/src/gem.cxx Wed May 12 21:30:27 2010
@@ -176,7 +176,7 @@
 	long chans = in.dim[2];
 	imageStruct &im = m_pixBlock.image;
 	im.upsidedown = !yflip;
-	for (long y=dex/sxc; n; data+=sxc, n-=sxc, y++) {
+	for (long y=in.dex/sxc; n; data+=sxc, n-=sxc, y++) {
 		if (chans==3) {
 			uint8 *buf2 = buf+y*sx*im.csize;
 			T    *data2 = data;

Modified: trunk/src/grid.cxx
==============================================================================
--- trunk/src/grid.cxx (original)
+++ trunk/src/grid.cxx Wed May 12 21:30:27 2010
@@ -113,7 +113,7 @@
 	dex=0;
 	buf=0;
 	try {
-#define FOO(T) gh->flow(*this,dex,-1,(T *)0); break;
+#define FOO(T) gh->flow(*this,-1,(T *)0); break;
 		TYPESWITCH(sender->nt,FOO,)
 #undef FOO
 	} catch (Barf &barf) {this->sender=0; throw;}
@@ -144,7 +144,7 @@
 		if (bufi==bufn) {
 			long newdex = dex+bufn;
 			CHECK_ALIGN(bufd,sender->nt);
-			try {gh->flow(*this,dex,bufn,bufd);} CATCH_IT;
+			try {gh->flow(*this,bufn,bufd);} CATCH_IT;
 			dex = newdex;
 			bufi = 0;
 		}
@@ -152,7 +152,7 @@
 	int m = (n/bufn)*bufn;
 	if (m) {
 		int newdex = dex + m;
-		try {gh->flow(*this,dex,m,data);} CATCH_IT;
+		try {gh->flow(*this,m,data);} CATCH_IT;
 		dex = newdex;
 	}
 	data += m;
@@ -164,7 +164,7 @@
 	CHECK_BUSY1(inlet);
 	if (dim.prod() != dex) post("%s: incomplete grid: %ld of %ld from [%s] to [%s]",
 	    ARGS(parent),dex,long(dim.prod()),ARGS(sender->parent),ARGS(parent));
-#define FOO(T) try {gh->flow(*this,dex,-2,(T *)0);} CATCH_IT;
+#define FOO(T) try {gh->flow(*this,-2,(T *)0);} CATCH_IT;
 	TYPESWITCH(sender->nt,FOO,)
 #undef FOO
 	dim=0; buf=0; dex=0; sender=0;

Modified: trunk/src/gridflow.hxx
==============================================================================
--- trunk/src/gridflow.hxx (original)
+++ trunk/src/gridflow.hxx Wed May 12 21:30:27 2010
@@ -631,31 +631,28 @@
 //****************************************************************
 // GridInlet represents a grid-aware inlet
 
-#define GRIDHANDLER_ARGS(T) GridInlet &in, long dex, long n, T *data
+#define GRIDHANDLER_ARGS(T) GridInlet &in, 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 (GRIDHANDLER_ARGS(T)) {((THISCLASS*)in.parent)->grin_##I(in,dex,n,data);}\
+	template <class T> void THISCLASS::grinw_##I (GRIDHANDLER_ARGS(T)) {((THISCLASS*)in.parent)->grin_##I(in,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 }
 
-/* macro for defining a gridinlet's behaviour as just storage (no backstore) */
+/* macros for defining a gridinlet's behaviour as just storage (without and with backstore, respectively) */
 // V is a PtrGrid instance-var
 #define GRID_INPUT(I,V) \
-	GRID_INLET(I) {V=new Grid(in.dim,NumberTypeE_type_of(data));} GRID_FLOW {COPY((T *)*(V)+dex,data,n);} GRID_FINISH
-
-// macro for defining a gridinlet's behaviour as just storage (with backstore)
-// V is a PtrGrid instance-var
+	GRID_INLET(I) {V=new Grid(in.dim,NumberTypeE_type_of(data));} GRID_FLOW {COPY((T *)*(V)+in.dex,data,n);} GRID_FINISH
 #define GRID_INPUT2(I,V) GRID_INLET(I) {V.next = new Grid(in.dim,NumberTypeE_type_of(data));} \
-	GRID_FLOW {COPY(((T *)*(V.next?V.next.p:&*V.p))+dex,data,n);} GRID_FINISH
+	GRID_FLOW {COPY(((T *)*(V.next?V.next.p:&*V.p))+in.dex,data,n);} GRID_FINISH
 
 typedef struct GridInlet GridInlet;
 typedef struct GridHandler {
 #define FOO(T) void (*flow_##T)(GRIDHANDLER_ARGS(T)); \
-	       void   flow     (GRIDHANDLER_ARGS(T)) const {flow_##T(in,dex,n,data);}
+	       void   flow     (GRIDHANDLER_ARGS(T)) const {flow_##T(in,n,data);}
 EACH_NUMBER_TYPE(FOO)
 #undef FOO
 } GridHandler;

Modified: trunk/src/sdl.cxx
==============================================================================
--- trunk/src/sdl.cxx (original)
+++ trunk/src/sdl.cxx Wed May 12 21:30:27 2010
@@ -192,7 +192,7 @@
 	int bypl = screen->pitch;
 	int sxc = in.dim.prod(1);
 	int sx = in.dim[1];
-	int y = dex/sxc;
+	int y = in.dex/sxc;
 	if (SDL_MUSTLOCK(screen)) if (SDL_LockSurface(screen) < 0) return; //???
 	for (; n>0; y++, data+=sxc, n-=sxc) {
 		/* convert line */

Modified: trunk/src/x11.cxx
==============================================================================
--- trunk/src/x11.cxx (original)
+++ trunk/src/x11.cxx Wed May 12 21:30:27 2010
@@ -605,7 +605,7 @@
 	int bypl = ximage->bytes_per_line;
 	int sxc = in.dim.prod(1);
 	int sx = in.dim[1];
-	int y = dex/sxc;
+	int y = in.dex/sxc;
 	for (; n>0; y++, data+=sxc, n-=sxc) {
 		// convert line
 		if (use_stripes) {



More information about the Gridflow-cvs mailing list