#  File name is 'awk_soft'
#
#  @(#)awk_soft	1.1 84/06/13
#
#  This awk file generates ex commands to insert alias lines in FORTRAN
#  source.  These alias lines are used to alias the Softool instrument
#  library routines lower case names to upper case.  This is necessary
#  since the source files are compiled using the -U compiler option by
#  default.
#
BEGIN { 
        line = 0;
        stmt = 0;
      }
{
  if ( ($0 ~ /^[ 	]*(PROGRAM|FUNCTION|SUBROUTINE).*/) || \
	 ($0 ~ /^[ 	]*(REAL|COMPLEX|INTEGER|LOGICAL|CHARACTER)[ 	]*[\*]?[ 	]*[0-9]*[ 	]*FUNCTION.*/) || \
	 ($0 ~ /^[ 	]*DOUBLE[ 	]*(COMPLEX|PRECISION)[ 	]*[\*]?[ 	]*[0-9]*[ 	]*FUNCTION.*/) || \
	 ($0 ~ /^[ 	]*BLOCK[ 	]*DATA.*/) )
    {
      line = NR;
      print line;
      stmt = 1;
    }
  else if ( stmt == 1)
    {
      if ( substr ($0,6,1) != " ")
        {
           line = NR;
           print line;
        }
      else 
        {
           stmt = 0;
           print ( line );
	   print ( "r /usr/contrib/bin/alii" );
           print ( "w" );
           print ( "q" );
           exit;
        };
    };
}
