[GRASS-SVN] r39841 - grass/trunk/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Nov 28 00:46:18 EST 2009
Author: glynn
Date: 2009-11-28 00:46:17 -0500 (Sat, 28 Nov 2009)
New Revision: 39841
Modified:
grass/trunk/lib/gis/parser.c
grass/trunk/lib/gis/parser_help.c
grass/trunk/lib/gis/parser_html.c
grass/trunk/lib/gis/parser_interface.c
grass/trunk/lib/gis/parser_local_proto.h
grass/trunk/lib/gis/parser_script.c
grass/trunk/lib/gis/parser_wps.c
Log:
Clean up parser refactoring
Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c 2009-11-27 23:48:44 UTC (rev 39840)
+++ grass/trunk/lib/gis/parser.c 2009-11-28 05:46:17 UTC (rev 39841)
@@ -84,7 +84,7 @@
static int contains(const char *, int);
static int is_option(const char *);
static int set_option(const char *);
-static int check_opts();
+static int check_opts(void);
static int check_an_opt(const char *, int, const char *, const char **, char **);
static int check_int(const char *, const char **);
static int check_double(const char *, const char **);
@@ -419,28 +419,28 @@
/* If first arg is "--interface-description" then print out
* a xml description of the task */
if (strcmp(argv[1], "--interface-description") == 0) {
- usage_xml();
+ G__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) {
- usage_html();
+ G__usage_html();
exit(EXIT_SUCCESS);
}
/* If first arg is "--wps-process-description" then print out
* the wps process description of the task */
if (strcmp(argv[1], "--wps-process-description") == 0) {
- wps_print_process_description();
+ G__wps_print_process_description();
exit(EXIT_SUCCESS);
}
/* If first arg is "--script" then then generate
* g.parser boilerplate */
if (strcmp(argv[1], "--script") == 0) {
- script();
+ G__script();
exit(EXIT_SUCCESS);
}
@@ -683,7 +683,7 @@
}
-int uses_new_gisprompt(void)
+int G__uses_new_gisprompt(void)
{
struct Option *opt;
char age[KEYLENGTH];
@@ -710,7 +710,7 @@
return 0;
}
-void print_keywords(FILE *fd, void (*format)(FILE *, const char *))
+void G__print_keywords(FILE *fd, void (*format)(FILE *, const char *))
{
int i;
@@ -1291,7 +1291,7 @@
return (error);
}
-void split_gisprompt(const char *gisprompt, char *age, char *element,
+static void split_gisprompt(const char *gisprompt, char *age, char *element,
char *desc)
{
const char *ptr1;
Modified: grass/trunk/lib/gis/parser_help.c
===================================================================
--- grass/trunk/lib/gis/parser_help.c 2009-11-27 23:48:44 UTC (rev 39840)
+++ grass/trunk/lib/gis/parser_help.c 2009-11-28 05:46:17 UTC (rev 39841)
@@ -33,7 +33,7 @@
int len, n;
int new_prompt = 0;
- new_prompt = uses_new_gisprompt();
+ new_prompt = G__uses_new_gisprompt();
if (!st->pgm_name) /* v.dave && r.michael */
st->pgm_name = G_program_name();
@@ -49,7 +49,7 @@
}
if (st->module_info.keywords) {
fprintf(stderr, _("\nKeywords:\n "));
- print_keywords(stderr, NULL);
+ G__print_keywords(stderr, NULL);
fprintf(stderr, "\n");
}
Modified: grass/trunk/lib/gis/parser_html.c
===================================================================
--- grass/trunk/lib/gis/parser_html.c 2009-11-27 23:48:44 UTC (rev 39840)
+++ grass/trunk/lib/gis/parser_html.c 2009-11-28 05:46:17 UTC (rev 39841)
@@ -6,14 +6,14 @@
/*!
\brief Print module usage description in HTML format.
*/
-void usage_html(void)
+void G__usage_html(void)
{
struct Option *opt;
struct Flag *flag;
const char *type;
int new_prompt = 0;
- new_prompt = uses_new_gisprompt();
+ new_prompt = G__uses_new_gisprompt();
if (!st->pgm_name) /* v.dave && r.michael */
st->pgm_name = G_program_name();
@@ -47,7 +47,7 @@
fprintf(stdout, "<h2>%s</h2>\n", _("KEYWORDS"));
if (st->module_info.keywords) {
- print_keywords(stdout, NULL);
+ G__print_keywords(stdout, NULL);
fprintf(stdout, "\n");
}
fprintf(stdout, "<h2>%s</h2>\n", _("SYNOPSIS"));
Modified: grass/trunk/lib/gis/parser_interface.c
===================================================================
--- grass/trunk/lib/gis/parser_interface.c 2009-11-27 23:48:44 UTC (rev 39840)
+++ grass/trunk/lib/gis/parser_interface.c 2009-11-28 05:46:17 UTC (rev 39841)
@@ -7,7 +7,7 @@
* \param[in,out] fp file to write to
* \param str string to write
*/
-void print_escaped_for_xml(FILE * fp, const char *str)
+static void print_escaped_for_xml(FILE * fp, const char *str)
{
for (; *str; str++) {
switch (*str) {
@@ -29,7 +29,7 @@
/*!
\brief Print module usage description in XML format.
*/
-void usage_xml(void)
+void G__usage_xml(void)
{
struct Option *opt;
struct Flag *flag;
@@ -39,7 +39,7 @@
char *encoding;
int new_prompt = 0;
- new_prompt = uses_new_gisprompt();
+ new_prompt = G__uses_new_gisprompt();
/* gettext converts strings to encoding returned by nl_langinfo(CODESET) */
@@ -81,7 +81,7 @@
if (st->module_info.keywords) {
fprintf(stdout, "\t<keywords>\n\t\t");
- print_keywords(stdout, print_escaped_for_xml);
+ G__print_keywords(stdout, print_escaped_for_xml);
fprintf(stdout, "\n\t</keywords>\n");
}
Modified: grass/trunk/lib/gis/parser_local_proto.h
===================================================================
--- grass/trunk/lib/gis/parser_local_proto.h 2009-11-27 23:48:44 UTC (rev 39840)
+++ grass/trunk/lib/gis/parser_local_proto.h 2009-11-28 05:46:17 UTC (rev 39841)
@@ -28,7 +28,7 @@
struct Item *next_item;
};
-typedef struct state {
+struct state {
int no_interactive;
int n_opts;
int n_flags;
@@ -52,10 +52,10 @@
struct Item first_item;
struct Item *current_item;
int n_items;
-}state_type;
+};
-extern state_type *st;
+extern struct state *st;
#define BAD_SYNTAX 1
#define OUT_OF_RANGE 2
@@ -66,12 +66,12 @@
/* functions which are used by several parser functions in different files */
-void usage_xml(void);
-void usage_html(void);
-void script(void);
-void wps_print_process_description(void);
-void print_escaped_for_xml(FILE * fp, const char *str);
-int uses_new_gisprompt(void);
-void print_keywords(FILE *fd, void (*format)(FILE *, const char *));
+void G__usage_xml(void);
+void G__usage_html(void);
+void G__script(void);
+void G__wps_print_process_description(void);
+int G__uses_new_gisprompt(void);
+void G__print_keywords(FILE *fd, void (*format)(FILE *, const char *));
-#endif
\ No newline at end of file
+#endif
+
Modified: grass/trunk/lib/gis/parser_script.c
===================================================================
--- grass/trunk/lib/gis/parser_script.c 2009-11-27 23:48:44 UTC (rev 39840)
+++ grass/trunk/lib/gis/parser_script.c 2009-11-28 05:46:17 UTC (rev 39841)
@@ -1,6 +1,6 @@
#include "parser_local_proto.h"
-void script(void)
+void G__script(void)
{
FILE *fp = stdout;
char *type;
@@ -40,7 +40,7 @@
fprintf(fp, "#%% description: %s\n", st->module_info.description);
if (st->module_info.keywords) {
fprintf(fp, "#%% keywords: ");
- print_keywords(fp, NULL);
+ G__print_keywords(fp, NULL);
fprintf(fp, "\n");
}
fprintf(fp, "#%%end\n");
Modified: grass/trunk/lib/gis/parser_wps.c
===================================================================
--- grass/trunk/lib/gis/parser_wps.c 2009-11-27 23:48:44 UTC (rev 39840)
+++ grass/trunk/lib/gis/parser_wps.c 2009-11-28 05:46:17 UTC (rev 39841)
@@ -36,6 +36,25 @@
const char *, const char *, const char *, int ,
const char **, int , const char *, int );
+static void print_escaped_for_xml(FILE * fp, const char *str)
+{
+ for (; *str; str++) {
+ switch (*str) {
+ case '&':
+ fputs("&", fp);
+ break;
+ case '<':
+ fputs("<", fp);
+ break;
+ case '>':
+ fputs(">", fp);
+ break;
+ default:
+ fputc(*str, fp);
+ }
+ }
+}
+
/*!
* \brief Print the WPS 1.0.0 process description XML document to stdout
*
@@ -53,7 +72,7 @@
*
* */
-void wps_print_process_description()
+void G__wps_print_process_description(void)
{
struct Option *opt;
struct Flag *flag;
@@ -73,7 +92,7 @@
int min = 0, max = 0;
int num_keywords = 0;
int found_output = 0;
- new_prompt = uses_new_gisprompt();
+ new_prompt = G__uses_new_gisprompt();
/* gettext converts strings to encoding returned by nl_langinfo(CODESET) */
More information about the grass-commit
mailing list