[asterisk-commits] russell: trunk r72986 - in /trunk: doc/tex/ main/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 2 18:02:17 CDT 2007


Author: russell
Date: Mon Jul  2 18:02:16 2007
New Revision: 72986

URL: http://svn.digium.com/view/asterisk?view=rev&rev=72986
Log:
After some discussion on the asterisk-dev list, we determined that this approach
for extracting application, function, manager, and agi documentation is the wrong
one to take.  The most severe problem is that the output depends on which modules
are loaded as well as compile time options, which both determine which parts are
available.

Removed:
    trunk/doc/tex/ast_agi_commands.tex
    trunk/doc/tex/ast_appdocs.tex
    trunk/doc/tex/ast_cli_commands.tex
    trunk/doc/tex/ast_funcdocs.tex
    trunk/doc/tex/ast_manager_actiondocs.tex
Modified:
    trunk/doc/tex/asterisk.tex
    trunk/main/cli.c
    trunk/main/manager.c
    trunk/main/pbx.c
    trunk/res/res_agi.c

Modified: trunk/doc/tex/asterisk.tex
URL: http://svn.digium.com/view/asterisk/trunk/doc/tex/asterisk.tex?view=diff&rev=72986&r1=72985&r2=72986
==============================================================================
--- trunk/doc/tex/asterisk.tex (original)
+++ trunk/doc/tex/asterisk.tex Mon Jul  2 18:02:16 2007
@@ -108,31 +108,6 @@
   \section{Queue Logs}
   \input{queuelog.tex}
 
-% Generate this using the "core dump clidocs" CLI command that is present
-% when Asterisk is built with dev-mode enabled.
-\chapter{CLI Command Reference}
-\input{ast_cli_commands.tex}
-
-% Generate this using the "core dump appdocs" CLI command that is present
-% when Asterisk is built with dev-mode enabled.
-\chapter{Dialplan Application Reference}
-\input{ast_appdocs.tex}
-
-% Generate this using the "core dump funcdocs" CLI command that is present
-% when Asterisk is built with dev-mode enabled.
-\chapter{Dialplan Function Reference}
-\input{ast_funcdocs.tex}
-
-% Generate this using the "manager dump actiondocs" CLI command that is present
-% when Asterisk is built with dev-mode enabled.
-\chapter{Manager Action Reference}
-\input{ast_manager_actiondocs.tex}
-
-% Generate this using the "agi dump commanddocs" CLI command that is present
-% when Asterisk is built with dev-mode enabled.
-\chapter{AGI Command Reference}
-\input{ast_agi_commands.tex}
-
 % This is a list of files not yet integrated into this document:
 %
 %Misc

Modified: trunk/main/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cli.c?view=diff&rev=72986&r1=72985&r2=72986
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Mon Jul  2 18:02:16 2007
@@ -972,10 +972,6 @@
 
 static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 
-#ifdef AST_DEVMODE
-static char *handle_core_dump_clidocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-#endif
-
 static struct ast_cli_entry cli_cli[] = {
 	/* Deprecated, but preferred command is now consolidated (and already has a deprecated command for it). */
 	NEW_CLI(handle_nodebugchan_deprecated, "Disable debugging on channel(s)"),
@@ -1014,10 +1010,6 @@
 	{ { "soft", "hangup", NULL },
 	handle_softhangup, "Request a hangup on a given channel",
 	softhangup_help, complete_ch_3 },
-
-#ifdef AST_DEVMODE
-	NEW_CLI(handle_core_dump_clidocs, "Dump CLI command documentation in LaTeX format"),
-#endif
 };
 
 /*!
@@ -1457,65 +1449,6 @@
 	AST_LIST_UNLOCK(&helpers);
 	return RESULT_SUCCESS;
 }
-
-#ifdef AST_DEVMODE
-static char *handle_core_dump_clidocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	struct ast_cli_entry *cli;
-	FILE *f;
-	const char *fn = "/tmp/ast_cli_commands.tex";
-	struct cli_iterator i = { NULL, NULL};
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "core dump clidocs";
-		e->usage =
-			"Usage: core dump clidocs\n"
-			"       Dump CLI command documentation to /tmp/ast_cli_commands.tex.\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc != e->args)
-		return CLI_SHOWUSAGE;
-
-	if (!(f = fopen(fn, "w+"))) {
-		ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
-		return CLI_FAILURE;
-	}
-
-	fprintf(f, "%% This file is automatically generated by the \"core dump clidocs\" CLI command.  Any manual edits will be lost.\n");
-
-	AST_LIST_LOCK(&helpers);
-	while ((cli = cli_next(&i))) {
-		/* Hide commands that start with '_' */
-		if (cli->_full_cmd[0] == '_')
-			continue;
-		/* Hide commands that are marked as deprecated. */
-		if (cli->deprecated)
-			continue;
-
-		fprintf(f, "\\section{%s}\n"
-				"\\subsection{Summary}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n"
-				"\\subsection{Usage}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n\n\n", 
-				cli->_full_cmd, cli->summary, cli->usage);
-	}
-	AST_LIST_UNLOCK(&helpers);
-
-	fclose(f);
-
-	ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
-
-	return CLI_SUCCESS;
-}
-#endif /* AST_DEVMODE */
 
 static char *parse_args(const char *s, int *argc, char *argv[], int max, int *trailingwhitespace)
 {

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=72986&r1=72985&r2=72986
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Mon Jul  2 18:02:16 2007
@@ -491,73 +491,6 @@
 	return ret;
 }
 
-#ifdef AST_DEVMODE
-static char *handle_manager_dump_actiondocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	struct manager_action *action;
-	FILE *f;
-	char *action_name = NULL;
-	const char *fn = "/tmp/ast_manager_actiondocs.tex";
-	struct ast_str *authority = ast_str_alloca(80);
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "manager dump actiondocs";
-		e->usage =
-			"Usage: manager dump actiondocs [action]\n"
-			"       Dump manager action documentation to /tmp/ast_manager_actiondocs.tex.\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc == e->args + 1)
-		action_name = a->argv[e->args];
-	else if (a->argc != e->args)
-		return CLI_SHOWUSAGE;
-
-	if (!(f = fopen(fn, "w+"))) {
-		ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
-		return CLI_FAILURE;
-	}
-
-	fprintf(f, "%% This file is automatically generated by the \"manager dump actiondocs\" CLI command.  Any manual edits will be lost.\n");
-
-	ast_rwlock_rdlock(&actionlock);
-	for (action = first_action; action; action = action->next) {
-		if (action_name && strcasecmp(action->action, action_name))
-			continue;
-
-		fprintf(f, "\\section{%s}\n"
-				"\\subsection{Synopsis}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n"
-				"\\subsection{Authority}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n"
-				"\\subsection{Description}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n\n\n", 
-				action->action, action->synopsis, 
-				authority_to_str(action->authority, &authority),
-				action->description);
-
-		if (action_name)
-			break;
-	}
-	ast_rwlock_unlock(&actionlock);
-
-	fclose(f);
-
-	ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
-
-	return CLI_SUCCESS;
-}
-#endif /* AST_DEVMODE */
-
 static int handle_showmancmd(int fd, int argc, char *argv[])
 {
 	struct manager_action *cur;
@@ -775,10 +708,6 @@
 	{ { "manager", "debug", NULL },
 	handle_mandebug, "Show, enable, disable debugging of the manager code",
 	"Usage: manager debug [on|off]\n	Show, enable, disable debugging of the manager code.\n", NULL, NULL },
-
-#ifdef AST_DEVMODE
-	NEW_CLI(handle_manager_dump_actiondocs, "Dump manager action documentation in LaTeX format"),
-#endif
 };
 
 /*

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=72986&r1=72985&r2=72986
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Mon Jul  2 18:02:16 2007
@@ -3153,144 +3153,6 @@
 	return RESULT_SUCCESS;
 }
 
-#ifdef AST_DEVMODE
-static char *handle_core_dump_appdocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	struct ast_app *app;
-	FILE *f;
-	char *appname = NULL;
-	const char *fn = "/tmp/ast_appdocs.tex";
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "core dump appdocs";
-		e->usage =
-			"Usage: core dump appdocs [application]\n"
-			"       Dump Application documentation to /tmp/ast_appdocs.tex.\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc == e->args + 1)
-		appname = a->argv[e->args];
-	else if (a->argc != e->args)
-		return CLI_SHOWUSAGE;
-
-	if (!(f = fopen(fn, "w+"))) {
-		ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
-		return CLI_FAILURE;
-	}
-
-	fprintf(f, "%% This file is automatically generated by the \"core dump appdocs\" CLI command.  Any manual edits will be lost.\n");
-
-	AST_RWLIST_RDLOCK(&apps);
-	AST_RWLIST_TRAVERSE(&apps, app, list) {
-		if (appname && strcasecmp(app->name, appname))
-			continue;
-
-		fprintf(f, "\\section{%s}\n"
-				"\\subsection{Synopsis}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n"
-				"\\subsection{Description}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n\n\n", app->name, app->synopsis, app->description);
-
-		if (appname)
-			break;
-	}
-	AST_RWLIST_UNLOCK(&apps);
-
-	fclose(f);
-
-	ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
-
-	return CLI_SUCCESS;
-}
-
-static void funcdocs_write_section(FILE *f, const char *name)
-{
-	char *section, *cur;
-
-	cur = section = alloca(strlen(name) * 2 + 1);
-
-	for (; *name; name++) {
-		if (*name == '_')
-			*cur++ = '\\';
-		*cur++ = *name;
-	}
-	*cur = '\0';
-
-	fprintf(f, "\\section{%s}\n", section);
-}
-
-static char *handle_core_dump_funcdocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	struct ast_custom_function *acf;
-	FILE *f;
-	char *funcname = NULL;
-	const char *fn = "/tmp/ast_funcdocs.tex";
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "core dump funcdocs";
-		e->usage =
-			"Usage: core dump funcdocs [function]\n"
-			"       Dump Application documentation to /tmp/ast_funcdocs.tex.\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc == e->args + 1)
-		funcname = a->argv[e->args];
-	else if (a->argc != e->args)
-		return CLI_SHOWUSAGE;
-
-	if (!(f = fopen(fn, "w+"))) {
-		ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
-		return CLI_FAILURE;
-	}
-
-	fprintf(f, "%% This file is automatically generated by the \"core dump funcdocs\" CLI command.  Any manual edits will be lost.\n");
-
-	AST_RWLIST_RDLOCK(&acf_root);
-	AST_RWLIST_TRAVERSE(&acf_root, acf, acflist) {
-		if (funcname && strcasecmp(acf->name, funcname))
-			continue;
-
-		funcdocs_write_section(f, acf->name);
-
-		fprintf(f, "\\subsection{Syntax}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n"
-				"\\subsection{Synopsis}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n"
-				"\\subsection{Description}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n\n\n", 
-				acf->syntax, acf->synopsis, acf->desc);
-
-		if (funcname)
-			break;
-	}
-	AST_RWLIST_UNLOCK(&acf_root);
-
-	fclose(f);
-
-	ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
-
-	return CLI_SUCCESS;
-}
-#endif
-
 /*! \brief  handle_show_hints: CLI support for listing registered dial plan hints */
 static int handle_show_hints(int fd, int argc, char *argv[])
 {
@@ -3956,11 +3818,6 @@
 	{ { "core", "show", "application", NULL },
 	handle_show_application, "Describe a specific dialplan application",
 	show_application_help, complete_show_application },
-
-#ifdef AST_DEVMODE
-	NEW_CLI(handle_core_dump_appdocs, "Dump application documentation in LaTeX format"),
-	NEW_CLI(handle_core_dump_funcdocs, "Dump function documentation in LaTeX format"),
-#endif
 
 	{ { "core", "set", "global", NULL },
 	handle_set_global, "Set global dialplan variable",

Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=72986&r1=72985&r2=72986
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Mon Jul  2 18:02:16 2007
@@ -1673,74 +1673,6 @@
 	return 0;
 }
 
-#ifdef AST_DEVMODE
-static char *handle_agi_dump_commanddocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	FILE *f;
-	char *command_name = NULL;
-	const char *fn = "/tmp/ast_agi_commands.tex";
-	int i;
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "agi dump commanddocs";
-		e->usage =
-			"Usage: agi dump commanddocs [command]\n"
-			"       Dump manager action documentation to /tmp/ast_agi_commands.tex.\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc == e->args + 1)
-		command_name = a->argv[e->args];
-	else if (a->argc != e->args)
-		return CLI_SHOWUSAGE;
-
-	if (!(f = fopen(fn, "w+"))) {
-		ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
-		return CLI_FAILURE;
-	}
-
-	fprintf(f, "%% This file is automatically generated by the \"manager dump actiondocs\" CLI command.  Any manual edits will be lost.\n");
-
-	/* XXX Not thread safe :( */
-	for (i = 0; i < ARRAY_LEN(commands); i++) {
-		struct agi_command *command;	
-		char fullcmd[80];
-
-		command = &commands[i];
-		if (!command->cmda[0])
-			break;
-
-		ast_join(fullcmd, sizeof(fullcmd), command->cmda);
-
-		if (command_name && strcasecmp(fullcmd, command_name))
-			continue;
-	
-		fprintf(f, "\\section{%s}\n"
-				"\\subsection{Summary}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n"
-				"\\subsection{Usage}\n"
-				"\\begin{verbatim}\n"
-				"%s\n"
-				"\\end{verbatim}\n\n\n", 
-				fullcmd, command->summary, command->usage);
-
-		if (command_name)
-			break;
-	}
-
-	fclose(f);
-
-	ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
-
-	return CLI_SUCCESS;
-}
-#endif /* AST_DEVMODE */
-
 int ast_agi_register(agi_command *agi)
 {
 	int x;
@@ -2232,10 +2164,6 @@
 	{ { "agi", "dumphtml", NULL },
 	handle_agidumphtml, "Dumps a list of agi commands in html format",
 	dumpagihtml_help },
-
-#ifdef AST_DEVMODE
-	NEW_CLI(handle_agi_dump_commanddocs, "Dump agi command documentation in LaTeX format"),
-#endif
 };
 
 static int unload_module(void)




More information about the asterisk-commits mailing list