[GRASS-SVN] r64375 - in grass/branches/releasebranch_7_0: . gui/xml lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jan 31 01:54:35 PST 2015
Author: martinl
Date: 2015-01-31 01:54:35 -0800 (Sat, 31 Jan 2015)
New Revision: 64375
Modified:
grass/branches/releasebranch_7_0/
grass/branches/releasebranch_7_0/gui/xml/grass-interface.dtd
grass/branches/releasebranch_7_0/lib/gis/parser_dependencies.c
grass/branches/releasebranch_7_0/lib/gis/parser_interface.c
grass/branches/releasebranch_7_0/lib/gis/parser_local_proto.h
Log:
Add inter-dependency rules to --interface-description output
See http://trac.osgeo.org/grass/wiki/Grass7Planning#Tobebackported
(merge r64226 from trunk)
Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
- /grass/trunk:64258,64367
+ /grass/trunk:64226,64258,64367
Modified: grass/branches/releasebranch_7_0/gui/xml/grass-interface.dtd
===================================================================
--- grass/branches/releasebranch_7_0/gui/xml/grass-interface.dtd 2015-01-30 22:31:10 UTC (rev 64374)
+++ grass/branches/releasebranch_7_0/gui/xml/grass-interface.dtd 2015-01-31 09:54:35 UTC (rev 64375)
@@ -152,3 +152,23 @@
<!-- list of keywords that describes a task
-->
<!ELEMENT keywords (#PCDATA)>
+
+<!-- option inter-dependency rules
+-->
+<!ELEMENT rules (rule+)>
+
+<!-- an option inter-dependency rule
+-->
+<!ELEMENT rule (rule-flag*, rule-option*)>
+<!ATTLIST rule type (exclusive | required | requires | requires-all |
+ excludes | collective) #REQUIRED>
+
+<!-- a flag name
+-->
+<!ELEMENT rule-flag EMPTY>
+<!ATTLIST rule-flag key CDATA #REQUIRED>
+
+<!-- an option name
+-->
+<!ELEMENT rule-option EMPTY>
+<!ATTLIST rule-option key CDATA #REQUIRED>
Modified: grass/branches/releasebranch_7_0/lib/gis/parser_dependencies.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/gis/parser_dependencies.c 2015-01-30 22:31:10 UTC (rev 64374)
+++ grass/branches/releasebranch_7_0/lib/gis/parser_dependencies.c 2015-01-31 09:54:35 UTC (rev 64375)
@@ -408,3 +408,40 @@
}
return FALSE;
}
+
+static const char * const rule_types[] = {
+ "exclusive",
+ "required",
+ "requires",
+ "requires-all",
+ "excludes",
+ "collective"
+};
+
+void G__describe_option_rules_xml(FILE *fp)
+{
+ unsigned int i, j;
+
+ if (!rules.count)
+ return;
+
+ fprintf(fp, "\t<rules>\n");
+ for (i = 0; i < rules.count; i++) {
+ const struct rule *rule = &((const struct rule *) rules.data)[i];
+ fprintf(fp, "\t\t<rule type=\"%s\">\n", rule_types[rule->type]);
+ for (j = 0; j < rule->count; j++) {
+ void *p = rule->opts[j];
+ if (is_flag(p)) {
+ const struct Flag *flag = (const struct Flag *) p;
+ fprintf(fp, "\t\t\t<rule-flag key=\"%c\"/>\n", flag->key);
+ }
+ else {
+ const struct Option *opt = (const struct Option *) p;
+ fprintf(fp, "\t\t\t<rule-option key=\"%s\"/>\n", opt->key);
+ }
+ }
+ fprintf(fp, "\t\t</rule>\n");
+ }
+ fprintf(fp, "\t</rules>\n");
+}
+
Modified: grass/branches/releasebranch_7_0/lib/gis/parser_interface.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/gis/parser_interface.c 2015-01-30 22:31:10 UTC (rev 64374)
+++ grass/branches/releasebranch_7_0/lib/gis/parser_interface.c 2015-01-31 09:54:35 UTC (rev 64375)
@@ -352,5 +352,7 @@
fprintf(stdout, "\n\t\t</description>\n");
fprintf(stdout, "\t</flag>\n");
+ G__describe_option_rules_xml(stdout);
+
fprintf(stdout, "</task>\n");
}
Modified: grass/branches/releasebranch_7_0/lib/gis/parser_local_proto.h
===================================================================
--- grass/branches/releasebranch_7_0/lib/gis/parser_local_proto.h 2015-01-30 22:31:10 UTC (rev 64374)
+++ grass/branches/releasebranch_7_0/lib/gis/parser_local_proto.h 2015-01-31 09:54:35 UTC (rev 64375)
@@ -59,6 +59,7 @@
void G__check_option_rules(void);
void G__describe_option_rules(void);
int G__has_required_rule(void);
+void G__describe_option_rules_xml(FILE *);
#endif
More information about the grass-commit
mailing list