[GRASS-SVN] r64253 - grass-addons/grass7/imagery/i.spec.sam

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 20 05:29:52 PST 2015


Author: ychemin
Date: 2015-01-20 05:29:52 -0800 (Tue, 20 Jan 2015)
New Revision: 64253

Modified:
   grass-addons/grass7/imagery/i.spec.sam/Makefile
   grass-addons/grass7/imagery/i.spec.sam/global.h
   grass-addons/grass7/imagery/i.spec.sam/main.c
   grass-addons/grass7/imagery/i.spec.sam/open.c
Log:
Fixed the flag.quiet structure issue

Modified: grass-addons/grass7/imagery/i.spec.sam/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.spec.sam/Makefile	2015-01-20 02:13:18 UTC (rev 64252)
+++ grass-addons/grass7/imagery/i.spec.sam/Makefile	2015-01-20 13:29:52 UTC (rev 64253)
@@ -3,10 +3,11 @@
 PGM = i.spec.sam
 
 EXTRALIB = meschach.a
-EXTRA_INC = $(PROJINC)
 LIBES     = $(IMAGERYLIB) $(GMATHLIB) $(RASTERLIB) $(GISLIB)  
 DEPENDENCIES= $(IMAGERYDEP) $(GMATHDEP) $(RASTERDEP) $(GISDEP)
 
+EXTRA_INC =  $(VECT_INC) $(PROJINC)
+
 include $(MODULE_TOPDIR)/include/Make/Module.make
 
 default: cmd

Modified: grass-addons/grass7/imagery/i.spec.sam/global.h
===================================================================
--- grass-addons/grass7/imagery/i.spec.sam/global.h	2015-01-20 02:13:18 UTC (rev 64252)
+++ grass-addons/grass7/imagery/i.spec.sam/global.h	2015-01-20 13:29:52 UTC (rev 64253)
@@ -24,8 +24,5 @@
 extern char result_name[80];
 extern char *result_prefix, *matrixfile;
 
-extern struct
-    {
-     struct Flag *quiet;
-    } flag;
+extern struct Flag *flag_quiet;
                 

Modified: grass-addons/grass7/imagery/i.spec.sam/main.c
===================================================================
--- grass-addons/grass7/imagery/i.spec.sam/main.c	2015-01-20 02:13:18 UTC (rev 64252)
+++ grass-addons/grass7/imagery/i.spec.sam/main.c	2015-01-20 13:29:52 UTC (rev 64253)
@@ -22,9 +22,10 @@
 #include "matrix.h"
 #include "matrix2.h"
 #include "local_proto.h"
-#include "grass/gis.h"
 #include "grass/raster.h"
 #include "grass/vector.h"
+#include "grass/glocale.h"
+#include "grass/gis.h"
 
 MAT *A;
 VEC *b, *Avector;
@@ -46,6 +47,8 @@
 char result_name[80];
 char *result_prefix, *matrixfile;
 
+struct Flag *flag_quiet;
+
 int open_files();
 void spectral_angle();
 CELL myround(x);
@@ -85,9 +88,9 @@
     parm.result->required = YES;
     parm.result->description = "Raster map prefix to hold spectral angles";
 
-    flag.quiet = G_define_flag();
-    flag.quiet->key = 'q';
-    flag.quiet->description = "Run quietly";
+    flag_quiet = G_define_flag();
+    flag_quiet->key = 'q';
+    flag_quiet->description = "Run quietly";
 
 
     if (G_parser(argc,argv))
@@ -168,14 +171,14 @@
     nrows = Rast_window_rows();
     ncols = Rast_window_cols();
     
-    if (!flag.quiet->answer)
+    if (!flag_quiet->answer)
     	{
 	 fprintf (stderr, "Calculating for %i x %i = %i pixels:\n",nrows,ncols, (ncols * ncols));
 	 fprintf (stderr, "%s ... ", G_program_name());
 	}
     for (row = 0; row < nrows; row++)                 /* rows loop*/
     {
-	if (!flag.quiet->answer)
+	if (!flag_quiet->answer)
 	    G_percent(row, nrows, 2);
 	for (band = 0; band < Ref.nfiles; band++)     /* get row for all bands*/
 	    Rast_get_c_row (cellfd[band], cell[band], row);
@@ -209,7 +212,7 @@
 
     } /* rows loop */
 
-    if (!flag.quiet->answer)
+    if (!flag_quiet->answer)
 	G_percent(row, nrows, 2);
 	
    /* close files */

Modified: grass-addons/grass7/imagery/i.spec.sam/open.c
===================================================================
--- grass-addons/grass7/imagery/i.spec.sam/open.c	2015-01-20 02:13:18 UTC (rev 64252)
+++ grass-addons/grass7/imagery/i.spec.sam/open.c	2015-01-20 13:29:52 UTC (rev 64253)
@@ -35,7 +35,7 @@
     fclose (fp);
     if ( A->m < A->n )
 	G_fatal_error("Need m (rows) >= n (cols) to obtain least squares fit\n");
-    if (!flag.quiet->answer)
+    if (!flag_quiet->answer)
     {
 	G_message("Your spectral matrix = ");
 	m_output(A);
@@ -73,7 +73,7 @@
 	cell[i] = Rast_allocate_c_buf();
 	name = Ref.file[i].name;
 	mapset = Ref.file[i].mapset;
-	if (!flag.quiet->answer)
+	if (!flag_quiet->answer)
 	    G_message("Opening input file no. %i [%s]\n", (i+1), name);
 	if ((cellfd[i] = Rast_open_old (name, mapset)) < 0)
 	    G_fatal_error("Unable to proceed\n");
@@ -84,11 +84,11 @@
     resultfd = (int *) G_malloc (Ref.nfiles * sizeof (int));
     for (i=0; i < Ref.nfiles; i++)
     {
-	 sprintf(result_name, "%s.%d", result_prefix, (i+1));
-	 if (!flag.quiet->answer)
-		G_message("Opening output file [%s]\n", result_name);	 
-	 result_cell[i] = Rast_allocate_c_buf();
-	 resultfd[i] = Rast_open_c_new (result_name);
+	sprintf(result_name, "%s.%d", result_prefix, (i+1));
+	if (!flag_quiet->answer)
+	    G_message("Opening output file [%s]\n", result_name);	 
+	result_cell[i] = Rast_allocate_c_buf();
+	resultfd[i] = Rast_open_c_new (result_name);
     }
 
 



More information about the grass-commit mailing list