[asterisk-commits] russell: branch russell/LaTeX_docs r58927 - in /team/russell/LaTeX_docs: ./ b...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Mar 15 15:06:34 MST 2007


Author: russell
Date: Thu Mar 15 17:06:33 2007
New Revision: 58927

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58927
Log:
Add CLI command to generate application docs in LaTeX format
Add asterisk.pdf makefile target

Modified:
    team/russell/LaTeX_docs/Makefile
    team/russell/LaTeX_docs/build_tools/make_buildopts_h
    team/russell/LaTeX_docs/main/pbx.c

Modified: team/russell/LaTeX_docs/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/LaTeX_docs/Makefile?view=diff&rev=58927&r1=58926&r2=58927
==============================================================================
--- team/russell/LaTeX_docs/Makefile (original)
+++ team/russell/LaTeX_docs/Makefile Thu Mar 15 17:06:33 2007
@@ -46,6 +46,7 @@
 export ASTCONFPATH
 export NOISY_BUILD
 export MENUSELECT_CFLAGS
+export AST_DEVMODE
 export CC
 export CXX
 export AR
@@ -676,4 +677,9 @@
 	@echo "Generating input for menuselect ..."
 	@build_tools/prep_moduledeps > $@
 
+asterisk.pdf: doc/asterisk.pdf
+
+doc/asterisk.pdf:
+	cd doc && rubber asterisk.tex
+
 .PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)

Modified: team/russell/LaTeX_docs/build_tools/make_buildopts_h
URL: http://svn.digium.com/view/asterisk/team/russell/LaTeX_docs/build_tools/make_buildopts_h?view=diff&rev=58927&r1=58926&r2=58927
==============================================================================
--- team/russell/LaTeX_docs/build_tools/make_buildopts_h (original)
+++ team/russell/LaTeX_docs/build_tools/make_buildopts_h Thu Mar 15 17:06:33 2007
@@ -9,5 +9,9 @@
 END
 TMP=`grep MENUSELECT_CFLAGS menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
 for x in ${TMP}; do
-     echo "#define ${x} 1"
+	echo "#define ${x} 1"
 done
+if grep AST_DEVMODE makeopts | grep -q yes
+then
+	echo "#define AST_DEVMODE 1"
+fi

Modified: team/russell/LaTeX_docs/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/russell/LaTeX_docs/main/pbx.c?view=diff&rev=58927&r1=58926&r2=58927
==============================================================================
--- team/russell/LaTeX_docs/main/pbx.c (original)
+++ team/russell/LaTeX_docs/main/pbx.c Thu Mar 15 17:06:33 2007
@@ -3202,6 +3202,56 @@
 	return RESULT_SUCCESS;
 }
 
+#ifdef AST_DEVMODE
+static char core_dumpappdocs_help[] =
+"Usage: core dumpappdocs [application]\n"
+"       Dump Application documentation to \\tmp\\ast_appdocs.tex.\n";
+
+static int handle_core_dumpappdocs(int fd, int argc, char *argv[])
+{
+	struct ast_app *app;
+	FILE *f;
+	char *appname = NULL;
+	const char *fn = "/tmp/ast_appdocs.tex";
+
+	if (argc > 3)
+		appname = argv[3];
+
+	if (!(f = fopen(fn, "w+"))) {
+		ast_cli(fd, "Unable to open %s for writing!\n", fn);
+		return RESULT_FAILURE;
+	}
+
+	fprintf(f, "%% This file is automatically generated.  Any manual edits will be lost.\n");
+
+	AST_LIST_LOCK(&apps);
+	AST_LIST_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_LIST_UNLOCK(&apps);
+
+	fclose(f);
+
+	ast_cli(fd, "Documentation has been dumped to %s\n", fn);
+
+	return RESULT_SUCCESS;
+}
+#endif
+
 /*! \brief  handle_show_hints: CLI support for listing registred dial plan hints */
 static int handle_show_hints(int fd, int argc, char *argv[])
 {
@@ -3787,6 +3837,12 @@
 	{ { "core", "show", "application", NULL },
 	handle_show_application, "Describe a specific dialplan application",
 	show_application_help, complete_show_application, &cli_show_application_deprecated },
+
+#ifdef AST_DEVMODE
+	{ { "core", "dumpappdocs", NULL },
+	handle_core_dumpappdocs, "Dump App docs in LaTeX format",
+	core_dumpappdocs_help, NULL },
+#endif
 
 	{ { "core", "set", "global", NULL },
 	handle_set_global, "Set global dialplan variable",



More information about the asterisk-commits mailing list