Move all the XML documentation API from pbx.c to xmldoc.c.

Export the XML documentation API:
   ast_xmldoc_build_synopsis()
   ast_xmldoc_build_syntax()
   ast_xmldoc_build_description()
   ast_xmldoc_build_seealso()
   ast_xmldoc_build_arguments()
   ast_xmldoc_printable()
   ast_xmldoc_load_documentation()



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155711 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Eliel C. Sardanons
2008-11-10 13:53:23 +00:00
parent 09d2814059
commit 23adb8e509
7 changed files with 1747 additions and 1640 deletions

View File

@@ -56,10 +56,10 @@ int ast_timing_init(void); /*!< Provided by timing.c */
*/
int ast_module_reload(const char *name);
/*! \brief Load XML documentation. Provided by pbx.c
/*! \brief Load XML documentation. Provided by xmldoc.c
* \retval 1 on error.
* \retval 0 on success.
*/
int ast_load_documentation(void);
int ast_xmldoc_load_documentation(void);
#endif /* _ASTERISK__PRIVATE_H */

View File

@@ -62,6 +62,10 @@ extern "C" {
#define COLOR_BRWHITE (37 | 128)
/*@} */
/*! \brief Maximum number of characters needed for a color escape sequence,
* plus a null char */
#define AST_TERM_MAX_ESCAPE_CHARS 23
char *term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout);
/*!

85
include/asterisk/xmldoc.h Normal file
View File

@@ -0,0 +1,85 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2008, Eliel C. Sardanons (LU1ALY) <eliels@gmail.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
#ifndef _ASTERISK_XMLDOC_H
#define _ASTERISK_XMLDOC_H
/*! \file
* \brief Asterisk XML Documentation API
*/
#include "asterisk/xml.h"
#ifdef AST_XML_DOCS
/*!
* \brief Get the syntax for a specified application or function.
* \param type Application, Function or AGI ?
* \param name Name of the application or function.
* \retval NULL on error.
* \retval The generated syntax in a ast_malloc'ed string.
*/
char *ast_xmldoc_build_syntax(const char *type, const char *name);
/*!
* \brief Parse the <see-also> node content.
* \param type 'application', 'function' or 'agi'.
* \param name Application or functions name.
* \retval NULL on error.
* \retval Content of the see-also node.
*/
char *ast_xmldoc_build_seealso(const char *type, const char *name);
/*!
* \brief Generate the [arguments] tag based on type of node ('application',
* 'function' or 'agi') and name.
* \param type 'application', 'function' or 'agi' ?
* \param name Name of the application or function to build the 'arguments' tag.
* \retval NULL on error.
* \retval Output buffer with the [arguments] tag content.
*/
char *ast_xmldoc_build_arguments(const char *type, const char *name);
/*!
* \brief Colorize and put delimiters (instead of tags) to the xmldoc output.
* \param bwinput Not colorized input with tags.
* \param withcolors Result output with colors.
* \retval NULL on error.
* \retval New malloced buffer colorized and with delimiters.
*/
char *ast_xmldoc_printable(const char *bwinput, int withcolors);
/*!
* \brief Generate synopsis documentation from XML.
* \param type The source of documentation (application, function, etc).
* \param name The name of the application, function, etc.
* \retval NULL on error.
* \retval A malloc'ed string with the synopsis.
*/
char *ast_xmldoc_build_synopsis(const char *type, const char *name);
/*!
* \brief Generate description documentation from XML.
* \param type The source of documentation (application, function, etc).
* \param name The name of the application, function, etc.
* \retval NULL on error.
* \retval A malloc'ed string with the formatted description.
*/
char *ast_xmldoc_build_description(const char *type, const char *name);
#endif /* AST_XML_DOCS */
#endif /* _ASTERISK_XMLDOC_H */

View File

@@ -28,7 +28,7 @@ OBJS= tcptls.o io.o sched.o logger.o frame.o loader.o config.o channel.o \
cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
strcompat.o threadstorage.o dial.o event.o adsistub.o audiohook.o \
astobj2.o hashtab.o global_datastores.o version.o \
features.o taskprocessor.o timing.o datastore.o xml.o
features.o taskprocessor.o timing.o datastore.o xml.o xmldoc.o
# we need to link in the objects statically, not as a library, because
# otherwise modules will not have them available if none of the static

View File

@@ -117,8 +117,8 @@ int daemon(int, int); /* defined in libresolv of all places */
#include "asterisk/devicestate.h"
#include "asterisk/module.h"
#include "asterisk/dsp.h"
#include "asterisk/xml.h"
#include "asterisk/buildinfo.h"
#include "asterisk/xmldoc.h"
#include "asterisk/doxyref.h" /* Doxygen documentation */
@@ -3346,7 +3346,7 @@ int main(int argc, char *argv[])
#ifdef AST_XML_DOCS
/* Load XML documentation. */
ast_load_documentation();
ast_xmldoc_load_documentation();
#endif
if (load_modules(1)) { /* Load modules, pre-load only */

1661
main/pbx.c

File diff suppressed because it is too large Load Diff

1621
main/xmldoc.c Normal file

File diff suppressed because it is too large Load Diff