[GRASS-SVN] r45957 - in grass/branches/releasebranch_6_4: include lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 13 15:20:58 EDT 2011


Author: martinl
Date: 2011-04-13 12:20:58 -0700 (Wed, 13 Apr 2011)
New Revision: 45957

Modified:
   grass/branches/releasebranch_6_4/include/gisdefs.h
   grass/branches/releasebranch_6_4/lib/gis/percent.c
Log:
gislib: backport G_usset/set_percent_routine() - used by wxGUI digitizer


Modified: grass/branches/releasebranch_6_4/include/gisdefs.h
===================================================================
--- grass/branches/releasebranch_6_4/include/gisdefs.h	2011-04-13 19:04:37 UTC (rev 45956)
+++ grass/branches/releasebranch_6_4/include/gisdefs.h	2011-04-13 19:20:58 UTC (rev 45957)
@@ -905,6 +905,8 @@
 int G_percent(long, long, int);
 int G_percent2(long, long, int, FILE *);
 int G_percent_reset(void);
+void G_set_percent_routine(int (*) (int));
+void G_unset_percent_routine(void);
 
 /* plot.c */
 int G_setup_plot(double, double, double, double, int (*)(int, int),

Modified: grass/branches/releasebranch_6_4/lib/gis/percent.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/gis/percent.c	2011-04-13 19:04:37 UTC (rev 45956)
+++ grass/branches/releasebranch_6_4/lib/gis/percent.c	2011-04-13 19:20:58 UTC (rev 45957)
@@ -10,8 +10,6 @@
  * (>=v2). Read the file COPYING that comes with GRASS for details.
  *
  * \author GRASS GIS Development Team
- *
- * \date 1999-2008
  */
 
 #include <stdio.h>
@@ -21,6 +19,7 @@
 static int prev = -1;
 static int first = 1;
 
+static int (*ext_percent) (int);
 
 /**
  * \brief Print percent complete messages.
@@ -151,3 +150,25 @@
 
     return 0;
 }
+
+/**
+ * \brief Establishes percent_routine as the routine that will handle
+ * the printing of percentage progress messages.
+ * 
+ * \param percent_routine routine will be called like this: percent_routine(x)
+ */
+void G_set_percent_routine(int (*percent_routine) (int))
+{
+    ext_percent = percent_routine;
+}
+
+/**
+ * \brief After this call subsequent percentage progress messages will
+ * be handled in the default method.
+ * 
+ * Percentage progress messages are printed directly to stderr.
+ */
+void G_unset_percent_routine(void)
+{
+    ext_percent = NULL;
+}



More information about the grass-commit mailing list