#!/bin/perl $dbdir = "tools/code_dbase" ; if ( ! opendir( TOOLDIR, "tools") ) { print "\nMust be in top level WRF directory\n" ; exit ; } closedir TOOLDIR ; $gofast=0 ; if ( ( scalar @ARGV < 1 ) || ( scalar @ARGV > 2 ) ) { print "usage: subinfo routinename \n" ; print " subinfo rebuild \n" ; exit ; } if ( ( scalar @ARGV == 2 ) ) { $gofast = 1 ; } # don't bother with links for argument lists if ( ! open( XXX, "$dbdir/calls" ) || $ARGV[0] eq "rebuild" ) { print "Building code database ... please wait.\n" ; system( "cd tools/CodeBase ; make" ) ; open P, "tools/build_codebase |&" ; while (
) { print ; } close P ; system( "ln -sf tools/subinfo ." ) ; system( "ln -sf tools/wrfvar ." ) ; if ( $ARGV[0] eq "rebuild" ) { exit ; } } close XXX ; $rout1 = lc $ARGV[0] ; $rout = $rout1 ; #print $vname,"\n" ; #print $rout,"\n" ; $routfile = $dbdir."/".$rout ; if ( ! ( open( ROUT, "< $routfile" )) ) { print "$rout is not a known subprogram. \n" ; open P, "/bin/ls -1 $dbdir/\*$rout\* | " ; print "Perhaps you mean:\n" ; while (
) {
s/.*\/// ;
if ( substr( $_, 0, 3 ) eq "lm_" ) { next ; }
if ( $_ =~ "not found" ) { break ; }
print " $_" ;
}
exit ;
}
#open ROUT, "< $routfile" or { print "$rout is not a known subprogram. Perhaps you mean:\n" ; }
# system( "/bin/ls -1 $dbdir/\*$rout\*" ) ;
# die ;
while ( \n" ;
# have it point to the wrf code browser instead
$rout1_uc = uc $rout1 ;
print " Defined in: $refer_to \n" ;
if ( open (DESC, "< ${routfile}_descrip" ) ) {
print " Description: \n" ;
while ( \n" ;
close DESC ;
}
print " Called by : \n" ;
print " \n ) {
chop ;
# printf("(%s)\n", $_, $_ ) ;
printf("(%s)\n", $_, uc $t[1], $_ ) ;
}
close P ;
}
}
if ( $use_entry == 1 ) { print " \n" ;
print " \n" ;
# print " ",ucfirst $subprog," : ",uc $rout1,"
\n" ;
# see if there is a 'big-f' file...
$refer_to = $sourcefile ;
$tail = substr( $sourcefile, length( $sourcefile ) - 2 ) ;
if ( "$tail" eq ".f" ) {
$refer_to = substr( $sourcefile, 0, length( $sourcefile ) - 2 ) . ".F" ;
if ( ! ( open( EXISTNCE, "< $refer_to" )) ) {
$refer_to = $sourcefile ;
}
else { close EXISTNCE ; }
}
#print " Defined in: $refer_to \n" ;
@sysargs = ( "tools/subinfo_calls", 0, "$rout" ) ;
open BBB , "tools/subinfo_calls 0 $rout | " ;
while (
\n" ;
$first=1 ;
$use_entry = 0 ;
open ROUT, "< $routfile" or die "can not open $routfile" ;
while ( \n" ;
$use_entry = 1 ;
$first = 0 ;
}
printf(" %-30s ",uc $t[1] ) ;
open P,"/bin/ls */*.F | grep -w $t[1] |" ;
while(
\n" ; }
close ROUT ;
print " Arguments: \n" ;
open ROUT, "< $routfile" or die "can not open $routfile" ;
$i = 1 ;
while (
\n" ;
$first = 1 ;
open CALLEES, "< $dbdir/calls" or die " cannot open $dbdir/calls " ;
while ( ' > $vfile ; tools/wrfvar $t[3] $rout1 >> $vfile ; echo '
' >> $vfile" ) ;
}
$intent = "INTENT( ".uc $t[7]." )" ;
if ( $t[11] ne "" ) {
$dims = "DIMENSION( ".$t[11]." )" ;
$vfile = "vv_" . $rout1 . "_" . $t[3] . ".html" ;
printf(" %-12s :: %-8s, %-16s, %s\n",$vfile,$t[3], uc $t[5], $intent, $dims ) ;
} else {
$vfile = "vv_" . $rout1 . "_" . $t[3] . ".html" ;
printf(" %-12s :: %-8s, %-16s\n",$vfile,$t[3], uc $t[5], $intent ) ;
}
}
}
close ROUT ;
print "\n" ;
print "
\n" ;
$first = 2 ;
}
open C ,"< $dbdir/$t[2]" ;
while (
\n" ;
}
print "\n" ;
exit
#if ( $found_var == 0 ) {
# print uc $vname , "is not an argument to ${rout1}. May be local or use-associated.\n" ;
# print ucfirst $rout1," has $nargs_rout arguments.\n" ;
# close ROUT ;
# open ROUT, "< $routfile" or die "can not open $routfile" ;
# while ( \n",$t[2], $t[2],$sf,$sf) ;
}
}
if ( $first == 2 ) {
print "%30s (%s)