From 45b85bb7a8af116329f464fc6ed9d92c8cfca2bb Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 13 Jun 2007 17:05:57 +0000 Subject: [PATCH] Many fixes to make it work on Linux. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@388 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Makefile.in | 96 +++++++++---------- Makefile.win | 176 +++++++++++++++++------------------ display.F90 | 8 +- flushqqq.f90 => flushqqq.F90 | 0 ftn_init.F90 | 12 ++- getfile.F90 | 2 + getfile2.f90 => getfile2.F90 | 11 ++- map65rc | 8 +- rfile2.f | 4 +- symspec.f | 3 +- 10 files changed, 166 insertions(+), 154 deletions(-) rename flushqqq.f90 => flushqqq.F90 (100%) rename getfile2.f90 => getfile2.F90 (82%) diff --git a/Makefile.in b/Makefile.in index 86d35f72f..0fbad8337 100644 --- a/Makefile.in +++ b/Makefile.in @@ -29,71 +29,63 @@ FC=@FC@ COMPILER += @FC_LIB_PATH@ LDFLAGS += -L${COMPILER} +LIBS += /usr/lib/libfftw3f.a PYTHON ?= @PYTHON@ RM ?= @RM@ F2PY = @F2PY@ +### +all: Audio.so -F2PYONLY = ftn_init ftn_quit audio_init spec getfile azdist0 astro0 +OBJS2C = init_rs.o encode_rs.o decode_rs.o + +F2PYONLY = ftn_init ftn_quit audio_init getfile azdist0 astro0 \ + spec map65a0 SRCS2F90 = astro0.F90 audio_init.F90 azdist0.f90 \ - decode1.F90 decode2.f90 decode3.F90 ftn_init.F90 \ - ftn_quit.f90 get_fname.F90 getfile.F90 \ - i1tor4.f90 pix2d65.f90 rfile.f90 savedata.F90 spec.f90 \ - wsjtgen.F90 runqqq.F90 fivehz.F90 -OBJS2F90 = ${SRCS2F90:.f90=.o} + decode1.F90 ftn_init.F90 ftn_quit.f90 wsjtgen.F90 \ + runqqq.F90 fivehz.F90 flushqqq.F90 map65a0.f90 \ + rfile.f90 rfile3a.f90 spec.f90 map65a.f90 display.F90 \ + getfile.F90 getfile2.F90 -SRCS2F77 = wsjt1.f astro.f azdist.f coord.f dcoord.f deg2grid.f \ - dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f moon2.f \ - MoonDop.f sun.f toxyz.f pfxdump.f \ - avesp2.f bzap.f \ - indexx.f flat2.f gen65.f chkmsg.f gentone.f \ - set.f flatten.f db.f pctile.f sort.f ssort.f ps.f smooth.f \ - peakup.f avemsg65.f decode65.f \ - demod64a.f encode65.f extract.f flat1.f four2.f rfile2.f \ - gencwid.f getpfx1.f getpfx2.f getsnr.f graycode.f grid2k.f \ - interleave63.f k2grid.f limit.f lpf1.f morse.f \ - nchar.f packcall.f packgrid.f packmsg.f packtext.f setup65.f \ - short65.f slope.f spec2d65.f sync65.f unpackcall.f \ - unpackgrid.f unpackmsg.f unpacktext.f xcor.f xfft.f xfft2.f wsjt65.f \ - ftpeak65.f fil651.f fil652.f fil653.f symsync65.f +SRCS2F77 = indexx.f gen65.f chkmsg.f \ + gentone.f gencwid.f set.f db.f pctile.f sort.f ssort.f \ + avemsg65.f demod64a.f encode65.f extract.f four2a.f getpfx1.f \ + getpfx2.f graycode.f grid2k.f interleave63.f k2grid.f \ + deep65.f morse.f nchar.f packcall.f packgrid.f \ + packmsg.f packtext.f setup65.f unpackcall.f unpackgrid.f \ + unpackmsg.f unpacktext.f astro.f azdist.f coord.f dcoord.f \ + deg2grid.f dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f \ + moon2.f MoonDop.f sun.f toxyz.f pfxdump.f \ + symspec.f ccf65.f trimlist.f chkhist.f decode1a.f \ + filbig.f fil659.f fil658.f fil6521.f twkfreq.f decode65b.f \ + afc65b.f fchisq.f ccf2.f rfile2.f -OBJS2F77 = ${SRCS2F77:.f=.o} deep65.o +SRCS2C = resample.c ptt.c igray.c wrapkarn.c rfile3.c wfile3.c -SRCS2C = init_rs.c encode_rs.c decode_rs.c -OBJS2C = ${SRCS2C:.c=.o} +OBJS2F77 = ${SRCS2F77:.f=.o} -# ok, so far for now -# Windows @AUDIO@ will be a2d.f90 jtaudio.c since it uses portaudio -# for *nix @AUDIO@ will also be a2d.f90, jtaudio.c -# and start_portaudio.c for systems using portaudio -# for *nix @AUDIO@ will be start_alsa.c for alsa -# for *nix @AUDIO@ will be start_oss.c for oss -# -# ptt_unix.c vs. ptt.c I'll sort out later. -# ditto for cutil.c (only used on *nix) -# --db -# jtaudio.c/start_threads.c mess will have to be sorted out later -# to minimise #ifdef's -# --db -# and mostly sorted -# --db -# -# @NEEDPORTAUDIO@ will be filled in with libportaudio.a if portaudio is used -# -SRCS3C = ptt_unix.c igray.c wrapkarn.c cutil.c -OBJS3C = ${SRCS3C:.c=.o} -AUDIOSRCS = @AUDIO@ +SRCS3C = ptt_unix.c igray.c wrapkarn.c cutil.c +OBJS3C = ${SRCS3C:.c=.o} +AUDIOSRCS = a2d.f90 jtaudio.c resample.c start_portaudio.c -all: map65 +#Audio.so: $(OBJS2C) $(SRCS2F90) $(SRCS2F77) $(SRCS2C) +# python f2py.py -c \ +# --quiet --"fcompiler=compaqv" \ +# --opt="/nologo /traceback /warn:errors /fast /fpp /define:Win32 \ +# /define:USE_PORTAUDIO" \ +# $(OBJS2C) \ +# -lwinmm -lpa -lfftw3single -llibsamplerate \ +# -m Audio \ +# only: $(F2PYONLY) : \ +# $(SRCS2F90) $(SRCS2F77) $(SRCS2C) -portaudio-v19/lib/.libs/libportaudio.a: - (cd portaudio-v19;./configure --with-jack=no) - (cd portaudio-v19;${MAKE}) +### -map65: @NEEDPORTAUDIO@ Audio.so # map65.spec -# ${PYTHON} c:\python23\installer\Build.py map65.spec +#portaudio-v19/lib/.libs/libportaudio.a: +# (cd portaudio-v19;./configure --with-jack=no) +# (cd portaudio-v19;${MAKE}) deep65.o: deep65.F $(FC) -c -O0 -Wall -fPIC deep65.F @@ -106,10 +98,6 @@ Audio.so: $(OBJS2C) $(OBJS3C) $(OBJS2F77) $(SRCS2F90) $(AUDIOSRCS) : $(SRCS2F90) \ ${SRCS3C} ${AUDIOSRCS} -map65.spec: map65.py astro.py g.py options.py palettes.py smeter.py specjt.py - ${PYTHON} c:\python23\installer\makespec.py --icon wsjt.ico \ - --tk --onefile map65.py - init_rs_int.o: init_rs.c $(CC) $(CFLAGS) -c -DBIGSYM=1 -o init_rs_int.o init_rs.c diff --git a/Makefile.win b/Makefile.win index eddc7e255..d171f1b63 100644 --- a/Makefile.win +++ b/Makefile.win @@ -1,88 +1,88 @@ -#Makefile for Windows -!include #Some definitions for Compaq Visual Fortran -gcc = cl -FC = df -#To do bounds checking (with useless reports) put "/check:all" in the -# --opt= line below (line 56, more or less ...) -#FFLAGS = /traceback /check:all -FFLAGS = /traceback /fast /nologo /check:all - -all: MAP65.EXE - -OBJS2C = init_rs.o encode_rs.o decode_rs.o jtaudio.o - -F2PYONLY = ftn_init ftn_quit audio_init getfile azdist0 astro0 \ - spec map65a0 - -SRCS2F90 = a2d.f90 astro0.f90 audio_init.f90 azdist0.f90 \ - decode1.f90 ftn_init.f90 ftn_quit.f90 wsjtgen.f90 \ - runqqq.f90 fivehz.f90 flushqqq.f90 map65a0.f90 \ - rfile.f90 rfile3a.f90 spec.f90 map65a.f90 display.F90 \ - getfile.f90 getfile2.f90 - -SRCS2F77 = indexx.f gen65.f chkmsg.f \ - gentone.f gencwid.f set.f db.f pctile.f sort.f ssort.f \ - avemsg65.f demod64a.f encode65.f extract.f four2a.f getpfx1.f \ - getpfx2.f graycode.f grid2k.f interleave63.f k2grid.f \ - deep65.f morse.f nchar.f packcall.f packgrid.f \ - packmsg.f packtext.f setup65.f unpackcall.f unpackgrid.f \ - unpackmsg.f unpacktext.f astro.f azdist.f coord.f dcoord.f \ - deg2grid.f dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f \ - moon2.f MoonDop.f sun.f toxyz.f pfxdump.f \ - symspec.f ccf65.f trimlist.f chkhist.f decode1a.f \ - filbig.f fil659.f fil658.f fil6521.f twkfreq.f decode65b.f \ - afc65b.f fchisq.f ccf2.f - -SRCS2C = resample.c ptt.c igray.c wrapkarn.c rfile3.c wfile3.c - -MAP65.EXE: Audio.pyd map65.spec - python c:\python23\installer\Build.py map65.spec - -Audio.pyd: $(OBJS2C) $(SRCS2F90) $(SRCS2F77) $(SRCS2C) - python f2py.py -c \ - --quiet --"fcompiler=compaqv" \ - --opt="/nologo /traceback /warn:errors /fast /fpp /define:Win32 \ - /define:USE_PORTAUDIO" \ - $(OBJS2C) \ - -lwinmm -lpa -lfftw3single -llibsamplerate \ - -m Audio \ - only: $(F2PYONLY) : \ - $(SRCS2F90) $(SRCS2F77) $(SRCS2C) - -map65.spec: map65.py astro.py g.py options.py palettes.py smeter.py specjt.py - python c:\python23\installer\makespec.py --icon wsjt.ico \ - --tk --onefile map65.py - -jtaudio.o: jtaudio.c - $(CC) /nologo /c /DWin32 /Fojtaudio.o jtaudio.c - -init_rs.obj: init_rs.c - $(CC) /nologo /c /DBIGSYM=1 init_rs.c - -init_rs.o: init_rs.c - $(CC) /nologo /c /DBIGSYM=1 /Foinit_rs.o init_rs.c - -encode_rs.obj: encode_rs.c - $(CC) /nologo /c /DBIGSYM=1 encode_rs.c - -encode_rs.o: encode_rs.c - $(CC) /nologo /c /DBIGSYM=1 /Foencode_rs.o encode_rs.c - -decode_rs.obj: decode_rs.c - $(CC) /nologo /c /DBIGSYM=1 decode_rs.c - -decode_rs.o: decode_rs.c - $(CC) /nologo /c /DBIGSYM=1 /Ox /Zd /Fodecode_rs.o decode_rs.c - -wrapkarn.obj: wrapkarn.c - $(CC) /nologo /c /DWin32=1 wrapkarn.c - -igray.obj: igray.c - $(CC) /nologo /c /DWin32=1 igray.c - -.PHONY : clean - -clean: - -del *.o *.obj MAP65.EXE Audio.pyd - - +#Makefile for Windows +!include #Some definitions for Compaq Visual Fortran +gcc = cl +FC = df +#To do bounds checking (with useless reports) put "/check:all" in the +# --opt= line below (line 56, more or less ...) +#FFLAGS = /traceback /check:all +FFLAGS = /traceback /fast /nologo /check:all + +all: MAP65.EXE + +OBJS2C = init_rs.o encode_rs.o decode_rs.o jtaudio.o + +F2PYONLY = ftn_init ftn_quit audio_init getfile azdist0 astro0 \ + spec map65a0 + +SRCS2F90 = a2d.f90 astro0.f90 audio_init.f90 azdist0.f90 \ + decode1.f90 ftn_init.f90 ftn_quit.f90 wsjtgen.f90 \ + runqqq.f90 fivehz.f90 flushqqq.f90 map65a0.f90 \ + rfile.f90 rfile3a.f90 spec.f90 map65a.f90 display.F90 \ + getfile.f90 getfile2.f90 + +SRCS2F77 = indexx.f gen65.f chkmsg.f \ + gentone.f gencwid.f set.f db.f pctile.f sort.f ssort.f \ + avemsg65.f demod64a.f encode65.f extract.f four2a.f getpfx1.f \ + getpfx2.f graycode.f grid2k.f interleave63.f k2grid.f \ + deep65.f morse.f nchar.f packcall.f packgrid.f \ + packmsg.f packtext.f setup65.f unpackcall.f unpackgrid.f \ + unpackmsg.f unpacktext.f astro.f azdist.f coord.f dcoord.f \ + deg2grid.f dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f \ + moon2.f MoonDop.f sun.f toxyz.f pfxdump.f \ + symspec.f ccf65.f trimlist.f chkhist.f decode1a.f \ + filbig.f fil659.f fil658.f fil6521.f twkfreq.f decode65b.f \ + afc65b.f fchisq.f ccf2.f + +SRCS2C = resample.c ptt.c igray.c wrapkarn.c rfile3.c wfile3.c + +MAP65.EXE: Audio.pyd map65.spec + python c:\python23\installer\Build.py map65.spec + +Audio.pyd: $(OBJS2C) $(SRCS2F90) $(SRCS2F77) $(SRCS2C) + python f2py.py -c \ + --quiet --"fcompiler=compaqv" \ + --opt="/nologo /traceback /warn:errors /fast /fpp /define:Win32 \ + /define:USE_PORTAUDIO" \ + $(OBJS2C) \ + -lwinmm -lpa -lfftw3single -llibsamplerate \ + -m Audio \ + only: $(F2PYONLY) : \ + $(SRCS2F90) $(SRCS2F77) $(SRCS2C) + +map65.spec: map65.py astro.py g.py options.py palettes.py smeter.py specjt.py + python c:\python23\installer\makespec.py --icon wsjt.ico \ + --tk --onefile map65.py + +jtaudio.o: jtaudio.c + $(CC) /nologo /c /DWin32 /Fojtaudio.o jtaudio.c + +init_rs.obj: init_rs.c + $(CC) /nologo /c /DBIGSYM=1 init_rs.c + +init_rs.o: init_rs.c + $(CC) /nologo /c /DBIGSYM=1 /Foinit_rs.o init_rs.c + +encode_rs.obj: encode_rs.c + $(CC) /nologo /c /DBIGSYM=1 encode_rs.c + +encode_rs.o: encode_rs.c + $(CC) /nologo /c /DBIGSYM=1 /Foencode_rs.o encode_rs.c + +decode_rs.obj: decode_rs.c + $(CC) /nologo /c /DBIGSYM=1 decode_rs.c + +decode_rs.o: decode_rs.c + $(CC) /nologo /c /DBIGSYM=1 /Ox /Zd /Fodecode_rs.o decode_rs.c + +wrapkarn.obj: wrapkarn.c + $(CC) /nologo /c /DWin32=1 wrapkarn.c + +igray.obj: igray.c + $(CC) /nologo /c /DWin32=1 igray.c + +.PHONY : clean + +clean: + -del *.o *.obj MAP65.EXE Audio.pyd + + diff --git a/display.F90 b/display.F90 index 1d88acaa9..5d2da7a35 100644 --- a/display.F90 +++ b/display.F90 @@ -1,12 +1,15 @@ subroutine display +#ifdef Win32 use dfport +#endif parameter (MAXLINES=500,MX=500) integer indx(MAXLINES),indx2(MX) character*80 line(MAXLINES),line2(MX),line3(MAXLINES) character out*41,cfreq0*3 - character callsign*6,callsign0*6,freqcall*10(100) + character*6 callsign,callsign0 + character*10 freqcall(100) character*36 bm2 real freqkHz(MAXLINES) integer utc(MAXLINES),utc2(MX),utcz @@ -46,6 +49,7 @@ subroutine display write(26,1010) line(i) enddo endif + call flushqqq(26) call indexx(nz,freqkHz,indx) @@ -124,6 +128,7 @@ subroutine display endif endif enddo + call flushqqq(19) nc=nc+1 freqcall(nc)=' ' nc=nc+1 @@ -134,6 +139,7 @@ subroutine display write(20,1040) bm2 1040 format(a36) enddo + call flushqqq(20) return end subroutine display diff --git a/flushqqq.f90 b/flushqqq.F90 similarity index 100% rename from flushqqq.f90 rename to flushqqq.F90 diff --git a/ftn_init.F90 b/ftn_init.F90 index c2427df8e..7614dc93c 100644 --- a/ftn_init.F90 +++ b/ftn_init.F90 @@ -91,7 +91,8 @@ subroutine ftn_init open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown', & access='append',share='denynone',err=950) #else - open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown',err=950) + open(21,file=appdir(:iz)//'/ALL.TXT',status='unknown', & + access='append',err=950) do i=1,9999999 read(21,*,end=10) cjunk enddo @@ -106,10 +107,19 @@ subroutine ftn_init status='unknown') #endif +#ifdef Win32 open(24,file=appdir(:iz)//'/tmp24.txt',status='unknown', & share='denynone') +#else + open(24,file=appdir(:iz)//'/tmp24.txt',status='unknown') +#endif + +#ifdef Win32 open(26,file=appdir(:iz)//'/tmp26.txt',status='unknown', & share='denynone') +#else + open(26,file=appdir(:iz)//'/tmp26.txt',status='unknown') +#endif return diff --git a/getfile.F90 b/getfile.F90 index 2949244cd..5043fe91c 100644 --- a/getfile.F90 +++ b/getfile.F90 @@ -5,10 +5,12 @@ subroutine getfile(fname,len) parameter (NSMAX=60*96000) !Samples per 60 s file integer*2 id(4,NSMAX) !46 MB: raw data from Linrad timf2 common/datcom/nutc,newdat2,id,fname80,nlen + include 'gcom2.f90' fname80=fname nlen=len newdat2=1 + ierr=0 return end subroutine getfile diff --git a/getfile2.f90 b/getfile2.F90 similarity index 82% rename from getfile2.f90 rename to getfile2.F90 index c0a9f58e2..ecc5b3609 100644 --- a/getfile2.f90 +++ b/getfile2.F90 @@ -1,4 +1,3 @@ -!----------------------------------------------------- getfile subroutine getfile2(fname,len) #ifdef Win32 @@ -31,16 +30,22 @@ subroutine getfile2(fname,len) 10 filename=fname(i+1:) ierr=0 + n=8*NSMAX #ifdef Win32 ! open(10,file=fname,form='binary',status='old',err=998) - n=8*NSMAX call rfile3a(fname,id,n,ierr) if(ierr.ne.0) then print*,'Error opening or reading file: ',fname,ierr go to 999 endif #else - call rfile2(fname,hdr,44+2*NDMAX,nr) + call rfile2(fname,id,n,nr) + if(nr.ne.n) then + print*,'Error opening or reading file: ',fname,n,nr + ierr=1002 + go to 999 + endif + #endif read(filename(8:11),*) nutc diff --git a/map65rc b/map65rc index d9cc4d453..6c1bca5ff 100644 --- a/map65rc +++ b/map65rc @@ -1,7 +1,7 @@ -*font: "bitstream vera sans" 11 -*Label*font: "bitstream vera sans" 11 -*Text*font: "terminus" 13 -*Canvas*font: "LucidaTypewriter" 18 +*font: Arial 8 +*Label*font: Arial 8 +*Text*font: "Courier New" 9 +*Canvas*font: "Lucida Console" 16 *background: gray85 *Text*background: white *Entry*background: white diff --git a/rfile2.f b/rfile2.f index 46eaf98ca..58d21a060 100644 --- a/rfile2.f +++ b/rfile2.f @@ -1,13 +1,13 @@ subroutine rfile2(fname,buf,n,nr) -C Write a wave file to disk. +C Read data from disk. integer RMODE parameter(RMODE=0) integer*1 buf(n) integer open,read,close integer fd - character fname*80 + character fname*(*) data iz/0/ !Silence g77 warning do i=80,1,-1 diff --git a/symspec.f b/symspec.f index 221139d3f..d92621050 100644 --- a/symspec.f +++ b/symspec.f @@ -3,7 +3,8 @@ C Compute spectra at four polarizations, using half-symbol steps. parameter (NFFT=32768) - integer*2 id(4,nz) + parameter (NSMAX=60*96000) + integer*2 id(4,NSMAX) real savg(4,NFFT) complex cx(NFFT),cy(NFFT) ! pad to 32k with zeros complex z