[Gridflow-cvs] [svn] commit: r5608 - in /trunk/src: classes1.cxx formats.cxx gridflow.hxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Wed May 5 22:28:37 EDT 2010


Author: matju
Date: Wed May  5 22:28:36 2010
New Revision: 5608

Log:
Dim,GridInlet&

Modified:
    trunk/src/classes1.cxx
    trunk/src/formats.cxx
    trunk/src/gridflow.hxx

Modified: trunk/src/classes1.cxx
==============================================================================
--- trunk/src/classes1.cxx (original)
+++ trunk/src/classes1.cxx Wed May  5 22:28:36 2010
@@ -937,11 +937,10 @@
 }
 
 \def 0 bang () {
-	SAME_TYPE(from,to);
-	SAME_TYPE(from,step);
+	SAME_TYPE(*from,to);
+	SAME_TYPE(*from,step);
 	if (!from->dim.equal(to->dim) || !to->dim.equal(step->dim))
-		RAISE("dimension mismatch: from:%s to:%s step:%s",
-			from->dim.to_s(),to->dim.to_s(),step->dim.to_s());
+		RAISE("dimension mismatch: from:%s to:%s step:%s",from->dim.to_s(),to->dim.to_s(),step->dim.to_s());
 #define FOO(T) trigger((T)0);
 	TYPESWITCH(from->nt,FOO,);
 #undef FOO

Modified: trunk/src/formats.cxx
==============================================================================
--- trunk/src/formats.cxx (original)
+++ trunk/src/formats.cxx Wed May  5 22:28:36 2010
@@ -229,25 +229,25 @@
 GRID_INLET(0) {
 	if (!headerless) {
 		strncpy(head.magic,is_le()?"\x7fgrid":"\x7fGRID",5);
-		switch (in->nt) {
+		switch (in.nt) {
 		case uint8_e: head.type = 9; break;
 		case int16_e: head.type = 16; break;
 		case int32_e: head.type = 32; break;
 		default: RAISE("can't write that type of number to a file");
 		}
 		head.reserved = 0;
-		head.dimn = in->dim.n;
-		size_t sz = 4*in->dim.n;
+		head.dimn = in.dim.n;
+		size_t sz = 4*in.dim.n;
 #define FRAISE(funk,f) RAISE("can't "#funk": %s",ferror(f));
-		if (fwrite(&head,1,8,f     )< 8) FRAISE(fwrite,f);
-		if (fwrite(in->dim.v,1,sz,f)<sz) FRAISE(fwrite,f);
+		if (fwrite(&head,1,8,f    )< 8) FRAISE(fwrite,f);
+		if (fwrite(in.dim.v,1,sz,f)<sz) FRAISE(fwrite,f);
 	}
 } GRID_FLOW {
 #define FOO(T) {T data2[n]; for(int i=0; i<n; i++) data2[i]=(T)data[i]; \
 		if (endian!=is_le()) swap_endian(n,data2); \
 		size_t sz = n*sizeof(T); \
 		if (fwrite(data2,1,sz,f)<sz) FRAISE(fwrite,f);}
-TYPESWITCH(in->nt,FOO,)
+TYPESWITCH(in.nt,FOO,)
 #undef FOO
 } GRID_FINISH {
 	fflush(f);

Modified: trunk/src/gridflow.hxx
==============================================================================
--- trunk/src/gridflow.hxx (original)
+++ trunk/src/gridflow.hxx Wed May  5 22:28:36 2010
@@ -658,7 +658,7 @@
 // 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);}\
+		((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)
@@ -667,11 +667,11 @@
 /* macro for defining a gridinlet's behaviour as just storage (no backstore) */
 // 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
+	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
-#define GRID_INPUT2(I,V) GRID_INLET(I) {V.next = new Grid(in->dim,NumberTypeE_type_of(data));} \
+#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
 
 typedef struct GridInlet GridInlet;
@@ -696,8 +696,8 @@
 	GridInlet(FObject *parent_, const GridHandler *gh_) :
 		parent(parent_), gh(gh_), sender(0), dim(0), nt(int32_e), dex(0), chunk(-1), bufi(0) {}
 	~GridInlet() {}
-	const GridInlet *operator ->() const {return this;}
-	      GridInlet *operator ->()       {return this;}
+//	const GridInlet *operator ->() const {return this;}
+//	      GridInlet *operator ->()       {return this;}
 	void set_chunk(long whichdim);
 	int32 factor() {return buf?buf->dim.prod():1;} // which is usually not the same as this->dim->prod(chunk)
 	void begin(GridOutlet *sender);
@@ -833,10 +833,10 @@
 
 #undef ARGS
 #define ARGS(OBJ) ((OBJ) ? (OBJ)->bself->binbuf_string().data() : "[???]")
-#define NOTEMPTY(_a_) if (!(_a_)) RAISE("'%s' is empty",#_a_);
-#define SAME_TYPE(_a_,_b_) if ((_a_)->nt != (_b_)->nt) RAISE("same type please (%s has %s; %s has %s)", \
-	#_a_, number_type_table[(_a_)->nt].name, \
-	#_b_, number_type_table[(_b_)->nt].name);
+#define NOTEMPTY(A) if (!(A)) RAISE("'%s' is empty",#A);
+#define SAME_TYPE(A,B) if ((A).nt != (B)->nt) RAISE("same type please (%s has %s; %s has %s)", \
+	#A, number_type_table[(A).nt].name, \
+	#B, number_type_table[(B)->nt].name);
 static void SAME_DIM(int n, const Dim &a, int ai, const Dim &b, int bi) {
 	if (ai+n > a.n) RAISE("left hand: not enough dimensions");
 	if (bi+n > b.n) RAISE("right hand: not enough dimensions");



More information about the Gridflow-cvs mailing list