[asterisk-commits] eliel: branch group/appdocsxml r143608 - in /team/group/appdocsxml: apps/ fun...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 19 10:06:28 CDT 2008
Author: eliel
Date: Fri Sep 19 10:06:28 2008
New Revision: 143608
URL: http://svn.digium.com/view/asterisk?view=rev&rev=143608
Log:
Fix some issues in alarmreceiver and dial applications and also in function shell.
Add my amateur radio license to my copyright note.
Add support for <note> and <warning> elements (print them with fancy colors), their content MUST be between <para> elements like:
<note><para>This is a simple <emphasis>note</emphasis>, remember that variable: <variable>MACRO_SOMETHING</variable> will be changed... </para></note>
Modified:
team/group/appdocsxml/apps/app_alarmreceiver.c
team/group/appdocsxml/apps/app_dial.c
team/group/appdocsxml/funcs/func_shell.c
team/group/appdocsxml/main/pbx.c
team/group/appdocsxml/main/xml.c
Modified: team/group/appdocsxml/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_alarmreceiver.c?view=diff&rev=143608&r1=143607&r2=143608
==============================================================================
--- team/group/appdocsxml/apps/app_alarmreceiver.c (original)
+++ team/group/appdocsxml/apps/app_alarmreceiver.c Fri Sep 19 10:06:28 2008
@@ -74,7 +74,7 @@
The application will handshake with the alarm panel, and receive events, validate them, handshake them, and store them until the panel hangs up.
Once the panel hangs up, the application will run the system command specified by the eventcmd setting in <filename>alarmreceiver.conf</filename> and pipe the events to the standard input of the application.
The configuration file also contains settings for DTMF timing, and for the loudness of the acknowledgement tones.</para>
- <note>Only 1 signalling format is supported at this time: Ademco Contact ID.</note>
+ <note><para>Only 1 signalling format is supported at this time: Ademco Contact ID.</para></note>
</description>
</application>
***/
Modified: team/group/appdocsxml/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_dial.c?view=diff&rev=143608&r1=143607&r2=143608
==============================================================================
--- team/group/appdocsxml/apps/app_dial.c (original)
+++ team/group/appdocsxml/apps/app_dial.c Fri Sep 19 10:06:28 2008
@@ -201,9 +201,9 @@
</option>
<option name="m">
<argument name="class" required="false"/>
- Provide hold music to the calling party until a requested
- channel answers. A specific music on hold <replaceable>class</replaceable>
- (as defined in <filename>musiconhold.conf</filename>) can be specified.
+ <para>Provide hold music to the calling party until a requested
+ channel answers. A specific music on hold <replaceable>class</replaceable>
+ (as defined in <filename>musiconhold.conf</filename>) can be specified.</para>
</option>
<option name="M" argsep="^">
<argument name="macro" required="true">
Modified: team/group/appdocsxml/funcs/func_shell.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/funcs/func_shell.c?view=diff&rev=143608&r1=143607&r2=143608
==============================================================================
--- team/group/appdocsxml/funcs/func_shell.c (original)
+++ team/group/appdocsxml/funcs/func_shell.c Fri Sep 19 10:06:28 2008
@@ -76,11 +76,11 @@
<description>
<para>Returns the value from a system command</para>
<para>Example: <literal>Set(foo=${SHELL(echo \bar\)})</literal></para>
- <note>When using the SHELL() dialplan function, your \SHELL\ is /bin/sh,
+ <note><para>When using the SHELL() dialplan function, your \SHELL\ is /bin/sh,
which may differ as to the underlying shell, depending upon your production
platform. Also keep in mind that if you are using a common path, you should
be mindful of race conditions that could result from two calls running
- SHELL() simultaneously.</note>
+ SHELL() simultaneously.</para></note>
</description>
</function>
Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=143608&r1=143607&r2=143608
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Fri Sep 19 10:06:28 2008
@@ -2848,8 +2848,22 @@
{ "<", ">", COLOR_GREEN, COLOR_BLACK, "<replaceable>", "</replaceable>" },
{ "\'", "\'", COLOR_BLUE, COLOR_BLACK, "<literal>", "</literal>" },
{ "*", "*", COLOR_RED, COLOR_BLACK, "<emphasis>", "</emphasis>" },
- { "\"", "\"", COLOR_YELLOW, COLOR_BLACK, "<filename>", "</filename>" }
+ { "\"", "\"", COLOR_YELLOW, COLOR_BLACK, "<filename>", "</filename>" },
+ { "\"", "\"", COLOR_CYAN, COLOR_BLACK, "<directory>", "</directory>" },
+ { "${", "}", COLOR_GREEN, COLOR_BLACK, "<variable>", "</variable>" },
+ { "", "", COLOR_YELLOW, COLOR_BLACK, "<note>", "</note>" },
+ { "", "", COLOR_RED, COLOR_BLACK, "<warning>", "</warning>" }
};
+
+static const struct strspecial_tags {
+ char *tagname; /*!< Special tag name. */
+ char *init; /*!< Print this at the beginning. */
+ char *end; /*!< Print this at the end. */
+} special_tags[] = {
+ { "note", "<note>NOTE:</note> ", "" },
+ { "warning", "<warning>WARNING!!!:</warning> ", "" }
+};
+
/*! \internal
* \brief Calculate the space in bytes used by a format string
@@ -3538,6 +3552,63 @@
}
/*! \internal
+ * \brief Parse special elements defined in 'struct special_tags' special elements must have a <para> element inside them.
+ * \param fixnode special tag node pointer.
+ * \param tabs put tabs before printing the node content.
+ * \param posttabs put posttabs after printing node content.
+ * \param len current buffer len (will be changed if data is appended to this buffer).
+ * \param buffer
+ * \retval 0 if no special element is parsed.
+ * \retval 1 if a special element is parsed.
+ */
+static int xmldoc_parse_specialtags(ast_xml_node *fixnode, const char *tabs, const char *posttabs, int *len, char **buffer)
+{
+ ast_xml_node *node = fixnode;
+ int ret = 0, i, count = 0;
+
+ if (!node || !node->AST_XML_CHILD) {
+ return ret;
+ }
+
+ for (i = 0; i < ARRAY_LEN(special_tags); i++) {
+ if (!strcasecmp((char *)node->AST_XML_NAME, special_tags[i].tagname)) {
+ ret = 1;
+ /* This is a special tag. */
+
+ /* concat data */
+ if (strlen(special_tags[i].init) > 0) {
+ *buffer = ast_realloc(*buffer, *len + strlen(special_tags[i].init) + xmldoc_postbrlen(tabs) + 1);
+ *len += sprintf(*buffer + *len, "%s%s", tabs, special_tags[i].init);
+ }
+
+ /* parse <para> elements inside special tags. */
+ node = node->AST_XML_CHILD;
+ while (node) {
+ if (count > 0) {
+ if (xmldoc_parse_para(node, tabs, posttabs, len, buffer) == 2) {
+ ret = 2;
+ }
+ } else {
+ if (xmldoc_parse_para(node, "", posttabs, len, buffer) == 2) {
+ ret = 2;
+ }
+ }
+ node = node->AST_XML_NEXT;
+ }
+
+ if (strlen(special_tags[i].end) > 0) {
+ *buffer = ast_realloc(*buffer, *len + strlen(special_tags[i].init) + xmldoc_postbrlen(posttabs) + 1);
+ *len += sprintf(*buffer + *len, "%s%s", special_tags[i].end, posttabs);
+ }
+
+ break;
+ }
+ }
+
+ return ret;
+}
+
+/*! \internal
* \brief Parse an <argument> element from the xml documentation.
* \param tabs What to be printed before the argument name.
* \param buffer Output buffer to put values found inside the <argument> element.
@@ -3569,9 +3640,15 @@
if (xmldoc_parse_para(node, tabs, "\n", len, buffer) == 2) {
count++;
ret = 1;
+ } else if (xmldoc_parse_specialtags(node, tabs, "\n", len, buffer) == 2) {
+ count++;
+ ret = 1;
}
} else {
if (xmldoc_parse_para(node, " - ", "\n", len, buffer) == 2) {
+ count++;
+ ret = 1;
+ } else if (xmldoc_parse_specialtags(node, " - ", "\n", len, buffer) == 2) {
count++;
ret = 1;
}
@@ -3612,6 +3689,9 @@
if (xmldoc_parse_para(tmp, (ret ? tabs : ""), "\n", len, buffer)) {
tmp = tmp->AST_XML_NEXT;
continue;
+ } else if (xmldoc_parse_specialtags(tmp, (ret ? tabs : ""), "\n", len, buffer)) {
+ tmp = tmp->AST_XML_NEXT;
+ continue;
}
if (!strcasecmp((char *)tmp->AST_XML_NAME, "value")) {
@@ -3685,6 +3765,9 @@
ret = 1;
tmp = tmp->AST_XML_NEXT;
continue;
+ } else if ((xmldoc_parse_specialtags(tmp, (ret ? tabs : ""), "\n", len, buffer))) {
+ ret = 1;
+ tmp = tmp->AST_XML_NEXT;
}
if (!strcasecmp((char *)tmp->AST_XML_NAME, "variable")) {
@@ -3743,6 +3826,8 @@
if (xmldoc_parse_para(node, (ret ? " " : ""), "\n", len, buffer)) {
ret = 1;
+ } else if (xmldoc_parse_specialtags(node, (ret ? " " : ""), "\n", len, buffer)) {
+ ret = 1;
}
if (xmldoc_parse_variablelist(node, " ", len, buffer)) {
@@ -3842,6 +3927,9 @@
} else if (!strcasecmp((char *)node->AST_XML_NAME, "argument")) {
xmldoc_parse_argument(" ", buffer, len, node);
} else if ((xmldoc_parse_para(node, " ", "\n", len, buffer))) {
+ node = node->AST_XML_NEXT;
+ continue;
+ } else if ((xmldoc_parse_specialtags(node, " ", "\n", len, buffer))) {
node = node->AST_XML_NEXT;
continue;
}
@@ -3927,6 +4015,9 @@
while (tmp) {
/* if found, parse a <para> element. */
if (xmldoc_parse_para(tmp, "", "\n", &len, &ret)) {
+ tmp = tmp->AST_XML_NEXT;
+ continue;
+ } else if (xmldoc_parse_specialtags(tmp, "", "\n", &len, &ret)) {
tmp = tmp->AST_XML_NEXT;
continue;
}
Modified: team/group/appdocsxml/main/xml.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/xml.c?view=diff&rev=143608&r1=143607&r2=143608
==============================================================================
--- team/group/appdocsxml/main/xml.c (original)
+++ team/group/appdocsxml/main/xml.c Fri Sep 19 10:06:28 2008
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 2008, Eliel C. Sardanons <eliels at gmail.com>
+ * Copyright (C) 2008, Eliel C. Sardanons (LU1ALY) <eliels at gmail.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -18,7 +18,7 @@
*
* \brief XML abstraction layer
*
- * \author Eliel C. Sardanons <eliels at gmail.com>
+ * \author Eliel C. Sardanons (LU1ALY) <eliels at gmail.com>
*/
#include "asterisk.h"
More information about the asterisk-commits
mailing list