1 # This file is part of the graph-includes package
3 # (c) 2005 Yann Dirson <ydirson@altern.org>
4 # Distributed under version 2 of the GNU GPL.
6 package graphincludes
::project
::default;
7 use graphincludes
::project
;
8 our @ISA = qw(graphincludes::project);
14 $self = $class->SUPER::new
(@_);
16 bless ($self, $class);
18 $self->{IGNOREDDEPS
} = $self->ignored_deps();
19 $self->{IGNOREDEDGES
} = {}; # to be computed in getdeps
26 my ($file,$level) = @_;
27 $level = $main::minshow
unless defined $level;
29 $file =~ s/^$self->{PFXSTRIP}// if defined $self->{PFXSTRIP
};
32 } elsif ($level == 1) {
33 $file =~ s/\.[^.]*$//;
35 } elsif ($level == 2) {
36 if ($file =~ m!(.*)/.*!) {
39 return '<' . $self->filelabel($file, $level - 1) . '>';
57 my $lbl = $self->{IGNOREDEDGES
}->{$src}->{$dst};
60 return "color=gray,constraint=false,label=\"$lbl\"";
62 return $self->SUPER::special_edge
($src,$dst);
71 my ($dstpath, $strip, $srcpath) = @_;
72 join ('/', @
$srcpath[0..($#$srcpath-$strip)], @$dstpath);
76 if (m/^\s*#\s*include\s*"(.*)"/) {
77 my @srcpath = split (m
|/|, $ARGV); # can we avoid to compute this for each dep ?
78 my @dstpath = split (m
|/|, $1);
79 # count number of leading "../" in the #include reference
80 my $strip = 1; # we'll have to strip at least the basename from srcpath
81 while ($dstpath[0] eq '..') { $strip++; shift @dstpath; }
82 while ($#srcpath >= $strip and
83 !defined $self->{NODEIDS
}->{$self->filelabel(fullpath
(\
@dstpath,$strip,\
@srcpath))})
85 my $dstfile = fullpath
(\
@dstpath,$strip,\
@srcpath);
86 if (grep { $_ eq $dstfile } @
{$self->{FILES
}}) {
87 my $orignode = $self->{NODEIDS
}->{$self->filelabel($ARGV)};
88 my $destnode = $self->{NODEIDS
}->{$self->filelabel($dstfile)};
89 if (defined $self->{IGNOREDDEPS
}->{$ARGV}->{$dstfile}) {
90 print STDERR
"ignoring $ARGV -> $dstfile\n" if $main::debug
;
91 $self->{IGNOREDEDGES
}->{$orignode}->{$destnode} =
92 $self->{IGNOREDDEPS
}->{$ARGV}->{$dstfile};
94 push (@
{$deps{$orignode}}, $destnode);
96 print STDERR
"ERROR: unknown file $dstfile referenced by $ARGV\n" if $main::verbose
>= 2;
98 } elsif (m/^\s*#\s*include\s*<(.*)>/) {
99 print STDERR
"Ignoring <$1> for now ($ARGV)\n" if $main::verbose
>= 2;