[asterisk-commits] twilson: branch twilson/config_docs r370233 - in /team/twilson/config_docs: a...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 18 19:02:58 CDT 2012
Author: twilson
Date: Wed Jul 18 19:02:55 2012
New Revision: 370233
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370233
Log:
Add rudimentary "syntax" support
Modified:
team/twilson/config_docs/apps/app_skel.c
team/twilson/config_docs/doc/appdocsxml.dtd
team/twilson/config_docs/main/config_options.c
team/twilson/config_docs/main/xmldoc.c
Modified: team/twilson/config_docs/apps/app_skel.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_docs/apps/app_skel.c?view=diff&rev=370233&r1=370232&r2=370233
==============================================================================
--- team/twilson/config_docs/apps/app_skel.c (original)
+++ team/twilson/config_docs/apps/app_skel.c Wed Jul 18 19:02:55 2012
@@ -81,15 +81,15 @@
<configInfo module="app_skel" language="en_US">
<configObject name="globals">
<synopsis>Options that apply globally to app_skel</synopsis>
- <category match="true" exact="true">^general$</category>
+ <syntax><category match="true">^general$</category></syntax>
</configObject>
<configObject name="sounds">
<synopsis>Prompts for SkelGuessNumber to play</synopsis>
- <category match="true">^sounds$</category>
+ <syntax><category match="true">^sounds$</category></syntax>
</configObject>
<configObject name="level">
<synopsis>Defined levels for the SkelGuessNumber game</synopsis>
- <category match="false">^(general|sounds)$</category>
+ <syntax><category match="false">^(general|sounds)$</category></syntax>
</configObject>
<configFile name="app_skel.conf">
@@ -100,44 +100,44 @@
<configOption name="games" objectType="globals" default="3">
<synopsis>The number of games a single execution of SkelGuessNumber will play</synopsis>
- <dataType type="uint" min="1" max="1000"/>
+ <syntax><dataType type="uint" min="1" max="1000"/></syntax>
</configOption>
<configOption name="cheat" objectType="globals" default="no">
<synopsis>Should the computer cheat?</synopsis>
<description><para>If enabled, the computer will ignore winning guesses.</para></description>
- <dataType type="boolean"/>
+ <syntax><dataType type="boolean"/></syntax>
</configOption>
<configOption name="prompt" objectType="sounds" default="please-enter-your&number&queue-less-than">
<synopsis>A prompt directing the user to enter a number less than the max number</synopsis>
- <dataType type="string"/>
+ <syntax><dataType type="string"/></syntax>
</configOption>
<configOption name="wrong_guess" objectType="sounds" default="vm-pls-try-again">
<synopsis>The sound file to play when a wrong guess is made</synopsis>
- <dataType type="string"/>
+ <syntax><dataType type="string"/></syntax>
</configOption>
<configOption name="right_guess" objectType="sounds" default="auth-thankyou">
<synopsis>The sound file to play when a correct guess is made</synopsis>
- <dataType type="string"/>
+ <syntax><dataType type="string"/></syntax>
</configOption>
<configOption name="too_low" objectType="sounds" default="low">
<synopsis>The sound file to play when a guess is too low</synopsis>
- <dataType type="string"/>
+ <syntax><dataType type="string"/></syntax>
</configOption>
<configOption name="too_high" objectType="sounds" default="high">
<synopsis>The sound file to play when a guess is too high</synopsis>
- <dataType type="string"/>
+ <syntax><dataType type="string"/></syntax>
</configOption>
<configOption name="lose" objectType="sounds" default="vm-goodbye">
<synopsis>The sound file to play when a player loses</synopsis>
- <dataType type="string"/>
+ <syntax><dataType type="string"/></syntax>
</configOption>
<configOption name="max_number" objectType="level">
<synopsis>The maximum in the range of numbers to guess (1 is the implied minimum)</synopsis>
- <dataType type="uint"/>
+ <syntax><dataType type="uint"/></syntax>
</configOption>
<configOption name="max_guesses" objectType="level">
<synopsis>The maximum number of guesses before a game is considered lost</synopsis>
- <dataType type="uint"/>
+ <syntax><dataType type="uint"/></syntax>
</configOption>
</configInfo>
***/
Modified: team/twilson/config_docs/doc/appdocsxml.dtd
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_docs/doc/appdocsxml.dtd?view=diff&rev=370233&r1=370232&r2=370233
==============================================================================
--- team/twilson/config_docs/doc/appdocsxml.dtd (original)
+++ team/twilson/config_docs/doc/appdocsxml.dtd Wed Jul 18 19:02:55 2012
@@ -40,10 +40,10 @@
<!ATTLIST configInfo module CDATA #REQUIRED>
<!ATTLIST configInfo language CDATA #REQUIRED>
- <!ELEMENT configObject (synopsis?,category?)*>
+ <!ELEMENT configObject (synopsis?,syntax?)*>
<!ATTLIST configObject name ID #REQUIRED>
- <!ELEMENT configOption (synopsis,description?,dataType?)*>
+ <!ELEMENT configOption (synopsis,description?,syntax?)*>
<!ATTLIST configOption name CDATA #REQUIRED>
<!ATTLIST configOption objectType IDREF #REQUIRED>
<!ATTLIST configOption default CDATA #IMPLIED>
@@ -70,7 +70,7 @@
<!ATTLIST dataType max CDATA #IMPLIED>
<!ATTLIST dataType min CDATA #IMPLIED>
- <!ELEMENT syntax (parameter|xi:include)*>
+ <!ELEMENT syntax (parameter|dataType|category|xi:include)*>
<!ATTLIST syntax argsep CDATA ",">
<!ELEMENT description (para|note|warning|variablelist|enumlist|xi:include)*>
Modified: team/twilson/config_docs/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_docs/main/config_options.c?view=diff&rev=370233&r1=370232&r2=370233
==============================================================================
--- team/twilson/config_docs/main/config_options.c (original)
+++ team/twilson/config_docs/main/config_options.c Wed Jul 18 19:02:55 2012
@@ -783,6 +783,7 @@
ast_cli(a->fd, "%s\n", tmp->name);
ast_cli(a->fd, "Synopsis: %s\n", AS_OR(tmp->synopsis, "n/a"));
ast_cli(a->fd, "Description:\n\t%s\n", AS_OR(tmp->description, "n/a"));
+ ast_cli(a->fd, "Syntax:\n\t%s\n", AS_OR(tmp->syntax, "n/a"));
}
}
@@ -851,6 +852,7 @@
ast_cli(a->fd, "<%s> %s\n", tmp->ref, tmp->name);
ast_cli(a->fd, "Synopsis: %s\n", AS_OR(tmp->synopsis, "n/a"));
ast_cli(a->fd, "Description:\n\t%s\n", AS_OR(tmp->description, "n/a"));
+ ast_cli(a->fd, "Syntax:\n\t%s\n", AS_OR(tmp->syntax, "n/a"));
}
}
return CLI_SUCCESS;
Modified: team/twilson/config_docs/main/xmldoc.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_docs/main/xmldoc.c?view=diff&rev=370233&r1=370232&r2=370233
==============================================================================
--- team/twilson/config_docs/main/xmldoc.c (original)
+++ team/twilson/config_docs/main/xmldoc.c Wed Jul 18 19:02:55 2012
@@ -1098,12 +1098,53 @@
return ret;
}
+static char *xmldoc_get_syntax_config_object(struct ast_xml_node *fixnode, const char *name)
+{
+ struct ast_xml_node *node;
+ int match;
+ const char *text;
+ RAII_VAR(struct ast_str *, syntax, ast_str_create(128), ast_free);
+
+ if (!syntax) {
+ return NULL;
+ }
+ if (!(node = ast_xml_find_element(ast_xml_node_get_children(fixnode), "category", NULL, NULL))) {
+ return NULL;
+ }
+ match = ast_true(ast_xml_get_attribute(node, "match"));
+ text = ast_xml_get_text(node);
+ ast_str_set(&syntax, 0, "category %s /%s/\n", match ? "=~" : "!~", text);
+
+ return ast_strdup(ast_str_buffer(syntax));
+}
+
+static char *xmldoc_get_syntax_config_option(struct ast_xml_node *fixnode, const char *name)
+{
+ struct ast_xml_node *node;
+ const char *text;
+ RAII_VAR(struct ast_str *, syntax, ast_str_create(128), ast_free);
+
+ if (!syntax) {
+ return NULL;
+ }
+ if (!(node = ast_xml_find_element(ast_xml_node_get_children(fixnode), "dataType", NULL, NULL))) {
+ return NULL;
+ }
+ text = ast_xml_get_attribute(node, "type");
+ ast_str_set(&syntax, 0, "type: %s\n", text);
+ return ast_strdup(ast_str_buffer(syntax));
+
+ return NULL;
+}
+
/*! \brief Types of syntax that we are able to generate. */
enum syntaxtype {
FUNCTION_SYNTAX,
MANAGER_SYNTAX,
MANAGER_EVENT_SYNTAX,
CONFIG_INFO_SYNTAX,
+ CONFIG_OPTION_SYNTAX,
+ CONFIG_OBJECT_SYNTAX,
COMMAND_SYNTAX
};
@@ -1112,12 +1153,14 @@
const char *type;
enum syntaxtype stxtype;
} stxtype[] = {
- { "function", FUNCTION_SYNTAX },
- { "application", FUNCTION_SYNTAX },
- { "manager", MANAGER_SYNTAX },
- { "managerEvent", MANAGER_EVENT_SYNTAX },
- { "configInfo", CONFIG_INFO_SYNTAX },
- { "agi", COMMAND_SYNTAX },
+ { "function", FUNCTION_SYNTAX },
+ { "application", FUNCTION_SYNTAX },
+ { "manager", MANAGER_SYNTAX },
+ { "managerEvent", MANAGER_EVENT_SYNTAX },
+ { "configInfo", CONFIG_INFO_SYNTAX },
+ { "configOption", CONFIG_OPTION_SYNTAX },
+ { "configObject", CONFIG_OBJECT_SYNTAX },
+ { "agi", COMMAND_SYNTAX },
};
/*! \internal
@@ -1178,6 +1221,12 @@
break;
case MANAGER_EVENT_SYNTAX:
syntax = xmldoc_get_syntax_manager(node, name, "Event");
+ break;
+ case CONFIG_OPTION_SYNTAX:
+ syntax = xmldoc_get_syntax_config_option(node, name);
+ break;
+ case CONFIG_OBJECT_SYNTAX:
+ syntax = xmldoc_get_syntax_config_object(node, name);
break;
default:
syntax = xmldoc_get_syntax_fun(node, name, "parameter", 1, 1);
More information about the asterisk-commits
mailing list