dgh@validgh.com (David G. Hough on validgh) (05/26/91)
Persons struggling to get RS/6000 xlf to work more like f77 may find the following helpful. I'm no expert in shell and awk scripts; the following work for me but may be far from optimal for you. They primarily deal with 1) sending .F files through cpp 2) different notions of free form input 3) problems accepting complex*16 function headers The testing regime in which this is installed compiles only one source file at a time into a .o or else links one or more .o's into an executable. You also need to link with a home-brew library that will define familiar but nonstandard functions like etime(3f). Some of these problems may have disappeared with more recent versions of xlf than we have installed. ------------------------------------------------------------------------------------ xlf.sh ------------------------------------------------------------------------------------ #!/bin/sh # echo `pwd` xlf.sh 1.12 91/04/08 $0 $* lastparam=$0 tmpdir=. f77=xlf preproc='cat' cppopts=' -P -D_IBMR2 -D_AIX' for i in $* ; do case $i in -w66) echo ignore -w66 ;; -D*|-I*) cppopts="$cppopts $i" ;; -*) f77="$f77 $i" ;; *.o) f77="$f77 $i" ; if test $lastparam = -o ; then doto=$i ; fi ;; *.F) suffixfile=$i ; suffix=".F" ; preproc='cpp' ;; *.f) suffixfile=$i ; suffix=".f" ;; *.?) suffixfile=$i ; f77="$f77 $i" ;; *) f77="$f77 $i" ;; esac lastparam=$i done if test $preproc = 'cpp' ; then preproc="/lib/cpp $cppopts" ; fi case $suffixfile in *.[fF]) tmpdir=`dirname $doto` ; tmpfil=`basename $suffixfile $suffix`.f ; echo $preproc $suffixfile $tmpdir/$tmpfil ; f77="$f77 $tmpdir/$tmpfil" ; awk '{print substr($0,1,72)}' < $suffixfile | $preproc | sed 's/[rR][eE][aA][lL][ ]*\*4[ ]*[fF][uU][nN][cC][tT][iI][oO][nN]/realfunction/g' | sed 's/[rR][eE][aA][lL][ ]*\*8[ ]*[fF][uU][nN][cC][tT][iI][oO][nN]/doubleprecisionfunction/g' | sed 's/[cC][oO][mM][pP][lL][eE][xX][ ]*\*8[ ]*[fF][uU][nN][cC][tT][iI][oO][nN]/complexfunction/g' | sed 's/[cC][oO][mM][pP][lL][eE][xX][ ]*\*16[ ]*[fF][uU][nN][cC][tT][iI][oO][nN]/doublecomplexfunction/g' | awk -f /valid/src/xlf/xlf.awk | cat > $tmpdir/$tmpfil ;; esac f77="$f77 -qextname" echo $f77 $f77 ------------------------------------------------------------------------------------ xlf.awk: ------------------------------------------------------------------------------------ # # function to fold Fortran source at column 72 for benefit of xlf # { # eliminate leading tabs if (substr($0,1,1) == " ") r = " " substr($0,2) else r = $0 s=substr(r,1,1) if ((s == " ") && (length(r) > 72)) { print substr(r,1,72) print " +" substr(r,73) } else { print r } } ------------------------------------------------------------------------------------- -- David Hough dgh@validgh.com uunet!validgh!dgh na.hough@na-net.ornl.gov
dik@cwi.nl (Dik T. Winter) (05/27/91)
In article <390@validgh.com> dgh@validgh.com (David G. Hough on validgh) writes: > You also need to link with a home-brew library that will define familiar but > nonstandard functions like etime(3f). > Here a replacement for etime if you use the function result only. It ignores its parameter: REAL FUNCTION ETIME(IGN) INTEGER MCLOCK EXTERNAL MCLOCK C C HARUMPH. THE MANUAL TELLS IT IS IN 60TH OF A SECOND. C EXPERIMENTS TELL SOMETHING DIFFERENT! ETIME = MCLOCK() / 100.0 RETURN END -- dik t. winter, cwi, amsterdam, nederland dik@cwi.nl