[GRASS-SVN] r34777 - grass/branches/develbranch_6/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Dec 7 05:58:43 EST 2008
Author: hamish
Date: 2008-12-07 05:58:43 -0500 (Sun, 07 Dec 2008)
New Revision: 34777
Modified:
grass/branches/develbranch_6/lib/gis/percent.c
Log:
fix my crappy explaination of the placement logic
Modified: grass/branches/develbranch_6/lib/gis/percent.c
===================================================================
--- grass/branches/develbranch_6/lib/gis/percent.c 2008-12-07 10:45:16 UTC (rev 34776)
+++ grass/branches/develbranch_6/lib/gis/percent.c 2008-12-07 10:58:43 UTC (rev 34777)
@@ -40,20 +40,17 @@
for (row = 0; row < nrows; row++)
{
G_percent (row+1, nrows, 10);
- ...
- ...
- ...
+ do_calculation(row);
}
\endcode
*
- * This will print completion messages at 10% increments; i.e., 10%, 20%, 30%,
- * etc., up to 100%. Each message does not appear on a new line, but rather erases
- * the previous message.
+ * This example code will print completion messages at 10% increments;
+ * i.e., 10%, 20%, 30%, etc., up to 100%. Each message does not appear
+ * on a new line, but rather erases the previous message.
*
- * G_percent() should stay at the start of the for loop. If the loop takes
- * a long time to run, 0% should print before the first iteration has begun,
- * and final 100% message in loop should not be printed before the last
- * iteration is complete. Otherwise it seems to stall at 99% done, etc.
+ * Note that to prevent the illusion of the module stalling, the G_percent()
+ * call is placed before the time consuming part of the for loop, and an
+ * additional call is added after the loop to "finish it off" at 100%.
*
* \param n current element
* \param d total number of elements
@@ -71,12 +68,9 @@
/**
* \brief Print percent complete messages.
*
- * This routine prints a percentage complete message to stderr. The
- * percentage complete is <i>(<b>n</b>/<b>d</b>)*100</i>, and these are
- * printed only for each <b>s</b> percentage.
+ * This routine prints a percentage complete message to the file given
+ * by the out parameter. Otherwise usage is the same as G_percent().
*
- * See G_percent() for details.
- *
* \param n current element
* \param d total number of elements
* \param s increment size
@@ -85,7 +79,7 @@
* \return always returns 0
*/
-int G_percent2(long n, long d, int s, FILE * out)
+int G_percent2(long n, long d, int s, FILE *out)
{
int x, format;
More information about the grass-commit
mailing list