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
|
#!/usr/bin/env perl
use strict;
use warnings;
use DDP {deparse => 1};
my $file_name = shift // "vm.h";
open my $fh, '<', $file_name;
my @res = ();
while (my $line = <$fh>) {
if ($line =~ /__code (\w+)/) {
my $args = $';
#$args eq (Impl* vm, pde_t* pgdir, char* init, uint sz, __code next(...));
while ($args =~ /((?:struct|union|const)\s+)?([\w*\[\]_]+)\s*(\w+),?/g) {
push(@res, "$2 $3");
}
}
}
my @uniq = uniq(@res);
p @uniq;
sub uniq {
my %seen;
return grep { !$seen{$_}++ } @_;
}
|