[GRASS-SVN] r42827 - grass/trunk/raster/r.terraflow

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jul 18 05:58:32 EDT 2010


Author: hamish
Date: 2010-07-18 09:58:32 +0000 (Sun, 18 Jul 2010)
New Revision: 42827

Modified:
   grass/trunk/raster/r.terraflow/grass2str.h
Log:
sync msgs from devbr6

Modified: grass/trunk/raster/r.terraflow/grass2str.h
===================================================================
--- grass/trunk/raster/r.terraflow/grass2str.h	2010-07-18 08:57:58 UTC (rev 42826)
+++ grass/trunk/raster/r.terraflow/grass2str.h	2010-07-18 09:58:32 UTC (rev 42827)
@@ -21,6 +21,7 @@
 #define _gras2str_H
 
 #include <grass/iostream/ami.h>
+#include <grass/glocale.h>
 #include "option.h"
 #include "types.h"
 #include "common.h"
@@ -48,21 +49,20 @@
   { 
     char * foo;
     str->name(&foo); 
-    *stats << "reading raster map " << cellname 
-		   << "to stream " << foo << endl;
-    if (opt->verbose) 
-      fprintf(stderr, "reading data from %s to stream %s: ", cellname, foo);
+    *stats << "Reading raster map <" << cellname 
+		   << "> to stream <" << foo << ">." << endl;
+    G_verbose_message(_("Reading data from <%s> to stream <%s>"), cellname, foo);
   }
-  
+
   const char *mapset;
   mapset = G_find_raster (cellname, "");
   if (mapset == NULL)
-    G_fatal_error (_("Raster map <%s> not found"), cellname);
+    G_fatal_error(_("Raster map <%s> not found"), cellname);
   
   /* open map */
   int infd;
   if ( (infd = Rast_open_old (cellname, mapset)) < 0)
-    G_fatal_error (_("Unable to open raster map <%s>"), cellname);
+    G_fatal_error(_("Unable to open raster map <%s>"), cellname);
   
   /* determine map type (CELL/FCELL/DCELL) */
   RASTER_MAP_TYPE data_type;
@@ -79,10 +79,10 @@
   int isnull = 0;
 
   for (int i = 0; i< nrows; i++) {
-	
+
 	/* read input map */
-      Rast_get_row (infd, inrast, i, data_type);
-  
+	Rast_get_row (infd, inrast, i, data_type);
+
 	for (int j=0; j<ncols; j++) {
 
 	  switch (data_type) {
@@ -118,9 +118,9 @@
 	  } else {
 		/* check range */
 		if ((d > (DCELL)T_max_value) || (d < (DCELL)T_min_value)) {
-		  fprintf(stderr, "reading raster map %s at (i=%d,j=%d) value=%.1f\n",
-				  cellname, i, j, d);
-		  G_fatal_error("value out of range.");
+		  G_fatal_error("Value out of range, reading raster map <%s> "
+				"at (i=%d, j=%d) value=%.1f",
+				cellname, i, j, d);
 		}
 	  }  
 	  /* write x to stream */
@@ -139,7 +139,9 @@
   G_free(inrast);
   /* close map files */
   Rast_close (infd);
-  
+
+  G_debug(3, "nrows=%d   ncols=%d    stream_len()=%d", nrows, ncols,
+		str->stream_len());  
   assert(nrows * ncols == str->stream_len());
   rt_stop(rt);
   stats->recordTime("reading raster map", rt);
@@ -167,15 +169,13 @@
   {
     char * foo;
     str->name(&foo); 
-    *stats << "writing stream " << foo << " to raster map  " << cellname << "\n";
-    fprintf(stderr, "writing stream %s to raster map %s: ", foo, cellname);
+    *stats << "Writing stream <" << foo << "> to raster map <" << cellname << ">.\n";
+    G_verbose_message(_("Writing stream <%s> to raster map <%s>"), foo, cellname);
   }
 
   /* open output raster map */
   int outfd;
   if ( (outfd = Rast_open_new (cellname, mtype)) < 0) {
-    G_fatal_error (_("Unable to create raster map <%s>"), cellname);
-  }
   
   /* Allocate output buffer */
   unsigned char *outrast;
@@ -190,8 +190,8 @@
 	  ae = str->read_item(&elt);
 	  if (ae != AMI_ERROR_NO_ERROR) {
 		str->sprint();
-		fprintf(stderr, "reading stream failed at (%d,%d)\n", i,j);
-		G_fatal_error("stream2cell failed");
+		G_fatal_error(_("stream2cell: Reading stream failed at (%d,%d)"),
+				i, j);
 	  }
 
 	  /* WRITE VALUE */
@@ -251,14 +251,14 @@
   {
     char * foo;
     str->name(&foo); 
-    *stats << "writing stream " << foo << "cellfile  " << cellname << endl;
-    fprintf(stderr, "writing stream %s to raster map %s: ", foo, cellname);
+    *stats << "Writing stream <" << foo << "> to raster map <" << cellname << ">." << endl;
+    G_verbose_message(_("Writing stream <%s> to raster map <%s>"), foo, cellname);
   }
   
   /* open output raster map */
   int outfd;
   if ( (outfd = Rast_open_new (cellname, CELL_TYPE)) < 0) {
-    G_fatal_error ("Could not open <%s>", cellname);
+    G_fatal_error(_("Could not open <%s>"), cellname);
   }
   
   /* Allocate output buffer */
@@ -324,14 +324,14 @@
   {
     char * foo;
     str->name(&foo); 
-    *stats << "writing stream " << foo << "cellfile  " << cellname << endl;
-    fprintf(stderr, "writing stream %s to raster map %s: ", foo, cellname);
+    *stats << "Writing stream <" << foo << "> to raster map <" << cellname << ">." << endl;
+    G_verbose_message(_("Writing stream <%s> to raster map <%s>"), foo, cellname);
   }
   
   /* open output raster map */
   int outfd;
   if ( (outfd = Rast_open_new (cellname, FCELL_TYPE)) < 0) {
-    G_fatal_error ("Could not open <%s>", cellname);
+    G_fatal_error(_("Could not open <%s>"), cellname);
   }
   
   /* Allocate output buffer */
@@ -404,7 +404,7 @@
   assert(str);
 #ifndef   OUTPUT_TCI 
   /* this function should be used only if tci is wanted as output */
-  fprintf(stderr, "use this function only if tci is wanted as output\n");
+  G_warning("Use this function only if tci is wanted as output");
   exit(1);
 #else 
   rt_start(rt); 
@@ -413,20 +413,20 @@
   {
     char * foo;
     str->name(&foo); 
-    *stats << "writing stream " << foo << "to raster maps  "
-	   << cellname1 << ", " << cellname2 << endl;
-    fprintf(stderr, "writing stream %s to raster maps %s, %s: ", 
-	    foo, cellname1, cellname2);
+    *stats << "Writing stream <" << foo << "> to raster maps <"
+	   << cellname1 << "> and <" << cellname2 << ">." << endl;
+    G_verbose_message(_("Writing stream <%s> to raster maps <%s> and <%s>"), 
+		foo, cellname1, cellname2);
   }
 
   /* open  raster maps */
   int fd1;
   if ( (fd1 = Rast_open_new (cellname1, FCELL_TYPE)) < 0) {
-    G_fatal_error ("Could not open <%s>", cellname1);
+    G_fatal_error(_("Could not open <%s>"), cellname1);
   }
   int fd2;
   if ( (fd2 = Rast_open_new (cellname2, FCELL_TYPE)) < 0) {
-    G_fatal_error ("Could not open <%s>", cellname2);
+    G_fatal_error(_("Could not open <%s>"), cellname2);
   }
   
 



More information about the grass-commit mailing list