[Gridflow-cvs] [svn] commit: r4065 - /trunk/base/flow_objects.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Wed Aug 20 16:32:31 EDT 2008


Author: matju
Date: Wed Aug 20 16:32:29 2008
New Revision: 4065

Log:
fix for [#print] so that the truncation feature does work when the grid has 2 dimensions.

Modified:
    trunk/base/flow_objects.c

Modified: trunk/base/flow_objects.c
==============================================================================
--- trunk/base/flow_objects.c (original)
+++ trunk/base/flow_objects.c Wed Aug 20 16:32:29 2008
@@ -256,6 +256,7 @@
 				}
 			}
 			if (i<n-1) s << sep;
+			if (s.tellp()>trunc) return;
 		}
 	}
 	void dump_dims(std::ostream &s, GridInlet *in) {
@@ -321,9 +322,10 @@
 		make_columns(n,data);
 		long sy = in->dim->v[0];
 		long sx = n/sy;
-		for (int row=0; row<in->dim->v[0]; row++) {
+		for (int row=0; row<sy; row++) {
 			std::ostringstream body;
 			dump(body,sx,&data[sx*row],' ',trunc);
+			if (body.tellp()>trunc) body << "...";
 			puts(body);
 			if (row>maxrows) {puts("..."); break;}
 		}
@@ -339,8 +341,7 @@
 			for (int col=0; col<sx; col++) {
 				str << "(";
 				dump(str,sz2,&data[sz*row+sz2*col],' ',trunc);
-				str << ")";
-				if (str.str().size()>trunc) break;
+				if (str.tellp()>trunc) {str << "..."; break;} else str << ")";
 			}
 			puts(str);
 			if (row>maxrows) {puts("..."); break;}
@@ -572,7 +573,6 @@
 } GRID_FLOW {
 	T *rdata = (T *)*r;
 	long loop = r->dim->prod();
-	//fprintf(stderr,"[#] op=%s loop=%ld\n",op->name,loop);
 	T tada[n];
 	COPY(tada,data,n);
 	if (loop>1) {



More information about the Gridflow-cvs mailing list