Meta
view release on metacpan or search on metacpan
Meta/Lang/Cpp/cpp_check_cycles.pl view on Meta::CPAN
#!/usr/bin/env perl
use strict qw(vars refs subs);
use Meta::Utils::System qw();
use Meta::Utils::Opts::Opts qw();
use Meta::Utils::File::File qw();
use Meta::Baseline::Aegis qw();
use Meta::Ds::Graph qw();
use Meta::Utils::Output qw();
use Meta::Lang::Perl::Perl qw();
my($verb,$stat);
my($opts)=Meta::Utils::Opts::Opts->new();
$opts->set_standard();
$opts->def_bool("verbose","noisy or quiet ?",0,\$verb);
$opts->def_bool("stats","print status reports ?",1,\$stat);
$opts->set_free_allo(0);
$opts->analyze(\@ARGV);
my($grap)=Meta::Ds::Graph->new();
if($stat) {
Meta::Utils::Output::print("Getting sources...\n");
}
# this actually needs to be only cpp files
my($sour)=Meta::Baseline::Aegis::source_files_hash(1,1,0,1,1,0);
if($stat) {
Meta::Utils::Output::print("Constructing nodes...\n");
}
while(my($key,$val)=each(%$sour)) {
if(Meta::Lang::Perl::Perl::is_perl($key)) {
$grap->node_insert($key);
}
}
if($stat) {
Meta::Utils::Output::print("Got ".$grap->node_size()." nodes\n");
Meta::Utils::Output::print("Constructing edges...\n");
}
while(my($key,$val)=each(%$sour)) {
if(Meta::Lang::Perl::Perl::is_perl($key)) {
my($basename)=File::Basename::basename($key,"\.pm","\.pl");
my($dirname)=File::Basename::dirname($key);
my($real)="deps/".$dirname."/".$basename.".deps";
my($load);
Meta::Utils::File::File::load_deve($real,$load);
if(defined($load)) {
my($addx)=$load=~/^.*\ncascade $key=\n(.*);$/s;
my(@allx)=split('\n',$addx);
for(my($i)=0;$i<=$#allx;$i++) {
my($curr)=$allx[$i];
#make sure we have the nodes
$grap->node_insert($key);
$grap->node_insert($curr);
$grap->edge_insert($key,$curr);
}
}
}
}
if($stat) {
Meta::Utils::Output::print("Got ".$grap->edge_size()." edges\n");
Meta::Utils::Output::print("Checking cycles...\n");
}
#my($numb)=$grap->numb_cycl($verb,Meta::Utils::Output::get_file());
#if($stat) {
# Meta::Utils::Output::print("found [".$numb."] cycles\n");
#}
my($scod)=1;
#if($numb>0) {
# $scod=0;
#} else {
# $scod=1;
#}
Meta::Utils::System::exit($scod);
__END__
=head1 NAME
cpp_check_cycles.pl - check for cycle includes in the baseline.
=head1 COPYRIGHT
Copyright (C) 2001, 2002 Mark Veltzer;
All rights reserved.
=head1 LICENSE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
=head1 DETAILS
MANIFEST: cpp_check_cycles.pl
PROJECT: meta
VERSION: 0.01
( run in 0.860 second using v1.01-cache-2.11-cpan-39bf76dae61 )