Changed compile-time flag from "Win32" to "CVF", and a few other changes

to enable compiling MAP65.EXE under Windows, using gcc and g95.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@594 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2007-12-21 18:40:47 +00:00
parent f87f65fc3d
commit 2b1a57aa0e
26 changed files with 196 additions and 87 deletions

91
Makefile.MinGW Normal file
View File

@ -0,0 +1,91 @@
#Makefile to compile MAP65.EXE for Windows.
#!include <dfinc.mak> #Some definitions for Compaq Visual Fortran
CC = /mingw/bin/gcc
FC = g95
CFLAGS = -I.
all: MAP65.EXE
OBJS2C = init_rs.o encode_rs.o decode_rs.o jtaudio.o plrr_subs.o
F2PYONLY = ftn_init ftn_quit audio_init getfile azdist0 astro0 spec
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 \
rfile.f90 rfile3a.F90 spec.f90 map65a.F90 display.F90 \
getfile.f90 getfile2.f90 recvpkt.f90 savetf2.F90 \
symspec.f90 sec_midn.F90 getdphi.f90
SRCSCOM = datcom.f90 gcom1.f90 gcom2.f90 gcom3.f90 gcom4.f90 spcom.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 \
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
SRCS2C = resample.c ptt.c igray.c wrapkarn.c wfile3.c cutil.c \
start_portaudio.c
MAP65.EXE: Audio.pyd map65.spec
c:/python25/python c:/python25/pyinstaller-1.3/Build.py map65.spec
Audio.pyd: $(OBJS2C) $(SRCS2F90) $(SRCS2F77) $(SRCS2C) $(SRCSCOM)
c:/Python25/python C:/python25/scripts/f2py.py -c -I. \
--quiet --fcompiler=g95 \
--opt="-fbounds-check -O2 -cpp -DWin32 -DUSE_PORTAUDIO" \
--compiler=mingw32 \
$(OBJS2C) libfftw3f.a libsamplerate.a \
libportaudio.a libpthreadGC2.a -lwinmm -lws2_32 \
-m Audio \
only: $(F2PYONLY) : \
$(SRCS2F90) $(SRCS2F77) $(SRCS2C)
map65.spec: map65.py astro.py g.py options.py palettes.py smeter.py specjt.py
C:/Python25/python C:/Python25/pyinstaller-1.3/makespec.py \
--icon wsjt.ico --tk --onefile map65.py
jtaudio.o: jtaudio.c
$(CC) -c -DWin32 -o jtaudio.o jtaudio.c
init_rs.obj: init_rs.c
$(CC) -c -DBIGSYM=1 init_rs.c
init_rs.o: init_rs.c
$(CC) -c -DBIGSYM=1 -o init_rs.o init_rs.c
encode_rs.obj: encode_rs.c
$(CC) -c -DBIGSYM=1 encode_rs.c
encode_rs.o: encode_rs.c
$(CC) -c -DBIGSYM=1 -o encode_rs.o encode_rs.c
decode_rs.obj: decode_rs.c
$(CC) -c -DBIGSYM=1 decode_rs.c
decode_rs.o: decode_rs.c
$(CC) -c -DBIGSYM=1 -o decode_rs.o decode_rs.c
wrapkarn.obj: wrapkarn.c
$(CC) -c -DWin32=1 wrapkarn.c
igray.obj: igray.c
$(CC) -c -DWin32=1 igray.c
plrr_subs.o: plrr_subs_win.c
$(CC) -c plrr_subs_win.c -o plrr_subs.o
.PHONY : clean
clean:
rm *.o Audio.pyd map65.spec MAP65.EXE

View File

@ -29,7 +29,7 @@ C NB: may want to smooth the Tsky map to 10 degrees or so.
1 lenappdir=i
call zero(nsky,180*180)
fname=Appdir(1:lenappdir)//'/TSKY.DAT'
#ifdef Win32
#ifdef CVF
open(13,file=fname,status='old',form='binary',err=10)
read(13) nsky
close(13)

View File

@ -95,7 +95,7 @@ subroutine astro0(nyear,month,nday,uth8,nfreq,grid,cauxra,cauxdec, &
imin=60*uth8
isec=3600*uth8
#ifdef Win32
!#ifdef CVF
if(isec.ne.isec0) then
ih=uth8
im=mod(imin,60)
@ -114,7 +114,7 @@ subroutine astro0(nyear,month,nday,uth8,nfreq,grid,cauxra,cauxdec, &
rewind 14
isec0=isec
endif
#endif
!#endif
return
end subroutine astro0

View File

@ -1,7 +1,7 @@
!------------------------------------------------ audio_init
subroutine audio_init(ndin,ndout)
#ifdef Win32
#ifdef CVF
use dfmt
integer Thread1,Thread2,Thread3
external a2d,decode1,recvpkt
@ -28,7 +28,7 @@ subroutine audio_init(ndin,ndout)
iwave(i)=nint(32767.0*sin(6.283185307*i*f0/nfsample))
enddo
#ifdef Win32
#ifdef CVF
! Priority classes (for processes):
! IDLE_PRIORITY_CLASS 64
! NORMAL_PRIORITY_CLASS 32

24
cutil.c
View File

@ -4,9 +4,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/times.h>
#include <time.h>
#include <sys/time.h>
// #include <sys/times.h>
// #include <time.h>
// #include <sys/time.h>
#include "sleep.h"
#include "timeval.h"
/* FORTRAN: fd = close(filedes) */
int close_(int *filedes)
@ -39,10 +41,10 @@ int lseek_(int *fd,int *offset, int *origin)
return(lseek(*fd,*offset,*origin));
}
/* times(2) */
int times_(struct tms *buf)
{
return (times(buf));
}
//int times_(struct tms *buf)
//{
// return (times(buf));
//}
/* ioperm(2) */
//ioperm_(from,num,turn_on)
//unsigned long *from,*num,*turn_on;
@ -54,7 +56,7 @@ int times_(struct tms *buf)
/* usleep(3) */
int usleep_(unsigned long *microsec)
{
return (usleep(*microsec));
usleep(*microsec);
}
/* returns random numbers between 0 and 32767 to FORTRAN program */
@ -62,16 +64,19 @@ int iran_(int *arg)
{
return (rand());
}
int exit_(int *n)
{
printf("\n\n");
exit(*n);
}
struct tm *
gmtime_r_(const time_t *clock, struct tm *result)
{
gmtime_r(clock, result);
// gmtime_r(clock, result);
}
time_t time_(void)
{
return time(0);
@ -81,7 +86,6 @@ time_t time_(void)
double hrtime_(void)
{
struct timeval tv;
gettimeofday(&tv,NULL);
return(tv.tv_sec+1.e-6*tv.tv_usec);
}

View File

@ -3,7 +3,7 @@ subroutine decode1(iarg)
! Get data and parameters from gcom, then call the decoders when needed.
! This routine runs in a background thread and will never return.
#ifdef Win32
#ifdef CVF
use dflib
#endif
@ -37,12 +37,10 @@ subroutine decode1(iarg)
kbuf0=kbuf
kkk=kk
if(kbuf.eq.2) kkk=kk-5760000
n=Tsec
if(ndebug.eq.2 .and. n.ne.ns00) then
write(29,3101) nutc,mod(n,60),ndiskdat,ndecoding,kbuf, &
newdat,kk,kkdone
3101 format('d1:',i5.4,i3.2,4i5,2i10)
write(29,3101) nutc,mod(n,60),kbuf,kk,kkdone,ndecoding,newdat
3101 format('d1:',i5.4,i3.2,i5,2i10,2i3)
ns00=n
endif

View File

@ -1,6 +1,6 @@
subroutine display(nkeep,ncsmin)
#ifdef Win32
#ifdef CVF
use dfport
#endif

View File

@ -10,7 +10,8 @@ C f_stop = 750 Hz.
complex c4a(NFFT2),c4b(NFFT2) !Output data
complex ca(NFFT1),cb(NFFT1) !FFTs of input
real*8 df
real halfpulse(8) !Impulse response of filter (one side)
C Impulse response of filter (one side)
real halfpulse(8)
complex cfilt(NFFT2)
!Filter (complex; imag = 0)
real rfilt(NFFT2) !Filter (real)

View File

@ -9,7 +9,7 @@ subroutine fivehz
! Disk I/O is a bad idea. Writing to stdout (for diagnostic purposes)
! seems to be OK.
#ifdef Win32
#ifdef CVF
use dflib
use dfport
#endif
@ -187,7 +187,7 @@ subroutine fivehztx
! Called at interrupt level from the PortAudio output callback.
#ifdef Win32
#ifdef CVF
use dflib
use dfport
#endif

View File

@ -1,6 +1,6 @@
subroutine flushqqq(lu)
#ifdef Win32
#ifdef CVF
use dfport
#endif

View File

@ -46,7 +46,7 @@ subroutine ftn_init
enddo
2 iz2=i
#ifdef Win32
#ifdef CVF
open(11,file=appdir(:iz)//'/decoded.txt',status='unknown', &
share='denynone',err=910)
#else
@ -55,7 +55,7 @@ subroutine ftn_init
#endif
endfile 11
#ifdef Win32
#ifdef CVF
open(12,file=appdir(:iz)//'/decoded.ave',status='unknown', &
share='denynone',err=920)
#else
@ -64,7 +64,7 @@ subroutine ftn_init
#endif
endfile 12
#ifdef Win32
#ifdef CVF
open(14,file=azeldir(:iz2)//'/azel.dat',status='unknown', &
share='denynone',err=930)
#else
@ -72,7 +72,7 @@ subroutine ftn_init
err=930)
#endif
#ifdef Win32
#ifdef CVF
open(19,file=appdir(:iz)//'/messages.txt',status='unknown', &
share='denynone',err=911)
#else
@ -81,7 +81,7 @@ subroutine ftn_init
#endif
endfile 19
#ifdef Win32
#ifdef CVF
open(20,file=appdir(:iz)//'/bandmap.txt',status='unknown', &
share='denynone',err=912)
#else
@ -90,7 +90,7 @@ subroutine ftn_init
#endif
endfile 20
#ifdef Win32
#ifdef CVF
open(21,file=appdir(:iz)//'/ALL65.TXT',status='unknown', &
access='append',share='denynone',err=950)
#else
@ -102,7 +102,7 @@ subroutine ftn_init
10 continue
#endif
#ifdef Win32
#ifdef CVF
open(22,file=appdir(:iz)//'/kvasd.dat',access='direct',recl=1024, &
status='unknown',share='denynone')
#else
@ -110,35 +110,35 @@ subroutine ftn_init
status='unknown')
#endif
#ifdef Win32
#ifdef CVF
open(24,file=appdir(:iz)//'/meas24.txt',status='unknown', &
share='denynone')
#else
open(24,file=appdir(:iz)//'/meas24.txt',status='unknown')
#endif
#ifdef Win32
#ifdef CVF
open(25,file=appdir(:iz)//'/meas25.txt',status='unknown', &
share='denynone')
#else
open(25,file=appdir(:iz)//'/meas25.txt',status='unknown')
#endif
#ifdef Win32
#ifdef CVF
open(26,file=appdir(:iz)//'/tmp26.txt',status='unknown', &
share='denynone')
#else
open(26,file=appdir(:iz)//'/tmp26.txt',status='unknown')
#endif
#ifdef Win32
#ifdef CVF
open(27,file=appdir(:iz)//'/dphi.txt',status='unknown', &
share='denynone')
#else
open(27,file=appdir(:iz)//'/dphi.txt',status='unknown')
#endif
#ifdef Win32
#ifdef CVF
open(29,file=appdir(:iz)//'/debug.txt',status='unknown', &
share='denynone')
#else

View File

@ -1,7 +1,7 @@
subroutine get_fname(hiscall,ntime,trperiod,lauto,fname)
#ifdef Win32
#ifdef CVF
use dfport
#else
external gmtime_r
@ -15,7 +15,7 @@ subroutine get_fname(hiscall,ntime,trperiod,lauto,fname)
n1=ntime
n2=(n1+2)/trperiod
n3=n2*trperiod
#ifdef Win32
#ifdef CVF
call gmtime(n3,it)
#else
call gmtime_r(n3,it)

View File

@ -1,6 +1,6 @@
subroutine getfile2(fname,len)
#ifdef Win32
#ifdef CVF
use dflib
#endif
@ -14,7 +14,7 @@ subroutine getfile2(fname,len)
include 'gcom4.f90'
1 if(ndecoding.eq.0) go to 2
#ifdef Win32
#ifdef CVF
call sleepqq(100)
#else
call usleep(100*1000)
@ -33,22 +33,22 @@ subroutine getfile2(fname,len)
ndecoding=4
monitoring=0
kbuf=1
#ifdef Win32
!#ifdef CVF
! open(10,file=fname,form='binary',status='old',err=998)
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,id,n,nr)
if(nr.ne.n) then
print*,'Error opening or reading file: ',fname,n,nr
ierr=1002
go to 999
endif
#endif
!#else
! 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
sq=0.
ka=0.1*NSMAX

View File

@ -1,5 +1,5 @@
#include <stdio.h>
#include <portaudio.h>
#include "portaudio.h"
#include <string.h>
void fivehz_();

View File

@ -8,7 +8,8 @@ from tkMessageBox import showwarning
import g,os,time
import Audio
from math import log10
from Numeric import zeros
#from Numeric import zeros
from numpy import zeros
import dircache
import Image,ImageTk #, ImageDraw
from palettes import colormapblue, colormapgray0, colormapHot, \

View File

@ -38,7 +38,7 @@ subroutine map65a(newdat)
nrw26=0
endif
#ifdef Win32
#ifdef CVF
open(23,file='CALL3.TXT',status='unknown',share='denynone')
#else
open(23,file='CALL3.TXT',status='unknown')

View File

@ -1,4 +1,4 @@
!---------------------------------------------------- recvpkt
!----------------------------------------------------- recvpkt
subroutine recvpkt(iarg)
! Receive timf2 packets from Linrad, stuff data into id().
@ -49,7 +49,7 @@ subroutine recvpkt(iarg)
if(nb.lt.0) nb=nb+65536
nb0=nblock0
if(nb0.lt.0) nb0=nb0+65536
if(ndebug.gt.0) print*,'Lost packets:',nb0,nb,lost
! if(ndebug.gt.0) print*,'Lost packets:',nb0,nb,lost
lost_tot=lost_tot + lost ! Insert zeros for the lost data.
do i=1,174*lost
k=k+1
@ -129,16 +129,16 @@ subroutine recvpkt(iarg)
kk=k
ndiskdat=0
ndone1=1
if(ndebug.eq.2) write(29,3001) nutc,mod(int(sec_midn()),60),ns, &
kbuf,kk
3001 format('r1:',i5.4,2i3.2,i5,i10)
! if(ndebug.eq.2) write(29,3001) nutc,mod(int(sec_midn()),60), &
! kbuf,kk,kkdone
!3001 format('r1:',i5.4,i3.2,i5,2i10)
endif
if(ns.ge.nt2 .and. ndone2.eq.0) then
kk=k
ndone2=1
if(ndebug.eq.2) write(29,3002) nutc,mod(int(sec_midn()),60),ns, &
kbuf,kk
3002 format('r2:',i5.4,2i3.2,i5,i10)
! if(ndebug.eq.2) write(29,3002) nutc,mod(int(sec_midn()),60), &
! kbuf,kk,kkdone
!3002 format('r2:',i5.4,i3.2,i5,2i10)
nlost=lost_tot ! Save stats for printout
endif
endif

View File

@ -1,5 +1,9 @@
#include <stdio.h>
#include <samplerate.h>
//#ifdef Win32
#include "samplerate.h"
//#else
//#include <samplerate.h>
//#endif
int resample_(float din[], int *jzin, int *conv_type, int *channels,
double *samfac, float dout[], int *jzout)

View File

@ -4,7 +4,11 @@ subroutine rfile3a(infile,ibuf,n,ierr)
character*(*) infile
integer*1 ibuf(n)
#ifdef CVF
open(10,file=infile,form='binary',status='old',err=998)
#else
open(10,file=infile,access='stream',status='old',err=998)
#endif
read(10,end=998) ibuf
ierr=0
go to 999

View File

@ -1,16 +1,18 @@
subroutine runqqq(fname,cmnd,iret)
#ifdef Win32
#ifdef CVF
use dflib
#endif
integer system
character*(*) fname,cmnd
#ifdef Win32
#ifdef CVF
iret=runqq(fname,cmnd)
#else
iret=system('./KVASD -q >& /dev/null')
! iret=system('./KVASD -q >& /dev/null')
iret=system('KVASD -q')
! print*,iret
#endif
return

View File

@ -1,6 +1,6 @@
subroutine savetf2(id,nsave,ntime,nutc,savedir)
#ifdef Win32
#ifdef CVF
use dfport
#else
external gmtime_r
@ -18,7 +18,7 @@ subroutine savetf2(id,nsave,ntime,nutc,savedir)
if(nsave.eq.1) then
n2=ntime/60
n3=(n2-1)*60
#ifdef Win32
#ifdef CVF
call gmtime(n3,it)
#else
call gmtime_r(n3,it)
@ -35,7 +35,7 @@ subroutine savetf2(id,nsave,ntime,nutc,savedir)
1 iz=i
fname=savedir(1:iz)//fname
#ifdef Win32
#ifdef CVF
open(17,file=fname,status='unknown',form='binary',err=998)
write(17) id
close(17)

View File

@ -2,7 +2,7 @@ real function sec_midn()
real*8 sec8,hrtime
#ifdef Win32
#ifdef CVF
sec_midn=secnds(0.0)
#else
sec8=hrtime()
@ -14,15 +14,14 @@ end function sec_midn
subroutine sleep_msec(n)
#ifdef Win32
#ifdef CVF
use dflib
#endif
#ifdef Win32
#ifdef CVF
call sleepqq(n)
#else
!m=min(1,n)
! call usleep(m)
call usleep(1000*n)
#endif
return

View File

@ -8,8 +8,8 @@ import Audio
import g
import string
import cPickle
#import Numeric
from Numeric import zeros, multiarray
#from Numeric import zeros, multiarray
import numpy
import Image, ImageTk, ImageDraw
from palettes import colormapblue, colormapgray0, colormapHot, \
colormapAFMHot, colormapgray1, colormapLinrad, Colormap2Palette
@ -69,13 +69,15 @@ ttot=0.0
c=Canvas()
NX=750
NY=130
a=zeros(NX*NY,'s')
#a=zeros(NX*NY,'s')
a=numpy.zeros(NX*NY,numpy.int16)
im=Image.new('P',(NX,NY))
line0=Image.new('P',(NX,1)) #Image fragment for top line of waterfall
draw=ImageDraw.Draw(im)
pim=ImageTk.PhotoImage(im)
a2=zeros(NX*NY,'s')
#a2=zeros(NX*NY,'s')
a2=numpy.zeros(NX*NY,numpy.int16)
im2=Image.new('P',(NX,NY))
line02=Image.new('P',(NX,1)) #Image fragment for top line of zoomed waterfall
draw2=ImageDraw.Draw(im2)

6
sun.f
View File

@ -25,8 +25,10 @@ C Other standard variables:
real r !Distance to sun, AU
real xv,yv !x and y coords in ecliptic
real lonsun !Ecliptic long and lat of sun
real xs,ys !Ecliptic coords of sun (geocentric)
real xe,ye,ze !Equatorial coords of sun (geocentric)
C Ecliptic coords of sun (geocentric)
real xs,ys
C Equatorial coords of sun (geocentric)
real xe,ye,ze
real lon,lat
real GMST0,LST,HA
real xx,yy,zz

View File

@ -18,9 +18,9 @@ subroutine symspec(id,kbuf,kk,kkdone,nutc,newdat)
! kbuf,kk,kkk,kkdone
!4001 format(a1,i5.4,2i3,3i9,i5)
if(ndebug.eq.2) write(29,3001) nutc,mod(int(sec_midn()),60),n, &
newdat,ndecoding,kbuf,kk,kkdone
3001 format('s1:',i5.4,i3.2,4i5,2i10)
if(ndebug.eq.2) write(29,3001) nutc,mod(int(sec_midn()),60), &
kbuf,kk,kkdone,ndecoding,newdat,n
3001 format('s1:',i5.4,i3.2,i5,2i10,2i3,i5)
fac=0.0002
if(nagc.ne.0) fac=0.0002 * 10.0**(0.05*(-rxnoise))
hsym=2048.d0*96000.d0/11025.d0 !Samples per half symbol
@ -120,8 +120,9 @@ subroutine symspec(id,kbuf,kk,kkdone,nutc,newdat)
999 continue
! if(ndebug.gt.0) write(*,4001) 'B',nutc,mod(int(sec_midn()),60), &
! kbuf,kk,kkk,kkdone,n
if(ndebug.eq.2) write(29,3002) mod(int(sec_midn()),60),n, &
newdat,ndecoding,kbuf,kk,kkdone
3002 format('s2:',i8.2,4i5,2i10)
if(ndebug.eq.2) write(29,3002) nutc,mod(int(sec_midn()),60), &
kbuf,kk,kkdone,ndecoding,newdat,n
3002 format('s2:',i5.4,i3.2,i5,2i10,2i3,i5)
return
end subroutine symspec

View File

@ -62,7 +62,7 @@ subroutine wsjtgen
if(msg(2:2).eq.'/' .or. ichar(msg(2:2)).eq.92) then
txmsg=msg
testfile=msg(2:)
#ifdef Win32
#ifdef CVF
open(18,file=testfile,form='binary',status='old',err=12)
go to 14
12 print*,'Cannot open test file ',msg(2:)