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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 5 16:39:41 EST 2008


Author: martinl
Date: 2008-02-05 16:39:40 -0500 (Tue, 05 Feb 2008)
New Revision: 29962

Modified:
   grass/trunk/lib/gis/nme_in_mps.c
Log:
Use GNAME_MAX, GMAPSET_MAX macros.
Doxygen strings updated.


Modified: grass/trunk/lib/gis/nme_in_mps.c
===================================================================
--- grass/trunk/lib/gis/nme_in_mps.c	2008-02-05 20:42:42 UTC (rev 29961)
+++ grass/trunk/lib/gis/nme_in_mps.c	2008-02-05 21:39:40 UTC (rev 29962)
@@ -1,19 +1,34 @@
-/*****************************************************************
- * G__name_in_mapset (name_in, name_out, mapset)
- *
- * checks to see if 'name_in' is in the format: <name> in <mapset>
- *
- * returns
- *    1 (TRUE)  name_in is in this format.
- *              name_out will contain the simple <name>
- *              mapset will contain <mapset>
- *    0 (FALSE) name_in is not in this format
- *              name_out and mapset are undefined (changed)
- ****************************************************************/
+/*!
+  \file nme_in_mps.c
 
+  \brief GIS Library - check map name
+  
+  (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 <string.h>
 #include <grass/gis.h>
 
+/*!
+  \brief Checks to see if 'name_in' is in the format: <name> in <mapset>
+  
+  \param name_in full map name
+  \param[out] name_out map name
+  \param[out] mapset mapset name
+  
+  \return 1 name_in is in this format.
+  name_out will contain the simple <name>
+  mapset will contain <mapset>
+  \return 0 name_in is not in this format
+  name_out and mapset are undefined (changed)
+*/
 #ifndef COMMENTED_OUT
 int G__name_in_mapset (
     const char *name_in,
@@ -28,6 +43,20 @@
 }
 #endif
 
+/*!
+  \brief Check if map name is fully qualified (map @ mapset)
+
+  Note:
+  - <b>name</b> is char array of size GNAME_MAX
+  - <b>mapset</b> is char array of size GMAPSET_MAX
+  
+  \param fullname full map name
+  \param[out] name map name
+  \param[out] mapset mapset name
+  
+  \return 1 if input map name is fully qualified
+  \return 0 if input map name is not fully qualified
+*/
 int G__name_is_fully_qualified (
     const char *fullname,
     char *name,char *mapset)
@@ -63,15 +92,16 @@
 
 
 /*!
- * \brief fully qualified file name
- *
- * Returns a fully qualified name for the file <b>name</b> in 
- * <b>mapset.</b> Currently this string is in the form <i>name at mapset</i>, 
- * but the programmer should pretend not to know this and always call this 
- * routine to get the fully qualified name.
- * The following example shows how an interactive version of <i>d.rast</i>
- * interfaces with the command-line version of <i>d.rast</i>:
- \code
+  \brief fully qualified file name
+  
+  Returns a fully qualified name for the file <b>name</b> in 
+  <b>mapset.</b> Currently this string is in the form <i>name @ mapset</i>, 
+  but the programmer should pretend not to know this and always call this 
+  routine to get the fully qualified name.
+  The following example shows how an interactive version of <i>d.rast</i>
+  interfaces with the command-line version of <i>d.rast</i>:
+ 
+  \code
   #include "gis.h"
   int main(char *argc, char **argv)
   {
@@ -79,24 +109,22 @@
   char command[1024];
   G_gisinit(argv[0]);
   mapset = G_ask_cell_old ("", name, "");
-  if (mapset = = NULL) exit(EXIT_SUCCESS);
+  if (mapset == NULL) exit(EXIT_SUCCESS);
   fqn = G_fully_qualified_name (name, mapset);
   sprintf (command, "d.rast map='%s'", fqn);
   system(command);
   }
- \endcode
- *
- *  \param name
- *  \param mapset
- *  \return char * 
- */
+  \endcode
+ 
+  \param name map name
+  \param mapset mapset name
 
+  \return pointer to full map name (map @ mapset)
+*/
 char *
 G_fully_qualified_name  (const char *name, const char *mapset)
-
 {
-    char fullname[1024];
-    char *G_store();
+    char fullname[GNAME_MAX+GMAPSET_MAX];
 
     if(strchr(name, '@'))
     	sprintf (fullname, "%s", name);



More information about the grass-commit mailing list