[asterisk-commits] eliel: branch group/appdocsxml r151975 - /team/group/appdocsxml/main/pbx.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Oct 25 11:26:33 CDT 2008
Author: eliel
Date: Sat Oct 25 11:26:31 2008
New Revision: 151975
URL: http://svn.digium.com/view/asterisk?view=rev&rev=151975
Log:
When the documentation is in AST_XML_STATIC format not pass it throw the AST_XML_DOC
functions for formatting purposes, just leave it as usual.
Modified:
team/group/appdocsxml/main/pbx.c
Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=151975&r1=151974&r2=151975
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Sat Oct 25 11:26:31 2008
@@ -2986,10 +2986,7 @@
char infotitle[64 + AST_MAX_APP + 22], syntitle[40], destitle[40], argtitle[40], seealsotitle[40];
char info[64 + AST_MAX_APP], *synopsis = NULL, *description = NULL, *seealso = NULL;
char stxtitle[40], *syntax = NULL, *arguments = NULL;
- int syntax_size;
-#ifndef XML_DOCUMENTATION
- int description_size, synopsis_size, arguments_size, seealso_size;
-#endif
+ int syntax_size, description_size, synopsis_size, arguments_size, seealso_size;
char *ret = NULL;
int which = 0;
int wordlen;
@@ -3045,53 +3042,57 @@
term_color(seealsotitle, "[See Also]\n", COLOR_MAGENTA, 0, 40);
term_color(syntax, S_OR(acf->syntax, "Not available"), COLOR_CYAN, 0, syntax_size);
#ifdef XML_DOCUMENTATION
- arguments = xmldoc_colorization(S_OR(acf->arguments, "Not available"), COLOR_CYAN, COLOR_BLACK);
- synopsis = xmldoc_colorization(S_OR(acf->synopsis, "Not available"), COLOR_CYAN, COLOR_BLACK);
- description = xmldoc_colorization(S_OR(acf->desc, "Not available"), COLOR_CYAN, COLOR_BLACK);
- seealso = xmldoc_colorization(S_OR(acf->seealso, "Not available"), COLOR_CYAN, COLOR_BLACK);
-#else
- if (!ast_strlen_zero(acf->synopsis)) {
- synopsis_size = strlen(acf->synopsis) + 23;
+ if (acf->docsrc == AST_XML_DOC) {
+ arguments = xmldoc_colorization(S_OR(acf->arguments, "Not available"), COLOR_CYAN, COLOR_BLACK);
+ synopsis = xmldoc_colorization(S_OR(acf->synopsis, "Not available"), COLOR_CYAN, COLOR_BLACK);
+ description = xmldoc_colorization(S_OR(acf->desc, "Not available"), COLOR_CYAN, COLOR_BLACK);
+ seealso = xmldoc_colorization(S_OR(acf->seealso, "Not available"), COLOR_CYAN, COLOR_BLACK);
} else {
- synopsis_size = strlen("Not available") + 23;
- }
- synopsis = ast_malloc(synopsis_size);
-
- if (!ast_strlen_zero(acf->desc)) {
- description_size = strlen(acf->desc) + 23;
- } else {
- description_size = strlen("Not available") + 23;
- }
- description = ast_malloc(description_size);
-
- if (!ast_strlen_zero(acf->arguments)) {
- arguments_size = strlen(acf->arguments) + 23;
- } else {
- arguments_size = strlen("Not available") + 23;
- }
- arguments = ast_malloc(arguments_size);
-
- if (!ast_strlen_zero(acf->seealso)) {
- seealso_size = strlen(acf->seealso) + 23;
- } else {
- seealso_size = strlen("Not available") + 23;
- }
- seealso = ast_malloc(seealso_size);
-
- /* check allocated memory. */
- if (!synopsis || !description || !arguments || !seealso) {
- ast_free(synopsis);
- ast_free(description);
- ast_free(arguments);
- ast_free(seealso);
- ast_free(syntax);
- return CLI_FAILURE;
- }
-
- term_color(arguments, S_OR(acf->arguments, "Not available"), COLOR_CYAN, 0, arguments_size);
- term_color(synopsis, S_OR(acf->synopsis, "Not available"), COLOR_CYAN, 0, synopsis_size);
- term_color(description, S_OR(acf->desc, "Not available"), COLOR_CYAN, 0, description_size);
- term_color(seealso, S_OR(acf->seealso, "Not available"), COLOR_CYAN, 0, seealso_size);
+#endif
+ if (!ast_strlen_zero(acf->synopsis)) {
+ synopsis_size = strlen(acf->synopsis) + 23;
+ } else {
+ synopsis_size = strlen("Not available") + 23;
+ }
+ synopsis = ast_malloc(synopsis_size);
+
+ if (!ast_strlen_zero(acf->desc)) {
+ description_size = strlen(acf->desc) + 23;
+ } else {
+ description_size = strlen("Not available") + 23;
+ }
+ description = ast_malloc(description_size);
+
+ if (!ast_strlen_zero(acf->arguments)) {
+ arguments_size = strlen(acf->arguments) + 23;
+ } else {
+ arguments_size = strlen("Not available") + 23;
+ }
+ arguments = ast_malloc(arguments_size);
+
+ if (!ast_strlen_zero(acf->seealso)) {
+ seealso_size = strlen(acf->seealso) + 23;
+ } else {
+ seealso_size = strlen("Not available") + 23;
+ }
+ seealso = ast_malloc(seealso_size);
+
+ /* check allocated memory. */
+ if (!synopsis || !description || !arguments || !seealso) {
+ ast_free(synopsis);
+ ast_free(description);
+ ast_free(arguments);
+ ast_free(seealso);
+ ast_free(syntax);
+ return CLI_FAILURE;
+ }
+
+ term_color(arguments, S_OR(acf->arguments, "Not available"), COLOR_CYAN, 0, arguments_size);
+ term_color(synopsis, S_OR(acf->synopsis, "Not available"), COLOR_CYAN, 0, synopsis_size);
+ term_color(description, S_OR(acf->desc, "Not available"), COLOR_CYAN, 0, description_size);
+ term_color(seealso, S_OR(acf->seealso, "Not available"), COLOR_CYAN, 0, seealso_size);
+#ifdef XML_DOCUMENTATION
+ }
#endif
ast_cli(a->fd,"%s%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n", infotitle, stxtitle, syntax, argtitle, arguments,
@@ -6571,40 +6572,66 @@
char seealsotitle[40];
char info[64 + AST_MAX_APP], *synopsis = NULL, *description = NULL, *syntax = NULL, *arguments = NULL;
char *seealso = NULL;
- int syntax_size;
-#ifndef XML_DOCUMENTATION
- int synopsis_size, description_size, arguments_size, seealso_size;
+ int syntax_size, synopsis_size, description_size, arguments_size, seealso_size;
+
+ no_registered_app = 0;
+
+ snprintf(info, sizeof(info), "\n -= Info about application '%s' =- \n\n", aa->name);
+ term_color(infotitle, info, COLOR_MAGENTA, 0, sizeof(infotitle));
+ term_color(stxtitle, "[Syntax]\n", COLOR_MAGENTA, 0, 40);
+ term_color(argtitle, "[Arguments]\n", COLOR_MAGENTA, 0, 40);
+ term_color(syntitle, "[Synopsis]\n", COLOR_MAGENTA, 0, 40);
+ term_color(destitle, "[Description]\n", COLOR_MAGENTA, 0, 40);
+ term_color(seealsotitle, "[See Also]\n", COLOR_MAGENTA, 0, 40);
+#ifdef XML_DOCUMENTATION
+ if (aa->docsrc == AST_XML_DOC) {
+ description = xmldoc_colorization(S_OR(aa->description, "Not available"), COLOR_CYAN, COLOR_BLACK);
+ arguments = xmldoc_colorization(S_OR(aa->arguments, "Not available"), COLOR_CYAN, COLOR_BLACK);
+ synopsis = xmldoc_colorization(S_OR(aa->synopsis, "Not available"), COLOR_CYAN, COLOR_BLACK);
+ seealso = xmldoc_colorization(S_OR(aa->seealso, "Not available"), COLOR_CYAN, COLOR_BLACK);
+ } else {
#endif
-
- no_registered_app = 0;
-#ifndef XML_DOCUMENTATION
- if (!ast_strlen_zero(aa->synopsis)) {
- synopsis_size = strlen(aa->synopsis) + 23;
- } else {
- synopsis_size = strlen("Not available") + 23;
+ if (!ast_strlen_zero(aa->synopsis)) {
+ synopsis_size = strlen(aa->synopsis) + 23;
+ } else {
+ synopsis_size = strlen("Not available") + 23;
+ }
+ synopsis = ast_malloc(synopsis_size);
+
+ if (!ast_strlen_zero(aa->description)) {
+ description_size = strlen(aa->description) + 23;
+ } else {
+ description_size = strlen("Not available") + 23;
+ }
+ description = ast_malloc(description_size);
+
+ if (!ast_strlen_zero(aa->arguments)) {
+ arguments_size = strlen(aa->arguments) + 23;
+ } else {
+ arguments_size = strlen("Not available") + 23;
+ }
+ arguments = ast_malloc(arguments_size);
+
+ if (!ast_strlen_zero(aa->seealso)) {
+ seealso_size = strlen(aa->seealso) + 23;
+ } else {
+ seealso_size = strlen("Not available") + 23;
+ }
+ seealso = ast_malloc(seealso_size);
+
+ if (!synopsis || !description || !arguments || !seealso) {
+ ast_free(synopsis);
+ ast_free(description);
+ ast_free(arguments);
+ ast_free(seealso);
+ continue;
+ }
+ term_color(synopsis, S_OR(aa->synopsis, "Not available"), COLOR_CYAN, 0, synopsis_size);
+ term_color(description, S_OR(aa->description, "Not available"), COLOR_CYAN, 0, description_size);
+ term_color(arguments, S_OR(aa->arguments, "Not available"), COLOR_CYAN, 0, arguments_size);
+ term_color(seealso, S_OR(aa->seealso, "Not available"), COLOR_CYAN, 0, seealso_size);
+#ifdef XML_DOCUMENTATION
}
- synopsis = ast_malloc(synopsis_size);
-
- if (!ast_strlen_zero(aa->description)) {
- description_size = strlen(aa->description) + 23;
- } else {
- description_size = strlen("Not available") + 23;
- }
- description = ast_malloc(description_size);
-
- if (!ast_strlen_zero(aa->arguments)) {
- arguments_size = strlen(aa->arguments) + 23;
- } else {
- arguments_size = strlen("Not available") + 23;
- }
- arguments = ast_malloc(arguments_size);
-
- if (!ast_strlen_zero(aa->seealso)) {
- seealso_size = strlen(aa->seealso) + 23;
- } else {
- seealso_size = strlen("Not available") + 23;
- }
- seealso = ast_malloc(seealso_size);
#endif
if (!ast_strlen_zero(aa->syntax)) {
syntax_size = strlen(aa->syntax) + 23;
@@ -6612,32 +6639,8 @@
syntax_size = strlen("Not available") + 23;
}
syntax = ast_malloc(syntax_size);
-
-#ifdef XML_DOCUMENTATION
- if (syntax) {
-#else
- if (syntax && description && arguments && synopsis && seealso) {
-#endif
- snprintf(info, sizeof(info), "\n -= Info about application '%s' =- \n\n", aa->name);
- term_color(infotitle, info, COLOR_MAGENTA, 0, sizeof(infotitle));
- term_color(stxtitle, "[Syntax]\n", COLOR_MAGENTA, 0, 40);
- term_color(argtitle, "[Arguments]\n", COLOR_MAGENTA, 0, 40);
- term_color(syntitle, "[Synopsis]\n", COLOR_MAGENTA, 0, 40);
- term_color(destitle, "[Description]\n", COLOR_MAGENTA, 0, 40);
- term_color(seealsotitle, "[See Also]\n", COLOR_MAGENTA, 0, 40);
-#ifdef XML_DOCUMENTATION
- description = xmldoc_colorization(S_OR(aa->description, "Not available"), COLOR_CYAN, COLOR_BLACK);
- arguments = xmldoc_colorization(S_OR(aa->arguments, "Not available"), COLOR_CYAN, COLOR_BLACK);
- synopsis = xmldoc_colorization(S_OR(aa->synopsis, "Not available"), COLOR_CYAN, COLOR_BLACK);
- seealso = xmldoc_colorization(S_OR(aa->seealso, "Not available"), COLOR_CYAN, COLOR_BLACK);
-#else
- term_color(synopsis, S_OR(aa->synopsis, "Not available"), COLOR_CYAN, 0, synopsis_size);
- term_color(description, S_OR(aa->description, "Not available"), COLOR_CYAN, 0, description_size);
- term_color(arguments, S_OR(aa->arguments, "Not available"), COLOR_CYAN, 0, arguments_size);
- term_color(seealso, S_OR(aa->seealso, "Not available"), COLOR_CYAN, 0, seealso_size);
-#endif
+ if (syntax && synopsis && arguments && description && seealso) {
term_color(syntax, S_OR(aa->syntax, "Not available"), COLOR_CYAN, 0, syntax_size);
-
ast_cli(a->fd,"%s%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n", infotitle, stxtitle, syntax, argtitle,
arguments, syntitle, synopsis, destitle, description, seealsotitle, seealso);
} else {
More information about the asterisk-commits
mailing list