#!/usr/local/bin/perl -w
%table = ();
%where = ();
sub notice
{
my ($index,$str) = @_;
${$cur}[$index] = [] unless defined ${$cur}[$index];
my $array = ${$cur}[$index];
push(@$array,$str);
$where{$str} = [] unless defined $where{$str};
push (@{$where{$str}},$Func,$index);
}
while (<>)
{
if (defined $Func)
{
if (/^}/)
{
undef $Func;
undef $cur;
}
if (/strn?cmp\s*\(\s*LangString\(args\[(\d+)\]\)\s*,\s*("[^"]*")\s*/)
{
notice($1,$2);
}
elsif (/strn?cmp\s*\(\s*("[^"]*")\s*,LangString\(args\[(\d+)\]\)/)
{
notice($2,$1);
}
}
else
{
if (/^([A-Za-z][A-Za-z0-9_]*)\s*\(/)
{
$Func = "$ARGV:$1";
$table{$Func} = [] if (!defined $table{$Func});
$cur = $table{$Func};
}
}
}
foreach $Func (sort keys %table)
{
$cur = $table{$Func};
if (@{$cur})
{
print "$Func:\n";
my $i = 0;
for ($i = 0; $i < @{$cur}; $i++)
{
if (defined ${$cur}[$i])
{
my $array = ${$cur}[$i];
print " $i ",join(' ',@$array),"\n";
}
}
print "\n";
}
}
foreach $str (sort keys %where)
{
my $array = $where{$str};
my $i = 0;
print "$str:";
for ($i=0; $i < @{$array}; $i += 2)
{
print " ${$array}[$i](${$array}[$i+1])";
}
print "\n";
}