subroutine reavec(prompt,n,vec) ! read in n reals to vec; sp and tab delimit. ! retry if error in conversion; escape w/ 'QUIT' ! note that fully ascii fields are allowed and ignored, ! if they begin with an exclam implicit none integer b,i,n,nt,begs(20),ends(20),typs(20) integer ints(20),err real vals(20),vec(*) character*(*) prompt, temp*256 2 print 1, trim(prompt) 1 format(' ',a,' ',$) read 101,temp 101 format(a) nt=n !max requested, may return fewer call parseme(temp,nt,begs,ends,typs,ints,vals,err) do i=1,min(nt,n) !test for not a int, not a real tokens if((typs(i) < 2).and.(err==0)) then b=begs(i) !substring start if(temp(b:b)/='!') then !ignore if comment if(err==0) err=i !else mark first endif endif enddo if(err.gt.0) then if(temp.eq.'QUIT') return print *,' ',temp(1:ends(err)),'<- retry or QUIT' goto 2 endif do i=1,min(nt,n) !return only UP TO # requested if(typs(i) > 1) vec(i)=vals(i) !but not if comment enddo return end