Recompiling an old fortran 2/4\66 program that was compiled for os\2 need it to run in dos
Posted
by
Mike Hansen
on Stack Overflow
See other posts from Stack Overflow
or by Mike Hansen
Published on 2011-01-10T18:53:04Z
Indexed on
2011/01/12
23:54 UTC
Read the original article
Hit count: 262
I am helping an old scientist with some problems and have 1 program that he found and modified about 20 yrs. ago, and runs fine as a 32 bit os\2 executable but i need it to run under dos! I am not a programmer but a good hardware & software man, so I'am pretty stupid about this problem, but here go's I have downloaded 6 different compilers watcom77,silverfrost ftn95,gfortran,2 versions of g77 and f80. Watcom says it is to old of program,find older compiler,silverfrost opens it,debugs, etc. but is changing all the subroutines from "real" to "complex" and vice-vesa,and the g77's seem to install perfectly (library links and etc.) but wont even compile the test.f programs.My problem is 1; to recompile "as is" or "upgrade" the code? PROGRAM xconvlv INTEGER N,N2,M
PARAMETER (N=2048,N2=2048,M=128)
INTEGER i,isign
REAL data(n),respns(m),resp(n),ans(n2),t3(n),DUMMY
OPEN(UNIT=1, FILE='C:\QKBAS20\FDATA1.DAT')
DO 1 i=1,N
READ(1,*) T3(i), data(i), DUMMY
continue
CLOSE(UNIT-1)
do 12 i=1,N
respns(i)=data(i)
resp(i)=respns(i)
continue
isign=-1
call convlv(data,N,resp,M,isign,ans)
OPEN(UNIT=1,FILE='C:\QKBAS20\FDATA9.DAT')
DO 14 i=1,N
WRITE(1,*) T3(i), ans(i)
continue
END
SUBROUTINE CONVLV(data,n,respns,m,isign,ans)
INTEGER isign,m,n,NMAX
REAL data(n),respns(n)
COMPLEX ans(n)
PARAMETER (NMAX=4096)
* uses realft, twofft
INTEGER i,no2
COMPLEX fft (NMAX)
do 11 i=1, (m-1)/2
respns(n+1-i)=respns(m+1-i)
continue
do 12 i=(m+3)/2,n-(m-1)/2
respns(i)=0.0
continue
call twofft (data,respns,fft,ans,n)
no2=n/2
do 13 i=1,no2+1
if (isign.eq.1) then
ans(i)=fft(i)*ans(i)/no2
else if (isign.eq.-1) then
if (abs(ans(i)) .eq.0.0) pause
ans(i)=fft(i)/ans(i)/no2
else
pause 'no meaning for isign in convlv'
endif
continue
ans(1)=cmplx(real (ans(1)),real (ans(no2+1)))
call realft(ans,n,-1)
return
END
SUBROUTINE realft(data,n,isign)
INTEGER isign,n
REAL data(n)
* uses four1
INTEGER i,i1,i2,i3,i4,n2p3
REAL c1,c2,hli,hir,h2i,h2r,wis,wrs
DOUBLE PRECISION theta,wi,wpi,wpr,wr,wtemp
theta=3.141592653589793d0/dble(n/2)
cl=0.5
if (isign.eq.1) then
c2=-0.5
call four1(data,n/2,+1)
else
c2=0.5
theta=-theta
endif
(etc.,etc., etc.)
SUBROUTINE twofft(data,data2,fft1,fft2,n)
INTEGER n
REAL data1(n,data2(n)
COMPLEX fft1(n), fft2(n)
* uses four1
INTEGER j,n2
COMPLEX h1,h2,c1,c2
c1=cmplx(0.5,0.0)
c2=cmplx(0.0,-0.5)
do 11 j=1,n
fft1(j)=cmplx(data1(j),data2(j)
continue
call four1 (fft1,n,1)
fft2(1)=cmplx(aimag(fft1(1)),0.0)
fft1(1)=cmplx(real(fft1(1)),0.0)
n2=n+2
do 12 j=2,n/2+1
h1=c1*(fft1(j)+conjg(fft1(n2-j)))
h2=c2*(fft1(j)-conjg(fft1(n2-j)))
fft1(j)=h1
fft1(n2-j)=conjg(h1)
fft2(j)=h2
fft2(n2-j)=conjg(h2)
continue
return
END
SUBROUTINE four1(data,nn,isign)
INTEGER isign,nn
REAL data(2*nn)
INTEGER i,istep,j,m,mmax,n
REAL tempi,tempr
DOUBLE PRECISION theta, wi,wpi,wpr,wr,wtemp
n=2*nn
j=1
do 11 i=1,n,2
if(j.gt.i)then
tempr=data(j)
tempi=data(j+1)
(etc.,etc.,etc.,)
continue
mmax=istep
goto 2
endif
return
END
There are 4 subroutines with this that are about 3 pages of code and whould be much easier to e-mail to someone if their able to help me with this.My e-mail is [email protected] , or if someone could tell me where to get a "working" compiler that could recompile this? THANK-YOU, THANK-YOU,and THANK-YOU for any help with this! The errors Iam getting are; 1.In a call to CONVLV from another procedure,the first argument was of a type REAL(kind=1), it is now a COMPLEX(kind=1) 2.In a call to REALFT from another procedure, ... COMPLEX(kind=1) it is now a REAL(kind=1) 3.In a call to TWOFFT from...COMPLEX(kind-1) it is now a REAL(kind=1) 4.In a previous call to FOUR1, the first argument was of a type REAL(kind=1) it is now a COMPLEX(kind=1).
© Stack Overflow or respective owner