	subroutine wtspedit(in,ist,sp,nt,nf,nlr)
c *** 09-Jan-06 *** rev. 05-Aug-10 ***
	integer in(24,60),sp(1922),nt(2,60),nf(60),iap(3),and,rshift
	parameter (mask=1023)
	data iap/4,2,3/
	la(i)=and(rshift(in(i,k),22),mask)
	lb(i)=and(rshift(in(i,k),11),mask)
	lc(i)=and(in(i,k),mask)
	interp(k)=((sp(k-1)+sp(k+1))*4-sp(k-2)-sp(k+2)+3)/6
c
	idap=iap(ist-13)
	nlr=0
	do k=1,60
	 if (and(rshift(in(2,k),21),7).eq.idap) then
	  nlr=nlr+1
	  nt(1,nlr)=in(1,k)
	  nt(2,nlr)=in(2,k)
	  nf(nlr)=and(rshift(in(3,k),1),'7f'x)
	  j1=32*nlr-29
	  j=j1
	  do i=4,22,2
	   sp(j+1)=la(i)
	   sp(j+2)=lc(i)
	   sp(j+3)=lb(i+1)
	   j=j+3
	   end do
	  sp(j+1)=la(24)
	  sp(j1)=interp(j1)
	  if (ist.eq.15) sp(j1+11)=interp(j1+11)
	  if (ist.ne.14) sp(j1+22)=interp(j1+22)
	  sp(j1+27)=interp(j1+27)
	  end if
	 end do
	sp(1)=sp(j1+30)
	sp(2)=sp(j1+31)
	return
	end


