Indentation fix, cleanup.
[AROS.git] / tools / cxref / contrib / daVinvi_function.pl
blob1983df6982fbf12e96002715b966332bda5714cc
1 #!/bin/sh
3 # Converts the cxref output files into a format that can be read into
4 # the DaVinci graph drawing program.
6 # (c) 1999 Andrew M. Bishop
9 exec perl -x $0 $*
11 #!perl
13 die "Usage: $0 cxref.include\n" if($#ARGV==-1);
15 open(FUNCTION,"<$ARGV[0]") || die "Cannot open $ARGV[0]\n";
17 %sysfunctions=();
18 %localfunctions=();
19 %function=();
21 while(<FUNCTION>)
23 chop;
24 ($file,$function,$scope,@calls)=split(/ /);
26 $localfunctions{$function}=1;
28 $function{$function}="$file:$function";
31 print "[\n";
33 close(FUNCTION);
35 open(FUNCTION,"<$ARGV[0]") || die "Cannot open $ARGV[0]\n";
37 while(<FUNCTION>)
39 chop;
40 ($file,$function,$scope,@calls)=split(/ /);
42 if($scope==1)
44 print "l(\"$file:$function\",n(\"\",[a(\"OBJECT\",\"$function\")],\n";
46 else
48 print "l(\"$file:$function\",n(\"\",[a(\"OBJECT\",\"$function\")],\n";
51 print "\t[\n";
52 foreach $call (@calls)
54 next if($call =~ /\&/);
56 if($call =~ /^%(.+)$/)
58 print "\te(\"\",[],r(\"$file:$1\")),\n";
60 elsif($function{$call})
62 print "\te(\"\",[],r(\"$function{$call}\")),\n";
64 else
66 print "\te(\"\",[],r(\"$call\")),\n";
67 $sysfunctions{$call}=1;
70 print "\t]))\n,\n";
73 foreach $function (keys(%sysfunctions))
75 print "l(\"$function\",n(\"\",[a(\"OBJECT\",\"$function\"),a(\"COLOR\",\"#808080\")],[]))\n,\n";
78 print "]\n";
80 close(FUNCTION);