subroutine tv4hex(string,numg,ivec) ! tv4hex subroutine i/o c.typscn sbp 2008.04.30 !tpl call tv4hex('string',num_to_type,vec_to_type_in_hex) ! free form output of string and given integer values on terminal. implicit none character*(*) string,out*78,form*20 integer ivec(*),ival,numg,och,nch,i,iw,ia out=string !transfer string nch=min(20,len_trim(out))+1 do i=1,numg ival=ivec(i) !get ith of vector ia=ival if(ival.lt.0) then iw=8 else iw=1 do while (ia.gt.15) ia=ishft(ia,-4) iw=iw+1 enddo endif och=nch !start from end of last nch=och+iw+1 !will be start of next if((nch).gt.78) then !full, dump print 1002,out out=' ' !clear nch=iw+2 !reint with latest added och=1 1002 format(1x,a) endif form=' ' if(i.eq.1) then write(form,1005) '(hex) ',iw nch=nch+7 else write(form,1001) iw endif 1005 format('(1x,''',a6,''',z',i1,')') 1001 format('(z',i1,')') write(out(och:nch),form) ival enddo if(out(2:2).ne.' ') print 1002,out return end