3 $dbdir = "tools/code_dbase" ;
5 if ( ! opendir( TOOLDIR
, "tools") ) {
6 print "\nMust be in top level WRF directory\n" ;
12 if ( ( scalar @ARGV < 1 ) || ( scalar @ARGV > 2 ) ) {
13 print "usage: subinfo routinename \n" ;
14 print " subinfo rebuild \n" ;
17 if ( ( scalar @ARGV == 2 ) ) { $gofast = 1 ; } # don't bother with links for argument lists
19 if ( ! open( XXX
, "$dbdir/calls" ) || $ARGV[0] eq "rebuild" )
21 print "Building code database ... please wait.\n" ;
22 system( "cd tools/CodeBase ; make" ) ;
23 open P
, "tools/build_codebase |&" ; while (<P
>) { print ; } close P
;
24 system( "ln -sf tools/subinfo ." ) ;
25 system( "ln -sf tools/wrfvar ." ) ;
26 if ( $ARGV[0] eq "rebuild" ) { exit ; }
31 $rout1 = lc $ARGV[0] ;
36 $routfile = $dbdir."/".$rout ;
38 if ( ! ( open( ROUT
, "< $routfile" )) ) {
39 print "$rout is not a known subprogram. \n" ;
40 open P
, "/bin/ls -1 $dbdir/\*$rout\* | " ;
41 print "Perhaps you mean:\n" ;
44 if ( substr( $_, 0, 3 ) eq "lm_" ) { next ; }
45 if ( $_ =~ "not found" ) { break ; }
51 #open ROUT, "< $routfile" or { print "$rout is not a known subprogram. Perhaps you mean:\n" ; }
52 # system( "/bin/ls -1 $dbdir/\*$rout\*" ) ;
57 if ( $t[0] eq sourcefile
) {
60 if ( $t[0] eq subprogram
) {
61 if ( $t[1] eq "function" ) {
62 $subprog = $t[2]." ".$t[1] ;
71 print "<title> ",ucfirst $subprog," : ",uc $rout1," </title>\n" ;
73 print "<h1> ",ucfirst $subprog," : ",uc $rout1," </h1> \n" ;
75 # see if there is a 'big-f' file...
76 $refer_to = $sourcefile ;
77 $tail = substr( $sourcefile, length( $sourcefile ) - 2 ) ;
78 if ( "$tail" eq ".f" ) {
79 $refer_to = substr( $sourcefile, 0, length( $sourcefile ) - 2 ) . ".F" ;
80 if ( ! ( open( EXISTNCE
, "< $refer_to" )) ) {
81 $refer_to = $sourcefile ;
83 else { close EXISTNCE
; }
86 #print "<b> Defined in: </b> <a href=\"../../$refer_to\"> $refer_to </a> <p> <p>\n" ;
87 # have it point to the wrf code browser instead
88 $rout1_uc = uc $rout1 ;
89 print "<b> Defined in: </b> <a href=\"../../../wrfbrowser/html_code/${refer_to}.html#$rout1_uc\"> $refer_to </a> <p> <p>\n" ;
91 if ( open (DESC
, "< ${routfile}_descrip" ) ) {
92 print "<b> Description: </b><p>\n" ;
101 print "<b> Called by : </b> <p> <p>\n" ;
103 @sysargs = ( "tools/subinfo_calls", 0, "$rout" ) ;
104 open BBB
, "tools/subinfo_calls 0 $rout | " ;
105 while ( <BBB
> ) { print ; }
111 open ROUT
, "< $routfile" or die "can not open $routfile" ;
114 if ( $t[0] eq "use" ) {
116 print "<b> Uses: </b> <p> <p>\n<pre>\n" ;
120 printf(" %-30s ",uc $t[1] ) ;
121 open P
,"/bin/ls */*.F | grep -w $t[1] |" ;
124 # printf("(<a href=\"../../%s\">%s</a>)\n", $_, $_ ) ;
125 printf("(<a href=\"../../../wrfbrowser/html_code/%s.html#%s\">%s</a>)\n", $_, uc $t[1], $_ ) ;
130 if ( $use_entry == 1 ) { print "</pre>\n" ; }
133 print "<b> Arguments: </b> <p> <p>\n" ;
136 open ROUT
, "< $routfile" or die "can not open $routfile" ;
140 if ( $t[0] eq arg
&& $t[9] eq dummyarg
) {
141 printf("%3d.",$i++) ;
142 $vfile = "$dbdir/vv_" . $rout1 . "_" . $t[3] . ".html" ;
143 if ( $gofast == 0 ) {
144 system ( "echo '<html><pre>' > $vfile ; tools/wrfvar $t[3] $rout1 >> $vfile ; echo '</pre></html>' >> $vfile" ) ;
146 $intent = "INTENT( ".uc $t[7]." )" ;
147 if ( $t[11] ne "" ) {
148 $dims = "DIMENSION( ".$t[11]." )" ;
149 $vfile = "vv_" . $rout1 . "_" . $t[3] . ".html" ;
150 printf(" <a href=\"%s\">%-12s</a> :: %-8s, %-16s, %s\n",$vfile,$t[3], uc $t[5], $intent, $dims ) ;
152 $vfile = "vv_" . $rout1 . "_" . $t[3] . ".html" ;
153 printf(" <a href=\"%s\">%-12s</a> :: %-8s, %-16s\n",$vfile,$t[3], uc $t[5], $intent ) ;
161 open CALLEES
, "< $dbdir/calls" or die " cannot open $dbdir/calls " ;
162 while ( <CALLEES
> ) {
164 if ( $t[0] eq lc $rout && $t[1] eq calls
&& ! ($t[2] =~ add_msg
) && !($t[2] =~ reset_msgs
) && !($t[2] =~ stencil
) && !($t[2] =~ wrf_debug
)
165 && (substr($t[2],0,4) ne "get_") ) {
167 print "<b>",uc $rout," calls : </b> <p> <p>\n" ;
172 open C
,"< $dbdir/$t[2]" ;
175 if ( $u[0] eq sourcefile
) { $sf = $u[1] ; break ; }
178 # see if there is a 'big-f' file...
180 $tail = substr( $sf, length( $sf ) - 2 ) ;
181 if ( "$tail" eq ".f" ) {
182 $refer_to = substr( $sf, 0, length( $sf ) - 2 ) . ".F" ;
183 if ( ! ( open( EXISTNCE
, "< $refer_to" )) ) {
186 else { close EXISTNCE
; }
189 printf("<tr><td><a href=\"%s\.html\">%30s</a></td><td>(<a href=\"../../%s\">%s</a>)</td></tr>\n",$t[2], $t[2],$sf,$sf) ;
202 #if ( $found_var == 0 ) {
203 # print uc $vname , "is not an argument to ${rout1}. May be local or use-associated.\n" ;
204 # print ucfirst $rout1," has $nargs_rout arguments.\n" ;
206 # open ROUT, "< $routfile" or die "can not open $routfile" ;
212 # if ( $t[0] eq "arg" ) {
214 # printf("%3d. ",$i) ;
215 # print uc $t[3]," of type ", uc $t[5],", intent ",uc $t[7],"\n" ;