subroutine write_cbpmii_button_gain(file,comments_list, old_comments_list, table0_bpm_data, table1_bpm_data) use precision_def implicit none type range_struct real(rp) range(0:10) end type type button_gain_struct character*10 label type (range_struct) button(0:3) end type type (button_gain_struct) table0_bpm_data(0:120), table1_bpm_data(0:120) character*100 file, string character*13 label character*120 comments_list(100), old_comments_list(100) integer bpm,ix,i integer iu integer io real(rp) temp(0:10) iu=1 ! call read_string(' button gain file ? (DEF= cbpmii_button_gain.dat) ','cbpmii_button_gain.dat', file) print *,file open(unit = iu, file = file) do i=1,size(comments_list) if(index(comments_list(i),'#')/= 0)write(iu,'(a)')comments_list(i) if(index(comments_list(i),'HEADER') /= 0)write(iu,'(a)')comments_list(i) if(index(comments_list(i),'TYPE') /= 0)write(iu,'(a)')comments_list(i) if(index(comments_list(i),'nodata') == 0)print '(i,1x,a)',i,comments_list(i) end do do i=1,size(old_comments_list) if(index(old_comments_list(i),'#')/= 0)write(iu,'(a)')old_comments_list(i) ! if(len(old_comments_list(i)) /= 1)write(iu,'(a)')old_comments_list(i) end do do bpm=0,120 if(index(table0_bpm_data(bpm)%label,'[')==0)cycle write(iu,*) write(iu,'(a)')table0_bpm_data(bpm)%label write(iu,'(a13,11f10.4)')'.GAIN_TABLE_0',table0_bpm_data(bpm)%button(2)%range(0:10) write(iu,'(13x,11f10.4)')table0_bpm_data(bpm)%button(0)%range(0:10) write(iu,'(13x,11f10.4)')table0_bpm_data(bpm)%button(1)%range(0:10) write(iu,'(13x,11f10.4)')table0_bpm_data(bpm)%button(3)%range(0:10) write(iu,*) write(iu,'(a13,11f10.4)')'.GAIN_TABLE_1',table1_bpm_data(bpm)%button(2)%range(0:10) write(iu,'(13x,11f10.4)')table1_bpm_data(bpm)%button(0)%range(0:10) write(iu,'(13x,11f10.4)')table1_bpm_data(bpm)%button(1)%range(0:10) write(iu,'(13x,11f10.4)')table1_bpm_data(bpm)%button(3)%range(0:10) end do close(unit=1) end subroutine