c******************************************************** integer*4 function cabb_load_sites( message ) implicit none character*(*) message c reads the SITE DATABASE file which contains our best description c of the station coordinates, axis types, etc. include 'CALCDB.i' integer*4 n, I1, inx, lun real*8 R3(3), R1 character*80 str character*8 name character*80 site_file c-------------------------------------- c Open SITE database file - defined in environment variable 'SITE_DATABASE' call get_environment_variable( 'SITE_DATABASE', site_file ) if( site_file(1:8) .eq. ' ' ) then message = 'SITE_DATABASE Environment NOT SET' cabb_load_sites = -1 return end if lun = 29 open( unit=lun, file=site_file, status='old', ERR=900 ) n = 0 do while ( .TRUE. ) read( lun, '(A)', end=200, ERR=910 ) str if( index(str, '#') .gt. 0 ) go to 100 ! comment line n = n + 1 if( n .gt. Max_Stat ) then write( message, 2222 ) Max_Stat, site_file 2222 format( 'TOO MANY SITES (Max=', I3,') in ', A ) close( lun ) cabb_load_sites = -1 return end if read( str, *, ERR=920 ) R3, I1, R1 sitere(1,n) = R3(1) sitere(2,n) = R3(2) sitere(3,n) = R3(3) axisty(n) = I1 axisof(n) = R1 siteze(n) = 0.7d-18 inx = index (str, '$') if( inx .le. 0 ) then write( message, 3333 ) n 3333 format( 'ERROR - missing $ for SITENAME ', 1 I3, ' in SITE_DATABASE' ) close( lun ) cabb_load_sites = -1 return end if read( str(inx+1:), '(A)', ERR=930 ) name sitnam(n) = name nsites = n 100 continue end do c Normal return 200 close( lun ) cabb_load_sites = 0 return c Error returns 900 continue message = 'ERROR opening ' // site_file cabb_load_sites = -1 return 910 continue message = ' ERROR READING ' // site_file close( lun ) cabb_load_sites = -1 return 920 continue message = ' ERROR READING LINE in ' // site_file close( lun ) cabb_load_sites = -1 return 930 continue message = ' ERROR in SITE NAME in ' // site_file close( lun ) cabb_load_sites = -1 return end