[asterisk-commits] mjordan: branch mjordan/manager-events r368468 - in /team/mjordan/manager-eve...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 4 16:08:30 CDT 2012


Author: mjordan
Date: Mon Jun  4 16:08:27 2012
New Revision: 368468

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=368468
Log:
Turn on automerge

Modified:
    team/mjordan/manager-events/   (props changed)
    team/mjordan/manager-events/include/asterisk/xmldoc.h
    team/mjordan/manager-events/main/xmldoc.c

Propchange: team/mjordan/manager-events/
------------------------------------------------------------------------------
    automerge = *

Modified: team/mjordan/manager-events/include/asterisk/xmldoc.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/manager-events/include/asterisk/xmldoc.h?view=diff&rev=368468&r1=368467&r2=368468
==============================================================================
--- team/mjordan/manager-events/include/asterisk/xmldoc.h (original)
+++ team/mjordan/manager-events/include/asterisk/xmldoc.h Mon Jun  4 16:08:27 2012
@@ -22,6 +22,7 @@
  */
 
 #include "asterisk/xml.h"
+#include "asterisk/stringfields.h"
 
 /*! \brief From where the documentation come from, this structure is useful for
  *  use it inside application/functions/manager actions structure. */
@@ -31,6 +32,35 @@
 };
 
 #ifdef AST_XML_DOCS
+
+struct ao2_container;
+struct ast_str;
+
+/*! \brief Struct that contains the XML documentation for a particular item.  Note
+ * that this is an ao2 ref counted object.
+ *
+ * \note
+ * Each of the ast_str objects are built from the corresponding ast_xmldoc_build_*
+ * calls
+ */
+struct ast_xml_doc {
+	/*!< The syntax of the item */
+	struct ast_str *syntax;
+	/*!< Seealso tagged information, if it exists */
+	struct ast_str *seealso;
+	/*!< The arguments to the item */
+	struct ast_str *arguments:
+	/*!< A synopsis of the item */
+	struct ast_str *synopsis;
+	/*!< A description of the item */
+	struct ast_str *description;
+	AST_DECLARE_STRING_FIELDS(
+		/*!< The name of the item.  Must be unique across all items of a particular type */
+		AST_STRING_FIELD(name);
+		/*!< The type of the item */
+		AST_STRING_FIELD(type);
+	);
+};
 
 /*!
  *  \brief Get the syntax for a specified application or function.
@@ -92,6 +122,15 @@
  */
 char *ast_xmldoc_build_description(const char *type, const char *name, const char *module);
 
+/*!
+ *  \brief Build the documentation for a particular type
+ *  \param type The source of the documentation items (application, function, etc.)
+ *  \retval NULL on error
+ *  \retval An ao2_container populated with ast_xml_doc instances for each item
+ *  that exists within that type
+ */
+struct ao2_container *ast_xmldoc_build_documentation(const char *type);
+
 #endif /* AST_XML_DOCS */
 
 #endif /* _ASTERISK_XMLDOC_H */

Modified: team/mjordan/manager-events/main/xmldoc.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/manager-events/main/xmldoc.c?view=diff&rev=368468&r1=368467&r2=368468
==============================================================================
--- team/mjordan/manager-events/main/xmldoc.c (original)
+++ team/mjordan/manager-events/main/xmldoc.c Mon Jun  4 16:08:27 2012
@@ -1878,6 +1878,62 @@
 	return xmldoc_build_field(type, name, module, "description", 0);
 }
 
+static void ast_xml_doc_destructor(void *obj)
+{
+	struct ast_xml_doc *doc = obj;
+
+	if (!doc) {
+		return;
+	}
+
+	ast_free(doc->syntax);
+	ast_free(doc->seealso);
+	ast_free(doc->arguments);
+	ast_free(doc->synopsis);
+	ast_free(doc->description);
+	ast_string_field_free(doc);
+}
+
+static struct ast_xml_doc *ast_xml_doc_alloc(const char *name, const char *type)
+{
+	struct ast_xml_doc *doc;
+
+	if (!(doc = ao2_alloc(sizeof(*doc), ast_xml_doc_destructor))) {
+		ast_log(AST_LOG_ERROR, "Failed to allocate memory for ast_xml_doc instance\n");
+		return;
+	}
+
+	if (   !(doc->syntax = ast_str_alloc(128))
+		|| !(doc->seealso = ast_str_alloc(128))
+		|| !(doc->arguments = ast_str_alloc(128))
+		|| !(doc->synopsis = ast_str_alloc(128))
+		|| !(doc->description = ast_str_alloc(128))) {
+		ast_log(AST_LOG_ERROR, "Failed to allocate strings for ast_xml_doc instance\n");
+		goto ast_xml_doc_failure;
+	}
+
+	if (!ast_string_field_init(doc, 64)) {
+		ast_log(AST_LOG_ERROR, "Failed to initialize string field for ast_xml_doc instance\n");
+		goto ast_xml_doc_failure;
+	}
+	ast_string_field_set(doc, name, name);
+	ast_string_field_set(doc, type, type);
+
+	return doc;
+
+ast_xml_doc_failure:
+	ao2_ref(doc, -1);
+	return NULL;
+}
+
+
+struct ao2_container *ast_xmldoc_build_documentation(const char *type)
+{
+	struct ao2_container *docs;
+
+
+}
+
 #if !defined(HAVE_GLOB_NOMAGIC) || !defined(HAVE_GLOB_BRACE) || defined(DEBUG_NONGNU)
 static int xml_pathmatch(char *xmlpattern, int xmlpattern_maxlen, glob_t *globbuf)
 {




More information about the asterisk-commits mailing list