1#!/usr/bin/perl -w
2
3%knownmsg = (
4   "^Section \\S+ follows section" => "Section out of order",
5   "^Documentation string \\d+ exceeds" => "Documentation string length",
6   "^Calculated standard value for \\S+" => "Calculated standard value",
7   "^Calculated additional value for \\S+" => "Calculated additional value",
8   "^Standard qualifier '\\S+' in section '\\S+'" => "Standard badsection",
9   "^Additional qualifier '\\S+' in section '\\S+'" => "Additional badsection",
10   "^Advanced qualifier '\\S+' in section '\\S+'" => "Advanced badsection",
11   "^First \\S+ (\\S+ )?qualifier '\\S+' is not" => "Bad first qualname",
12   "^\\S+ (\\S+ )?qualifier '\\S+' is not" => "Bad qualname",
13   "^No knowntype specified for" => "Knowntype missing",
14   "^Pattern but no knowntype specified for" => "Pattern without knowntype",
15   "^Knowntype '[^']+' not defined" => "Knowntype undefined",
16   "^Knowntype '[^']+' defined for type '[^']+', used" => "Knowntype wrong type",
17   "^Expected \\S+ (\\S+ )?qualifier is '\\S+' found '\\S+'" => "Bad expected qualname",
18   "^Unexpected information value for" => "Unexpected information",
19   "^\\S+ string for '\\S+' starts in lower case" => "String start lowercase",
20   "^\\S+ string for '\\S+' starts non-alphabetic" => "String start nonalpha",
21   "Section info '[^']+' expected, case mismatch" => "Section info badcase",
22   "^Qualifier '\\S+' type '\\S+' not in section" => "Qualifier badsection",
23   "^No section defined for qualifier '\\S+'" => "No section",
24   "^Sub level section '\\S+' should be under" => "Subsection badsection",
25   "Parameter defined as false" => "Parameter false",
26   "Section '\\S+' not defined in sections[.]standard file" => "Section undefined",
27   "First \\S+ (\\S+ )?'\\S+' is not a parameter" => "Nonparameter first",
28   "Subsequent \\S+ (\\S+ )?'\\S+' is not a parameter" => "Nonparameter later",
29   "Sequence set '\\S+' has no 'aligned'" => "Seqset aligned undefined",
30#   "" => "",
31   "^Multiple definition of parameter/standard/additional" => "Multiple definition of parameter/standard/additional",
32   "Information string for '\\S+' '[^']+' not standard" => "Nonstandard info",
33   "Missing standard information '\\S+' expected" => "Missing standard info",
34   "Dummy message" => "dummy"
35	     );
36
37%knownexp = ();
38$applcnt = 0;
39$embassycnt = 0;
40
41foreach $x (sort (keys (%knownmsg))) {
42    $xname = $knownmsg{$x};
43    $knownexp{$xname} = qr/$x/;
44}
45
46while (<>) {
47    if (/^(Error|Warning): File ([^.]+)[.]acd line \d+: (.*)/) {
48	$type = $1;
49	$file = $2;
50	$message = $3;
51	$found=0;
52	foreach $x (keys (%knownexp)) {
53	    if ($message =~ /$knownexp{$x}/) {
54		if ($type eq "Error") {$y = "* $x"}
55		else {$y = $x}
56		$countknown{$y}++;
57#		print "$file: Message '$y' $countknown{$y}: $message\n";
58		$found=1;
59		last;
60	    }
61	}
62	if (!$found) {
63	    $countmsg{$message}++;
64	    print "$file: Message '++other++' $countmsg{$message}: $message\n";
65	}
66	if($isembassy) {$embassy{$index} .= $_}
67	else {$apps{$index} .= $_}
68    }
69    elsif (/^[+](\S+)\s+[\(]([a-zA-Z0-9]+)[\)]$/) {
70	$embassycnt++;
71	$index = "$2 $1";
72	$embassy{$index} = $_;
73	$isembassy=1;
74    }
75
76    elsif (/^(\S+)$/) {
77	$applcnt++;
78	$index = $1;
79	$apps{$index} = $_;
80	$isembassy=0;
81    }
82
83}
84
85foreach $x (sort (keys ( %countknown ) ) ) {
86    printf "%4d %s\n", $countknown{$x}, $x;
87}
88
89print "\n$applcnt EMBOSS and $embassycnt EMBASSY applications\n";
90
91foreach $x(sort(keys(%apps))) {
92    if($apps{$x} ne "$x\n") {
93	print "\n$apps{$x}";
94    }
95}
96
97foreach $x(sort(keys(%embassy))) {
98    if($embassy{$x} !~ /^\+\S+ [\(][^\)]+[\)]$/) {
99	print "\n$embassy{$x}";
100    }
101}
102