Pārlūkot izejas kodu

Remove R_flush()

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@33224 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 16 gadi atpakaļ
vecāks
revīzija
9a0192956a

+ 0 - 2
display/d.geodesic/plot.c

@@ -58,7 +58,6 @@ plot(double lon1, double lat1, double lon2, double lat2, int line_color,
 	G_plot_where_xy(lon1, (lat1 + lat2) / 2, &text_x, &text_y);
 	G_plot_where_xy(lon1, (lat1 + lat2) / 2, &text_x, &text_y);
 	G_plot_line(lon1, lat1, lon2, lat2);
 	G_plot_line(lon1, lat1, lon2, lat2);
     }
     }
-    R_flush();
 
 
     distance = G_geodesic_distance(lon1, lat1, lon2, lat2);
     distance = G_geodesic_distance(lon1, lat1, lon2, lat2);
     sprintf(buf, "%.0f miles\n", METERS_TO_MILES(distance));
     sprintf(buf, "%.0f miles\n", METERS_TO_MILES(distance));
@@ -70,7 +69,6 @@ plot(double lon1, double lat1, double lon2, double lat2, int line_color,
 	D_move_abs(text_x, text_y);
 	D_move_abs(text_x, text_y);
 	D_use_color(text_color);
 	D_use_color(text_color);
 	R_text(buf);
 	R_text(buf);
-	R_flush();
     }
     }
 
 
     return 0;
     return 0;

+ 0 - 1
display/d.histogram/main.c

@@ -211,7 +211,6 @@ int main(int argc, char **argv)
     else
     else
 	bar(&dist_stats, &pcolors);
 	bar(&dist_stats, &pcolors);
 
 
-    R_flush();
     R_close_driver();
     R_close_driver();
 
 
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);

+ 7 - 17
display/d.linegraph/main.c

@@ -333,8 +333,8 @@ int main(int argc, char **argv)
 
 
     for (i = 0; i <= num_y_files; i++) {
     for (i = 0; i <= num_y_files; i++) {
 	if ((in[i].fp = fopen(in[i].full_name, "r")) == NULL) {
 	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 @@ int main(int argc, char **argv)
 
 
 	/* didn't find a number or hit EOF before our time */
 	/* didn't find a number or hit EOF before our time */
 	if ((err != 1) || (err == EOF)) {
 	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 */
 	/* for each Y data file, get a value and compute where to draw it */
@@ -362,10 +362,9 @@ int main(int argc, char **argv)
 	    if (line < in[i].num_pnts) {
 	    if (line < in[i].num_pnts) {
 		err = fscanf(in[i].fp, "%f", &in[i].value);
 		err = fscanf(in[i].fp, "%f", &in[i].value);
 		if ((in[i].num_pnts >= line) && (err != 1)) {
 		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
 		/* in case the Y file has fewer lines than the X file, we will skip
@@ -554,7 +553,6 @@ int main(int argc, char **argv)
     D_use_color(title_color);
     D_use_color(title_color);
     D_polyline_abs(x_line, y_line, 3);
     D_polyline_abs(x_line, y_line, 3);
 
 
-    R_flush();
     R_close_driver();
     R_close_driver();
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);
 }
 }
@@ -566,11 +564,3 @@ float rem(long int x, long int y)
     return ((float)(x - y * d));
     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);
-}

+ 1 - 1
display/d.rast/display.c

@@ -71,7 +71,7 @@ static int cell_draw(const char *name,
 
 
     }
     }
     D_cell_draw_end();
     D_cell_draw_end();
-    R_flush();
+
     G_percent(nrows, nrows, 2);
     G_percent(nrows, nrows, 2);
 
 
     /* Wrap up and return */
     /* Wrap up and return */

+ 0 - 1
display/d.rhumbline/plot.c

@@ -39,7 +39,6 @@ plot(double lon1, double lat1, double lon2, double lat2, int line_color,
 	G_plot_where_xy(lon1, (lat1 + lat2) / 2, &text_x, &text_y);
 	G_plot_where_xy(lon1, (lat1 + lat2) / 2, &text_x, &text_y);
 	G_plot_line(lon1, lat1, lon2, lat2);
 	G_plot_line(lon1, lat1, lon2, lat2);
     }
     }
-    R_flush();
 
 
     return 0;
     return 0;
 }
 }

+ 0 - 1
include/raster.h

@@ -1,7 +1,6 @@
 #ifndef _GRASS_RASTER_H
 #ifndef _GRASS_RASTER_H
 #define _GRASS_RASTER_H
 #define _GRASS_RASTER_H
 
 
-void R_flush(void);
 int R_open_driver(void);
 int R_open_driver(void);
 void R_close_driver(void);
 void R_close_driver(void);
 
 

+ 0 - 1
lib/cairodriver/Driver.c

@@ -39,7 +39,6 @@ const struct driver *Cairo_Driver(void)
     drv.Begin_scaled_raster = Cairo_begin_scaled_raster;
     drv.Begin_scaled_raster = Cairo_begin_scaled_raster;
     drv.Scaled_raster = Cairo_scaled_raster;
     drv.Scaled_raster = Cairo_scaled_raster;
     drv.End_scaled_raster = Cairo_end_scaled_raster;
     drv.End_scaled_raster = Cairo_end_scaled_raster;
-    drv.Respond = Cairo_Respond;
     drv.color_rgb = Cairo_color_rgb;
     drv.color_rgb = Cairo_color_rgb;
     drv.draw_line = Cairo_draw_line;
     drv.draw_line = Cairo_draw_line;
     drv.draw_point = Cairo_draw_point;
     drv.draw_point = Cairo_draw_point;

+ 0 - 3
lib/cairodriver/Graph.c

@@ -233,9 +233,6 @@ int Cairo_Graph_set(void)
     else
     else
 	ca.bgcolor_a = 1.0;
 	ca.bgcolor_a = 1.0;
 
 
-    p = getenv("GRASS_PNG_AUTO_WRITE");
-    ca.auto_write = p && strcmp(p, "TRUE") == 0;
-
     antialias = CAIRO_ANTIALIAS_DEFAULT;
     antialias = CAIRO_ANTIALIAS_DEFAULT;
     p = getenv("GRASS_ANTIALIAS");
     p = getenv("GRASS_ANTIALIAS");
     if (p && G_strcasecmp(p, "default") == 0)
     if (p && G_strcasecmp(p, "default") == 0)

+ 0 - 24
lib/cairodriver/Respond.c

@@ -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();
-}

+ 0 - 2
lib/cairodriver/cairodriver.h

@@ -53,7 +53,6 @@ struct cairo_state {
     int file_type;
     int file_type;
     int width, height, stride;
     int width, height, stride;
     unsigned char *grid;
     unsigned char *grid;
-    int auto_write;
     double bgcolor_r, bgcolor_g, bgcolor_b, bgcolor_a;
     double bgcolor_r, bgcolor_g, bgcolor_b, bgcolor_a;
     int modified;
     int modified;
     int mapped;
     int mapped;
@@ -82,7 +81,6 @@ extern void Cairo_Line_width(double);
 extern void Cairo_Polygon(const double *, const double *, int);
 extern void Cairo_Polygon(const double *, const double *, int);
 extern void Cairo_Polyline(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_Polydots(const double *, const double *, int);
-extern void Cairo_Respond(void);
 extern void Cairo_draw_text(const char *);
 extern void Cairo_draw_text(const char *);
 extern void Cairo_text_box(const char *, double *, double *, double *, double *);
 extern void Cairo_text_box(const char *, double *, double *, double *, double *);
 extern void Cairo_set_font(const char *);
 extern void Cairo_set_font(const char *);

+ 0 - 7
lib/cairodriver/cairodriver.html

@@ -69,13 +69,6 @@ Several environment variables affect the operation of the Cairo driver:
   <LI><B>GRASS_TRANSPARENT=[TRUE|FALSE]</B><BR>
   <LI><B>GRASS_TRANSPARENT=[TRUE|FALSE]</B><BR>
     sets transparent background on (TRUE) or off (FALSE, default).
     sets transparent background on (TRUE) or off (FALSE, default).
   </LI>
   </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>
   <LI><B>GRASS_PNG_READ</B><BR>
      if <tt>TRUE</tt>, the Cairo driver will initialize the image from
      if <tt>TRUE</tt>, the Cairo driver will initialize the image from
     the contents of GRASS_PNGFILE.<BR>
     the contents of GRASS_PNGFILE.<BR>

+ 0 - 9
lib/driver/Respond.c

@@ -1,9 +0,0 @@
-
-#include "driver.h"
-#include "driverlib.h"
-
-void COM_Respond(void)
-{
-    if (driver->Respond)
-	(*driver->Respond) ();
-}

+ 0 - 4
lib/driver/driver.h

@@ -35,7 +35,6 @@ struct driver
 			 const unsigned char *,
 			 const unsigned char *,
 			 const unsigned char *, const unsigned char *);
 			 const unsigned char *, const unsigned char *);
     void (*End_scaled_raster)(void);
     void (*End_scaled_raster)(void);
-    void (*Respond)(void);
 
 
     void (*color_rgb)(int, int, int);
     void (*color_rgb)(int, int, int);
     void (*draw_line)(double, double, double, double);
     void (*draw_line)(double, double, double, double);
@@ -112,9 +111,6 @@ extern int COM_scaled_raster(int, int, const unsigned char *,
 			     const unsigned char *);
 			     const unsigned char *);
 extern void COM_end_scaled_raster(void);
 extern void COM_end_scaled_raster(void);
 
 
-/* Respond.c */
-extern void COM_Respond(void);
-
 /* Set_window.c */
 /* Set_window.c */
 extern void COM_Set_window(double, double, double, double);
 extern void COM_Set_window(double, double, double, double);
 extern void COM_Get_window(double *, double *, double *, double *);
 extern void COM_Get_window(double *, double *, double *, double *);

+ 0 - 1
lib/htmldriver/Driver.c

@@ -37,7 +37,6 @@ const struct driver *HTML_Driver(void)
     drv.Begin_scaled_raster = NULL;
     drv.Begin_scaled_raster = NULL;
     drv.Scaled_raster = NULL;
     drv.Scaled_raster = NULL;
     drv.End_scaled_raster = NULL;
     drv.End_scaled_raster = NULL;
-    drv.Respond = NULL;
     drv.color_rgb = NULL;
     drv.color_rgb = NULL;
     drv.draw_line = NULL;
     drv.draw_line = NULL;
     drv.draw_point = NULL;
     drv.draw_point = NULL;

+ 0 - 1
lib/pngdriver/Driver.c

@@ -39,7 +39,6 @@ const struct driver *PNG_Driver(void)
     drv.Begin_scaled_raster = PNG_begin_scaled_raster;
     drv.Begin_scaled_raster = PNG_begin_scaled_raster;
     drv.Scaled_raster = PNG_scaled_raster;
     drv.Scaled_raster = PNG_scaled_raster;
     drv.End_scaled_raster = NULL;
     drv.End_scaled_raster = NULL;
-    drv.Respond = PNG_Respond;
     drv.color_rgb = PNG_color_rgb;
     drv.color_rgb = PNG_color_rgb;
     drv.draw_line = PNG_draw_line;
     drv.draw_line = PNG_draw_line;
     drv.draw_point = PNG_draw_point;
     drv.draw_point = PNG_draw_point;

+ 0 - 3
lib/pngdriver/Graph_set.c

@@ -71,9 +71,6 @@ int PNG_Graph_set(void)
     G_message("PNG: GRASS_TRUECOLOR status: %s",
     G_message("PNG: GRASS_TRUECOLOR status: %s",
 	      png.true_color ? "TRUE" : "FALSE");
 	      png.true_color ? "TRUE" : "FALSE");
 
 
-    p = getenv("GRASS_PNG_AUTO_WRITE");
-    png.auto_write = p && strcmp(p, "TRUE") == 0;
-
     p = getenv("GRASS_PNG_MAPPED");
     p = getenv("GRASS_PNG_MAPPED");
     do_map = p && strcmp(p, "TRUE") == 0;
     do_map = p && strcmp(p, "TRUE") == 0;
 
 

+ 0 - 8
lib/pngdriver/Respond.c

@@ -1,8 +0,0 @@
-
-#include "pngdriver.h"
-
-void PNG_Respond(void)
-{
-    if (png.auto_write)
-	write_image();
-}

+ 0 - 2
lib/pngdriver/pngdriver.h

@@ -15,7 +15,6 @@ struct png_state
     char *file_name;
     char *file_name;
     int current_color;
     int current_color;
     int true_color;
     int true_color;
-    int auto_write;
     int has_alpha;
     int has_alpha;
     int mapped;
     int mapped;
 
 
@@ -60,7 +59,6 @@ extern void PNG_begin_scaled_raster(int, int[2][2], double[2][2]);
 extern int PNG_scaled_raster(int, int, const unsigned char *,
 extern int PNG_scaled_raster(int, int, const unsigned char *,
 			     const unsigned char *, const unsigned char *,
 			     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_Set_window(double, double, double, double);
 extern void PNG_color_rgb(int, int, int);
 extern void PNG_color_rgb(int, int, int);
 extern void PNG_draw_bitmap(int, int, int, const unsigned char *);
 extern void PNG_draw_bitmap(int, int, int, const unsigned char *);

+ 0 - 4
lib/pngdriver/pngdriver.html

@@ -43,10 +43,6 @@ of the PNG driver.
     sets true-color support. Default is TRUE</LI>
     sets true-color support. Default is TRUE</LI>
   <LI><B>GRASS_PNG_COMPRESSION=[0|1|9]</B><BR>
   <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>
     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>
   <LI><B>GRASS_PNG_READ</B><BR>
      if <tt>TRUE</tt>, the PNG driver will initialize the image from
      if <tt>TRUE</tt>, the PNG driver will initialize the image from
      the contents of GRASS_PNGFILE.</LI>
      the contents of GRASS_PNGFILE.</LI>

+ 0 - 1
lib/psdriver/Driver.c

@@ -39,7 +39,6 @@ const struct driver *PS_Driver(void)
     drv.Begin_scaled_raster = PS_begin_scaled_raster;
     drv.Begin_scaled_raster = PS_begin_scaled_raster;
     drv.Scaled_raster = PS_scaled_raster;
     drv.Scaled_raster = PS_scaled_raster;
     drv.End_scaled_raster = PS_end_scaled_raster;
     drv.End_scaled_raster = PS_end_scaled_raster;
-    drv.Respond = PS_Respond;
     drv.color_rgb = PS_color_rgb;
     drv.color_rgb = PS_color_rgb;
     drv.draw_line = PS_draw_line;
     drv.draw_line = PS_draw_line;
     drv.draw_point = PS_draw_point;
     drv.draw_point = PS_draw_point;

+ 0 - 7
lib/psdriver/Respond.c

@@ -1,7 +0,0 @@
-
-#include "psdriver.h"
-
-void PS_Respond(void)
-{
-    fflush(ps.outfp);
-}

+ 0 - 1
lib/psdriver/psdriver.h

@@ -32,7 +32,6 @@ extern void PS_Erase(void);
 extern void PS_Graph_close(void);
 extern void PS_Graph_close(void);
 extern int PS_Graph_set(void);
 extern int PS_Graph_set(void);
 extern void PS_Line_width(double);
 extern void PS_Line_width(double);
-extern void PS_Respond(void);
 extern void PS_Set_window(double, double, double, double);
 extern void PS_Set_window(double, double, double, double);
 extern void PS_color_rgb(int, int, int);
 extern void PS_color_rgb(int, int, int);
 extern void PS_draw_bitmap(int, int, int, const unsigned char *);
 extern void PS_draw_bitmap(int, int, int, const unsigned char *);

+ 0 - 6
lib/raster/raster.c

@@ -71,16 +71,10 @@ int R_open_driver(void)
     return 0;
     return 0;
 }
 }
 
 
-void R_flush(void)
-{
-    COM_Respond();
-}
-
 void R_close_driver(void)
 void R_close_driver(void)
 {
 {
     const char *cmd = getenv("GRASS_NOTIFY");
     const char *cmd = getenv("GRASS_NOTIFY");
 
 
-    COM_Respond();
     COM_Graph_close();
     COM_Graph_close();
 
 
     if (cmd)
     if (cmd)