[GRASS-SVN] r29740 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 17 15:54:30 EST 2008


Author: martinl
Date: 2008-01-17 15:54:30 -0500 (Thu, 17 Jan 2008)
New Revision: 29740

Modified:
   grass/trunk/lib/gis/env.c
   grass/trunk/lib/gis/gisdbase.c
   grass/trunk/lib/gis/location.c
Log:
gislib: some doxygen strings updated

Modified: grass/trunk/lib/gis/env.c
===================================================================
--- grass/trunk/lib/gis/env.c	2008-01-17 17:54:20 UTC (rev 29739)
+++ grass/trunk/lib/gis/env.c	2008-01-17 20:54:30 UTC (rev 29740)
@@ -1,55 +1,18 @@
-/*
- ****************************************************************
- * GIS environment routines
- *
- ***************************************************************
- * char *
- * G_getenv (name)
- *
- *   returns char pointer to value for name
- *   dies if name not set
- *
- ***************************************************************
- * G_setenv (name, value)
- *
- *   sets environment name to value
- *     if value is NULL, becomes an G_unsetenv (name)
- *   updates .gisrc
- *
- ***************************************************************
- * G_unsetenv (name)
- *
- *   remove name from environment
- *   updates .gisrc
- *
- ***************************************************************
- * char *
- * G__getenv (name)
- *
- *   returns char pointer to value for name
- *   returns NULL if name not set
- *
- ***************************************************************
- * G__setenv (name, value)
- *
- *   sets environment name to value
- *   does NOT update .gisrc
- *
- ***************************************************************
- * G__write_env()
- *
- *   writes current environment to .gisrc
- ***************************************************************
- * char *
- * G__env_name (n)
- *
- *   returns environment variable name n
- *   for eample:
- *     for (n = 0; ; n++)
- *       if ((name = G__env_name(n)) == NULL)
- *          break;
- ***************************************************************/
+/**
+   \file env.c
 
+   \brief GIS library - environment routines
+   
+   (C) 2001-2008 by 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 Original author CERL
+*/
+
 #include <signal.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -59,6 +22,7 @@
 #include <grass/glocale.h>
 
 #define ENV struct env
+
 ENV
 {
     int loc;
@@ -81,13 +45,29 @@
 static int write_env ( int );
 static FILE *open_env ( const char *, int);
 
-/* Set where to find/store variables */
+/**
+   \brief Set where to find/store variables
+
+   Modes:
+    - G_GISRC_MODE_FILE
+    - G_GISRC_MODE_MEMORY 
+
+   \param mode mode to find/store variables (G_GISRC_MODE_FILE by default)
+
+   \return
+*/
 void G_set_gisrc_mode ( int mode )
 {
     varmode = mode; 
 }
 
-/* Get info where variables are stored */
+/**
+   \brief Get info where variables are stored
+
+   \param
+
+   \return mode
+*/
 int G_get_gisrc_mode ( void )
 {
     return ( varmode ); 
@@ -280,6 +260,15 @@
     return fopen (buf, mode);
 }
 
+/**
+   \brief Get enviroment variable
+
+   Calls G_fatal_error() if name not set.
+
+   \param name variable name
+
+   \return char pointer to value for name
+*/ 
 char *G_getenv( const char *name)
 {
     char *value;
@@ -287,11 +276,25 @@
     if ((value = G__getenv(name)))
 	return value;
 
-    G_fatal_error(_("%s not set"), name);
+    G_fatal_error(_("G_getenv(): Variable %s not set"), name);
     return NULL;
 }
 
-/* Read variable from specific place */
+/**
+   \brief Read variable from specific place
+
+   Locations:
+    - G_VAR_GISRC
+    - G_VAR_MAPSET
+
+   G_fatal_error() is called when variable is not found.
+
+   \param name variable name
+   \param loc location id
+
+   \return variable value
+   \return NULL if not found
+*/
 char *G_getenv2( const char *name, int loc )
 {
     char *value;
@@ -303,6 +306,14 @@
     return NULL;
 }
 
+/**
+   \brief Get environment variable
+
+   \param name variable name
+   
+   \return char pointer to value for name
+   \return NULL if name not set
+*/
 char *G__getenv ( const char *name)
 {
     if (strcmp (name, "GISBASE") == 0)
@@ -313,6 +324,15 @@
     return get_env (name, G_VAR_GISRC);
 }
 
+/**
+   \brief Get environment variable from specific place
+
+   \param name variable name
+   \param loc location id
+   
+   \return char pointer to value for name
+   \return NULL if name not set
+*/
 char *G__getenv2 ( const char *name, int loc)
 {
     if (strcmp (name, "GISBASE") == 0)
@@ -323,6 +343,17 @@
     return get_env (name, loc);
 }
 
+/**
+   \brief Set environment variable
+
+   If value is NULL, becomes an G_unsetenv().
+   Updates .gisrc
+
+   \param name variable name
+   \param value variable value
+
+   \return 0
+*/
 int G_setenv (const char *name, const char *value)
 {
     read_env(G_VAR_GISRC);
@@ -331,6 +362,18 @@
     return 0;
 }
 
+/**
+   \brief Set environment variable from specific place
+
+   If value is NULL, becomes an G_unsetenv().
+   Updates .gisrc
+
+   \param name variable name
+   \param value variable value
+   \param loc location id
+
+   \return 0
+*/
 int G_setenv2 (const char *name, const char *value, int loc)
 {
     read_env(loc);
@@ -339,6 +382,14 @@
     return 0;
 }
 
+/**
+   \brief Set environment name to value
+
+   \param name variable name
+   \param value variable value
+
+   \return 0
+*/
 int G__setenv ( const char *name, const char *value)
 {
     read_env(G_VAR_GISRC);
@@ -346,6 +397,15 @@
     return 0;
 }
 
+/**
+   \brief Set environment name to value from specific place
+
+   \param name variable name
+   \param value variable value
+   \param loc location id
+
+   \return 0
+*/
 int G__setenv2 (const char *name, const char *value, int loc)
 {
     read_env(loc);
@@ -353,6 +413,15 @@
     return 0;
 }
 
+/**
+   \brief Remove name from environment
+
+   Updates .gisrc
+
+   \param name variable name
+
+   \return 0
+*/
 int G_unsetenv ( const char *name)
 {
     read_env(G_VAR_GISRC);
@@ -362,6 +431,15 @@
     return 0;
 }
 
+/**
+   \brief Remove name from environment from specific place
+
+   Updates .gisrc
+
+   \param name variable name
+
+   \return 0
+*/
 int G_unsetenv2 ( const char *name, int loc)
 {
     read_env(loc);
@@ -371,6 +449,13 @@
     return 0;
 }
 
+/**
+   \brief Writes current environment to .gisrc
+
+   \param
+
+   \return 0
+*/
 int 
 G__write_env (void)
 {
@@ -380,6 +465,20 @@
     return 0;
 }
 
+/**
+   \brief Get variable name for index n.
+
+   For example:
+   \code
+   for (n = 0; ; n++)
+      if ((name = G__env_name(n)) == NULL)
+        break;
+   \endcode
+
+   \param n index of variable
+
+   \return pointer to variable name
+*/
 char *G__env_name (int n)
 {
     int i;
@@ -392,6 +491,13 @@
     return NULL;
 }
 
+/**
+   \brief Initialize init array for G_VAR_GISRC.
+
+   \param
+
+   \return 0
+*/
 int G__read_env (void)
 {
     init[G_VAR_GISRC] = 0;
@@ -399,6 +505,13 @@
     return 0;
 }
 
+/**
+   \brief Sets filename for gisrc
+
+   \param name filename
+
+   \return 0
+*/
 int G__set_gisrc_file( const char *name)
 {
     gisrc = NULL;
@@ -408,16 +521,30 @@
     return 0;
 }
 
+/**
+   \brief Get gisrc filename
+
+   \param
+   
+   \return char pointer to filename
+*/
 char *G__get_gisrc_file (void)
 {
     return gisrc;
 }
 
+/**
+   \brief Set up alternative environment variables
+
+   \param
+
+   \return 0
+*/
 int G__create_alt_env (void)
 {
     int i;
 
-/* copy env to env2 */
+    /* copy env to env2 */
     env2 = env;
     count2 = count;
     env = NULL;
@@ -430,6 +557,13 @@
     return 0;
 }
 
+/**
+   \brief Switch environments
+
+   \param
+
+   \return 0
+*/
 int G__switch_env (void)
 {
     ENV *tmp;

Modified: grass/trunk/lib/gis/gisdbase.c
===================================================================
--- grass/trunk/lib/gis/gisdbase.c	2008-01-17 17:54:20 UTC (rev 29739)
+++ grass/trunk/lib/gis/gisdbase.c	2008-01-17 20:54:30 UTC (rev 29740)
@@ -1,24 +1,29 @@
-/**********************************************************************
- *
- *   char *
- *   G_gisdbase()
- *
- *   returns:    pointer to string containing the base directory of
- *               GRASS-GRID data.
- **********************************************************************/
+/*!
+  \file gisdbase.c
+  
+  \brief GIS library - environment routines (gisdbase)
+  
+  (C) 2001-2008 by 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 Original author CERL
+*/
 
 #include <grass/gis.h>
 
-
 /*!
- * \brief top level database directory
+ * \brief Get name of top level database directory
  *
- * Returns the
- * full UNIX path name of the directory which holds the database locations. See
- * GISDBASE for a full explanation of this directory.
+ * Returns the full UNIX path name of the directory which holds the
+ * database locations. See GISDBASE for a full explanation of this
+ * directory.
  *
- *  \param void
- *  \return char * 
+ *  \param
+ *  \return pointer to string containing the base directory
  */
 
 char *

Modified: grass/trunk/lib/gis/location.c
===================================================================
--- grass/trunk/lib/gis/location.c	2008-01-17 17:54:20 UTC (rev 29739)
+++ grass/trunk/lib/gis/location.c	2008-01-17 20:54:30 UTC (rev 29740)
@@ -1,20 +1,17 @@
-/**********************************************************************
- *
- *   char *
- *   G_location_path()
- *
- *   returns pointer to the full path name to the current location
- *
- *   note:
- *      exits with message if path not accessible to user
- **********************************************************************
- *
- *   char *
- *   G_location()
- *
- *   returns:    pointer to string containing the one word location
- *               name.
- **********************************************************************/
+/*!
+  \file location.c
+  
+  \brief GIS library - environment routines (location)
+  
+  (C) 2001-2008 by 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 Original author CERL
+*/
 
 #include <stdio.h>
 #include <string.h>
@@ -25,15 +22,15 @@
 
 
 /*!
- * \brief current location directory
+ * \brief Get current location directory
  *
- * Returns the
- * full UNIX path name of the current database location. For example, if the user
- * is working in location <i>spearfish</i> in the <i>/usr/grass5/data</i>
- * database directory, this routine will return a string which looks like
+ * Returns the full UNIX path name of the current database
+ * location. For example, if the user is working in location
+ * <i>spearfish</i> in the <i>/usr/grass5/data</i> database directory,
+ * this routine will return a string which looks like
  * <i>/home/user/grassdata/spearfish</i>.
  *
- *  \param void
+ *  \param
  *  \return char * 
  */
 
@@ -54,23 +51,27 @@
 
 
 /*!
- * \brief current location name
+ * \brief Get current location name
  *
- * Returns the name of
- * the current database location. This routine should be used by modules that
- * need to display the current location to the user. See Locations for
- * an explanation of locations.
+ * Returns the name of the current database location. This routine
+ * should be used by modules that need to display the current location
+ * to the user. See Locations for an explanation of locations.
  *
- *  \param void
- *  \return char * 
+ *  \param
+ *  \return char* tolocation name
  */
-
 char *
 G_location(void)
 {
     return G_getenv ("LOCATION_NAME");
 }
 
+/*!
+ * \brief Get current location path
+ *
+ *  \param
+ *  \return char* to location path
+ */
 char *
 G__location_path(void)
 {



More information about the grass-commit mailing list