File: findstrings

package info (click to toggle)
libtk-tablematrix-perl 1.29-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,344 kB
  • sloc: ansic: 22,028; perl: 2,751; makefile: 2,132; sh: 16
file content (75 lines) | stat: -rwxr-xr-x 1,317 bytes parent folder | download | duplicates (22)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/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";
 }