[GRASS-SVN] r38356 - grass/trunk/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 10 14:53:38 EDT 2009
Author: martinl
Date: 2009-07-10 14:53:38 -0400 (Fri, 10 Jul 2009)
New Revision: 38356
Modified:
grass/trunk/lib/gis/parser.c
Log:
make script() to be language-agnostic
minor cleanup
Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c 2009-07-10 16:13:29 UTC (rev 38355)
+++ grass/trunk/lib/gis/parser.c 2009-07-10 18:53:38 UTC (rev 38356)
@@ -151,10 +151,10 @@
static void define_keywords(void);
static void print_keywords(FILE *, void (*)(FILE *, const char *));
-static void G_gui(void);
-static void G_usage_xml(void);
-static void G_usage_html(void);
-static void G_script(void);
+static void gui(void);
+static void usage_xml(void);
+static void usage_html(void);
+static void script(void);
/*!
* \brief Disables the ability of the parser to operate interactively.
@@ -873,7 +873,7 @@
/* If there are NO arguments, go interactive */
if (argc < 2 && st->has_required && !st->no_interactive && isatty(0)) {
- G_gui();
+ gui();
return -1;
}
else if (argc < 2 && st->has_required && isatty(0)) {
@@ -892,21 +892,21 @@
/* If first arg is "--interface-description" then print out
* a xml description of the task */
if (strcmp(argv[1], "--interface-description") == 0) {
- G_usage_xml();
+ usage_xml();
exit(EXIT_SUCCESS);
}
/* If first arg is "--html-description" then print out
* a html description of the task */
if (strcmp(argv[1], "--html-description") == 0) {
- G_usage_html();
+ usage_html();
exit(EXIT_SUCCESS);
}
/* If first arg is "--script" then then generate
* g.parser boilerplate */
if (strcmp(argv[1], "--script") == 0) {
- G_script();
+ script();
exit(EXIT_SUCCESS);
}
@@ -982,7 +982,7 @@
/* Run the gui if it was specifically requested */
if (force_gui) {
- G_gui();
+ gui();
return -1;
}
@@ -1283,7 +1283,7 @@
/*!
\brief Print module usage description in XML format.
*/
-static void G_usage_xml(void)
+static void usage_xml(void)
{
struct Option *opt;
struct Flag *flag;
@@ -1526,7 +1526,7 @@
/*!
\brief Print module usage description in HTML format.
*/
-static void G_usage_html(void)
+static void usage_html(void)
{
struct Option *opt;
struct Flag *flag;
@@ -1752,21 +1752,21 @@
}
/*!
- \brief Print a module parameter template to assist with creating shell script wrappers.
+ \brief Print a module parameter template to assist with creating
+ script wrappers.
*/
-static void G_script(void)
+static void script(void)
{
FILE *fp = stdout;
char *type;
- fprintf(fp, "#!/bin/sh\n\n");
fprintf(fp,
"############################################################################\n");
fprintf(fp, "#\n");
fprintf(fp, "# MODULE: %s_wrapper\n", G_program_name());
fprintf(fp, "# AUTHOR(S): %s\n", G_whoami());
fprintf(fp, "# PURPOSE: \n");
- fprintf(fp, "# COPYRIGHT: (C) 2009 GRASS Development Team/%s\n",
+ fprintf(fp, "# COPYRIGHT: (C) 2009 by %s, and The GRASS Development Team\n",
G_whoami());
fprintf(fp, "#\n");
fprintf(fp,
@@ -1786,9 +1786,9 @@
fprintf(fp, "# GNU General Public License for more details.\n");
fprintf(fp, "#\n");
fprintf(fp,
- "############################################################################\n");
+ "############################################################################\n\n");
- fprintf(fp, "#%%Module\n");
+ fprintf(fp, "#%%module\n");
if (st->module_info.label)
fprintf(fp, "#%% label: %s\n", st->module_info.label);
if (st->module_info.description)
@@ -1798,13 +1798,13 @@
print_keywords(fp, NULL);
fprintf(fp, "\n");
}
- fprintf(fp, "#%%End\n");
+ fprintf(fp, "#%%end\n");
if (st->n_flags) {
struct Flag *flag;
for (flag = &st->first_flag; flag; flag = flag->next_flag) {
- fprintf(fp, "#%%Flag\n");
+ fprintf(fp, "#%%flag\n");
fprintf(fp, "#%% key: %c\n", flag->key);
if (flag->label)
fprintf(fp, "#%% label: %s\n", flag->label);
@@ -1812,7 +1812,7 @@
fprintf(fp, "#%% description: %s\n", flag->description);
if (flag->guisection)
fprintf(fp, "#%% guisection: %s\n", flag->guisection);
- fprintf(fp, "#%%End\n");
+ fprintf(fp, "#%%end\n");
}
}
@@ -1835,7 +1835,7 @@
break;
}
- fprintf(fp, "#%%Option\n");
+ fprintf(fp, "#%%option\n");
fprintf(fp, "#%% key: %s\n", opt->key);
fprintf(fp, "#%% type: %s\n", type);
fprintf(fp, "#%% required: %s\n", opt->required ? "yes" : "no");
@@ -1858,25 +1858,15 @@
fprintf(fp, "#%% guisection: %s\n", opt->guisection);
if (opt->guidependency)
fprintf(fp, "#%% guidependency: %s\n", opt->guidependency);
- fprintf(fp, "#%%End\n");
+ fprintf(fp, "#%%end\n");
}
}
-
- fprintf(fp,
- "\nif [ -z \"$GISBASE\" ] ; then\n"
- " echo \"You must be in GRASS GIS to run this program.\" 1>&2\n"
- " exit 1\n"
- "fi\n"
- "\n"
- "if [ \"$1\" != \"@ARGS_PARSED@\" ] ; then\n"
- " exec g.parser \"$0\" \"$@\"\n"
- "fi\n" "\n" "# CODE GOES HERE\n" "\n");
}
/*!
- \brief Build wxPython GUI dialog.
+ \brief Invoke GUI dialog
*/
-static void G_gui_wx(void)
+static void gui(void)
{
char script[GPATH_MAX];
@@ -1890,18 +1880,6 @@
G_spawn(getenv("GRASS_PYTHON"), "menuform.py", script, st->pgm_path, NULL);
}
-/*!
- \brief Invoke GUI dialog
-
- Use G_gui_wx() to generate GUI dialog.
-
- G_gui_wx() is called by default (if GRASS_GUI is not defined)
-*/
-static void G_gui(void)
-{
- G_gui_wx();
-}
-
/**************************************************************************
*
* The remaining routines are all local (static) routines used to support
More information about the grass-commit
mailing list