]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
make a perl proggie which will generate readable manpages
authorMiek Gieben <miekg@NLnetLabs.nl>
Mon, 25 Apr 2005 11:48:14 +0000 (11:48 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Mon, 25 Apr 2005 11:48:14 +0000 (11:48 +0000)
doc/doxyparse.pl [new file with mode: 0755]
doc/ldns-man.tmpl

diff --git a/doc/doxyparse.pl b/doc/doxyparse.pl
new file mode 100755 (executable)
index 0000000..1884f5a
--- /dev/null
@@ -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";
+}
index 139ee5672eda2f4c2990aba278201260d801ed12..d1a7009eb3b29687c32c819e482b8048349f84df 100644 (file)
@@ -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.