#!/usr/bin/perl
use strict;
my ($p, @params, %param_t, %param_d);

while (<>) {
	my @params = split '\0', $_;
	foreach $p (@params) {
		next if (!$p);
		# description, it has " () "
		if ($p =~ /(\S+) \(\) (.+)/) {
			$param_d{$1} = $2;
			next;
		}
		# type in parens
		if ($p =~ /(\S+)\s+(.*)/) {
			$param_t{$1} = $2;
			next;
		}
		# what's after '='
		if ($p =~ /(\S+=).*/) {
			$param_t{$1} = '(string)';
			next;
		}
		# parameter has no value
		if ($p =~ /(\S+)/) {
			$param_t{$1} = '';
			next;
		}
	}
}

# print it
foreach $p (sort(keys(%param_t))) {
	print "$p $param_t{$p}\n";
	if (!$param_d{$p}) {
		print "  No description\n";
	} else {
		print "  $param_d{$p}\n";
	}
	print "\n";
}

# descriptions alone; typos
foreach $p (sort(keys(%param_d))) {
	if (!$param_t{$p}) {
		print STDERR "$p only has description\n";
	}
}
