program sdr
C takes file "sdr.raw" and outputs html
C sample html:
C
C
C
- (star names)
C
- sdr######.fits
C
C
-- we only need one at the beginning and
C one
at the end
C imax is max number of measurements expected for any one star
C mmax is max number of indices
integer imax, mmax
parameter (imax = 200, mmax=2)
C
integer run(imax),nindex,tape(imax),scan(imax)
parameter (nindex=2)
character*16 name(imax)
character*44 link(imax)
integer j,k,n,irts(imax)
iend = 0
C open input and output files
open(unit=1,file='sdr.raw',status='old')
open(unit=2,file='html.out',status='unknown')
open(unit=22,file='database.out',status='unknown')
write(2,'(a)') ''
C read first line
j=1
read(1,'(3x,a16,i2,2i3)')
z name(j),run(j),tape(j),scan(j)
C read next line (loop back to here for all subsequent passes)
5 j=j+1
read(1,'(3x,a16,i2,2i3)',end=111)
z name(j),run(j),tape(j),scan(j)
C if j and j-1 names match, keep going
C if j and j-1 names do not match, we have switched stars so
C compute average etcetera, and reset j to 1
if (name(j).eq.name(j-1)) then
goto 5
else
33 n = j-1
C write star name
write(2,'(a,a16)') '- ',name(1)
C write links
do k=1,n
iid = 10000*run(k) + 100*tape(k) + scan(k)
irts(k) = iid
write(link(k),'(a21,i6.6,a6,i6.6,a5)')
z '',iid,' '
end do
write(2,'(a,200(a44))') '
- ',(link(k),k=1,n)
write(22,'(a16,200i7)') name(1),(irts(k),k=1,n)
C initialize
run(1) = run(j)
tape(1) = tape(j)
scan(1) = scan(j)
name(1) = name(j)
j = 1
if (iend.eq.1) goto 112
goto 5
end if
111 iend = 1
goto 33
112 close(1)
write(2,'(a)') '
'
close(2)
close(22)
stop
end