[GRASS-SVN] r33224 - in grass/trunk: display/d.geodesic display/d.histogram display/d.linegraph display/d.rast display/d.rhumbline include lib/cairodriver lib/driver lib/htmldriver lib/pngdriver lib/psdriver lib/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 2 14:50:59 EDT 2008


Author: glynn
Date: 2008-09-02 14:50:59 -0400 (Tue, 02 Sep 2008)
New Revision: 33224

Removed:
   grass/trunk/lib/cairodriver/Respond.c
   grass/trunk/lib/driver/Respond.c
   grass/trunk/lib/pngdriver/Respond.c
   grass/trunk/lib/psdriver/Respond.c
Modified:
   grass/trunk/display/d.geodesic/plot.c
   grass/trunk/display/d.histogram/main.c
   grass/trunk/display/d.linegraph/main.c
   grass/trunk/display/d.rast/display.c
   grass/trunk/display/d.rhumbline/plot.c
   grass/trunk/include/raster.h
   grass/trunk/lib/cairodriver/Driver.c
   grass/trunk/lib/cairodriver/Graph.c
   grass/trunk/lib/cairodriver/cairodriver.h
   grass/trunk/lib/cairodriver/cairodriver.html
   grass/trunk/lib/driver/driver.h
   grass/trunk/lib/htmldriver/Driver.c
   grass/trunk/lib/pngdriver/Driver.c
   grass/trunk/lib/pngdriver/Graph_set.c
   grass/trunk/lib/pngdriver/pngdriver.h
   grass/trunk/lib/pngdriver/pngdriver.html
   grass/trunk/lib/psdriver/Driver.c
   grass/trunk/lib/psdriver/psdriver.h
   grass/trunk/lib/raster/raster.c
Log:
Remove R_flush()


Modified: grass/trunk/display/d.geodesic/plot.c
===================================================================
--- grass/trunk/display/d.geodesic/plot.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/display/d.geodesic/plot.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -58,7 +58,6 @@
 	G_plot_where_xy(lon1, (lat1 + lat2) / 2, &text_x, &text_y);
 	G_plot_line(lon1, lat1, lon2, lat2);
     }
-    R_flush();
 
     distance = G_geodesic_distance(lon1, lat1, lon2, lat2);
     sprintf(buf, "%.0f miles\n", METERS_TO_MILES(distance));
@@ -70,7 +69,6 @@
 	D_move_abs(text_x, text_y);
 	D_use_color(text_color);
 	R_text(buf);
-	R_flush();
     }
 
     return 0;

Modified: grass/trunk/display/d.histogram/main.c
===================================================================
--- grass/trunk/display/d.histogram/main.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/display/d.histogram/main.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -211,7 +211,6 @@
     else
 	bar(&dist_stats, &pcolors);
 
-    R_flush();
     R_close_driver();
 
     exit(EXIT_SUCCESS);

Modified: grass/trunk/display/d.linegraph/main.c
===================================================================
--- grass/trunk/display/d.linegraph/main.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/display/d.linegraph/main.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -333,8 +333,8 @@
 
     for (i = 0; i <= num_y_files; i++) {
 	if ((in[i].fp = fopen(in[i].full_name, "r")) == NULL) {
-	    sprintf(txt, "Could not open input file <%s>.", in[i].full_name);
-	    death(txt);
+	    R_close_driver();
+	    G_fatal_error(_("Unable to open input file <%s>"), in[i].full_name);
 	}
     }
 
@@ -352,8 +352,8 @@
 
 	/* didn't find a number or hit EOF before our time */
 	if ((err != 1) || (err == EOF)) {
-	    sprintf(txt, _("Problem reading X data file at line %d"), line);
-	    death(txt);
+	    R_close_driver();
+	    G_fatal_error(_("Problem reading X data file at line %d"), line);
 	}
 
 	/* for each Y data file, get a value and compute where to draw it */
@@ -362,10 +362,9 @@
 	    if (line < in[i].num_pnts) {
 		err = fscanf(in[i].fp, "%f", &in[i].value);
 		if ((in[i].num_pnts >= line) && (err != 1)) {
-		    sprintf(txt,
-			    _("Problem reading <%s> data file at line %d"),
-			    in[i].name, line);
-		    death(txt);
+		    R_close_driver();
+		    G_fatal_error(_("Problem reading <%s> data file at line %d"),
+				  in[i].name, line);
 		}
 
 		/* in case the Y file has fewer lines than the X file, we will skip
@@ -554,7 +553,6 @@
     D_use_color(title_color);
     D_polyline_abs(x_line, y_line, 3);
 
-    R_flush();
     R_close_driver();
     exit(EXIT_SUCCESS);
 }
@@ -566,11 +564,3 @@
     return ((float)(x - y * d));
 }
 
-
-/* a function for making an exit after the R_driver is open */
-int death(char *gasp)
-{
-    R_flush();
-    R_close_driver();
-    G_fatal_error("%s", gasp);
-}

Modified: grass/trunk/display/d.rast/display.c
===================================================================
--- grass/trunk/display/d.rast/display.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/display/d.rast/display.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -71,7 +71,7 @@
 
     }
     D_cell_draw_end();
-    R_flush();
+
     G_percent(nrows, nrows, 2);
 
     /* Wrap up and return */

Modified: grass/trunk/display/d.rhumbline/plot.c
===================================================================
--- grass/trunk/display/d.rhumbline/plot.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/display/d.rhumbline/plot.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -39,7 +39,6 @@
 	G_plot_where_xy(lon1, (lat1 + lat2) / 2, &text_x, &text_y);
 	G_plot_line(lon1, lat1, lon2, lat2);
     }
-    R_flush();
 
     return 0;
 }

Modified: grass/trunk/include/raster.h
===================================================================
--- grass/trunk/include/raster.h	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/include/raster.h	2008-09-02 18:50:59 UTC (rev 33224)
@@ -1,7 +1,6 @@
 #ifndef _GRASS_RASTER_H
 #define _GRASS_RASTER_H
 
-void R_flush(void);
 int R_open_driver(void);
 void R_close_driver(void);
 

Modified: grass/trunk/lib/cairodriver/Driver.c
===================================================================
--- grass/trunk/lib/cairodriver/Driver.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/cairodriver/Driver.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -39,7 +39,6 @@
     drv.Begin_scaled_raster = Cairo_begin_scaled_raster;
     drv.Scaled_raster = Cairo_scaled_raster;
     drv.End_scaled_raster = Cairo_end_scaled_raster;
-    drv.Respond = Cairo_Respond;
     drv.color_rgb = Cairo_color_rgb;
     drv.draw_line = Cairo_draw_line;
     drv.draw_point = Cairo_draw_point;

Modified: grass/trunk/lib/cairodriver/Graph.c
===================================================================
--- grass/trunk/lib/cairodriver/Graph.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/cairodriver/Graph.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -233,9 +233,6 @@
     else
 	ca.bgcolor_a = 1.0;
 
-    p = getenv("GRASS_PNG_AUTO_WRITE");
-    ca.auto_write = p && strcmp(p, "TRUE") == 0;
-
     antialias = CAIRO_ANTIALIAS_DEFAULT;
     p = getenv("GRASS_ANTIALIAS");
     if (p && G_strcasecmp(p, "default") == 0)

Deleted: grass/trunk/lib/cairodriver/Respond.c
===================================================================
--- grass/trunk/lib/cairodriver/Respond.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/cairodriver/Respond.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -1,24 +0,0 @@
-/*!
-  \file cairodriver/Respond.c
-
-  \brief GRASS cairo display driver - write image
-
-  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
-  
-  This program is free software under the GNU General Public License
-  (>=v2). Read the file COPYING that comes with GRASS for details.
-  
-  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
-  \author Glynn Clements  
-*/
-
-#include "cairodriver.h"
-
-/*!
-  \brief Write image
-*/
-void Cairo_Respond(void)
-{
-    if (ca.auto_write)
-	cairo_write_image();
-}

Modified: grass/trunk/lib/cairodriver/cairodriver.h
===================================================================
--- grass/trunk/lib/cairodriver/cairodriver.h	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/cairodriver/cairodriver.h	2008-09-02 18:50:59 UTC (rev 33224)
@@ -53,7 +53,6 @@
     int file_type;
     int width, height, stride;
     unsigned char *grid;
-    int auto_write;
     double bgcolor_r, bgcolor_g, bgcolor_b, bgcolor_a;
     int modified;
     int mapped;
@@ -82,7 +81,6 @@
 extern void Cairo_Polygon(const double *, const double *, int);
 extern void Cairo_Polyline(const double *, const double *, int);
 extern void Cairo_Polydots(const double *, const double *, int);
-extern void Cairo_Respond(void);
 extern void Cairo_draw_text(const char *);
 extern void Cairo_text_box(const char *, double *, double *, double *, double *);
 extern void Cairo_set_font(const char *);

Modified: grass/trunk/lib/cairodriver/cairodriver.html
===================================================================
--- grass/trunk/lib/cairodriver/cairodriver.html	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/cairodriver/cairodriver.html	2008-09-02 18:50:59 UTC (rev 33224)
@@ -69,13 +69,6 @@
   <LI><B>GRASS_TRANSPARENT=[TRUE|FALSE]</B><BR>
     sets transparent background on (TRUE) or off (FALSE, default).
   </LI>
-  <LI><B>GRASS_AUTO_WRITE=[TRUE|FALSE]</B><BR>
-    if set to <tt>TRUE</tt>, the image file will be written after each 
-    operation (i.e. whenever a client disconnects), rather than
-    only being written out when the driver terminates.<BR>
-    (Note: This only applies to bitmap formats - vector formats
-    are always written directly to file).
-  </LI>
   <LI><B>GRASS_PNG_READ</B><BR>
      if <tt>TRUE</tt>, the Cairo driver will initialize the image from
     the contents of GRASS_PNGFILE.<BR>

Deleted: grass/trunk/lib/driver/Respond.c
===================================================================
--- grass/trunk/lib/driver/Respond.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/driver/Respond.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -1,9 +0,0 @@
-
-#include "driver.h"
-#include "driverlib.h"
-
-void COM_Respond(void)
-{
-    if (driver->Respond)
-	(*driver->Respond) ();
-}

Modified: grass/trunk/lib/driver/driver.h
===================================================================
--- grass/trunk/lib/driver/driver.h	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/driver/driver.h	2008-09-02 18:50:59 UTC (rev 33224)
@@ -35,7 +35,6 @@
 			 const unsigned char *,
 			 const unsigned char *, const unsigned char *);
     void (*End_scaled_raster)(void);
-    void (*Respond)(void);
 
     void (*color_rgb)(int, int, int);
     void (*draw_line)(double, double, double, double);
@@ -112,9 +111,6 @@
 			     const unsigned char *);
 extern void COM_end_scaled_raster(void);
 
-/* Respond.c */
-extern void COM_Respond(void);
-
 /* Set_window.c */
 extern void COM_Set_window(double, double, double, double);
 extern void COM_Get_window(double *, double *, double *, double *);

Modified: grass/trunk/lib/htmldriver/Driver.c
===================================================================
--- grass/trunk/lib/htmldriver/Driver.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/htmldriver/Driver.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -37,7 +37,6 @@
     drv.Begin_scaled_raster = NULL;
     drv.Scaled_raster = NULL;
     drv.End_scaled_raster = NULL;
-    drv.Respond = NULL;
     drv.color_rgb = NULL;
     drv.draw_line = NULL;
     drv.draw_point = NULL;

Modified: grass/trunk/lib/pngdriver/Driver.c
===================================================================
--- grass/trunk/lib/pngdriver/Driver.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/pngdriver/Driver.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -39,7 +39,6 @@
     drv.Begin_scaled_raster = PNG_begin_scaled_raster;
     drv.Scaled_raster = PNG_scaled_raster;
     drv.End_scaled_raster = NULL;
-    drv.Respond = PNG_Respond;
     drv.color_rgb = PNG_color_rgb;
     drv.draw_line = PNG_draw_line;
     drv.draw_point = PNG_draw_point;

Modified: grass/trunk/lib/pngdriver/Graph_set.c
===================================================================
--- grass/trunk/lib/pngdriver/Graph_set.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/pngdriver/Graph_set.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -71,9 +71,6 @@
     G_message("PNG: GRASS_TRUECOLOR status: %s",
 	      png.true_color ? "TRUE" : "FALSE");
 
-    p = getenv("GRASS_PNG_AUTO_WRITE");
-    png.auto_write = p && strcmp(p, "TRUE") == 0;
-
     p = getenv("GRASS_PNG_MAPPED");
     do_map = p && strcmp(p, "TRUE") == 0;
 

Deleted: grass/trunk/lib/pngdriver/Respond.c
===================================================================
--- grass/trunk/lib/pngdriver/Respond.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/pngdriver/Respond.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -1,8 +0,0 @@
-
-#include "pngdriver.h"
-
-void PNG_Respond(void)
-{
-    if (png.auto_write)
-	write_image();
-}

Modified: grass/trunk/lib/pngdriver/pngdriver.h
===================================================================
--- grass/trunk/lib/pngdriver/pngdriver.h	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/pngdriver/pngdriver.h	2008-09-02 18:50:59 UTC (rev 33224)
@@ -15,7 +15,6 @@
     char *file_name;
     int current_color;
     int true_color;
-    int auto_write;
     int has_alpha;
     int mapped;
 
@@ -60,7 +59,6 @@
 extern int PNG_scaled_raster(int, int, const unsigned char *,
 			     const unsigned char *, const unsigned char *,
 			     const unsigned char *);
-extern void PNG_Respond(void);
 extern void PNG_Set_window(double, double, double, double);
 extern void PNG_color_rgb(int, int, int);
 extern void PNG_draw_bitmap(int, int, int, const unsigned char *);

Modified: grass/trunk/lib/pngdriver/pngdriver.html
===================================================================
--- grass/trunk/lib/pngdriver/pngdriver.html	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/pngdriver/pngdriver.html	2008-09-02 18:50:59 UTC (rev 33224)
@@ -43,10 +43,6 @@
     sets true-color support. Default is TRUE</LI>
   <LI><B>GRASS_PNG_COMPRESSION=[0|1|9]</B><BR>
     compression level of PNG files (0 = none, 1 = fastest, 9 = best, default is 6)</LI>
-  <LI><B>GRASS_PNG_AUTO_WRITE=[TRUE|FALSE]</B><BR>
-     if set to <tt>TRUE</tt>, the image file will be written after each 
-     operation (i.e. whenever a client disconnects), rather than
-     only being written out when the driver terminates.</LI>
   <LI><B>GRASS_PNG_READ</B><BR>
      if <tt>TRUE</tt>, the PNG driver will initialize the image from
      the contents of GRASS_PNGFILE.</LI>

Modified: grass/trunk/lib/psdriver/Driver.c
===================================================================
--- grass/trunk/lib/psdriver/Driver.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/psdriver/Driver.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -39,7 +39,6 @@
     drv.Begin_scaled_raster = PS_begin_scaled_raster;
     drv.Scaled_raster = PS_scaled_raster;
     drv.End_scaled_raster = PS_end_scaled_raster;
-    drv.Respond = PS_Respond;
     drv.color_rgb = PS_color_rgb;
     drv.draw_line = PS_draw_line;
     drv.draw_point = PS_draw_point;

Deleted: grass/trunk/lib/psdriver/Respond.c
===================================================================
--- grass/trunk/lib/psdriver/Respond.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/psdriver/Respond.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -1,7 +0,0 @@
-
-#include "psdriver.h"
-
-void PS_Respond(void)
-{
-    fflush(ps.outfp);
-}

Modified: grass/trunk/lib/psdriver/psdriver.h
===================================================================
--- grass/trunk/lib/psdriver/psdriver.h	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/psdriver/psdriver.h	2008-09-02 18:50:59 UTC (rev 33224)
@@ -32,7 +32,6 @@
 extern void PS_Graph_close(void);
 extern int PS_Graph_set(void);
 extern void PS_Line_width(double);
-extern void PS_Respond(void);
 extern void PS_Set_window(double, double, double, double);
 extern void PS_color_rgb(int, int, int);
 extern void PS_draw_bitmap(int, int, int, const unsigned char *);

Modified: grass/trunk/lib/raster/raster.c
===================================================================
--- grass/trunk/lib/raster/raster.c	2008-09-02 15:04:26 UTC (rev 33223)
+++ grass/trunk/lib/raster/raster.c	2008-09-02 18:50:59 UTC (rev 33224)
@@ -71,16 +71,10 @@
     return 0;
 }
 
-void R_flush(void)
-{
-    COM_Respond();
-}
-
 void R_close_driver(void)
 {
     const char *cmd = getenv("GRASS_NOTIFY");
 
-    COM_Respond();
     COM_Graph_close();
 
     if (cmd)



More information about the grass-commit mailing list