[GRASS-SVN] r32406 - grass/branches/develbranch_6/vector/v.in.ascii

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 31 12:28:26 EDT 2008


Author: martinl
Date: 2008-07-31 12:28:26 -0400 (Thu, 31 Jul 2008)
New Revision: 32406

Modified:
   grass/branches/develbranch_6/vector/v.in.ascii/in.c
   grass/branches/develbranch_6/vector/v.in.ascii/local_proto.h
   grass/branches/develbranch_6/vector/v.in.ascii/points.c
Log:
Show progress information in points mode, trac #244 (merged from trunk r32398, r32405)


Modified: grass/branches/develbranch_6/vector/v.in.ascii/in.c
===================================================================
--- grass/branches/develbranch_6/vector/v.in.ascii/in.c	2008-07-31 13:52:53 UTC (rev 32405)
+++ grass/branches/develbranch_6/vector/v.in.ascii/in.c	2008-07-31 16:28:26 UTC (rev 32406)
@@ -228,7 +228,7 @@
     }
 
     if (format == FORMAT_POINT) {
-	int i, rowlen, ncols, minncols, *coltype, *coltype2, *collen;
+      int i, rowlen, ncols, minncols, *coltype, *coltype2, *collen, nrows;
 	int n_int = 0, n_double = 0, n_string = 0;
 	char buf[1000];
 	struct field_info *Fi;
@@ -244,7 +244,7 @@
 	}
 	unlink(tmp);
 
-	points_analyse(ascii, tmpascii, fs, &rowlen, &ncols, &minncols,
+	points_analyse(ascii, tmpascii, fs, &rowlen, &ncols, &minncols, &nrows,
 		       &coltype, &collen, skip_lines, xcol, ycol,
 		       region_flag->answer);
 
@@ -510,7 +510,7 @@
 	    table = NULL;
 	}
 
-	points_to_bin(tmpascii, rowlen, &Map, driver, table, fs, ncols,
+	points_to_bin(tmpascii, rowlen, &Map, driver, table, fs, nrows, ncols,
 		      coltype2, xcol, ycol, zcol, catcol, skip_lines);
 
 	if (driver) {

Modified: grass/branches/develbranch_6/vector/v.in.ascii/local_proto.h
===================================================================
--- grass/branches/develbranch_6/vector/v.in.ascii/local_proto.h	2008-07-31 13:52:53 UTC (rev 32405)
+++ grass/branches/develbranch_6/vector/v.in.ascii/local_proto.h	2008-07-31 16:28:26 UTC (rev 32406)
@@ -11,11 +11,11 @@
 #define FORMAT_ALL   1
 
 
-int points_analyse (FILE *, FILE *, char *, int *, int *, int *, int **,
+int points_analyse (FILE *, FILE *, char *, int *, int *, int *, int*, int **,
 		     int **, int, int, int, int);
 
 int points_to_bin (FILE *, int, struct Map_info *, dbDriver *,
-		   char *, char *, int, int *,
+		   char *, char *, int, int, int *,
 		   int, int, int, int, int);
 
 int read_head (FILE *, struct Map_info *);

Modified: grass/branches/develbranch_6/vector/v.in.ascii/points.c
===================================================================
--- grass/branches/develbranch_6/vector/v.in.ascii/points.c	2008-07-31 13:52:53 UTC (rev 32405)
+++ grass/branches/develbranch_6/vector/v.in.ascii/points.c	2008-07-31 16:28:26 UTC (rev 32406)
@@ -48,12 +48,13 @@
  * rowlength: maximum row length
  * ncolumns: number of columns
  * minncolumns: minimum number of columns
+ * nrows: number of rows
  * column_type: column types
  * column_length: column lengths (string only)
  */
 
 int points_analyse(FILE * ascii_in, FILE * ascii, char *fs,
-		   int *rowlength, int *ncolumns, int *minncolumns,
+		   int *rowlength, int *ncolumns, int *minncolumns, int *nrows,
 		   int **column_type, int **column_length, int skip_lines,
 		   int xcol, int ycol, int region_flag)
 {
@@ -242,6 +243,7 @@
     *minncolumns = minncols;
     *column_type = coltype;
     *column_length = collen;
+    *nrows = row - 1; /* including skipped lines */
 
     G_free(buf);
     G_free(buf_raw);
@@ -265,7 +267,7 @@
  * Note: column types (both in header or coldef) must be supported by driver
  */
 int points_to_bin(FILE * ascii, int rowlen, struct Map_info *Map,
-		  dbDriver * driver, char *table, char *fs, int ncols,
+		  dbDriver * driver, char *table, char *fs, int nrows, int ncols,
 		  int *coltype, int xcol, int ycol, int zcol, int catcol,
 		  int skip_lines)
 {
@@ -394,7 +396,11 @@
 	    }
 	}
 
+	G_percent(row, nrows, 2);
+
 	G_free_tokens(tokens);
+
+	row++;
     }
 
     return 0;



More information about the grass-commit mailing list