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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 5 09:05:33 EST 2008


Author: martinl
Date: 2008-01-05 09:05:33 -0500 (Sat, 05 Jan 2008)
New Revision: 29571

Modified:
   grass/trunk/lib/gis/parser.c
Log:
GRASS_GUI can be defined as environment variable or internal GRASS variable.
Cosmetics in doxygen docs.


Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c	2008-01-05 13:21:38 UTC (rev 29570)
+++ grass/trunk/lib/gis/parser.c	2008-01-05 14:05:33 UTC (rev 29571)
@@ -3,12 +3,12 @@
  *
  * \brief GIS library - Argument parsing functions.
  *
+ * \author Radim Blazek
+ *
+ * \date 2003-2008 (C) 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 Radim Blazek
- *
- * \date 2003-2006
  */
 
 /***************************************************************************
@@ -781,8 +781,8 @@
 				j++;
 			    }
 			    if ( !found ) {
-				G_warning ( "BUG in descriptions, option %s in %s does not exist",
-				             tokens[i], opt->key );
+				G_warning (_("BUG in descriptions, option %s in %s does not exist"),
+					   tokens[i], opt->key );
 			    } else {
 				opt->descs[j] = G_store ( tokens[i+1] );
 			    }
@@ -1261,6 +1261,9 @@
 }
 #undef do_escape
 
+/**
+   \brief Print module usage description in XML format.
+**/
 static void G_usage_xml (void)
 {
 	struct Option *opt ;
@@ -1477,6 +1480,9 @@
 	fprintf(stdout, "</task>\n");
 }
 
+/**
+   \brief Print module usage description in HTML format.
+**/
 static void G_usage_html (void)
 {
 	struct Option *opt ;
@@ -1704,6 +1710,9 @@
     fprintf(stdout, "</body>\n</html>\n");
 }
 
+/**
+   \brief Print module usage description used in shell scripts.
+**/
 static void G_script(void)
 {
 	FILE *fp = stdout;
@@ -1817,6 +1826,11 @@
 		);
 }
 
+/**
+  \brief Generates tcltk dialog.
+
+  \param[out] fp File to store tcltk code
+**/
 static void generate_tcl(FILE *fp)
 {
 	int new_prompt = uses_new_gisprompt();
@@ -1914,7 +1928,9 @@
 	fprintf(fp, "end_dialog %d\n", optn - 1);
 }
 
-/* Build Tcl/Tk gui */
+/**
+   \brief Build Tcl/Tk GUI dialog
+**/
 static void G_gui_tcltk (void)
 {
 	FILE *fp;
@@ -1937,7 +1953,7 @@
 #endif
 
 	if (!fp)
-		G_fatal_error("unable to spawn wish");
+	    G_fatal_error(_("Unable to spawn wish"));
 
 	fprintf(fp, "source $env(GISBASE)/etc/gui.tcl\n");
 
@@ -1946,32 +1962,48 @@
 	G_pclose(fp);
 }
 
-/* Build wxPython gui */
+/**
+   \brief Build wxPython GUI dialog
+**/
 static void G_gui_wx (void)
 {
 	char script[GPATH_MAX];
 
 	if (!pgm_name)
-		pgm_name = G_program_name ();
+	    pgm_name = G_program_name ();
 	if (!pgm_name)
-		G_fatal_error("unable to determine program name");
+	    G_fatal_error(_("Unable to determine program name"));
 
 	sprintf(script, "%s/etc/wx/gui_modules/menuform.py", getenv("GISBASE"));
 	G_spawn("python", "menuform.py", script, pgm_name, NULL);
 }
 
-/* Invoke gui */
+/**
+   \brief Invoke GUI dialog 
+
+   Use G_gui_wx() or G_gui_tcltk() to generate GUI dialog.
+
+   G_gui_tcltk() is called by default (if GRASS_GUI is not defined)
+**/
 static void G_gui (void)
 {
-	char *gui = getenv("GRASS_GUI");
+    /* read environment variables first then internal GRASS variable */
+    char *gui = getenv("GRASS_GUI");
+    if (!gui) {
+	gui = G_getenv("GRASS_GUI");
+    }
 
-	if (gui && strcmp(gui, "wx") == 0)
-		G_gui_wx();
-	else
-		G_gui_tcltk();
+    if (gui && strcmp(gui, "wx") == 0)
+	G_gui_wx();
+    else
+	G_gui_tcltk();
+
+    return;
 }
 
-/* Send Tcl/Tk code to tcltkgrass */
+/**
+   \brief Send Tcl/Tk code to tcltkgrass 
+**/
 static void G_tcltk (void)
 {
 	if (!pgm_name)
@@ -2538,7 +2570,7 @@
 			    if ( G_find_file (element, opt->answer, G_mapset()) ) /* found */
 			    {
 				if ( !overwrite && !over ) { 
-				    fprintf(stderr,_("ERROR: option <%s>: <%s> exists.\n"), 
+				    fprintf(stderr, _("ERROR: option <%s>: <%s> exists.\n"), 
 						   opt->key, opt->answer );
 
 				    error = 1;
@@ -2763,7 +2795,6 @@
 	return 0;
 }
 
-
 /**
  * \fn char *G_recreate_command (void)
  *
@@ -2774,7 +2805,6 @@
  *
  * \retval char * Pointer to a char string
  */
-
 char *G_recreate_command (void)
 {
 	static char *buff;
@@ -2878,4 +2908,3 @@
 
 	return(buff) ;
 }
-



More information about the grass-commit mailing list