From: Miek Gieben Date: Mon, 25 Apr 2005 11:48:14 +0000 (+0000) Subject: make a perl proggie which will generate readable manpages X-Git-Tag: release-0.50~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd38b91870b06bbb2ea8ce9f3e964122aaf377aa;p=thirdparty%2Fldns.git make a perl proggie which will generate readable manpages --- diff --git a/doc/doxyparse.pl b/doc/doxyparse.pl new file mode 100755 index 00000000..1884f5a1 --- /dev/null +++ b/doc/doxyparse.pl @@ -0,0 +1,85 @@ +#!/usr/bin/perl + +# Doxygen is usefull for html documentation, but sucks +# in making manual pages. Still tool also parses the .h +# files with the doxygen documentation and creates +# the man page we want +# +# 2 way process +# 1. All the .h files are processed to create in file in which: +# filename | API | description | return values +# are documented +# 2. Another file is parsed which states which function should +# be grouped together in which manpage. Symlinks are also created. +# +# With this all in place, all documentation should be autogenerated +# from the doxydoc. + +use strict; + +my $state; + +my $description; +my $key; +my $return; +my $param; +my $api; + +my %description; +my %api; +my %return; + +# 0 - somewhere in the file +# 1 - in a doxygen par + +$state = 0; + +while(<>) { + if (/\/\*\*/) { + # /** Seen + $state = 1; + next; + } + if (/\*\//) { + $state = 0; + next; + } + + if ($state == 1) { + # inside doxygen + s/^[ \t]*\*[ \t]*//; + + $description = $description . $_; + } + if (/(.*)[\t ]+(.*?)\((.*)\);/) { + # this should also end the current comment parsing + $return = $1; + $key = $2; + $api = $3; + # sometimes the * is stuck to the function + # name instead to the return type + if ($key =~ /^\*/) { + #print"Name starts with *\n"; + $key =~ s/^\*//; + $return = '*' . $return; + } + print "Function seen\t$return [$key] [$api]\n"; + $description{$key} = $description; + $api{$key} = $api; + $return{$key} = $return; + undef $description; + $state = 0; + } +} + +# walk over the found functions +foreach (keys %description) { + if ($_ eq "") { next; } + + # func name || api || description || return + + print $_, "||"; + print $api{$_}, "||"; + print $description{$_},"||"; + print $return{$_},"\n"; +} diff --git a/doc/ldns-man.tmpl b/doc/ldns-man.tmpl index 139ee567..d1a7009e 100644 --- a/doc/ldns-man.tmpl +++ b/doc/ldns-man.tmpl @@ -13,6 +13,14 @@ A new paragraph +.SH RETURN VALUES + + +.SH SEE ALSO + + + + .SH AUTHOR The ldns team at NLnet Labs. Which consists out of: Jelte Jansen, Erik Rozendaal and Miek Gieben.