]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/tool/circular
Inital import
[l4.git] / kernel / fiasco / tool / circular
1 #!/usr/bin/perl
2 $, = ' ';               # set output field separator
3 $\ = "\n";              # set output record separator
4
5 $doit = 0;              # Is there a circular dep. with the current module?
6 $modnameseen = 0;       # Have we seen the module name yet?
7 $deps = 0;
8
9 print "\n---\n";
10
11 line: while (<>) {
12     chomp;      # strip record separator
13     if (/^[a-z]/) {
14         $modnameseen = 1;
15         $iam = $_;
16
17         maybeprintmodname() if $doit;
18
19         next;
20     }
21
22     if (/^---$/) {
23         print "\n---\n" if $doit;
24
25         $doit = 0;
26         $iamprinted = 0;
27         $modnameseen = 0;
28     }
29
30     s| \*$|| || next;
31
32     $doit = 1;
33     if ($modnameseen) {
34         maybeprintmodname();
35         $deps++;
36     }
37
38     print $_;
39 }
40
41 print "TOTAL CIRCULAR DEPS:\n$deps";
42
43 ######################################################################
44
45 sub maybeprintmodname {
46     print "$iam" if ! $iamprinted;
47     $iamprinted = 1;
48 }