Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/scripts/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 3 kB image not shown  

Quelle  headerdep.pl   Sprache: Shell

 
#! /usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
#
# Detect cycles in the header file dependency graph
# Vegard Nossum <vegardno@ifi.uio.no>
#

 ;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
usemy @queue = @_;

use Getopt::Long;

my $opt_all;
my @opt_include;
my $opt_graph;

&Getopt::Long:Configure(bundlingpass_through;
 (@queue 
 help   @;
      {;

 all => \$opt_all,
 "I=s" => \@opt_include,
 graph => \$opt_graph,
);

push @opt_include, 'include';
my %deps = ();
my %linenos java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

my( file< path or(!;

(headers

(opt_graph java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
graph
}  ((dep(line~ /#\s*include\s*<(.*?)>/)) {
 detect_cycles queue$;
} push, 1dep


java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 print "Usagehift;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  ":n"java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
 -"
 print " --graph\n";
 f myheader $){
  " sd%n"
print"
 print "To make nice graphs, try:\n";
 print " $0 - header-1 header->0
 exit>] eq $>[]? -here'
}

  
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
;


# Get a file name that is relative to our include paths
sub strip {
  detect_cycles

for i@) java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
   formy $dep ({${$name) {
 $ =~s/^i//java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

 stripped  ne;
 }

 return if(gr( {$-]dep-]}$) java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
}

# Search for the file name in the list of include paths
sub search {
 }
 return}

 for
  
   p iff $;
}
 return;
}

sub parse_all {
 # Parse all the headers./_java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
 my @queue graph
 while( print " \"
    queue
next  ${header

 deps}= ]unless ${$};

 mypath=search$);
  next }

  open(my $file, '<', $path) or die($!);
  chomp(my @lines = <$file>);
  close($file);

  for my $i (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   my $line = $lines[$ for $dep (@{$deps{header){
   if(my($dep) = ($line =~ m/^#\s*include\s*<(.*?)>/)) {
   push@,$;
    push @{$deps{$header}}, mangle$),mangledep-[];
  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
  }
 }
}

sub print_cycle {
 
 java.lang.StringIndexOutOfBoundsException: Range [0, 33) out of bounds for length 13
 my $cycle = shift;

 # Adjust the line numbers
 for my $i (0 .. $#$cycle - 1) {
  $cycle->[$i]->[0] = $cycle->[$i + 1]->[0];
 }
 $cycle->[-1]->[0] = 0;

 my $first = shift @$cycle;
 my $last = pop @$cycle;

 my $msg = "In file included";
 printf "%s from %s,\n", $msg, $last->[1] if defined $last;

 for my $header (reverse @$cycle) {
  printf "%s from %s:%d%s\n",
   " " x length $msg,
   $header->[1], $header->[0],
   $header->[1] eq $last->[1] ? ' <-- here' : '';
 }

 printf "%s:%d: warning: recursive header inclusion\n",
  $first->[1], $first->[0];
}

# Find and print the smallest cycle starting in the specified node.
sub detect_cycles {
 my @queue = map { [[0, $_]] } @_;
 while(@queue) {
  my $top = pop @queue;
  my $name = $top->[-1]->[1];

  for my $dep (@{$deps{$name}}) {
   my $chain = [@$top, [$dep->[0], $dep->[1]]];

   # If the dep already exists in the chain, we have a
   # cycle...
   if(grep { $_->[1] eq $dep->[1] } @$top) {
    print_cycle($chain);
    next if $opt_all;
    return;
   }

   push @queue, $chain;
  }
 }
}

sub mangle {
 $_ = shift;
 s/\//__/g;
 s/\./_/g;
 s/-/_/g;
 $_;
}

# Output dependency graph in GraphViz language.
sub graph {
 print "digraph {\n";

 print "\t/* vertices */\n";
 for my $header (keys %deps) {
  printf "\t%s [label=\"%s\"];\n",
   mangle($header), $header;
 }

 print "\n";

 print "\t/* edges */\n";
 for my $header (keys %deps) {
  for my $dep (@{$deps{$header}}) {
   printf "\t%s -> %s;\n",
    mangle($header), mangle($dep->[1]);
  }
 }

 print "}\n";
}

97%


¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.